Commit 86156c93 authored by 李灿灿's avatar 李灿灿

商险新增 根据测试案例调试

parent 0a1387ab
......@@ -100,6 +100,10 @@ public class InsurancesConstants {
* 员工姓名不能为空
*/
public static final String EMP_NAME_NOT_EMPTY = "员工姓名不能为空";
/**
* 员工姓名超过20字符长度限制
*/
public static final String EMP_NAME_MORE_THAN_20 = "员工姓名超过20字符长度限制";
/**
* 替换员工姓名不能为空
*/
......@@ -113,13 +117,13 @@ public class InsurancesConstants {
*/
public static final String REPLACE_EMP_IDCARD_NO_NOT_EMPTY = "替换员工身份证号不能为空";
/**
* 员工身份证号格式
* 员工身份证号格式
*/
public static final String EMP_IDCARD_NO_NOT_LEGITIMATE = "员工身份证号格式误";
public static final String EMP_IDCARD_NO_NOT_LEGITIMATE = "员工身份证号格式误";
/**
* 员工姓名、身份证号不一致
* 员工未通过实名认证
*/
public static final String EMP_ID_CARD_NO_NOT_FIT = "员工姓名、身份证号不一致";
public static final String EMP_ID_CARD_NO_NOT_FIT = "员工未通过实名认证";
/**
* 替换员工姓名、身份证号不一致
*/
......@@ -161,9 +165,13 @@ public class InsurancesConstants {
*/
public static final String POLICY_START_PARSE_ERROR = "保单开始时间格式错误";
/**
* 保单开始时间不能小于派单时间
* 保单开始时间需要大于派单日期
*/
public static final String POLICY_START_SHOULD_IS_FUTURE = "保单开始时间需要大于派单日期";
/**
* 保单结束时间需要大于保单开始时间
*/
public static final String POLICY_START_SHOULD_IS_FUTURE = "保单开始时间不能小于派单时间";
public static final String POLICY_START_SHOULD_LESS_THAN_POLICY_END = "保单结束时间需要大于保单开始时间";
/**
* 保单结束时间不能为空
*/
......@@ -185,33 +193,33 @@ public class InsurancesConstants {
*/
public static final String INSURANCE_PROVINCE_NAME_NOT_EMPTY = "商险购买地省名称不能为空";
/**
* 商险购买地省名称不存在
* 商险购买地省不存在
*/
public static final String INSURANCE_PROVINCE_NAME_NOT_EXIST = "商险购买地省名称不存在";
public static final String INSURANCE_PROVINCE_NAME_NOT_EXIST = "商险购买地省不存在";
/**
* 商险购买地市名称
*/
public static final String INSURANCE_CITY_NAME_NOT_EMPTY = "商险购买地市名称不能为空";
/**
* 商险购买地市名称不存在
* 商险购买地市不存在
*/
public static final String INSURANCE_CITY_NAME_NOT_EXIST = "商险购买地市名称不存在";
public static final String INSURANCE_CITY_NAME_NOT_EXIST = "商险购买地市不存在";
/**
* 商险办理省名称不能为空
*/
public static final String INSURANCE_HANDLE_PROVINCE_NAME_NOT_EMPTY = "商险办理省名称不能为空";
/**
* 商险办理省名称不存在
* 商险办理省不存在
*/
public static final String INSURANCE_HANDLE_PROVINCE_NAME_NOT_EXIST = "商险办理省名称不存在";
public static final String INSURANCE_HANDLE_PROVINCE_NAME_NOT_EXIST = "商险办理省不存在";
/**
* 商险办理城市名称不能为空
*/
public static final String INSURANCE_HANDLE_CITY_NAME_NOT_EMPTY = "商险办理城市名称不能为空";
/**
* 商险办理城市名称不存在
* 商险办理城市不存在
*/
public static final String INSURANCE_HANDLE_CITY_NAME_NOT_EXIST = "商险办理城市名称不存在";
public static final String INSURANCE_HANDLE_CITY_NAME_NOT_EXIST = "商险办理城市不存在";
/**
* 结算月不能为空
*/
......@@ -228,6 +236,14 @@ public class InsurancesConstants {
* 岗位不能为空
*/
public static final String POST_NOT_EMPTY = "岗位不能为空";
/**
* 岗位长度超过32字符限制
*/
public static final String POST_NOT_MORE_THAN_32 = "岗位长度超过32字符限制";
/**
* 备注长度超过50字符限制
*/
public static final String REMARK_NOT_MORE_THAN_50 = "备注长度超过50字符限制";
/**
* 保单号不能为空
*/
......
......@@ -113,6 +113,42 @@ public class LocalDateUtil {
return flag;
}
/**
* 比较两个时间的早晚
*
* @author licancan
* @param startDate 开始日期
* @param endDate 结束日期
* @return {@link boolean}
*/
public static boolean compareDate(String startDate,String endDate){
boolean flag = false;
//在日期字符串非空时执行
if (!Common.isEmpty(startDate) && !Common.isEmpty(endDate)) {
Date parseStartDate = null;
Date parseEndDate = null;
//格式化日期
SimpleDateFormat sdf = new SimpleDateFormat(NORM_DATE_PATTERN, Locale.CHINA);
try {
//将字符串转为日期格式,如果此处字符串为非合法日期就会抛出异常。
parseStartDate = sdf.parse(startDate);
parseEndDate = sdf.parse(endDate);
//调用Date里面的before方法来做判断
flag = parseStartDate.before(parseEndDate);
if (flag) {
System.out.println("开始日期早于结束日期");
}else {
System.out.println("开始日期晚于结束日期");
}
} catch (ParseException e) {
e.printStackTrace();
}
}else {
System.out.println("日期参数不可为空");
}
return flag;
}
/**
* 判断传入的月份是否大于等于本月(结算月份 >= 派单月份)
*
......@@ -149,12 +185,7 @@ public class LocalDateUtil {
return flag;
}
//获取指定时间的指定格式
public static String formatTime(LocalDate time, String pattern) {
return time.format(DateTimeFormatter.ofPattern(pattern));
}
public static void main(String[] args) {
System.out.println(isCurrentOrFutureMonth("2023-1"));
System.out.println(compareDate("2022-07-26","2022-07-27"));
}
}
......@@ -94,6 +94,12 @@ public class InsuranceDetailVO implements Serializable {
@Schema(description = "险种名称")
private String insuranceTypeName;
/**
* 险种主键
*/
@Schema(description = "险种主键")
private Long insuranceTypeId;
/**
* 购买标准
*/
......
......@@ -655,6 +655,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);
......@@ -720,6 +725,21 @@ 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.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);
......@@ -818,6 +838,12 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
listResult.add(param);
continue;
}
if (!LocalDateUtil.compareDate(param.getPolicyStart(),param.getPolicyEnd())){
param.setErrorMessage(InsurancesConstants.POLICY_START_SHOULD_LESS_THAN_POLICY_END);
listResult.add(param);
continue;
}
// 保险公司-险种-购买标准 是否存在
TInsuranceCompany insuranceCompany = tInsuranceCompanyService.getOne(Wrappers.<TInsuranceCompany>query().lambda()
.eq(TInsuranceCompany::getCompanyName, param.getInsuranceCompanyName())
......@@ -856,10 +882,24 @@ 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;
}
//记录查重校验:姓名 + 身份证号 + 保险公司 + 险种 + 保单开始日期~保单结束日期区间 是唯一(剔除退回、过期状态的记录)
//todo 时间区间
//待投保、投保中、已投保(有效、未过期)
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())
......@@ -869,23 +909,40 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
.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(insuranceDetail).isPresent()){
param.setErrorMessage(InsurancesConstants.DATA_IS_EXIST);
listResult.add(param);
continue;
}
// 结算月份 >= 派单月份(结算月 < 派单月份的记录予以拦截,并提示)
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);
//时间区间
TInsuranceDetail insuranceDetailBetween = 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)
.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);
......
......@@ -149,6 +149,7 @@
detail.POLICY_EFFECT as policyEffect,
detail.POLICY_NO as policyNo,
detail.INSURANCE_TYPE_NAME as insuranceTypeName,
detail.INSURANCE_TYPE_ID as insuranceTypeId,
detail.BUY_STANDARD as buyStandard,
detail.MEDICAL_QUOTA as medicalQuota,
detail.DIE_DISABLE_QUOTA as dieDisableQuota,
......
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