Commit aef66dfa by zhangxingmin

Merge branch 'dev' into prod

parents 3ea990f6 bf4d74a1
......@@ -23,6 +23,7 @@ import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
......@@ -58,7 +59,7 @@ public class ApiCustomerController {
*/
@Operation(summary = "创建客户")
@PostMapping("/add")
public Result<Map<String, Object>> addCustomer(@RequestBody CustomerAddRequest customerAddRequest, HttpServletRequest request) {
public Result<Map<String, Object>> addCustomer(@Validated @RequestBody CustomerAddRequest customerAddRequest, HttpServletRequest request) {
if (customerAddRequest == null) {
return Result.fail(ResultCode.PARAMS_ERROR.getCode(), ResultCode.PARAMS_ERROR.getMessage());
}
......@@ -134,7 +135,7 @@ public class ApiCustomerController {
*/
@PostMapping("/update")
@Operation(summary = "更新客户信息")
public Result<Boolean> updateCustomer(@RequestBody CustomerUpdateRequest customerUpdateRequest) {
public Result<Boolean> updateCustomer(@Validated @RequestBody CustomerUpdateRequest customerUpdateRequest) {
String customerBizId = customerUpdateRequest.getCustomerBizId();
if (ObjectUtils.isEmpty(customerBizId)) {
throw new BusinessException(ResultCode.PARAMS_ERROR.getCode(), "customerBizId不能为空");
......
......@@ -37,10 +37,7 @@ import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
/**
......@@ -529,8 +526,7 @@ public class ApiFortuneController {
// 查询列表数据
QueryWrapper<Fortune> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("expected_fortune_biz_id", fortuneQueryRequest.getExpectedFortuneBizId());
queryWrapper.eq("status", FortuneStatusEnum.SENT.getItemValue());
queryWrapper.or().eq("status", FortuneStatusEnum.CHECKED.getItemValue());
queryWrapper.in("status", Arrays.asList(FortuneStatusEnum.CHECKED.getItemValue(), FortuneStatusEnum.SENT.getItemValue()));
Page<Fortune> fortunePage = fortuneService.page(new Page<>(current, size),
queryWrapper);
// 组装返回值
......
......@@ -16,6 +16,11 @@ import java.util.List;
public class GenerateExpectedFortuneDto {
/**
* 来源 1-销售佣金 2-非销售佣金
*/
private Integer source;
/**
* 保单发佣批次ID
*/
private String batchBizId;
......
......@@ -679,13 +679,13 @@ public class ApiAppointmentServiceImpl implements ApiAppointmentService {
// 保單持有人
if (apiPolicyholderInfoDto != null) {
follow.setPolicyHolder(apiPolicyholderInfoDto.getNameCn());
follow.setPolicyHolder(StringUtils.isNotBlank(apiPolicyholderInfoDto.getNameCn()) ? apiPolicyholderInfoDto.getNameCn() : apiPolicyholderInfoDto.getNamePyEn());
}
// 受保人信息
if (!Objects.isNull(apiInsurantInfoDto)) {
// 受保人
follow.setInsured(apiInsurantInfoDto.getNameCn());
follow.setInsured(StringUtils.isNotBlank(apiInsurantInfoDto.getNameCn()) ? apiInsurantInfoDto.getNameCn() : apiInsurantInfoDto.getNamePyEn());
// 受保人业务id
follow.setInsuredBizId(apiInsurantInfoDto.getInsurantBizId());
// 受保人与保單持有人关系
......
......@@ -229,16 +229,26 @@ public class ApiCsfCommonServiceImpl implements ApiCsfCommonService {
LocalDate currentDate = LocalDate.now();
if (birthDate.isAfter(currentDate)) {
throw new IllegalArgumentException("生日日期不能于当前日期");
throw new IllegalArgumentException("生日日期不能于当前日期");
}
Period period = Period.between(birthDate, currentDate);
return String.valueOf(period.getYears());
} catch (Exception e) {
throw new IllegalArgumentException("生日格式不正确,应为yyyy-MM-dd格式");
// throw new IllegalArgumentException("生日格式不正确,应为yyyy-MM-dd格式");
throw new IllegalArgumentException(e.getMessage());
}
}
public static void main(String[] args) {
ApiCsfCommonServiceImpl commonService = new ApiCsfCommonServiceImpl();
ApiCsfCalculateRequest request = new ApiCsfCalculateRequest();
request.setRequestValue("310111202603191111");
request.setCalculateType(6);
Result<List<ApiCsfCalculateResponse>> result = commonService.calculate(request);
System.out.println(result);
}
/**
* 身高和体重计算BMI指数
* @param requestValueList
......@@ -283,18 +293,31 @@ public class ApiCsfCommonServiceImpl implements ApiCsfCommonService {
format.setToneType(HanyuPinyinToneType.WITHOUT_TONE);
StringBuilder pinyin = new StringBuilder();
boolean lastIsChinese = false; // 标记上一个字符是否为汉字,用于控制空格添加
for (char c : chinese.toCharArray()) {
if (Character.toString(c).matches("[\\u4E00-\\u9FA5]")) {
try {
String[] pinyinArray = PinyinHelper.toHanyuPinyinStringArray(c, format);
if (pinyinArray != null && pinyinArray.length > 0) {
// 如果上一个字符是汉字且当前也是汉字,则先加空格(避免开头空格)
if (lastIsChinese) {
pinyin.append(' ');
}
pinyin.append(pinyinArray[0]);
lastIsChinese = true;
} else {
// 如果没有拼音,原样追加
pinyin.append(c);
lastIsChinese = false;
}
} catch (BadHanyuPinyinOutputFormatCombination e) {
pinyin.append(c);
lastIsChinese = false;
}
} else {
pinyin.append(c);
lastIsChinese = false;
}
}
return pinyin.toString();
......
......@@ -643,6 +643,7 @@ public class ApiExpectedFortuneServiceImpl implements ApiExpectedFortuneService
.productLaunchBizId(brokerDto.getPlanBizId())
//保险公司业务id
.insuranceCompanyBizId(brokerDto.getInsuranceCompanyBizId())
.source(2)
.build());
return Result.success();
......@@ -717,6 +718,7 @@ public class ApiExpectedFortuneServiceImpl implements ApiExpectedFortuneService
.productLaunchBizId(brokerDto.getPlanBizId())
//保险公司业务id
.insuranceCompanyBizId(brokerDto.getInsuranceCompanyBizId())
.source(1)
.build());
return Result.success();
......@@ -734,8 +736,9 @@ public class ApiExpectedFortuneServiceImpl implements ApiExpectedFortuneService
if (!CollectionUtils.isEmpty(fortuneDto.getAlgorithmResDtoList())) {
//获得积分业务员绑定的基本法列表对应计算值结果集合
for (AlgorithmResDto algorithmResDto : fortuneDto.getAlgorithmResDtoList()) {
if (Objects.isNull(algorithmResDto.getCalculatedValue())
|| algorithmResDto.getCalculatedValue().compareTo(BigDecimal.ZERO) == 0) {
if (fortuneDto.getSource() == 2 && (Objects.isNull(algorithmResDto.getCalculatedValue())
|| algorithmResDto.getCalculatedValue().compareTo(BigDecimal.ZERO) == 0)) {
//2-非销售佣金并且计算金额为0,走这里
//判空判0
continue;
}
......
package com.yd.csf.api.service.impl;
import com.alibaba.fastjson.JSON;
import com.yd.base.feign.client.relobjectcertificate.ApiRelObjectCertificateFeignClient;
import com.yd.base.feign.dto.ApiCertificateDto;
import com.yd.base.feign.request.relobjectcertificate.ApiRelObjectCertificateListAddRequest;
......@@ -235,15 +236,19 @@ public class ApiInsurantServiceImpl implements ApiInsurantService {
Result<Insurant> result = checkInsurantIsExist(dto.getInsurantBizId());
//受保人信息信息
Insurant insurant = result.getData();
Long insurantId = insurant.getId();
//与投保人关系
if (RelTypeEnum.MYSELF.getItemValue().equals(dto.getPolicyholderRel())) {
//与投保人关系如果是本人,直接查询投保人信息表更新数据到受保人信息表中
Policyholder policyholder = iPolicyholderService.queryOne(appointmentBizId,"");
if (!Objects.isNull(policyholder)) {
log.info("与投保人关系如果是本人,直接查询投保人信息表更新数据到受保人信息表中之前result.getData(),{}", JSON.toJSONString(result));
log.info("与投保人关系如果是本人,直接查询投保人信息表更新数据到受保人信息表中之前,{}", JSON.toJSONString(insurant));
BeanUtils.copyProperties(policyholder,insurant);
insurant.setId(result.getData().getId());
insurant.setId(insurantId);
insurant.setAppointmentBizId(appointmentBizId);
log.info("与投保人关系如果是本人,直接查询投保人信息表更新数据到受保人信息表中之后,{}", JSON.toJSONString(insurant));
iInsurantService.saveOrUpdate(insurant);
//查询投保人税务列表信息
......
......@@ -1171,6 +1171,7 @@ public class ApiPremiumReconciliationServiceImpl implements ApiPremiumReconcilia
@Override
@Transactional(rollbackFor = Exception.class)
public Result editResult(ApiPremiumReconciliationResultEditRequest request) {
log.info("设置认定结果-保费对账记录信息前effectiveDate生效日期:{}",request.getEffectiveDate());
// 通过 RequestContextHolder 获取 HttpServletRequest
HttpServletRequest httpServletRequest = ((ServletRequestAttributes)
RequestContextHolder.currentRequestAttributes()).getRequest();
......@@ -1212,6 +1213,7 @@ public class ApiPremiumReconciliationServiceImpl implements ApiPremiumReconcilia
//遍历保单转介人列表信息 -> 调用基本法算出预计发佣列表
// 通过代理对象调用
// getSelf().execute(statusRequest,token);
log.info("changePolicyFollowStatus前effectiveDate生效日期:{}",statusRequest.getEffectiveDate());
Result<Boolean> result1 = changePolicyFollowStatus(statusRequest,token);
if (result1.getCode() != 200) {
throw new BusinessException(result1.getMsg());
......
......@@ -68,19 +68,19 @@ public class ApiAppointmentInfoDto {
* 签单日
*/
@NotNull(message = "签约信息-签单日不能为空")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private LocalDateTime signDate;
/**
* 到港时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private LocalDateTime arrivalTime;
/**
* 离港时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private LocalDateTime departureTime;
/**
......@@ -126,13 +126,13 @@ public class ApiAppointmentInfoDto {
/**
* 开户时间段(开始)
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private LocalDateTime openAccountStartTime;
/**
* 开户时间段(结束)
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private LocalDateTime openAccountEndTime;
/**
......
......@@ -59,7 +59,7 @@ public class ApiBeneficiaryInfoDto {
/**
* 出生日期(生日,如果是身份证,自动获取性别和生日)
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private LocalDateTime birthday;
/**
......
......@@ -49,8 +49,8 @@ public class ApiInsurantInfoDto {
/**
* 姓名-中文
*/
@NotBlank(message = "受保人-姓名(中文)不能为空", groups = GroupValid.NotSelf.class)
@Pattern(regexp = "^[\u4e00-\u9fa5]{2,6}$", message = "受保人-姓名(中文)必须为2-6位汉字", groups = GroupValid.NotSelf.class)
// @NotBlank(message = "受保人-姓名(中文)不能为空", groups = GroupValid.NotSelf.class)
@Pattern(regexp = "^(|[\u4e00-\u9fa5]{2,6})$", message = "受保人-姓名(中文)必须为2-6位汉字", groups = GroupValid.NotSelf.class)
private String nameCn;
/**
......@@ -79,19 +79,19 @@ public class ApiInsurantInfoDto {
* 出生日期(生日,如果是身份证,自动获取性别和生日)
*/
@NotNull(message = "受保人-生日不能为空", groups = GroupValid.NotSelf.class)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private LocalDateTime birthday;
@AssertTrue(message = "受保人-必须大于18周岁", groups = GroupValid.NotSelf.class)
public boolean isBirthdayValid() {
if (birthday == null) {
// @NotNull 会处理空值
return true;
}
LocalDateTime now = LocalDateTime.now();
// 计算年龄
int age = Period.between(birthday.toLocalDate(), now.toLocalDate()).getYears();
return age > 18;
}
// @AssertTrue(message = "受保人-必须大于18周岁", groups = GroupValid.NotSelf.class)
// public boolean isBirthdayValid() {
// if (birthday == null) {
// // @NotNull 会处理空值
// return true;
// }
// LocalDateTime now = LocalDateTime.now();
// // 计算年龄
// int age = Period.between(birthday.toLocalDate(), now.toLocalDate()).getYears();
// return age > 18;
// }
/**
* 年龄(通过生日自动获取年龄)
......
......@@ -42,8 +42,8 @@ public class ApiPolicyholderInfoDto {
/**
* 姓名-中文
*/
@NotBlank(message = "投保人-姓名(中文)不能为空")
@Pattern(regexp = "^[\u4e00-\u9fa5]{2,6}$", message = "投保人-姓名(中文)必须为2-6位汉字")
// @NotBlank(message = "投保人-姓名(中文)不能为空")
@Pattern(regexp = "^(|[\u4e00-\u9fa5]{2,6})$",message = "投保人-姓名(中文)必须为2-6位汉字")
private String nameCn;
/**
......@@ -72,7 +72,7 @@ public class ApiPolicyholderInfoDto {
* 出生日期(生日,如果是身份证,自动获取性别和生日)
*/
@NotNull(message = "投保人-生日不能为空")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private LocalDateTime birthday;
@AssertTrue(message = "投保人-必须大于18周岁")
public boolean isBirthdayValid() {
......
......@@ -127,7 +127,7 @@ public class ApiProductPlanMainInfoDto {
/**
* 回溯日期
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private LocalDateTime backtrackDate;
/**
......
......@@ -48,6 +48,6 @@ public class ApiSecondHolderInfoDto {
/**
* 出生日期(生日,如果是身份证,自动获取性别和生日)
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private LocalDateTime birthday;
}
......@@ -19,6 +19,6 @@ public class ApiAppointmentEditConfirmTimeRequest {
* 确定预约时间
*/
@NotNull(message = "确定预约时间不能为空")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private LocalDateTime confirmAppointmentTime;
}
......@@ -39,12 +39,12 @@ public class ApiAppointmentPageRequest extends PageDto {
/**
* 确定预约开始时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private LocalDateTime startTime;
/**
* 确定预约结束时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private LocalDateTime endTime;
}
......@@ -24,13 +24,13 @@ public class ApiCommissionRuleConfigAddRequest {
/**
* 生效开始日期
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private LocalDateTime effectiveStart;
/**
* 生效结束日期
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private LocalDateTime effectiveEnd;
/**
......
......@@ -29,13 +29,13 @@ public class ApiCommissionRuleConfigEditRequest {
/**
* 生效开始日期
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private LocalDateTime effectiveStart;
/**
* 生效结束日期
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private LocalDateTime effectiveEnd;
/**
......
......@@ -21,7 +21,7 @@ public class ApiPolicyReceiptAddRequest {
* 回执日期
*/
@NotNull(message = "回执日期不能为空")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private LocalDateTime receiptDate;
/**
......
......@@ -27,7 +27,7 @@ public class ApiPolicyReceiptEditRequest {
* 回执日期
*/
@NotNull(message = "回执日期不能为空")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private LocalDateTime receiptDate;
/**
......
......@@ -46,13 +46,13 @@ public class ApiPremiumReconciliationResultEditRequest {
/**
* 生效日期(保单生效日)
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date effectiveDate;
/**
* 保单核保日
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date underwritingDate;
/**
......@@ -63,13 +63,13 @@ public class ApiPremiumReconciliationResultEditRequest {
/**
* 冷静期结束日期
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date coolingOffEndDate;
/**
* 保单截止日期
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date policyExpirationDate;
}
......@@ -5,6 +5,7 @@ import com.yd.csf.service.vo.AddressVO;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import javax.validation.constraints.Pattern;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
......@@ -22,9 +23,15 @@ public class CustomerAddRequest implements Serializable {
private String fnaBizId;
/**
* 客户ID
*/
private String customerBizId;
/**
* 姓名-中文
*/
@Schema(description = "姓名-中文")
@Pattern(regexp = "^(|[\u4e00-\u9fa5]{2,6})$",message = "投保人-姓名(中文)必须为2-6位汉字")
private String nameCn;
/**
......
......@@ -5,6 +5,7 @@ import com.yd.csf.service.vo.AddressVO;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import javax.validation.constraints.Pattern;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
......@@ -32,6 +33,7 @@ public class CustomerUpdateRequest implements Serializable {
* 姓名-中文
*/
@Schema(description = "姓名-中文")
@Pattern(regexp = "^(|[\u4e00-\u9fa5]{2,6})$",message = "投保人-姓名(中文)必须为2-6位汉字")
private String nameCn;
/**
......
......@@ -150,7 +150,7 @@ public class PolicyFollowDto implements Serializable {
private String insuranceCompanyBizId;
@Schema(description = "对账公司")
private String reconciliationCompanyName;
private String reconciliationCompany;
@Schema(description = "对账公司编码")
private String reconciliationCode;
......
......@@ -34,4 +34,6 @@ public interface CustomerService extends IService<Customer> {
Boolean updateCustomer(CustomerUpdateRequest customerUpdateRequest);
void queryDependentsNum(Customer customer);
Customer queryOneByCustomerBizId(String customerBizId);
}
......@@ -611,6 +611,7 @@ public class CommissionExpectedServiceImpl extends ServiceImpl<CommissionExpecte
throw new BusinessException("保單持有人年齡不能为空");
}
Date effectiveDate = policy.getEffectiveDate();
log.info("getExpectedCommissionByProductlaunchId的effectiveDate生效日期:{}",effectiveDate);
if (effectiveDate == null) {
throw new BusinessException("保单生效日期不能为空");
}
......@@ -768,9 +769,12 @@ public class CommissionExpectedServiceImpl extends ServiceImpl<CommissionExpecte
unmatchedConditions, "保费[" + paymentPremium + "]");
// 检查生效日期
log.info("检查生效日期的effectiveDate生效日期:{}",effectiveDate);
currentList = filterAndCheck(currentList,
i -> isEffective(i.getEffectiveStart(), i.getEffectiveEnd(), effectiveDate),
unmatchedConditions, "生效日期[" + DateUtil.format(effectiveDate, "yyyy-MM-dd") + "]");
log.info("检查生效日期的currentList:{}",JSON.toJSONString(currentList));
log.info("检查生效日期的unmatchedConditions:{}",JSON.toJSONString(unmatchedConditions));
if (unmatchedConditions.size() > 0) {
return new MatchResult(Collections.emptyList(), unmatchedConditions);
}
......
......@@ -169,7 +169,11 @@ public class CommissionServiceImpl extends ServiceImpl<CommissionMapper, Commiss
if (commissionExpected.getCommissionRatio() != null) {
BigDecimal paidRatio = commissionExpected.getPaidRatio() != null ? commissionExpected.getPaidRatio() : BigDecimal.ZERO;
commissionVO.setPaidRatio(paidRatio);
commissionVO.setPendingRatio(commissionExpected.getCommissionRatio().subtract(paidRatio));
commissionVO.setPendingRatio(
BigDecimal.ONE
.subtract(paidRatio.divide(commissionExpected.getCommissionRatio(), 4, RoundingMode.HALF_UP))
.multiply(BigDecimal.valueOf(100))
);
}
commissionVO.setCommissionExpectedStatus(commissionExpected.getStatus());
}
......
......@@ -104,11 +104,21 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer>
if (ValidateUtil.isAllFieldsNull(customerAddRequest)) {
throw new BusinessException(ErrorCode.PARAMS_ERROR.getCode(), ErrorCode.PARAMS_ERROR.getMessage());
}
// 检查字段 certificate_list,根据证件类型、证件号码查询客户是否存在
Customer customer = queryByCertificate(customerAddRequest.getApiCertificateDtoList());
String customerBizId = customerAddRequest.getCustomerBizId();
Customer customer = null;
if (StringUtils.isNotBlank(customerAddRequest.getCustomerBizId())) {
customer = customerService.queryOneByCustomerBizId(customerAddRequest.getCustomerBizId());
}
if (customer == null) {
customer = new Customer();
// 检查字段 certificate_list,根据证件类型、证件号码查询客户是否存在
customer = queryByCertificate(customerAddRequest.getApiCertificateDtoList());
if (customer == null) {
customer = new Customer();
// 客户主表业务唯一id
customerBizId = RandomStringGenerator.generateBizId16(CommonEnum.UID_TYPE_CUSTOMER.getCode());
}else {
customerBizId = customer.getCustomerBizId();
}
}
// 客户主表信息
......@@ -128,8 +138,7 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer>
// 校验客户主表信息
validCustomer(customer);
// 客户主表业务唯一id
customer.setCustomerBizId(RandomStringGenerator.generateBizId16(CommonEnum.UID_TYPE_CUSTOMER.getCode()));
customer.setCustomerBizId(customerBizId);
boolean result = customerService.saveOrUpdate(customer);
if (!result) {
throw new BusinessException(ErrorCode.OPERATION_ERROR.getCode(), ErrorCode.OPERATION_ERROR.getMessage());
......@@ -269,6 +278,12 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer>
}
}
@Override
public Customer queryOneByCustomerBizId(String customerBizId) {
return this.baseMapper.selectOne(new LambdaQueryWrapper<Customer>()
.eq(Customer::getCustomerBizId,customerBizId).last(" limit 1 "));
}
}
......
......@@ -164,8 +164,9 @@ public class FortuneAccountServiceImpl extends ServiceImpl<FortuneAccountMapper,
updateFortune.setFortuneAccountBizId(fortuneAccountBizId);
updateFortune.setStatus(FortuneStatusEnum.CHECKED.getItemValue());
// 处理金额字段
updateFortune.setCurrentPaymentHkdAmount(item.getHkdAmount());
updateFortune.setCurrentPaymentRatio(BigDecimal.valueOf(100));
updateFortune.setCurrentPaymentHkdAmount(item.getCurrentPaymentHkdAmount());
updateFortune.setCurrentPaymentRatio(item.getCurrentPaymentHkdAmount()
.divide(item.getHkdAmount(), 4, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)));
updateFortune.setReconciliationOperator(currentLoginUser.getUsername());
updateFortuneList.add(updateFortune);
}
......
......@@ -234,14 +234,14 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
// 2. 更新expected_fortune记录为已全额发放状态
// 统一使用港币金额
expectedFortune.setPaidAmount(expectedFortune.getHkdAmount());
expectedFortune.setUnpaidAmount(BigDecimal.ZERO);
expectedFortune.setPaidRatio(BigDecimal.valueOf(100));
expectedFortune.setUnpaidRatio(BigDecimal.ZERO);
expectedFortune.setStatus("6"); // 全额发放完成状态
expectedFortune.setActualPayoutDate(LocalDate.now());
expectedFortuneService.updateById(expectedFortune);
// expectedFortune.setPaidAmount(expectedFortune.getHkdAmount());
// expectedFortune.setUnpaidAmount(BigDecimal.ZERO);
// expectedFortune.setPaidRatio(BigDecimal.valueOf(100));
// expectedFortune.setUnpaidRatio(BigDecimal.ZERO);
// expectedFortune.setStatus("6"); // 全额发放完成状态
// expectedFortune.setActualPayoutDate(LocalDate.now());
//
// expectedFortuneService.updateById(expectedFortune);
}
private BigDecimal queryDefaultExchangeRate(String currency) {
......@@ -287,10 +287,7 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
main.setReconciliationOperator(currentLoginUser.getUsername());
main.setUpdaterId(loginUserId);
main.setUpdateTime(new Date());
// 其他字段更新
if (StringUtils.isNotBlank(fortuneUpdateRequest.getCurrency())) {
main.setCurrency(fortuneUpdateRequest.getCurrency());
}
this.updateById(main);
// 2. 剩余金额生成新行
......@@ -303,7 +300,7 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
part.setCurrentPaymentHkdAmount(leftAmount);
part.setCurrentPaymentRatio(leftAmount
.divide(expectedFortune.getHkdAmount(), 4, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)));
part.setStatus(FortuneStatusEnum.WAIT.getItemValue());
part.setStatus(FortuneStatusEnum.RESERVED.getItemValue());
part.setIsPart(1);
part.setPayoutDate(LocalDate.now().plusMonths(1)); // 次月
part.setReconciliationOperator(currentLoginUser.getUsername());
......@@ -314,20 +311,20 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
// 3. 同步 expected_fortune
// 统一使用港币金额
BigDecimal newPaid = expectedFortune.getPaidAmount() == null ? BigDecimal.ZERO : expectedFortune.getPaidAmount().add(currentPaymentHkdAmount);
BigDecimal newUnpaid = expectedFortune.getHkdAmount().subtract(newPaid);
String newStatus = newUnpaid.compareTo(BigDecimal.ZERO) == 0 ? "6" : "3";
expectedFortuneService.lambdaUpdate()
.set(ExpectedFortune::getPaidAmount, newPaid)
.set(ExpectedFortune::getUnpaidAmount, newUnpaid)
.set(ExpectedFortune::getPaidRatio,
newPaid.divide(expectedFortune.getHkdAmount(), 4, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)))
.set(ExpectedFortune::getUnpaidRatio,
newUnpaid.divide(expectedFortune.getHkdAmount(), 4, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)))
.set(ExpectedFortune::getStatus, newStatus)
.eq(ExpectedFortune::getId, expectedFortune.getId())
.update();
// BigDecimal newPaid = expectedFortune.getPaidAmount() == null ? BigDecimal.ZERO : expectedFortune.getPaidAmount().add(currentPaymentHkdAmount);
// BigDecimal newUnpaid = expectedFortune.getHkdAmount().subtract(newPaid);
// String newStatus = newUnpaid.compareTo(BigDecimal.ZERO) == 0 ? "6" : "3";
//
// expectedFortuneService.lambdaUpdate()
// .set(ExpectedFortune::getPaidAmount, newPaid)
// .set(ExpectedFortune::getUnpaidAmount, newUnpaid)
// .set(ExpectedFortune::getPaidRatio,
// newPaid.divide(expectedFortune.getHkdAmount(), 4, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)))
// .set(ExpectedFortune::getUnpaidRatio,
// newUnpaid.divide(expectedFortune.getHkdAmount(), 4, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)))
// .set(ExpectedFortune::getStatus, newStatus)
// .eq(ExpectedFortune::getId, expectedFortune.getId())
// .update();
}
@Override
......@@ -368,9 +365,9 @@ public class FortuneServiceImpl extends ServiceImpl<FortuneMapper, Fortune>
// 校验发佣记录状态
StringBuilder validateMsg = new StringBuilder();
for (Fortune fortune : fortuneList) {
// if (StringUtils.equals(fortune.getStatus(), FortuneStatusEnum.CAN_SEND.getItemValue())) {
// validateMsg.append(fortune.getPolicyNo()).append("-").append(fortune.getBroker()).append("当前未检核,请检核后再生成出账记录; ");
// }
if (!StringUtils.equals(fortune.getStatus(), FortuneStatusEnum.CAN_SEND.getItemValue())) {
validateMsg.append(fortune.getPolicyNo()).append("-").append(fortune.getBroker()).append("当前状态不是'可出账, 待检核',不能生成出账记录; ");
}
if (StringUtils.equals(fortune.getStatus(), FortuneStatusEnum.SENT.getItemValue())) {
validateMsg.append(fortune.getPolicyNo()).append("-").append(fortune.getBroker()).append("已完成出账,不能生成出账记录; ");
}
......
......@@ -207,9 +207,6 @@ public class PolicyFollowServiceImpl extends ServiceImpl<PolicyFollowMapper, Pol
if (StringUtils.isNotBlank(policyFollowDto.getReconciliationCode())) {
policyFollow.setReconciliationCompanyCode(policyFollowDto.getReconciliationCode());
}
if (StringUtils.isNotBlank(policyFollowDto.getReconciliationCompanyName())) {
policyFollow.setReconciliationCompany(policyFollowDto.getReconciliationCompanyName());
}
// 检查保单号是否从空变为有值
String oldPolicyNo = policyFollow.getPolicyNo();
......@@ -556,6 +553,7 @@ public class PolicyFollowServiceImpl extends ServiceImpl<PolicyFollowMapper, Pol
updatePolicyBrokerPolicyNo(policyBizId, policy.getPolicyNo());
// 根据保单生成预计入账记录
log.info("根据保单生成预计入账记录前effectiveDate生效日期:{}",policy.getEffectiveDate());
generateExpectedCommission(policyFollow, policy);
// 更新FNA状态为 "签单完成"
......
......@@ -154,9 +154,9 @@ public class CommissionVO implements Serializable {
private Date commissionDate;
/**
* 当前来佣比例
* 当前来佣比例 (实佣率=实际入账金额/结算汇率/每期保费)
*/
@Schema(description = "当前来佣比例")
@Schema(description = "当前来佣比例 (实佣率=实际入账金额/结算汇率/每期保费)")
private BigDecimal currentCommissionRatio;
/**
......@@ -196,9 +196,9 @@ public class CommissionVO implements Serializable {
private BigDecimal paidRatio;
/**
* 待入账比例
* 达成率缺口= 1 - 本期实佣率/产品本期来佣率
*/
@Schema(description = "待入账比例")
@Schema(description = "达成率缺口= 1 - 累积实佣率/产品本期来佣率")
private BigDecimal pendingRatio;
/**
......
......@@ -29,14 +29,10 @@
ifnull(sum(ef.hkd_amount),0) as totalExpectedAmount,
ifnull(sum(ef.paid_amount),0) as totalPaidAmount,
ifnull(sum(ef.unpaid_amount),0) as totalUnpaidAmount,
MAX(e.total_payment_premium) * MAX(ef.default_exchange_rate) as totalPremiumAmount,
MAX(p.total_payment_premium) * MAX(ef.default_exchange_rate) as totalPremiumAmount,
count(distinct ef.policy_no) as totalPolicyCount
from expected_fortune ef
LEFT JOIN (
SELECT p.policy_no, p.total_payment_premium
FROM policy p
GROUP BY policy_no
) e ON ef.policy_no = e.policy_no
LEFT JOIN policy p ON ef.policy_no = p.policy_no
<where>
<if test="expectedFortuneIds != null and expectedFortuneIds.size > 0">
ef.id in
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment