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

Merge branch 'feature-licancan' into 'develop'

Feature licancan

See merge request fangxinjiang/yifu!45
parents 79755e82 597999f7
......@@ -77,9 +77,9 @@ public class InsurancesConstants {
*/
public static final String DATA_IS_NOT_EXIST = "投保信息不存在";
/**
* 被替换信息不存在
* 被替换员工投保记录不存在
*/
public static final String REPLACE_IS_NOT_EXIST = "被替换信息不存在";
public static final String REPLACE_IS_NOT_EXIST = "被替换员工投保记录不存在";
/**
* 项目编码不存在
*/
......@@ -89,13 +89,37 @@ public class InsurancesConstants {
*/
public static final String PROJECT_NOT_FIND_SETTLE_TYPE = "未找到结算主体的结算方式";
/**
* 替换者信息已存在
* 替换员工投保记录已存在
*/
public static final String REPLACE_IS_EXIST = "替换者信息已存在";
public static final String REPLACE_IS_EXIST = "替换员工投保记录已存在";
/**
* 无效、已过期、已出险、已减员的 不能替换
* 当前记录是待投保,无法替换
*/
public static final String REPLACE_IS_NOT_ALLOW = "无效、已过期、已出险、已减员的 不能替换";
public static final String ONE_REPLACE_IS_NOT_ALLOW = "当前记录是待投保,无法替换";
/**
* 当前记录是投保中,无法替换
*/
public static final String TWO_REPLACE_IS_NOT_ALLOW = "当前记录是投保中,无法替换";
/**
* 当前记录已出险,无法替换
*/
public static final String USE_REPLACE_IS_NOT_ALLOW = "当前记录已出险,无法替换";
/**
* 当前记录已失效,无法替换
*/
public static final String EFFECT_REPLACE_IS_NOT_ALLOW = "当前记录已失效,无法替换";
/**
* 当前记录已过期,无法替换
*/
public static final String OVERDUE_REPLACE_IS_NOT_ALLOW = "当前记录已过期,无法替换";
/**
* 当前记录已减员,无法替换
*/
public static final String FIVE_REPLACE_IS_NOT_ALLOW = "当前记录已减员,无法替换";
/**
* 当前记录在减员流程中,无法替换
*/
public static final String REDUCE_REPLACE_IS_NOT_ALLOW = "当前记录在减员流程中,无法替换";
/**
* 员工姓名不能为空
*/
......@@ -108,6 +132,10 @@ public class InsurancesConstants {
* 替换员工姓名不能为空
*/
public static final String REPLACE_EMP_NAME_NOT_EMPTY = "替换员工姓名不能为空";
/**
* 替换员工姓名超过20字符长度限制
*/
public static final String REPLACE_EMP_NAME_MORE_THAN_20 = "替换员工姓名超过20字符长度限制";
/**
* 员工身份证号不能为空
*/
......@@ -125,9 +153,9 @@ public class InsurancesConstants {
*/
public static final String EMP_ID_CARD_NO_NOT_FIT = "员工未通过实名认证";
/**
* 替换员工姓名、身份证号不一致
* 替换员工未通过实名认证
*/
public static final String REPLACE_EMP_ID_CARD_NO_NOT_FIT = "替换员工姓名、身份证号不一致";
public static final String REPLACE_EMP_ID_CARD_NO_NOT_FIT = "替换员工未通过实名认证";
/**
* 替换员工身份证号格式有误
*/
......@@ -137,9 +165,9 @@ public class InsurancesConstants {
*/
public static final String DEPT_NO_NOT_EMPTY = "项目编码不能为空";
/**
* 替换项目编码不能为空
* 替换员工项目编码不能为空
*/
public static final String REPLACE_DEPT_NO_NOT_EMPTY = "替换项目编码不能为空";
public static final String REPLACE_DEPT_NO_NOT_EMPTY = "替换员工项目编码不能为空";
/**
* 保险公司名称不能为空
*/
......@@ -253,9 +281,17 @@ public class InsurancesConstants {
*/
public static final String ACTUAL_PREMIUM_NO_EMPTY = "保费不能为空";
/**
* 保单号不存在
* 保单号不存在或已过期
*/
public static final String POLICY_NO_EXIST = "保单号不存在或已过期";
/**
* 保险公司错误
*/
public static final String POLICY_NO_COMPANY_NAME_NOT_SAME = "保险公司错误";
/**
* 险种名称错误
*/
public static final String POLICY_NO_EXIST= "保单号不存在";
public static final String POLICY_NO_TYPE_NAME_NOT_SAME = "险种名称错误";
/***********************减员办理错误码********************************/
......
......@@ -971,6 +971,11 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
listResult.add(param);
continue;
}
if (!ValidityUtil.validate20(param.getEmpName())){
param.setErrorMessage(InsurancesConstants.EMP_NAME_MORE_THAN_20);
listResult.add(param);
continue;
}
if (StringUtils.isBlank(param.getEmpIdcardNo())){
param.setErrorMessage(InsurancesConstants.EMP_IDCARD_NO_NOT_EMPTY);
listResult.add(param);
......@@ -981,6 +986,11 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
listResult.add(param);
continue;
}
if (!ValidityUtil.validate32(param.getPost())){
param.setErrorMessage(InsurancesConstants.POST_NOT_MORE_THAN_32);
listResult.add(param);
continue;
}
if (StringUtils.isBlank(param.getPolicyNo())){
param.setErrorMessage(InsurancesConstants.POLICY_NO_EMPTY);
listResult.add(param);
......@@ -1026,6 +1036,13 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
listResult.add(param);
continue;
}
if (StringUtils.isNotBlank(param.getRemark())){
if (!ValidityUtil.validate50(param.getRemark())){
param.setErrorMessage(InsurancesConstants.REMARK_NOT_MORE_THAN_50);
listResult.add(param);
continue;
}
}
// 身份证号位数校验(18 位合法)
if (!ValidityUtil.validateIDCard(param.getEmpIdcardNo())){
param.setErrorMessage(InsurancesConstants.EMP_IDCARD_NO_NOT_LEGITIMATE);
......@@ -1147,14 +1164,34 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}
}
}
// 结算月份 >= 派单月份(结算月 < 派单月份的记录予以拦截,并提示)
if(!LocalDateUtil.isDate(param.getSettleMonth(),LocalDateUtil.NORM_MONTH_PATTERN)){
param.setErrorMessage(InsurancesConstants.SETTLE_MONTH_PARSE_ERROR);
listResult.add(param);
continue;
}
if(!LocalDateUtil.isCurrentOrFutureMonth(param.getSettleMonth())){
param.setErrorMessage(InsurancesConstants.SETTLE_MONTH_SHOULD_IS_FUTURE);
listResult.add(param);
continue;
}
//记录查重校验:姓名 + 身份证号 + 保险公司 + 险种
//待投保、投保中、已投保(有效、未过期)
Set<Integer> setRStatus = Sets.newHashSet();
setRStatus.add(CommonConstants.FOUR_INT);
setRStatus.add(CommonConstants.FIVE_INT);
TInsuranceDetail insuranceDetail = this.baseMapper.selectOne(Wrappers.<TInsuranceDetail>query().lambda()
.eq(TInsuranceDetail::getEmpName, param.getEmpName())
.eq(TInsuranceDetail::getEmpIdcardNo, param.getEmpIdcardNo())
.eq(TInsuranceDetail::getInsuranceCompanyName, param.getInsuranceCompanyName())
.eq(TInsuranceDetail::getInsuranceTypeName, param.getInsuranceTypeName())
//是否需要加状态过滤?
.notIn(TInsuranceDetail::getBuyHandleStatus, setRStatus)
.eq(TInsuranceDetail::getDeleteFlag, CommonConstants.ZERO_INT)
.ne(TInsuranceDetail::getIsEffect,CommonConstants.ONE_INT)
.ne(TInsuranceDetail::getIsOverdue,CommonConstants.ONE_INT)
.last(CommonConstants.LAST_ONE_SQL)
);
if (Optional.ofNullable(insuranceDetail).isPresent()){
param.setErrorMessage(InsurancesConstants.DATA_IS_EXIST);
......@@ -1165,6 +1202,8 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
TInsuranceDetail limitOne = this.baseMapper.selectOne(Wrappers.<TInsuranceDetail>query().lambda()
.eq(TInsuranceDetail::getPolicyNo, param.getPolicyNo())
.eq(TInsuranceDetail::getBuyHandleStatus, CommonConstants.THREE_INT)
.ne(TInsuranceDetail::getIsEffect,CommonConstants.ONE_INT)
.ne(TInsuranceDetail::getIsOverdue,CommonConstants.ONE_INT)
.eq(TInsuranceDetail::getDeleteFlag, CommonConstants.ZERO_INT)
.last(CommonConstants.LAST_ONE_SQL)
);
......@@ -1173,20 +1212,18 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
listResult.add(param);
continue;
}else {
param.setPolicyStart(limitOne.getPolicyStart());
param.setPolicyEnd(limitOne.getPolicyEnd());
}
// 结算月份 >= 派单月份(结算月 < 派单月份的记录予以拦截,并提示)
if(!LocalDateUtil.isDate(param.getSettleMonth(),LocalDateUtil.NORM_MONTH_PATTERN)){
param.setErrorMessage(InsurancesConstants.SETTLE_MONTH_PARSE_ERROR);
listResult.add(param);
continue;
}
if(!LocalDateUtil.isCurrentOrFutureMonth(param.getSettleMonth())){
param.setErrorMessage(InsurancesConstants.SETTLE_MONTH_SHOULD_IS_FUTURE);
listResult.add(param);
continue;
if(!limitOne.getInsuranceCompanyName().equals(param.getInsuranceCompanyName())){
param.setErrorMessage(InsurancesConstants.POLICY_NO_COMPANY_NAME_NOT_SAME);
listResult.add(param);
continue;
}else if (!limitOne.getInsuranceTypeName().equals(param.getInsuranceTypeName())){
param.setErrorMessage(InsurancesConstants.POLICY_NO_TYPE_NAME_NOT_SAME);
listResult.add(param);
continue;
}else {
param.setPolicyStart(limitOne.getPolicyStart());
param.setPolicyEnd(limitOne.getPolicyEnd());
}
}
listSuccess.add(param);
}
......@@ -1248,6 +1285,11 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
listResult.add(param);
continue;
}
if (!ValidityUtil.validate20(param.getReplaceEmpName())){
param.setErrorMessage(InsurancesConstants.REPLACE_EMP_NAME_MORE_THAN_20);
listResult.add(param);
continue;
}
if (StringUtils.isBlank(param.getReplaceEmpIdcardNo())){
param.setErrorMessage(InsurancesConstants.REPLACE_EMP_IDCARD_NO_NOT_EMPTY);
listResult.add(param);
......@@ -1263,12 +1305,14 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
listResult.add(param);
continue;
}
// 身份证号位数校验(18 位合法)
if (!ValidityUtil.validateIDCard(param.getEmpIdcardNo())){
param.setErrorMessage(InsurancesConstants.EMP_IDCARD_NO_NOT_LEGITIMATE);
if (!ValidityUtil.validate32(param.getPost())){
param.setErrorMessage(InsurancesConstants.POST_NOT_MORE_THAN_32);
listResult.add(param);
continue;
}
// 身份证号位数校验(18 位合法)
if (!ValidityUtil.validateIDCard(param.getReplaceEmpIdcardNo())){
param.setErrorMessage(InsurancesConstants.REPLACE_EMP_IDCARD_NO_NOT_LEGITIMATE);
listResult.add(param);
......@@ -1288,6 +1332,24 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}
}
//根据项目编码查询项目是否存在
R<SetInfoVo> setInfoByCodes = archivesDaprUtil.getSetInfoByCodes(Arrays.asList(param.getDeptNo()));
if (null != setInfoByCodes && setInfoByCodes.getCode() == CommonConstants.SUCCESS) {
Map<String, ProjectSetInfoVo> data = setInfoByCodes.getData().getProjectSetInfoVoMap();
if (MapUtils.isEmpty(data)){
param.setErrorMessage(InsurancesConstants.DEPT_NO_IS_NOT_EXIST);
listResult.add(param);
continue;
}else {
ProjectSetInfoVo projectSetInfoVo = data.get(param.getDeptNo());
if (null == projectSetInfoVo){
param.setErrorMessage(InsurancesConstants.DEPT_NO_IS_NOT_EXIST);
listResult.add(param);
continue;
}
}
}
if(!LocalDateUtil.isDate(param.getPolicyStart(),LocalDateUtil.NORM_DATE_PATTERN)){
param.setErrorMessage(InsurancesConstants.POLICY_START_PARSE_ERROR);
listResult.add(param);
......@@ -1315,28 +1377,101 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
listResult.add(param);
continue;
}else {
// 无效、已过期、已出险、已减员的 不能替换
// 投保状态 待投保 不能替换
if (detail.getBuyHandleStatus() == CommonConstants.ONE_INT){
param.setErrorMessage(InsurancesConstants.ONE_REPLACE_IS_NOT_ALLOW);
listResult.add(param);
continue;
}
// 投保状态 投保中 不能替换
if (detail.getBuyHandleStatus() == CommonConstants.TWO_INT){
param.setErrorMessage(InsurancesConstants.TWO_REPLACE_IS_NOT_ALLOW);
listResult.add(param);
continue;
}
// 投保状态 已投保 已出险 不能替换
if (detail.getBuyHandleStatus() == CommonConstants.THREE_INT
&& detail.getIsUse() == CommonConstants.ONE_INT){
param.setErrorMessage(InsurancesConstants.USE_REPLACE_IS_NOT_ALLOW);
listResult.add(param);
continue;
}
// 投保状态 已投保 已失效 不能替换
if (detail.getBuyHandleStatus() == CommonConstants.THREE_INT
&& detail.getIsEffect() == CommonConstants.ONE_INT){
param.setErrorMessage(InsurancesConstants.EFFECT_REPLACE_IS_NOT_ALLOW);
listResult.add(param);
continue;
}
// 投保状态 已投保 已过期 不能替换
if (detail.getBuyHandleStatus() == CommonConstants.THREE_INT
&& detail.getIsOverdue() == CommonConstants.ONE_INT){
param.setErrorMessage(InsurancesConstants.OVERDUE_REPLACE_IS_NOT_ALLOW);
listResult.add(param);
continue;
}
// 投保状态 已减员 不能替换
if (detail.getBuyHandleStatus() == CommonConstants.FIVE_INT){
param.setErrorMessage(InsurancesConstants.REPLACE_IS_NOT_ALLOW);
param.setErrorMessage(InsurancesConstants.FIVE_REPLACE_IS_NOT_ALLOW);
listResult.add(param);
continue;
}
// 投保状态 已投保 减员状态 待减员/减员中 不能替换
if (detail.getBuyHandleStatus() == CommonConstants.THREE_INT
&& (detail.getReduceHandleStatus() == CommonConstants.ONE_INT
|| detail.getReduceHandleStatus() == CommonConstants.TWO_INT)){
param.setErrorMessage(InsurancesConstants.REDUCE_REPLACE_IS_NOT_ALLOW);
listResult.add(param);
continue;
}
}
//替换者数据查重校验:替换姓名 + 替换身份证号 + 替换项目编码 + 保险公司 + 险种名称
//替换者数据查重校验:替换姓名 + 替换身份证号 + 替换项目编码? + 保险公司 + 险种名称
//待投保、投保中、已投保(有效、未过期)
Set<Integer> setRStatus = Sets.newHashSet();
setRStatus.add(CommonConstants.FOUR_INT);
setRStatus.add(CommonConstants.FIVE_INT);
TInsuranceDetail replace = this.baseMapper.selectOne(Wrappers.<TInsuranceDetail>query().lambda()
.eq(TInsuranceDetail::getEmpName, param.getReplaceEmpName())
.eq(TInsuranceDetail::getEmpIdcardNo, param.getReplaceEmpIdcardNo())
.eq(TInsuranceDetail::getDeptNo, param.getReplaceDeptNo())
.eq(TInsuranceDetail::getInsuranceCompanyName, param.getInsuranceCompanyName())
.eq(TInsuranceDetail::getInsuranceTypeName, param.getInsuranceTypeName())
//加状态??
.eq(TInsuranceDetail::getPolicyStart, param.getPolicyStart())
.eq(TInsuranceDetail::getPolicyEnd, param.getPolicyEnd())
.notIn(TInsuranceDetail::getBuyHandleStatus, setRStatus)
.eq(TInsuranceDetail::getDeleteFlag, CommonConstants.ZERO_INT)
.ne(TInsuranceDetail::getIsEffect,CommonConstants.ONE_INT)
.ne(TInsuranceDetail::getIsOverdue,CommonConstants.ONE_INT)
.last(CommonConstants.LAST_ONE_SQL)
);
if (Optional.ofNullable(replace).isPresent()){
param.setErrorMessage(InsurancesConstants.REPLACE_IS_EXIST);
listResult.add(param);
continue;
}
//时间区间
TInsuranceDetail insuranceDetailBetween = this.baseMapper.selectOne(Wrappers.<TInsuranceDetail>query().lambda()
.eq(TInsuranceDetail::getEmpName, param.getReplaceEmpName())
.eq(TInsuranceDetail::getEmpIdcardNo, param.getReplaceEmpIdcardNo())
.eq(TInsuranceDetail::getInsuranceCompanyName, param.getInsuranceCompanyName())
.eq(TInsuranceDetail::getInsuranceTypeName, param.getInsuranceTypeName())
.notIn(TInsuranceDetail::getBuyHandleStatus, setRStatus)
.eq(TInsuranceDetail::getDeleteFlag, CommonConstants.ZERO_INT)
.and(
wrapper -> wrapper.between(TInsuranceDetail::getPolicyStart,LocalDateUtil.parseLocalDate(param.getPolicyStart()),LocalDateUtil.parseLocalDate(param.getPolicyEnd()))
.or()
.between(TInsuranceDetail::getPolicyEnd,LocalDateUtil.parseLocalDate(param.getPolicyStart()),LocalDateUtil.parseLocalDate(param.getPolicyEnd()))
)
.ne(TInsuranceDetail::getIsEffect,CommonConstants.ONE_INT)
.ne(TInsuranceDetail::getIsOverdue,CommonConstants.ONE_INT)
.last(CommonConstants.LAST_ONE_SQL)
);
if (Optional.ofNullable(insuranceDetailBetween).isPresent()){
param.setErrorMessage("替换员工在["+param.getPolicyStart()+"-"+param.getPolicyEnd()+"]期间内有投保记录");
listResult.add(param);
continue;
}
listSuccess.add(param);
}
map.put("listResult",listResult);
......@@ -1387,6 +1522,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
listResult.add(param);
continue;
}
// 身份证号位数校验(18 位合法)
if (!ValidityUtil.validateIDCard(param.getEmpIdcardNo())){
param.setErrorMessage(InsurancesConstants.EMP_IDCARD_NO_NOT_LEGITIMATE);
......
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