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

Merge branch 'feature-licancan' into 'develop'

Feature licancan

See merge request fangxinjiang/yifu!85
parents 9623dcea 30edd95a
...@@ -270,7 +270,37 @@ public class LocalDateUtil { ...@@ -270,7 +270,37 @@ public class LocalDateUtil {
return dif; return dif;
} }
/**
* 判断两个时间段是否有交集
*
* 思路:将有交集的情况列出,若不符合有交集的情况,则无交集
* 有交集的两种情况
* 1.第一个时间段的开始时间在第二个时间段的开始时间和结束时间当中
* 2.第二个时间段的开始时间在第一个时间段的开始时间和结束时间当中
*
* @author licancan
* @param leftStartDate 第一个时间段的开始时间
* @param leftEndDate 第一个时间段的结束时间
* @param rightStartDate 第二个时间段的开始时间
* @param rightEndDate 第二个时间段的结束时间
* @return {@link boolean} 若有交集, 返回true, 否则返回false
*/
public static boolean hasOverlap(LocalDate leftStartDate, LocalDate leftEndDate, LocalDate rightStartDate, LocalDate rightEndDate) {
return ((leftStartDate.equals(rightStartDate) || leftStartDate.isAfter(rightStartDate))
&& leftStartDate.isBefore(rightEndDate))
||
(leftStartDate.isAfter(rightStartDate)
&& (leftStartDate.equals(rightEndDate) || leftStartDate.isBefore(rightEndDate)))
||
((rightStartDate.equals(leftStartDate) || rightStartDate.isAfter(leftStartDate))
&& rightStartDate.isBefore(leftEndDate))
||
(rightStartDate.isAfter(leftStartDate)
&& (rightStartDate.equals(leftEndDate) || rightStartDate.isBefore(leftEndDate)));
}
public static void main(String[] args) { public static void main(String[] args) {
System.out.println(betweenMonth("2022-10-03","2022-08-03")); boolean hasOverlap = hasOverlap(parseLocalDate("2022-08-03"), parseLocalDate("2022-08-04"), parseLocalDate("2022-08-03"), parseLocalDate("2022-08-04"));
System.out.println(hasOverlap);
} }
} }
...@@ -3,6 +3,8 @@ package com.yifu.cloud.plus.v1.yifu.insurances.controller; ...@@ -3,6 +3,8 @@ package com.yifu.cloud.plus.v1.yifu.insurances.controller;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R; import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog;
import com.yifu.cloud.plus.v1.yifu.common.security.annotation.Inner;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceDetail; import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceDetail;
import com.yifu.cloud.plus.v1.yifu.insurances.vo.Dept; import com.yifu.cloud.plus.v1.yifu.insurances.vo.Dept;
import com.yifu.cloud.plus.v1.yifu.insurances.service.TInsuranceDetailService; import com.yifu.cloud.plus.v1.yifu.insurances.service.TInsuranceDetailService;
...@@ -37,6 +39,21 @@ public class TInsuranceDetailController { ...@@ -37,6 +39,21 @@ public class TInsuranceDetailController {
/***********************商险办理********************************/ /***********************商险办理********************************/
/**
* 每日定时刷新商险到期数据
*
* @author licancan
* @param
* @return void
*/
@Operation(summary = "每日定时刷新商险到期数据", description = "每日定时刷新商险到期数据")
@SysLog("每日定时刷新商险到期数据")
@Inner
@GetMapping("/inner/updateOverdueByTask")
public void updateOverdueByTask() {
tInsuranceDetailService.updateOverdueByTask();
}
/** /**
* EKP2INSURANCES 更新结算状态 * EKP2INSURANCES 更新结算状态
* *
......
...@@ -19,6 +19,15 @@ public interface TInsuranceDetailService extends IService<TInsuranceDetail> { ...@@ -19,6 +19,15 @@ public interface TInsuranceDetailService extends IService<TInsuranceDetail> {
/***********************商险办理********************************/ /***********************商险办理********************************/
/**
* 每日定时刷新商险到期数据
*
* @author licancan
* @param
* @return void
*/
void updateOverdueByTask();
/** /**
* EKP2INSURANCES 更新结算状态 * EKP2INSURANCES 更新结算状态
* *
......
...@@ -80,6 +80,17 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -80,6 +80,17 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
/***********************商险办理********************************/ /***********************商险办理********************************/
/**
* 每日定时刷新商险到期数据
*
* @return void
* @author licancan
*/
@Override
public void updateOverdueByTask() {
//todo
}
/** /**
* EKP2INSURANCES 更新结算状态 * EKP2INSURANCES 更新结算状态
* *
...@@ -934,7 +945,11 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -934,7 +945,11 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
Map<String,List<InsuranceAddParam>> map = new HashMap<>(); Map<String,List<InsuranceAddParam>> map = new HashMap<>();
List<InsuranceAddParam> listResult = new ArrayList<>(); List<InsuranceAddParam> listResult = new ArrayList<>();
List<InsuranceAddParam> listSuccess = new ArrayList<>(); List<InsuranceAddParam> listSuccess = new ArrayList<>();
for (InsuranceAddParam param : paramList.stream().distinct().collect(Collectors.toList())) { List<InsuranceAddParam> distinctList = paramList.stream().distinct().collect(Collectors.toList());
//定义外层循环标识,方便去重的时候跳出
outer:
for (int i = 0; i < distinctList.size(); i++) {
InsuranceAddParam param = distinctList.get(i);
// 必填校验 // 必填校验
if (StringUtils.isBlank(param.getEmpName())){ if (StringUtils.isBlank(param.getEmpName())){
param.setErrorMessage(InsurancesConstants.EMP_NAME_NOT_EMPTY); param.setErrorMessage(InsurancesConstants.EMP_NAME_NOT_EMPTY);
...@@ -1032,6 +1047,44 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -1032,6 +1047,44 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
listResult.add(param); listResult.add(param);
continue; continue;
} }
// 保单开始日期 > 当前派单日期
if(!LocalDateUtil.isDate(param.getPolicyStart(),LocalDateUtil.NORM_DATE_PATTERN)){
param.setErrorMessage(InsurancesConstants.POLICY_START_PARSE_ERROR);
listResult.add(param);
continue;
}
if(!LocalDateUtil.isDate(param.getPolicyEnd(),LocalDateUtil.NORM_DATE_PATTERN)){
param.setErrorMessage(InsurancesConstants.POLICY_END_PARSE_ERROR);
listResult.add(param);
continue;
}
if(!LocalDateUtil.isFutureDate(param.getPolicyStart())){
param.setErrorMessage(InsurancesConstants.POLICY_START_SHOULD_IS_FUTURE);
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;
}
//表内数据重复 员工姓名、员工身份证号码、保险公司、险种、起止时间(有交叉)
for (int j = 0; j < distinctList.size(); j++) {
InsuranceAddParam repeat = distinctList.get(j);
if (param.getEmpName().equals(repeat.getEmpName())
&& param.getEmpIdcardNo().equals(repeat.getEmpIdcardNo())
&& param.getInsuranceCompanyName().equals(repeat.getInsuranceCompanyName())
&& param.getInsuranceTypeName().equals(repeat.getInsuranceTypeName())
&& LocalDateUtil.hasOverlap(LocalDateUtil.parseLocalDate(param.getPolicyStart()),LocalDateUtil.parseLocalDate(param.getPolicyEnd()),LocalDateUtil.parseLocalDate(repeat.getPolicyStart()),LocalDateUtil.parseLocalDate(repeat.getPolicyEnd()))
&& i != j){
param.setErrorMessage(InsurancesConstants.DUPLICATE_DATA_ERROR);
listResult.add(param);
continue outer;
}
}
//校验身份合法 //校验身份合法
/*TCheckIdCard checkIdCard = new TCheckIdCard(); /*TCheckIdCard checkIdCard = new TCheckIdCard();
checkIdCard.setName(param.getEmpName()); checkIdCard.setName(param.getEmpName());
...@@ -1108,28 +1161,6 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -1108,28 +1161,6 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
param.setInsuranceHandleCity(Integer.parseInt(redisHandleCityName)); param.setInsuranceHandleCity(Integer.parseInt(redisHandleCityName));
} }
// 保单开始日期 > 当前派单日期
if(!LocalDateUtil.isDate(param.getPolicyStart(),LocalDateUtil.NORM_DATE_PATTERN)){
param.setErrorMessage(InsurancesConstants.POLICY_START_PARSE_ERROR);
listResult.add(param);
continue;
}
if(!LocalDateUtil.isDate(param.getPolicyEnd(),LocalDateUtil.NORM_DATE_PATTERN)){
param.setErrorMessage(InsurancesConstants.POLICY_END_PARSE_ERROR);
listResult.add(param);
continue;
}
if(!LocalDateUtil.isFutureDate(param.getPolicyStart())){
param.setErrorMessage(InsurancesConstants.POLICY_START_SHOULD_IS_FUTURE);
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() TInsuranceCompany insuranceCompany = tInsuranceCompanyService.getOne(Wrappers.<TInsuranceCompany>query().lambda()
.eq(TInsuranceCompany::getCompanyName, param.getInsuranceCompanyName()) .eq(TInsuranceCompany::getCompanyName, param.getInsuranceCompanyName())
...@@ -1286,7 +1317,11 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -1286,7 +1317,11 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
Map<String,List<InsuranceBatchParam>> map = new HashMap<>(); Map<String,List<InsuranceBatchParam>> map = new HashMap<>();
List<InsuranceBatchParam> listResult = new ArrayList<>(); List<InsuranceBatchParam> listResult = new ArrayList<>();
List<InsuranceBatchParam> listSuccess = new ArrayList<>(); List<InsuranceBatchParam> listSuccess = new ArrayList<>();
for (InsuranceBatchParam param : paramList.stream().distinct().collect(Collectors.toList())) { List<InsuranceBatchParam> distinctList = paramList.stream().distinct().collect(Collectors.toList());
//定义外层循环标识,方便去重的时候跳出
outer:
for (int i = 0; i < distinctList.size(); i++) {
InsuranceBatchParam param = distinctList.get(i);
// 必填校验 // 必填校验
if (StringUtils.isBlank(param.getDeptNo())){ if (StringUtils.isBlank(param.getDeptNo())){
param.setErrorMessage(InsurancesConstants.DEPT_NO_NOT_EMPTY); param.setErrorMessage(InsurancesConstants.DEPT_NO_NOT_EMPTY);
...@@ -1377,6 +1412,20 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -1377,6 +1412,20 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
continue; continue;
} }
//表内数据重复 员工姓名、员工身份证号码、保险公司、险种
for (int j = 0; j < distinctList.size(); j++) {
InsuranceBatchParam repeat = distinctList.get(j);
if (param.getEmpName().equals(repeat.getEmpName())
&& param.getEmpIdcardNo().equals(repeat.getEmpIdcardNo())
&& param.getInsuranceCompanyName().equals(repeat.getInsuranceCompanyName())
&& param.getInsuranceTypeName().equals(repeat.getInsuranceTypeName())
&& i != j){
param.setErrorMessage(InsurancesConstants.DUPLICATE_DATA_ERROR);
listResult.add(param);
continue outer;
}
}
//校验身份合法 //校验身份合法
/*TCheckIdCard checkIdCard = new TCheckIdCard(); /*TCheckIdCard checkIdCard = new TCheckIdCard();
checkIdCard.setName(param.getEmpName()); checkIdCard.setName(param.getEmpName());
...@@ -1614,7 +1663,11 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -1614,7 +1663,11 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
Map<String,List<InsuranceReplaceParam>> map = new HashMap<>(); Map<String,List<InsuranceReplaceParam>> map = new HashMap<>();
List<InsuranceReplaceParam> listResult = new ArrayList<>(); List<InsuranceReplaceParam> listResult = new ArrayList<>();
List<InsuranceReplaceParam> listSuccess = new ArrayList<>(); List<InsuranceReplaceParam> listSuccess = new ArrayList<>();
for (InsuranceReplaceParam param : paramList.stream().distinct().collect(Collectors.toList())) { List<InsuranceReplaceParam> distinctList = paramList.stream().distinct().collect(Collectors.toList());
//定义外层循环标识,方便去重的时候跳出
outer:
for (int i = 0; i < distinctList.size(); i++) {
InsuranceReplaceParam param = distinctList.get(i);
// 必填校验 // 必填校验
if (StringUtils.isBlank(param.getEmpName())){ if (StringUtils.isBlank(param.getEmpName())){
param.setErrorMessage(InsurancesConstants.EMP_NAME_NOT_EMPTY); param.setErrorMessage(InsurancesConstants.EMP_NAME_NOT_EMPTY);
...@@ -1689,6 +1742,38 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -1689,6 +1742,38 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
listResult.add(param); listResult.add(param);
continue; continue;
} }
if(!LocalDateUtil.isDate(param.getPolicyStart(),LocalDateUtil.NORM_DATE_PATTERN)){
param.setErrorMessage(InsurancesConstants.POLICY_START_PARSE_ERROR);
listResult.add(param);
continue;
}
if(!LocalDateUtil.isDate(param.getPolicyEnd(),LocalDateUtil.NORM_DATE_PATTERN)){
param.setErrorMessage(InsurancesConstants.POLICY_END_PARSE_ERROR);
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;
}
//表内数据重复 员工姓名、员工身份证号码、保险公司、险种、起止时间(有交叉)
for (int j = 0; j < distinctList.size(); j++) {
InsuranceReplaceParam repeat = distinctList.get(j);
if (((param.getEmpName().equals(repeat.getEmpName()) && param.getEmpIdcardNo().equals(repeat.getEmpIdcardNo()))
||(param.getReplaceEmpName().equals(repeat.getReplaceEmpName()) && param.getReplaceEmpIdcardNo().equals(repeat.getReplaceEmpIdcardNo())))
&& param.getInsuranceCompanyName().equals(repeat.getInsuranceCompanyName())
&& param.getInsuranceTypeName().equals(repeat.getInsuranceTypeName())
&& LocalDateUtil.hasOverlap(LocalDateUtil.parseLocalDate(param.getPolicyStart()),LocalDateUtil.parseLocalDate(param.getPolicyEnd()),LocalDateUtil.parseLocalDate(repeat.getPolicyStart()),LocalDateUtil.parseLocalDate(repeat.getPolicyEnd()))
&& i != j){
param.setErrorMessage(InsurancesConstants.DUPLICATE_DATA_ERROR);
listResult.add(param);
continue outer;
}
}
//校验身份合法 //校验身份合法
/*TCheckIdCard checkIdCard = new TCheckIdCard(); /*TCheckIdCard checkIdCard = new TCheckIdCard();
checkIdCard.setName(param.getReplaceEmpName()); checkIdCard.setName(param.getReplaceEmpName());
...@@ -1727,17 +1812,6 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -1727,17 +1812,6 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
} }
} }
if(!LocalDateUtil.isDate(param.getPolicyStart(),LocalDateUtil.NORM_DATE_PATTERN)){
param.setErrorMessage(InsurancesConstants.POLICY_START_PARSE_ERROR);
listResult.add(param);
continue;
}
if(!LocalDateUtil.isDate(param.getPolicyEnd(),LocalDateUtil.NORM_DATE_PATTERN)){
param.setErrorMessage(InsurancesConstants.POLICY_END_PARSE_ERROR);
listResult.add(param);
continue;
}
//原数据查重校验:姓名 + 身份证号 + 项目编码 + 保险公司 + 险种名称 + 保单开始时间 + 保单结束时间 //原数据查重校验:姓名 + 身份证号 + 项目编码 + 保险公司 + 险种名称 + 保单开始时间 + 保单结束时间
TInsuranceDetail detail = this.baseMapper.selectOne(Wrappers.<TInsuranceDetail>query().lambda() TInsuranceDetail detail = this.baseMapper.selectOne(Wrappers.<TInsuranceDetail>query().lambda()
.eq(TInsuranceDetail::getEmpName, param.getEmpName()) .eq(TInsuranceDetail::getEmpName, param.getEmpName())
......
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