Commit 4969961f authored by fangxinjiang's avatar fangxinjiang

预派单调整

parent db85b018
...@@ -74,7 +74,7 @@ public class TPreDispatchInfo extends BaseEntity { ...@@ -74,7 +74,7 @@ public class TPreDispatchInfo extends BaseEntity {
*/ */
@Schema(description ="接单分公司") @Schema(description ="接单分公司")
@Size(max = 50, message = "接单分公司不可超过50位") @Size(max = 50, message = "接单分公司不可超过50位")
@ExcelAttribute(name = "接单分公司", maxLength = 50) @ExcelAttribute(name = "接单分公司", isNotEmpty = true ,errorInfo = "接单分公司不能为空", maxLength = 50)
private String company; private String company;
/** /**
......
...@@ -50,10 +50,7 @@ import javax.servlet.http.HttpServletResponse; ...@@ -50,10 +50,7 @@ import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.ArrayList; import java.util.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/** /**
* 预派单记录 * 预派单记录
...@@ -652,8 +649,8 @@ public class TPreDispatchInfoServiceImpl extends ServiceImpl<TPreDispatchInfoMap ...@@ -652,8 +649,8 @@ public class TPreDispatchInfoServiceImpl extends ServiceImpl<TPreDispatchInfoMap
} }
TSettleDomainSelectVo selectVo = domainR.getData(); TSettleDomainSelectVo selectVo = domainR.getData();
// 获取基数配置信息 // 获取基数配置信息
HashMap<String, SysBaseSetInfo> baseSocialSetMap = new HashMap<>(); HashMap<String, List<SysBaseSetInfo>> baseSocialSetMap = new HashMap<>();
HashMap<String, SysBaseSetInfo> baseFundSetMap = new HashMap<>(); HashMap<String, List<SysBaseSetInfo>> baseFundSetMap = new HashMap<>();
HashMap<String, TPreDispatchInfo> baseSocialTimeMap = new HashMap<>(); HashMap<String, TPreDispatchInfo> baseSocialTimeMap = new HashMap<>();
HashMap<String, TPreDispatchInfo> baseFundTimeMap = new HashMap<>(); HashMap<String, TPreDispatchInfo> baseFundTimeMap = new HashMap<>();
initSocialAndFundBaseSet(listInfo, baseSocialSetMap, baseFundSetMap, baseSocialTimeMap, baseFundTimeMap); initSocialAndFundBaseSet(listInfo, baseSocialSetMap, baseFundSetMap, baseSocialTimeMap, baseFundTimeMap);
...@@ -663,6 +660,11 @@ public class TPreDispatchInfoServiceImpl extends ServiceImpl<TPreDispatchInfoMap ...@@ -663,6 +660,11 @@ public class TPreDispatchInfoServiceImpl extends ServiceImpl<TPreDispatchInfoMap
// 获取所有地市的最迟派单日限制 // 获取所有地市的最迟派单日限制
HashMap<String, Integer> dayConfMap = new HashMap<>(); HashMap<String, Integer> dayConfMap = new HashMap<>();
initDayConfMap(dayConfMap); initDayConfMap(dayConfMap);
// 存放所有社保户和公积金户信息,不用每次都去数据库处理 fxj 2022-11-09
HashMap<String, SysHouseHoldInfo> socialHoldMap = new HashMap<>();
HashMap<String, SysHouseHoldInfo> fundHoldMap = new HashMap<>();
SysHouseHoldInfo sh = null;
SysHouseHoldInfo fh = null;
int i = 1; int i = 1;
for (TPreDispatchInfo info : listInfo) { for (TPreDispatchInfo info : listInfo) {
i++; i++;
...@@ -676,7 +678,7 @@ public class TPreDispatchInfoServiceImpl extends ServiceImpl<TPreDispatchInfoMap ...@@ -676,7 +678,7 @@ public class TPreDispatchInfoServiceImpl extends ServiceImpl<TPreDispatchInfoMap
continue; continue;
} }
// 基础封装 其他 // 基础封装 其他
initBaseInfo(socialHouse, fundHouse, selectVo, info); initBaseInfo(sh, fh, selectVo, info,socialHoldMap,fundHoldMap);
// 2.先校验已有数据 // 2.先校验已有数据
checkBatchSave(info, CommonConstants.ZERO_STRING); checkBatchSave(info, CommonConstants.ZERO_STRING);
// 3.封装 社保缴纳地 公积金缴纳地 // 3.封装 社保缴纳地 公积金缴纳地
...@@ -799,8 +801,8 @@ public class TPreDispatchInfoServiceImpl extends ServiceImpl<TPreDispatchInfoMap ...@@ -799,8 +801,8 @@ public class TPreDispatchInfoServiceImpl extends ServiceImpl<TPreDispatchInfoMap
return errorList; return errorList;
} }
// 获取基数配置信息 // 获取基数配置信息
HashMap<String, SysBaseSetInfo> baseSocialSetMap = new HashMap<>(); HashMap<String, List<SysBaseSetInfo>> baseSocialSetMap = new HashMap<>();
HashMap<String, SysBaseSetInfo> baseFundSetMap = new HashMap<>(); HashMap<String, List<SysBaseSetInfo>> baseFundSetMap = new HashMap<>();
HashMap<String, TPreDispatchInfo> baseSocialTimeMap = new HashMap<>(); HashMap<String, TPreDispatchInfo> baseSocialTimeMap = new HashMap<>();
HashMap<String, TPreDispatchInfo> baseFundTimeMap = new HashMap<>(); HashMap<String, TPreDispatchInfo> baseFundTimeMap = new HashMap<>();
HashMap<String,TPreDispatchInfo> existsMap = new HashMap<>(); HashMap<String,TPreDispatchInfo> existsMap = new HashMap<>();
...@@ -1148,11 +1150,17 @@ public class TPreDispatchInfoServiceImpl extends ServiceImpl<TPreDispatchInfoMap ...@@ -1148,11 +1150,17 @@ public class TPreDispatchInfoServiceImpl extends ServiceImpl<TPreDispatchInfoMap
* @param socialHouse * @param socialHouse
* @param selectVo * @param selectVo
* @param info * @param info
* @param socialHoldMap
* @param fundHoldMap
* @return * @return
* @Author huyc * @Author huyc
* @Date 2022-07-18 * @Date 2022-07-18
**/ **/
private void initBaseInfo(String socialHouse, String fundHouse, TSettleDomainSelectVo selectVo, TPreDispatchInfo info) { private void initBaseInfo(SysHouseHoldInfo sysHouseHoldInfo, SysHouseHoldInfo sysHouseHoldFund,
TSettleDomainSelectVo selectVo,
TPreDispatchInfo info,
HashMap<String, SysHouseHoldInfo> socialHoldMap,
HashMap<String, SysHouseHoldInfo> fundHoldMap) {
info.setType(CommonConstants.ZERO_STRING); info.setType(CommonConstants.ZERO_STRING);
info.setDataSubStatus(CommonConstants.ONE_STRING); info.setDataSubStatus(CommonConstants.ONE_STRING);
info.setStatus(CommonConstants.ZERO_STRING); info.setStatus(CommonConstants.ZERO_STRING);
...@@ -1169,24 +1177,50 @@ public class TPreDispatchInfoServiceImpl extends ServiceImpl<TPreDispatchInfoMap ...@@ -1169,24 +1177,50 @@ public class TPreDispatchInfoServiceImpl extends ServiceImpl<TPreDispatchInfoMap
// 默认合同名称为代理社保 合同类型为其他 // 默认合同名称为代理社保 合同类型为其他
info.setContractNameAdd(PreDispatchConstants.CONTRACT_NAME); info.setContractNameAdd(PreDispatchConstants.CONTRACT_NAME);
info.setContractTypeAdd(CommonConstants.ONE_STRING); info.setContractTypeAdd(CommonConstants.ONE_STRING);
info.setContractStartAdd(DateUtil.getFirstDayString(info.getPensionStart()));
// 默认为开始时间后的两年时间 // 默认为开始时间后的两年时间
info.setContractEndAdd(DateUtil.getFirstDayString(DateUtil.getYearAndMonth(info.getPensionStart(),24))); if (Common.isNotNull(info.getPensionStart())){
info.setContractStartAdd(DateUtil.getFirstDayString(info.getPensionStart()));
info.setContractEndAdd(DateUtil.getFirstDayString(DateUtil.getYearAndMonth(info.getPensionStart(),24)));
}
// 默认合同期限2年 // 默认合同期限2年
info.setContractTermAdd(CommonConstants.TWO_STRING); info.setContractTermAdd(CommonConstants.TWO_STRING);
// 默认工时制 综合工时制2 // 默认工时制 综合工时制2
info.setWorkingHoursAdd(CommonConstants.TWO_STRING); info.setWorkingHoursAdd(CommonConstants.TWO_STRING);
SysHouseHoldInfo sysHouseHoldInfo = sysHouseHoldInfoMapper.selectOne(Wrappers.<SysHouseHoldInfo>query().lambda() sysHouseHoldInfo = socialHoldMap.get(info.getCompany());
.eq(SysHouseHoldInfo::getName, socialHouse).eq(SysHouseHoldInfo::getType, CommonConstants.ZERO_STRING) if (Common.isEmpty(sysHouseHoldInfo)){
.eq(SysHouseHoldInfo::getDelFlag, CommonConstants.ZERO_STRING)); sysHouseHoldInfo =sysHouseHoldInfoMapper.selectOne(Wrappers.<SysHouseHoldInfo>query().lambda()
info.setSocialHouseAdd(sysHouseHoldInfo.getId()); .eq(SysHouseHoldInfo::getName, info.getCompany()).eq(SysHouseHoldInfo::getType, CommonConstants.ZERO_STRING)
SysHouseHoldInfo sysHouseHoldFund = sysHouseHoldInfoMapper.selectOne(Wrappers.<SysHouseHoldInfo>query().lambda() .eq(SysHouseHoldInfo::getDelFlag, CommonConstants.ZERO_STRING));
.eq(SysHouseHoldInfo::getName, fundHouse).eq(SysHouseHoldInfo::getType, CommonConstants.ONE_STRING) if (Common.isNotNull(sysHouseHoldInfo)){
.eq(SysHouseHoldInfo::getDelFlag, CommonConstants.ZERO_STRING)); socialHoldMap.put(info.getCompany(),sysHouseHoldInfo);
}
}
if (Common.isNotNull(sysHouseHoldInfo)){
info.setSocialHouseAdd(sysHouseHoldInfo.getId());
}
if (Common.isEmpty(info.getSocialHouseAdd()) && Common.isNotNull(info.getPensionAddress())){
info.setPreStatus(CommonConstants.ONE_STRING);
info.setExceptionContent("未获取到可用社保户配置!");
return;
}
sysHouseHoldFund = fundHoldMap.get(info.getCompany());
if (Common.isEmpty(sysHouseHoldFund)){
sysHouseHoldFund =sysHouseHoldInfoMapper.selectOne(Wrappers.<SysHouseHoldInfo>query().lambda()
.eq(SysHouseHoldInfo::getName, info.getCompany()).eq(SysHouseHoldInfo::getType, CommonConstants.ONE_STRING)
.eq(SysHouseHoldInfo::getDelFlag, CommonConstants.ZERO_STRING));
if (Common.isNotNull(sysHouseHoldFund)){
fundHoldMap.put(info.getCompany(),sysHouseHoldFund);
}
}
if (Common.isNotNull(sysHouseHoldFund)) { if (Common.isNotNull(sysHouseHoldFund)) {
info.setFundHouseAdd(sysHouseHoldFund.getId()); info.setFundHouseAdd(sysHouseHoldFund.getId());
} }
if (Common.isEmpty(info.getFundHouseAdd()) && Common.isNotNull(info.getFundAddress())){
info.setPreStatus(CommonConstants.ONE_STRING);
info.setExceptionContent("未获取到可用公积金户配置!");
return;
}
} }
/** /**
...@@ -1799,8 +1833,8 @@ public class TPreDispatchInfoServiceImpl extends ServiceImpl<TPreDispatchInfoMap ...@@ -1799,8 +1833,8 @@ public class TPreDispatchInfoServiceImpl extends ServiceImpl<TPreDispatchInfoMap
* @Author huyc * @Author huyc
* @Date 2022-07-18 * @Date 2022-07-18
**/ **/
private void checkStartTime(Map<String, SysBaseSetInfo> baseSocialSetMap, private void checkStartTime(Map<String, List<SysBaseSetInfo>> baseSocialSetMap,
Map<String, SysBaseSetInfo> baseFundSetMap, Map<String, List<SysBaseSetInfo>> baseFundSetMap,
TPreDispatchInfo temp, TPreDispatchInfo info) { TPreDispatchInfo temp, TPreDispatchInfo info) {
if (CommonConstants.ZERO_STRING.equals(info.getType())) { if (CommonConstants.ZERO_STRING.equals(info.getType())) {
// 社保地址或缴纳时间变更 要重新校验 // 社保地址或缴纳时间变更 要重新校验
...@@ -1819,10 +1853,11 @@ public class TPreDispatchInfoServiceImpl extends ServiceImpl<TPreDispatchInfoMap ...@@ -1819,10 +1853,11 @@ public class TPreDispatchInfoServiceImpl extends ServiceImpl<TPreDispatchInfoMap
* @Author huyc * @Author huyc
* @Date 2022-07-18 * @Date 2022-07-18
*/ */
private void checkSocialStartTime(Map<String, SysBaseSetInfo> baseSocialSetMap, TPreDispatchInfo temp, TPreDispatchInfo info) { private void checkSocialStartTime(Map<String, List<SysBaseSetInfo>> baseSocialSetMap, TPreDispatchInfo temp, TPreDispatchInfo info) {
boolean flag; boolean flag;
LocalDateTime dateTime; Date dateTime;
SysBaseSetInfo socialBaseSetInfo; List<SysBaseSetInfo> socialBases;
SysBaseSetInfo socialBaseSetInfo = null;
String str; String str;
flag = Common.isNotNull(info.getPensionAddress()) && flag = Common.isNotNull(info.getPensionAddress()) &&
Common.isNotNull(info.getPensionStart()) && Common.isNotNull(info.getPensionStart()) &&
...@@ -1832,18 +1867,29 @@ public class TPreDispatchInfoServiceImpl extends ServiceImpl<TPreDispatchInfoMap ...@@ -1832,18 +1867,29 @@ public class TPreDispatchInfoServiceImpl extends ServiceImpl<TPreDispatchInfoMap
!info.getPensionStart().equals(temp.getPensionStart())); !info.getPensionStart().equals(temp.getPensionStart()));
} }
if (flag) { if (flag) {
dateTime = LocalDateTimeUtils.dateOfYearAndMonth(info.getPensionStart(), LocalDateTimeUtils.DATE_SHORT_PATTERN); dateTime = DateUtil.stringToDate(info.getPensionStart()+"01", DateUtil.ISO_DATE_FORMAT);
if (null != dateTime) { if (null != dateTime) {
socialBaseSetInfo = baseSocialSetMap.get(LocalDateTimeUtils.formatTime(dateTime, ValidityConstants.DATEFORMAT3_PATTERN) socialBases = baseSocialSetMap.get(info.getCompany());
+ CommonConstants.DOWN_LINE_STRING + info.getSocialHouseAdd() if (Common.isNotNull(socialBases)){
+ CommonConstants.DOWN_LINE_STRING + Common.isBlankToNullString(info.getSocialProvince()) for (SysBaseSetInfo base:socialBases){
+ CommonConstants.DOWN_LINE_STRING + Common.isBlankToNullString(info.getSocialCity()) if (Common.isNotNull(base.getApplyEndDate())
+ CommonConstants.DOWN_LINE_STRING + Common.isBlankToNullString(info.getSocialTown())); && base.getApplyStartDate().before(dateTime)
&& base.getApplyEndDate().after(dateTime)){
socialBaseSetInfo = base;
}
if (Common.isEmpty(base.getApplyEndDate()) && base.getApplyStartDate().before(dateTime) ){
socialBaseSetInfo = base;
}
}
}
str = checkSocialStartDate(info, socialBaseSetInfo); str = checkSocialStartDate(info, socialBaseSetInfo);
if (null != str) { if (null != str) {
info.setPreStatus(CommonConstants.ONE_STRING); info.setPreStatus(CommonConstants.ONE_STRING);
info.setExceptionContent(str); info.setExceptionContent(str);
} }
}else {
info.setPreStatus(CommonConstants.ONE_STRING);
info.setExceptionContent("获取社保起缴日期异常");
} }
} }
} }
...@@ -1858,10 +1904,11 @@ public class TPreDispatchInfoServiceImpl extends ServiceImpl<TPreDispatchInfoMap ...@@ -1858,10 +1904,11 @@ public class TPreDispatchInfoServiceImpl extends ServiceImpl<TPreDispatchInfoMap
* @Author huyc * @Author huyc
* @Date 2022-07-18 * @Date 2022-07-18
**/ **/
private void checkFundStartTime(Map<String, SysBaseSetInfo> baseFundSetMap, TPreDispatchInfo temp, TPreDispatchInfo info) { private void checkFundStartTime(Map<String, List<SysBaseSetInfo>> baseFundSetMap, TPreDispatchInfo temp, TPreDispatchInfo info) {
boolean flag; boolean flag;
LocalDateTime dateTime; Date dateTime;
SysBaseSetInfo fundBaseSetIfno; List<SysBaseSetInfo> baseSetInfos;
SysBaseSetInfo fundBaseSetIfno = null;
String str; String str;
flag = Common.isNotNull(info.getFundStart()) && flag = Common.isNotNull(info.getFundStart()) &&
Common.isNotNull(info.getFundAddress()) && Common.isNotNull(info.getFundAddress()) &&
...@@ -1871,18 +1918,29 @@ public class TPreDispatchInfoServiceImpl extends ServiceImpl<TPreDispatchInfoMap ...@@ -1871,18 +1918,29 @@ public class TPreDispatchInfoServiceImpl extends ServiceImpl<TPreDispatchInfoMap
!info.getFundStart().equals(temp.getFundStart())); !info.getFundStart().equals(temp.getFundStart()));
} }
if (flag) { if (flag) {
dateTime = LocalDateTimeUtils.dateOfYearAndMonth(info.getFundStart(), LocalDateTimeUtils.DATE_SHORT_PATTERN); dateTime = DateUtil.stringToDate(info.getFundStart()+"01", DateUtil.ISO_DATE_FORMAT);
if (null != dateTime) { if (null != dateTime) {
fundBaseSetIfno = baseFundSetMap.get(LocalDateTimeUtils.formatTime(dateTime, ValidityConstants.DATEFORMAT3_PATTERN) baseSetInfos = baseFundSetMap.get(info.getCompany());
+ CommonConstants.DOWN_LINE_STRING + info.getFundHouseAdd() if (Common.isNotNull(baseSetInfos)){
+ CommonConstants.DOWN_LINE_STRING + Common.isBlankToNullString(info.getFundProvince()) for (SysBaseSetInfo base:baseSetInfos){
+ CommonConstants.DOWN_LINE_STRING + Common.isBlankToNullString(info.getFundCity()) if (Common.isNotNull(base.getApplyEndDate())
+ CommonConstants.DOWN_LINE_STRING + Common.isBlankToNullString(info.getFundTown())); && base.getApplyStartDate().before(dateTime)
&& base.getApplyEndDate().after(dateTime)){
fundBaseSetIfno = base;
}
if (Common.isEmpty(base.getApplyEndDate()) && base.getApplyStartDate().before(dateTime) ){
fundBaseSetIfno = base;
}
}
}
str = checkFundStartDate(info, fundBaseSetIfno); str = checkFundStartDate(info, fundBaseSetIfno);
if (null != str) { if (null != str) {
info.setPreStatus(CommonConstants.ONE_STRING); info.setPreStatus(CommonConstants.ONE_STRING);
info.setExceptionContent(str); info.setExceptionContent(str);
} }
}else {
info.setPreStatus(CommonConstants.ONE_STRING);
info.setExceptionContent("获取公积金起缴日期异常");
} }
} }
} }
...@@ -1977,13 +2035,15 @@ public class TPreDispatchInfoServiceImpl extends ServiceImpl<TPreDispatchInfoMap ...@@ -1977,13 +2035,15 @@ public class TPreDispatchInfoServiceImpl extends ServiceImpl<TPreDispatchInfoMap
* @Date 2022-07-18 * @Date 2022-07-18
**/ **/
private void initSocialAndFundBaseSet(List<TPreDispatchInfo> listInfo, private void initSocialAndFundBaseSet(List<TPreDispatchInfo> listInfo,
Map<String, SysBaseSetInfo> baseSocialSetMap, Map<String, List<SysBaseSetInfo>> baseSocialSetMap,
Map<String, SysBaseSetInfo> baseFundSetMap, Map<String, List<SysBaseSetInfo>> baseFundSetMap,
Map<String, TPreDispatchInfo> baseSocialTimeMap, Map<String, TPreDispatchInfo> baseSocialTimeMap,
Map<String, TPreDispatchInfo> baseFundTimeMap) { Map<String, TPreDispatchInfo> baseFundTimeMap) {
List<String> idList = new ArrayList<>(); List<String> idList = new ArrayList<>();
Map<String, String> houseMap = new HashMap<>();
if (Common.isNotNull(listInfo)) { if (Common.isNotNull(listInfo)) {
for (TPreDispatchInfo info : listInfo) { for (TPreDispatchInfo info : listInfo) {
houseMap.put(info.getCompany(),info.getCompany());
if (Common.isNotNull(info.getPensionStart())) { if (Common.isNotNull(info.getPensionStart())) {
baseSocialTimeMap.put(info.getPensionStart(), info); baseSocialTimeMap.put(info.getPensionStart(), info);
} }
...@@ -1993,8 +2053,36 @@ public class TPreDispatchInfoServiceImpl extends ServiceImpl<TPreDispatchInfoMap ...@@ -1993,8 +2053,36 @@ public class TPreDispatchInfoServiceImpl extends ServiceImpl<TPreDispatchInfoMap
idList.add(info.getId()); idList.add(info.getId());
} }
} }
// 获取所有户对应的社保户和公积金户对应的在用基数配置
if (Common.isNotNull(houseMap)){
List<SysBaseSetInfo> baseSetInfoList = sysBaseSetInfoMapper.selectList(Wrappers.<SysBaseSetInfo>query().lambda()
.eq(SysBaseSetInfo::getDeleteFlag,CommonConstants.ZERO_STRING)
.eq(SysBaseSetInfo::getStatus,CommonConstants.ZERO_INT)
.in(SysBaseSetInfo::getDepartName,houseMap.values()));
List<SysBaseSetInfo> baseList;
if (Common.isNotNull(baseSetInfoList)){
for (SysBaseSetInfo base:baseSetInfoList){
if (CommonConstants.ZERO_STRING.equals(base.getBaseType())){
baseList = baseSocialSetMap.get(base.getDepartName());
if (Common.isEmpty(baseList)){
baseList = new ArrayList<>();
}
baseList.add(base);
baseSocialSetMap.put(base.getDepartName(),baseList);
}
if (CommonConstants.ONE_STRING.equals(base.getBaseType())){
baseList = baseFundSetMap.get(base.getDepartName());
if (Common.isEmpty(baseList)){
baseList = new ArrayList<>();
}
baseList.add(base);
baseFundSetMap.put(base.getDepartName(),baseList);
}
}
}
}
// 初始化社保和公积金配置数据 // 初始化社保和公积金配置数据
initBaseSetMap(baseSocialTimeMap, baseFundTimeMap, baseSocialSetMap, baseFundSetMap); //initBaseSetMap(baseSocialTimeMap, baseFundTimeMap, baseSocialSetMap, baseFundSetMap);
} }
/** /**
......
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