Commit 55d4c667 authored by 李灿灿's avatar 李灿灿

feat:已投保信息单个修改

parent 05e9bb28
...@@ -7,6 +7,10 @@ package com.yifu.cloud.plus.v1.yifu.insurances.constants; ...@@ -7,6 +7,10 @@ package com.yifu.cloud.plus.v1.yifu.insurances.constants;
*/ */
public class InsurancesConstants { public class InsurancesConstants {
/**
* 主键不能为空
*/
public static final String ID_IS_EMPTY = "主键不能为空";
/** /**
* 新增 * 新增
*/ */
...@@ -137,6 +141,10 @@ public class InsurancesConstants { ...@@ -137,6 +141,10 @@ public class InsurancesConstants {
* 替换员工投保记录已存在 * 替换员工投保记录已存在
*/ */
public static final String REPLACE_IS_EXIST = "替换员工投保记录已存在"; public static final String REPLACE_IS_EXIST = "替换员工投保记录已存在";
/**
* 替换类型不能修改
*/
public static final String REPLACE_NOT_ALLOW = "替换类型不能修改";
/** /**
* 当前记录是待投保,无法替换 * 当前记录是待投保,无法替换
*/ */
...@@ -928,6 +936,10 @@ public class InsurancesConstants { ...@@ -928,6 +936,10 @@ public class InsurancesConstants {
* 当前为已投保状态,不可办理 * 当前为已投保状态,不可办理
*/ */
public static final String BUY_HANDLE_STATUS_THREE_HANDLE_ERROR = "当前为已投保状态,不可办理"; public static final String BUY_HANDLE_STATUS_THREE_HANDLE_ERROR = "当前为已投保状态,不可办理";
/**
* 当前不是已投保状态
*/
public static final String BUY_HANDLE_STATUS_NOT_THREE = "当前不是已投保状态";
/** /**
* 当前为投保退回状态,不可办理 * 当前为投保退回状态,不可办理
*/ */
......
...@@ -36,4 +36,10 @@ public class InsuranceInsuredDetailParam implements Serializable { ...@@ -36,4 +36,10 @@ public class InsuranceInsuredDetailParam implements Serializable {
*/ */
@Schema(description = "变更后投保类型 1新增 3批增") @Schema(description = "变更后投保类型 1新增 3批增")
private Integer buyType; private Integer buyType;
/**
* 变更原因
*/
@Schema(description = "变更原因")
private String reason;
} }
...@@ -326,6 +326,13 @@ public class TInsuranceDetailController { ...@@ -326,6 +326,13 @@ public class TInsuranceDetailController {
return tInsuranceDetailService.updateInsuranceInsured(paramList); return tInsuranceDetailService.updateInsuranceInsured(paramList);
} }
/**
* 已投保信息修改
*
* @author licancan
* @param param
* @return {@link R< String>}
*/
@PostMapping("/updateInsuranceInsuredById") @PostMapping("/updateInsuranceInsuredById")
@Operation(summary = "已投保信息修改", description = "已投保信息修改") @Operation(summary = "已投保信息修改", description = "已投保信息修改")
//@PreAuthorize("@pms.hasPermission('handle_insured_by_id')") //@PreAuthorize("@pms.hasPermission('handle_insured_by_id')")
......
...@@ -2122,10 +2122,10 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -2122,10 +2122,10 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
} }
//操作记录 //操作记录
addOperate(detailList,user,InsurancesConstants.UPDATE_INSURED,null,CommonConstants.ONE_INT); /*addOperate(detailList,user,InsurancesConstants.UPDATE_INSURED,null,CommonConstants.ONE_INT);
if (operateList.stream().allMatch(e->e.getErrorMessage().equals(CommonConstants.RESULT_DATA_SUCESS))) { if (operateList.stream().allMatch(e->e.getErrorMessage().equals(CommonConstants.RESULT_DATA_SUCESS))) {
operateList = null; operateList = null;
} }*/
return R.ok(operateList,InsurancesConstants.OPERATE_SUCCESS); return R.ok(operateList,InsurancesConstants.OPERATE_SUCCESS);
} }
...@@ -2133,12 +2133,58 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -2133,12 +2133,58 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
* 已投保信息修改 * 已投保信息修改
* *
* @param param * @param param
* @return {@link R< String>} * @return {@link R<String>}
* @author licancan * @author licancan
*/ */
@Override @Override
public R<String> updateInsuranceInsuredById(InsuranceInsuredDetailParam param) { public R<String> updateInsuranceInsuredById(InsuranceInsuredDetailParam param) {
return null; if (StringUtils.isBlank(param.getId())){
R.failed(InsurancesConstants.ID_IS_EMPTY);
}
if (StringUtils.isBlank(param.getPolicyStart()) && StringUtils.isBlank(param.getPolicyEnd()) && Objects.isNull(param.getBuyType())){
R.failed(InsurancesConstants.CHOOSE_ONE_OF_THREE);
}
if (StringUtils.isNotBlank(param.getPolicyStart())){
if(!LocalDateUtil.isDate(param.getPolicyStart(),LocalDateUtil.NORM_DATE_PATTERN)){
R.failed(InsurancesConstants.POLICY_START_NEW_PARSE_ERROR);
}
}
if (StringUtils.isNotBlank(param.getPolicyEnd())){
if(!LocalDateUtil.isDate(param.getPolicyEnd(),LocalDateUtil.NORM_DATE_PATTERN)){
R.failed(InsurancesConstants.POLICY_END_NEW_PARSE_ERROR);
}
}
if (StringUtils.isNotBlank(param.getPolicyStart()) && StringUtils.isNotBlank(param.getPolicyEnd())){
if (!LocalDateUtil.compareDate(param.getPolicyStart(),param.getPolicyEnd())){
R.failed(InsurancesConstants.POLICY_START_NEW_SHOULD_LESS_THAN_POLICY_END_NEW);
}
}
if (StringUtils.isBlank(param.getReason())){
R.failed(InsurancesConstants.REASON_EMPTY);
}
TInsuranceDetail byId = this.getById(param.getId());
if (!Optional.ofNullable(byId).isPresent()){
R.failed(InsurancesConstants.DATA_IS_NOT_EXIST);
}
if (byId.getBuyType() == CommonConstants.FOUR_INT){
R.failed(InsurancesConstants.REPLACE_NOT_ALLOW);
}
if (byId.getBuyHandleStatus() != CommonConstants.THREE_INT){
R.failed(InsurancesConstants.BUY_HANDLE_STATUS_NOT_THREE);
}
TInsuranceDetail old = byId;
if (StringUtils.isNotBlank(param.getPolicyStart())){
byId.setPolicyStart(LocalDateUtil.parseLocalDate(param.getPolicyStart()));
}
if (StringUtils.isNotBlank(param.getPolicyEnd())){
byId.setPolicyEnd(LocalDateUtil.parseLocalDate(param.getPolicyEnd()));
}
if (Objects.nonNull(param.getBuyType())){
byId.setBuyType(param.getBuyType());
}
tBusinessOperateService.saveModificationRecord(byId.getId(),old,byId,param.getReason());
this.updateById(byId);
return R.ok(InsurancesConstants.OPERATE_SUCCESS);
} }
/** /**
...@@ -3600,6 +3646,12 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -3600,6 +3646,12 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
if (!Optional.ofNullable(detail).isPresent()){ if (!Optional.ofNullable(detail).isPresent()){
param.setErrorMessage(InsurancesConstants.DATA_IS_NOT_EXIST); param.setErrorMessage(InsurancesConstants.DATA_IS_NOT_EXIST);
continue; continue;
}else {
//判断是否是已投保状态
if (detail.getBuyHandleStatus() != CommonConstants.THREE_INT){
param.setErrorMessage(InsurancesConstants.BUY_HANDLE_STATUS_NOT_THREE);
continue;
}
} }
param.setErrorMessage(CommonConstants.RESULT_DATA_SUCESS); param.setErrorMessage(CommonConstants.RESULT_DATA_SUCESS);
} }
......
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