Commit be982fc5 authored by 李灿灿's avatar 李灿灿

Merge branch 'feature-licancan' into 'develop'

Feature licancan

See merge request fangxinjiang/yifu!97
parents c282dc98 3e72c3a9
......@@ -248,6 +248,7 @@ public class TInsuranceDetail extends BaseEntity {
* 是否有效 0有效 1无效
*/
@Schema(description = "是否有效 0有效 1无效")
@TableField(updateStrategy = FieldStrategy.IGNORED)
private Integer isEffect;
/**
......
......@@ -408,6 +408,8 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
return R.failed(InsurancesConstants.DATA_IS_NOT_EXIST);
}
if (byId.getBuyHandleStatus() == CommonConstants.FOUR_INT && byId.getBuyType() != CommonConstants.FOUR_INT){
//新增、批增的编辑逻辑
// 身份证号位数校验(18 位合法)
if (!ValidityUtil.validateIDCard(param.getEmpIdcardNo())){
return R.failed(InsurancesConstants.EMP_IDCARD_NO_NOT_LEGITIMATE);
......@@ -559,7 +561,55 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
byId.setUpdateBy(user.getId());
byId.setUpdateTime(LocalDateTime.now());
this.updateById(byId);
}else {
}else if(byId.getBuyHandleStatus() == CommonConstants.FOUR_INT && byId.getBuyType() == CommonConstants.FOUR_INT){
//替换的编辑逻辑
// 身份证号位数校验(18 位合法)
if (!ValidityUtil.validateIDCard(param.getEmpIdcardNo())){
return R.failed(InsurancesConstants.EMP_IDCARD_NO_NOT_LEGITIMATE);
}
//校验身份合法
/*TCheckIdCard checkIdCard = new TCheckIdCard();
checkIdCard.setName(param.getEmpName());
checkIdCard.setIdCard(param.getEmpIdcardNo());
R<TCheckIdCard> tCheckIdCardR = checkDaprUtil.checkIdCardSingle(checkIdCard);
if (null != tCheckIdCardR && tCheckIdCardR.getCode() == CommonConstants.SUCCESS){
TCheckIdCard data = tCheckIdCardR.getData();
if (CommonConstants.ONE_INT != data.getIsTrue()){
return R.failed(InsurancesConstants.EMP_ID_CARD_NO_NOT_FIT);
}
}*/
TInsuranceReplace one = tInsuranceReplaceService.getOne(Wrappers.<TInsuranceReplace>query().lambda()
.eq(TInsuranceReplace::getToInsuranceDetailId, byId.getId())
.last(CommonConstants.LAST_ONE_SQL));
if (Optional.ofNullable(one).isPresent()){
TInsuranceDetail insuranceDetail = this.getById(one.getFromInsuranceDetailId());
if (Optional.ofNullable(insuranceDetail).isPresent()){
if (insuranceDetail.getIsUse() == CommonConstants.ONE_INT){
return R.failed("员工"+insuranceDetail.getEmpName()+"的投保记录已出险,无法替换");
}
if (insuranceDetail.getIsEffect() == CommonConstants.ONE_INT){
return R.failed("员工"+insuranceDetail.getEmpName()+"的投保记录无效,无法替换");
}
//被替换者无效
insuranceDetail.setIsEffect(CommonConstants.ONE_INT);
this.updateById(insuranceDetail);
//替换记录成功
one.setReplaceStatus(CommonConstants.ONE_INT);
tInsuranceReplaceService.updateById(one);
//替换状态下目前只能编辑姓名、身份证号
//投保状态:待投保
byId.setBuyHandleStatus(CommonConstants.ONE_INT);
byId.setEmpName(param.getEmpName());
byId.setEmpIdcardNo(param.getEmpIdcardNo());
byId.setUpdateBy(user.getId());
byId.setUpdateTime(LocalDateTime.now());
this.updateById(byId);
}
}
} else {
return R.failed(InsurancesConstants.EDIT_NOT_ALLOW);
}
//操作记录
......@@ -685,6 +735,27 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
listVO.setErrorMessage(InsurancesConstants.REDUCE_ROLLBACK_REDUCE_IS_NOT_ALLOW);
errorList.add(listVO);
}else{
//判断是否是替换类型的退回,如果是,需要将被替换者激活,替换者有效状态为空
if(detail.getBuyType() == CommonConstants.FOUR_INT){
//替换者有效状态为空
detail.setIsEffect(null);
TInsuranceReplace one = tInsuranceReplaceService.getOne(Wrappers.<TInsuranceReplace>query().lambda()
.eq(TInsuranceReplace::getToInsuranceDetailId, detail.getId())
.last(CommonConstants.LAST_ONE_SQL));
if (Optional.ofNullable(one).isPresent()){
//替换记录变为失败
one.setReplaceStatus(CommonConstants.ZERO_INT);
tInsuranceReplaceService.updateById(one);
TInsuranceDetail byId = this.getById(one.getFromInsuranceDetailId());
if (Optional.ofNullable(byId).isPresent()){
//被替换者激活
byId.setIsEffect(CommonConstants.ZERO_INT);
this.updateById(byId);
}
}
}
// 记录状态置为「退回」
detail.setBuyHandleStatus(CommonConstants.FOUR_INT);
detail.setUpdateBy(user.getId());
......@@ -763,6 +834,17 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
listVO.setErrorMessage(InsurancesConstants.INSURANCE_BUY_STATUS_NOT_TWO);
errorList.add(listVO);
}else {
//替换类型不参与结算
if(detail.getBuyType() == CommonConstants.FOUR_INT){
//记录状态均置为「已投保」
detail.setBuyHandleStatus(CommonConstants.THREE_INT);
detail.setSignFlag(CommonConstants.ONE_INT);
//记录的有效状态,置为「有效」
detail.setIsEffect(CommonConstants.ZERO_INT);
detail.setIsOverdue(CommonConstants.ZERO_INT);
detail.setIsUse(CommonConstants.ZERO_INT);
successList.add(detail);
}else{
//根据结算类型判断是否需要计算预估保费
//预估
if (detail.getSettleType() == CommonConstants.ZERO_INT){
......@@ -848,6 +930,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}
}
}
}
if (CollectionUtils.isNotEmpty(successList)){
//更新
this.saveOrUpdateBatch(successList);
......
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