Commit 66d214fb authored by zhaji's avatar zhaji

"feature-zhaJi:新增导入时的部分非空校验"

parent 298b0029
...@@ -405,9 +405,9 @@ public class InsurancesConstants { ...@@ -405,9 +405,9 @@ public class InsurancesConstants {
public static final String INSURANCE_REFUND_STATUS_FOUR_ERROR = "商险已减员,无法减员"; public static final String INSURANCE_REFUND_STATUS_FOUR_ERROR = "商险已减员,无法减员";
/** /**
* 替换结算月份和原有结算月份相同 * 变更结算月和当前结算月一致
*/ */
public static final String SETTLE_MONTH_IDENTICAL = "替换结算月份和原有结算月份相同"; public static final String SETTLE_MONTH_IDENTICAL = "变更结算月和当前结算月一致";
/** /**
* 商险待投保,无法减员 * 商险待投保,无法减员
...@@ -429,6 +429,11 @@ public class InsurancesConstants { ...@@ -429,6 +429,11 @@ public class InsurancesConstants {
*/ */
public static final String SETTLE_MONTH_CHANGE_REFUND_STATUS_FOUR_ERROR = "商险已减员,无法变更结算月"; public static final String SETTLE_MONTH_CHANGE_REFUND_STATUS_FOUR_ERROR = "商险已减员,无法变更结算月";
/**
* 减员流程中,无法变更结算月
*/
public static final String SETTLE_MONTH_CHANGE_REFUND_STATUS_ONE_ERROR = "减员流程中,无法变更结算月";
/** /**
* 商险结算中,无法变更结算月 * 商险结算中,无法变更结算月
*/ */
......
...@@ -91,4 +91,23 @@ public class DeptChangeCheckParam implements Serializable { ...@@ -91,4 +91,23 @@ public class DeptChangeCheckParam implements Serializable {
@Schema(description = "结算方式") @Schema(description = "结算方式")
private Integer oldSettleType; private Integer oldSettleType;
/**
* 默认结算id
*/
@Schema(description = "默认结算id")
private String defaultSettleId;
/**
* 预估保费
*/
@Schema(description = "预估保费")
private String estimatePremium;
/**
* 实际保费
*/
@Schema(description = "实际保费")
private String actualPremium;
} }
...@@ -2343,8 +2343,6 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -2343,8 +2343,6 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
if(CollectionUtils.isNotEmpty(successList)){ if(CollectionUtils.isNotEmpty(successList)){
for (DeptChangeCheckParam success : successList) { for (DeptChangeCheckParam success : successList) {
Integer newSettleType = success.getNewSettleType();
Integer oldSettleType = success.getOldSettleType();
LambdaUpdateWrapper<TInsuranceDetail> updateWrapper = new LambdaUpdateWrapper<>(); LambdaUpdateWrapper<TInsuranceDetail> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(TInsuranceDetail ::getId,success.getId()) updateWrapper.eq(TInsuranceDetail ::getId,success.getId())
.set(TInsuranceDetail :: getDeptNo,success.getNewDeptNo()) .set(TInsuranceDetail :: getDeptNo,success.getNewDeptNo())
...@@ -2353,10 +2351,30 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -2353,10 +2351,30 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
.set(TInsuranceDetail :: getUpdateTime,LocalDateTime.now()); .set(TInsuranceDetail :: getUpdateTime,LocalDateTime.now());
update(updateWrapper); update(updateWrapper);
} }
updateDept2EKP(successList);
} }
List<DeptChangeCheckParam> errorList = stringListMap.get("errorList"); List<DeptChangeCheckParam> errorList = stringListMap.get("errorList");
return R.ok(errorList,"导入成功"); return R.ok(errorList,"导入成功");
} }
/**
* 发送变更通知至EKP
*
* @author zhaji
* @param successList
* @return void
*/
private void updateDept2EKP(List<DeptChangeCheckParam> successList) {
for (DeptChangeCheckParam param : successList) {
String newDeptNo = param.getNewDeptNo();
String oldDeptNo = param.getOldDeptNo();
Integer newSettleType = param.getNewSettleType();
Integer oldSettleType = param.getOldSettleType();
String defaultSettleId = param.getDefaultSettleId();
if (StringUtils.isNotBlank(defaultSettleId) && CommonConstants.ZERO_INT == newSettleType){
}
}
}
/** /**
* 根据保险公司名称查询保单明细 * 根据保险公司名称查询保单明细
...@@ -2555,8 +2573,8 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -2555,8 +2573,8 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
errorList.add(param); errorList.add(param);
continue; continue;
} }
Integer reduceHandleStatus = one.getReduceHandleStatus(); Integer reduceHandleStatus = one.getReduceHandleStatus();
if ( null != reduceHandleStatus){
//当前保单信息的减员状态不为空且不为减员退回时时不能进行导入 //当前保单信息的减员状态不为空且不为减员退回时时不能进行导入
if(CommonConstants.ONE_INT == reduceHandleStatus ){ if(CommonConstants.ONE_INT == reduceHandleStatus ){
param.setErrorMessage(InsurancesConstants.INSURANCE_REFUND_STATUS_ONE_ERROR); param.setErrorMessage(InsurancesConstants.INSURANCE_REFUND_STATUS_ONE_ERROR);
...@@ -2573,20 +2591,21 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -2573,20 +2591,21 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
errorList.add(param); errorList.add(param);
continue; continue;
} }
}
//出险状态 //出险状态
if(CommonConstants.ZERO_INT != one.getIsUse()){ if(null != one.getIsUse() && CommonConstants.ZERO_INT != one.getIsUse()){
param.setErrorMessage(InsurancesConstants.INSURANCE_IS_USE_ERROR); param.setErrorMessage(InsurancesConstants.INSURANCE_IS_USE_ERROR);
errorList.add(param); errorList.add(param);
continue; continue;
} }
//有效状态 //有效状态
if(CommonConstants.ZERO_INT != one.getIsEffect()){ if(null != one.getIsEffect() && CommonConstants.ZERO_INT != one.getIsEffect()){
param.setErrorMessage(InsurancesConstants.INSURANCE_IS_EFFECT_ERROR); param.setErrorMessage(InsurancesConstants.INSURANCE_IS_EFFECT_ERROR);
errorList.add(param); errorList.add(param);
continue; continue;
} }
//过期状态 //过期状态
if (CommonConstants.ZERO_INT != one.getIsOverdue()){ if (null != one.getIsOverdue() && CommonConstants.ZERO_INT != one.getIsOverdue()){
param.setErrorMessage(InsurancesConstants.INSURANCE_IS_OVERDUE_ERROR); param.setErrorMessage(InsurancesConstants.INSURANCE_IS_OVERDUE_ERROR);
errorList.add(param); errorList.add(param);
continue; continue;
...@@ -2656,11 +2675,6 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -2656,11 +2675,6 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
errorList.add(param); errorList.add(param);
continue; continue;
} }
/* if ( null != tInsuranceRefundDetail.getRefundMoney()){
param.setErrorMessage(InsurancesConstants.REFUND_MONEY_IS_NOT_NULL);
errorList.add(param);
continue;
}*/
param.setId(tInsuranceRefundDetail.getInsDetailId()); param.setId(tInsuranceRefundDetail.getInsDetailId());
successList.add(param); successList.add(param);
} }
...@@ -2830,12 +2844,17 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -2830,12 +2844,17 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
} }
} }
} }
//当前保单信息的为已减员时不能不能变更结算月 //当前保单信息的为已减员时不能变更结算月
if( CommonConstants.FIVE_INT == insuranceDetail.getBuyHandleStatus() ){ if( CommonConstants.FIVE_INT == insuranceDetail.getBuyHandleStatus() ){
param.setErrorMessage(InsurancesConstants.SETTLE_MONTH_CHANGE_REFUND_STATUS_FOUR_ERROR); param.setErrorMessage(InsurancesConstants.SETTLE_MONTH_CHANGE_REFUND_STATUS_FOUR_ERROR);
errorList.add(param); errorList.add(param);
continue; continue;
} }
if( CommonConstants.ONE_INT == insuranceDetail.getBuyHandleStatus() || CommonConstants.TWO_INT == insuranceDetail.getBuyHandleStatus()){
param.setErrorMessage(InsurancesConstants.SETTLE_MONTH_CHANGE_REFUND_STATUS_ONE_ERROR);
errorList.add(param);
continue;
}
param.setId(insuranceDetail.getId()); param.setId(insuranceDetail.getId());
successList.add(param); successList.add(param);
} }
...@@ -2996,7 +3015,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -2996,7 +3015,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
continue; continue;
} }
//当前保单信息的为已减员时,不能变更结算项目 //当前保单信息的为已减员时,不能变更结算项目
if( CommonConstants.FIVE_INT == insuranceDetail.getBuyHandleStatus() ){ if( null != insuranceDetail.getBuyHandleStatus() && CommonConstants.FIVE_INT == insuranceDetail.getBuyHandleStatus() ){
param.setErrorMessage(InsurancesConstants.DEPT_NO_CHANGE_REFUND_STATUS_FOUR_ERROR); param.setErrorMessage(InsurancesConstants.DEPT_NO_CHANGE_REFUND_STATUS_FOUR_ERROR);
errorList.add(param); errorList.add(param);
continue; continue;
...@@ -3020,6 +3039,65 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -3020,6 +3039,65 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
continue; continue;
} }
} }
//预估
if (insuranceDetail.getSettleType() == CommonConstants.ZERO_INT){
//根据险种获取费率,没费率返回错误
TInsuranceType insuranceType = tInsuranceTypeService.getById(insuranceDetail.getInsuranceTypeId());
//险种存不存在
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);
insuranceDetail.setEstimatePremium(estimatePremium);
if (insuranceDetail.getBuyType() == CommonConstants.THREE_INT){
insuranceDetail.setPolicyEffect(LocalDate.now().plusDays(CommonConstants.ONE_INT));
}
}
}else {
//按天
//计算起止时间的天数
long day = LocalDateUtil.betweenDay(insuranceDetail.getPolicyStart().toString(), insuranceDetail.getPolicyEnd().toString());
//预估保费 = (购买标准 / 365) * 天数
BigDecimal estimatePremium = new BigDecimal(insuranceDetail.getBuyStandard()).divide(new BigDecimal("365")).multiply(new BigDecimal(day)).setScale(2,BigDecimal.ROUND_HALF_UP);
insuranceDetail.setEstimatePremium(estimatePremium);
if (insuranceDetail.getBuyType() == CommonConstants.THREE_INT){
insuranceDetail.setPolicyEffect(LocalDate.now().plusDays(CommonConstants.ONE_INT));
}
//保费存储
TInsuranceSettle settle = new TInsuranceSettle();
settle.setInsDetailId(insuranceDetail.getId());
settle.setSettleType(insuranceDetail.getSettleType());
settle.setSettleHandleStatus(CommonConstants.ONE_STRING);
settle.setEstimatePremium(estimatePremium);
}
}
}
}
//判断当前数据中是否存在重复数据 //判断当前数据中是否存在重复数据
param.setId(insuranceDetail.getId()); param.setId(insuranceDetail.getId());
successList.add(param); successList.add(param);
......
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