Commit 6b327532 authored by zhaji's avatar zhaji

"feature-zhaJi:优化变更项目时的预估保费计算"

parent 5cf7bde6
package com.yifu.cloud.plus.v1.yifu.insurances.entity; package com.yifu.cloud.plus.v1.yifu.insurances.entity;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
...@@ -7,6 +10,8 @@ import java.util.Date; ...@@ -7,6 +10,8 @@ import java.util.Date;
* 结算信息作废记录表(用于记录项目变更导致推信息送至EKP) * 结算信息作废记录表(用于记录项目变更导致推信息送至EKP)
* @TableName t_insurance_settle_cancel * @TableName t_insurance_settle_cancel
*/ */
@Data
@Tag(name = "结算信息作废记录")
public class TInsuranceSettleCancel implements Serializable { public class TInsuranceSettleCancel implements Serializable {
/** /**
* *
...@@ -55,129 +60,4 @@ public class TInsuranceSettleCancel implements Serializable { ...@@ -55,129 +60,4 @@ public class TInsuranceSettleCancel implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/**
*
*/
public String getId() {
return id;
}
/**
*
*/
public void setId(String id) {
this.id = id;
}
/**
* 结算明细id
*/
public String getInsDetailId() {
return insDetailId;
}
/**
* 结算明细id
*/
public void setInsDetailId(String insDetailId) {
this.insDetailId = insDetailId;
}
/**
* 结算信息表id
*/
public String getSettleId() {
return settleId;
}
/**
* 结算信息表id
*/
public void setSettleId(String settleId) {
this.settleId = settleId;
}
/**
* 项目编码
*/
public String getDeptNo() {
return deptNo;
}
/**
* 项目编码
*/
public void setDeptNo(String deptNo) {
this.deptNo = deptNo;
}
/**
* 项目名称
*/
public String getDeptName() {
return deptName;
}
/**
* 项目名称
*/
public void setDeptName(String deptName) {
this.deptName = deptName;
}
/**
* 订单编号
*/
public String getOrderNo() {
return orderNo;
}
/**
* 订单编号
*/
public void setOrderNo(String orderNo) {
this.orderNo = orderNo;
}
/**
* 推送标识 1成功 0失败
*/
public Integer getIsCancelPush() {
return isCancelPush;
}
/**
* 推送标识 1成功 0失败
*/
public void setIsCancelPush(Integer isCancelPush) {
this.isCancelPush = isCancelPush;
}
/**
* 创建时间
*/
public Date getCreateTime() {
return createTime;
}
/**
* 创建时间
*/
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
/**
* 操作人
*/
public String getCreateUesr() {
return createUesr;
}
/**
* 操作人
*/
public void setCreateUesr(String createUesr) {
this.createUesr = createUesr;
}
} }
\ No newline at end of file
...@@ -2570,6 +2570,11 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -2570,6 +2570,11 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
tInsuranceSettle.setEstimatePremium(new BigDecimal("0")); tInsuranceSettle.setEstimatePremium(new BigDecimal("0"));
tInsuranceSettle.setUpdateTime(LocalDateTime.now()); tInsuranceSettle.setUpdateTime(LocalDateTime.now());
tInsuranceSettleService.updateById(tInsuranceSettle); tInsuranceSettleService.updateById(tInsuranceSettle);
//生成一条作废数据并推送至EKP
TInsuranceSettleCancel tInsuranceSettleCancel = new TInsuranceSettleCancel();
tInsuranceSettleCancel.setInsDetailId(success.getId());
tInsuranceSettleCancel.setSettleId(success.getDefaultSettleId());
}else{ }else{
//更新预估保费 //更新预估保费
updateWrapper.set(TInsuranceDetail ::getEstimatePremium,new BigDecimal("0")); updateWrapper.set(TInsuranceDetail ::getEstimatePremium,new BigDecimal("0"));
...@@ -3200,7 +3205,6 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -3200,7 +3205,6 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
errorList.add(param); errorList.add(param);
continue; continue;
} }
//保单开始日期 //保单开始日期
String policyStart = param.getPolicyStart(); String policyStart = param.getPolicyStart();
if(StringUtils.isBlank(policyStart)){ if(StringUtils.isBlank(policyStart)){
...@@ -3328,40 +3332,11 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -3328,40 +3332,11 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
} }
//预估 //预估
if (param.getNewSettleType() == CommonConstants.ZERO_INT){ if (param.getNewSettleType() == CommonConstants.ZERO_INT){
//根据险种获取费率,没费率返回错误 //按月
TInsuranceType insuranceType = tInsuranceTypeService.getById(insuranceDetail.getInsuranceTypeId()); if (CommonConstants.ONE_INT == insuranceDetail.getBillingType()){
//险种存不存在
if (!Optional.ofNullable(insuranceType).isPresent()){
param.setErrorMessage(InsurancesConstants.INSURANCE_TYPE_NAME_NOT_EXIST);
errorList.add(param);
continue;
}else {
TInsuranceCompany insuranceCompany = tInsuranceCompanyService.getById(insuranceType.getInsuranceCompanyId());
//保险公司存不存在
if (!Optional.ofNullable(insuranceCompany).isPresent()){
param.setErrorMessage(InsurancesConstants.INSURANCE_COMPANY_NAME_NOT_EXIST);
errorList.add(param);
continue;
}else {
if (CommonConstants.ONE_STRING.equals(insuranceCompany.getBillingType())){
//按月查费率
//计算起止时间的月数
long month = LocalDateUtil.betweenMonth(insuranceDetail.getPolicyStart().toString(), insuranceDetail.getPolicyEnd().toString());
TInsuranceTypeRate typeRate = tInsuranceTypeRateService.getOne(Wrappers.<TInsuranceTypeRate>query().lambda()
.eq(TInsuranceTypeRate::getInsuranceTypeId, insuranceDetail.getInsuranceTypeId())
.eq(TInsuranceTypeRate::getMonth, month)
.eq(TInsuranceTypeRate::getDeleteFlag, CommonConstants.ZERO_INT)
.last(CommonConstants.LAST_ONE_SQL)
);
if (!Optional.ofNullable(typeRate).isPresent()){
param.setErrorMessage(InsurancesConstants.INSURANCE_TYPE_RATE_NOT_EXIST);
errorList.add(param);
continue;
}else {
// 预估保费 = 费率 * 购买标准 // 预估保费 = 费率 * 购买标准
BigDecimal estimatePremium = new BigDecimal(insuranceDetail.getBuyStandard()).multiply(new BigDecimal(typeRate.getRate())).setScale(2,BigDecimal.ROUND_HALF_UP); BigDecimal estimatePremium = new BigDecimal(insuranceDetail.getBuyStandard()).multiply(insuranceDetail.getRate()).setScale(2,BigDecimal.ROUND_HALF_UP);
param.setEstimatePremium(estimatePremium); param.setEstimatePremium(estimatePremium);
}
}else { }else {
//按天 //按天
//计算起止时间的天数 //计算起止时间的天数
...@@ -3371,8 +3346,6 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -3371,8 +3346,6 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
param.setEstimatePremium(estimatePremium); param.setEstimatePremium(estimatePremium);
} }
} }
}
}
param.setOldSettleType(insuranceDetail.getSettleType()); param.setOldSettleType(insuranceDetail.getSettleType());
param.setDefaultSettleId(insuranceDetail.getDefaultSettleId()); param.setDefaultSettleId(insuranceDetail.getDefaultSettleId());
param.setId(insuranceDetail.getId()); param.setId(insuranceDetail.getId());
......
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