Commit 86822276 authored by huyuchen's avatar huyuchen

商险问题修改

parent 02166357
......@@ -337,13 +337,17 @@ public class InsurancesConstants {
*/
public static final String BUY_STANDARD_NOT_EMPTY = "购买标准不能为空";
/**
* 变更后保单开始时间、变更后保单结束时间、变更后投保类型个字段至少填写一个
* 变更后保单开始时间、变更后保单结束时间、变更后投保类型、变更后购买标准四个字段至少填写一个
*/
public static final String CHOOSE_ONE_OF_THREE = "变更后保单开始时间、变更后保单结束时间、变更后投保类型个字段至少填写一个";
public static final String CHOOSE_ONE_OF_THREE = "变更后保单开始时间、变更后保单结束时间、变更后投保类型、变更后购买标准四个字段至少填写一个";
/**
* 购买标准不存在
*/
public static final String BUY_STANDARD_NOT_EXIST = "购买标准不存在";
/**
* 变更后的购买标准不存在
*/
public static final String CHANGE_BUY_STANDARD_NOT_EXIST = "变更后的购买标准不存在";
/**
* 商险购买地省名称不能为空
*/
......
......@@ -2285,7 +2285,8 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
if (StringUtils.isBlank(param.getId())){
return R.failed(InsurancesConstants.ID_IS_EMPTY);
}
if (StringUtils.isBlank(param.getPolicyStart()) && StringUtils.isBlank(param.getPolicyEnd()) && Objects.isNull(param.getBuyType())){
if (StringUtils.isBlank(param.getPolicyStart()) && StringUtils.isBlank(param.getPolicyEnd())
&& Objects.isNull(param.getBuyType()) && StringUtils.isBlank(param.getBuyStandard())){
return R.failed(InsurancesConstants.CHOOSE_ONE_OF_THREE);
}
if (StringUtils.isNotBlank(param.getPolicyStart())){
......@@ -2331,6 +2332,17 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
byId.setBuyType(param.getBuyType());
}
if (Objects.nonNull(param.getBuyStandard())){
//判断变更后购买标准是否存在
//购买标准
TInsuranceTypeStandard typeStandard = tInsuranceTypeStandardService.getOne(Wrappers.<TInsuranceTypeStandard>query().lambda()
.eq(TInsuranceTypeStandard::getBuyStandard, param.getBuyStandard())
.eq(TInsuranceTypeStandard::getInsuranceTypeId, byId.getInsuranceTypeId())
.eq(TInsuranceTypeStandard::getDeleteFlag, CommonConstants.ZERO_INT)
.last(CommonConstants.LAST_ONE_SQL)
);
if (!Optional.ofNullable(typeStandard).isPresent()) {
return R.failed(InsurancesConstants.CHANGE_BUY_STANDARD_NOT_EXIST);
}
byId.setBuyStandard(param.getBuyStandard());
}
//变更记录
......@@ -3808,6 +3820,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
private List<InsuranceInsuredParam> updateInsuranceInsuredCheck(List<InsuranceInsuredParam> paramList, List<TInsuranceAreaRes> insuranceAreaResList){
List<InsuranceInsuredParam> collect = paramList.stream().distinct().collect(Collectors.toList());
TInsuranceDetail detail;
TInsuranceTypeStandard typeStandard;
for (InsuranceInsuredParam param : collect) {
param.setFlag(CommonConstants.ONE_STRING);
// 必填校验
......@@ -3847,7 +3860,8 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
param.setErrorMessage(InsurancesConstants.BUY_STANDARD_NOT_EMPTY);
continue;
}
if (StringUtils.isBlank(param.getPolicyStartNew()) && StringUtils.isBlank(param.getPolicyEndNew()) && StringUtils.isBlank(param.getBuyTypeStr())){
if (StringUtils.isBlank(param.getPolicyStartNew()) && StringUtils.isBlank(param.getPolicyEndNew())
&& StringUtils.isBlank(param.getBuyTypeStr()) && StringUtils.isBlank(param.getBuyStandardNew())){
param.setErrorMessage(InsurancesConstants.CHOOSE_ONE_OF_THREE);
continue;
}
......@@ -3929,6 +3943,19 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
param.setErrorMessage(InsurancesConstants.REPLACE_NOT_ALLOW);
continue;
}
//判断变更后购买标准是否存在
if (Common.isNotNull(param.getBuyStandardNew())) {
//购买标准
typeStandard = tInsuranceTypeStandardService.getOne(Wrappers.<TInsuranceTypeStandard>query().lambda()
.eq(TInsuranceTypeStandard::getBuyStandard, param.getBuyStandardNew())
.eq(TInsuranceTypeStandard::getInsuranceTypeId, detail.getInsuranceTypeId())
.eq(TInsuranceTypeStandard::getDeleteFlag, CommonConstants.ZERO_INT)
.last(CommonConstants.LAST_ONE_SQL)
);
if (!Optional.ofNullable(typeStandard).isPresent()) {
param.setErrorMessage(InsurancesConstants.CHANGE_BUY_STANDARD_NOT_EXIST);
}
}
}
param.setErrorMessage(CommonConstants.RESULT_DATA_SUCESS);
param.setFlag(CommonConstants.ZERO_STRING);
......
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