Commit 4969961f authored by fangxinjiang's avatar fangxinjiang

预派单调整

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