Commit dd51c838 authored by fangxinjiang's avatar fangxinjiang

优化-fxj

parent 20d3497a
......@@ -537,22 +537,32 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}
//计算购买周期:购买周期=保单结束日期-参保开始日期+1(天数);购买周期=保单结束日期-参保开始日期+1(天数)推算出月数;
//按天计费方式
long day = LocalDateUtil.betweenDay(buyStartDate.toString(),detail.getPolicyEnd().toString());
if (null != detail.getBillingType() && CommonConstants.ZERO_INT == detail.getBillingType().intValue()){
//计算预计保费:根据计费方式、购买标准、购买天数/月数等计算:
//“计费方式”为“按天”的,预估保费=购买周期天数/365*购买标准+5元;
//“计费方式”为“按月”的,预估保费=购买周期月数对应的费率*购买标准+5元
//按天计费方式
detail.setEstimatePremium(new BigDecimal(detail.getBuyStandard())
.multiply(new BigDecimal(purchaseCycle))
.multiply(new BigDecimal(day))
.divide(new BigDecimal("365"), 2, RoundingMode.HALF_UP)
.add(new BigDecimal("5.00")));
TInsuranceTypeRate typeRate = tInsuranceTypeRateService.getOne(Wrappers.<TInsuranceTypeRate>query().lambda()
.eq(TInsuranceTypeRate::getInsuranceTypeId, detail.getInsuranceTypeId())
.eq(TInsuranceTypeRate::getMonth, purchaseCycle)
.eq(TInsuranceTypeRate::getDeleteFlag, CommonConstants.ZERO_INT)
.last(CommonConstants.LAST_ONE_SQL)
);
if (null != typeRate){
detail.setRate(new BigDecimal(typeRate.getRate()));
}
//按月计费方式
}else if (null != detail.getBillingType() && CommonConstants.ONE_INT == detail.getBillingType().intValue()){
detail.setEstimatePremium(new BigDecimal(detail.getBuyStandard())
.multiply(null== detail.getRate()?BigDecimal.ZERO: detail.getRate())
.add(new BigDecimal("5.00")));
}
long day = LocalDateUtil.betweenDay(buyStartDate.toString(),detail.getPolicyEnd().toString());
//购买周期
detail.setPurchaseCycle(purchaseCycle+"个月/"+day+"天");
if (CommonConstants.ZERO_STRING.equals(detail.getIsJfcd())){
......@@ -2196,6 +2206,27 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
updateEmployeeInsurancePreRenewById(detail, Stream.of("4").collect(Collectors.toList()),CommonConstants.SIX_STRING, false);
//如果是见费出单,生成差额数据
if (CommonConstants.ZERO_STRING.equals(detail.getIsJfcd())){
//保费存储
TInsuranceSettle settle = new TInsuranceSettle();
settle.setInsDetailId(detail.getId());
settle.setSettleType(CommonConstants.TWO_INT);
settle.setSettleHandleStatus(CommonConstants.ONE_STRING);
settle.setEstimatePremium(BigDecimalUtils.safeAdd(detail.getActualPremium(),detail.getEstimatePremium()));
settle.setActualPremium(BigDecimal.ZERO);
//调完ekp接口才会是1
settle.setIsEstimatePush(CommonConstants.ONE_INT);
settle.setEstimatePushTime(LocalDateTime.now());
settle.setCreateTime(LocalDateTime.now());
settle.setId(RandomStringUtils.randomNumeric(19));
settleList.add(settle);
TInsuranceDetail detailTemp = new TInsuranceDetail();
BeanCopyUtils.copyProperties(detail,detailTemp);
detailTemp.setDefaultSettleId(settle.getId());
detailTemp.setEstimatePremium(BigDecimalUtils.safeAdd(detail.getActualPremium(),detail.getEstimatePremium()));
detailTemp.setActualPremium(BigDecimal.ZERO);
//差额结算
detailTemp.setSettleType(CommonConstants.TWO_INT);
successBanlance.add(detailTemp);
successThree.add(detail);
}
}
......
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