Commit b67fa342 authored by huyuchen's avatar huyuchen

优化修改

parent befd50bf
...@@ -32,6 +32,7 @@ import com.yifu.cloud.plus.v1.yifu.social.entity.TSocialFundInfo; ...@@ -32,6 +32,7 @@ import com.yifu.cloud.plus.v1.yifu.social.entity.TSocialFundInfo;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/** /**
* 预估费用 * 预估费用
...@@ -92,7 +93,7 @@ public interface TForecastLibraryService extends IService<TForecastLibrary> { ...@@ -92,7 +93,7 @@ public interface TForecastLibraryService extends IService<TForecastLibrary> {
* @Date: 2022/7/26 19:02 * @Date: 2022/7/26 19:02
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String> * @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
**/ **/
R<String> updateForecastLibaryByDispatch(TSocialFundInfo socialFundInfo); R<String> updateForecastLibaryByDispatch(ConcurrentHashMap<String, String> socialMap, ConcurrentHashMap<String, String> fundMap,TSocialFundInfo socialFundInfo);
/** /**
* @Description: 户调基-基数变更,同步社保公积金查询、预估库 * @Description: 户调基-基数变更,同步社保公积金查询、预估库
......
...@@ -724,7 +724,7 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T ...@@ -724,7 +724,7 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
} }
// 生成预付数据 // 生成预付数据
if (Common.isNotNull(socialFund) && Common.isNotNull(socialFund.getId())){ if (Common.isNotNull(socialFund) && Common.isNotNull(socialFund.getId())){
forecastLibraryService.updateForecastLibaryByDispatch(socialFund); forecastLibraryService.updateForecastLibaryByDispatch(null,null,socialFund);
} }
// 同步更新人员档案和项目档案的社保公积金状态 // 同步更新人员档案和项目档案的社保公积金状态
updateDocSocialFund(social, fund, socialFund,excel); updateDocSocialFund(social, fund, socialFund,excel);
...@@ -3356,7 +3356,7 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T ...@@ -3356,7 +3356,7 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
&& CommonConstants.ONE_INT == flag){ && CommonConstants.ONE_INT == flag){
// 更新预估数据 -- 失败项重新派单审核不通过不处理预估 // 更新预估数据 -- 失败项重新派单审核不通过不处理预估
if (!flagTemp){ if (!flagTemp){
socialTask.asynchronousDisPatchHandle(sf, forecastFlag,null,null,CommonConstants.ZERO_INT); socialTask.asynchronousDisPatchHandle(null,null,sf, forecastFlag,null,null,CommonConstants.ZERO_INT);
} }
// 更新人员档案和项目档案的社保公积金状态 // 更新人员档案和项目档案的社保公积金状态
UpProjectSocialFundVo vo = new UpProjectSocialFundVo(); UpProjectSocialFundVo vo = new UpProjectSocialFundVo();
...@@ -3490,7 +3490,7 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T ...@@ -3490,7 +3490,7 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
} }
if (Common.isNotNull(requestId)) { if (Common.isNotNull(requestId)) {
try { try {
List<ErrorMessage> errorInfo = addBatchApplyHandle(ids, typeSub, user, flag, handleStatus, List<ErrorMessage> errorInfo = addBatchApplyHandle(null,null,ids, typeSub, user, flag, handleStatus,
Common.isNullToString(handleRemark), socialType, remark); Common.isNullToString(handleRemark), socialType, remark);
if (errorInfo == null || errorInfo.isEmpty()) { if (errorInfo == null || errorInfo.isEmpty()) {
return R.ok(null, "办理成功!"); return R.ok(null, "办理成功!");
...@@ -3536,7 +3536,8 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T ...@@ -3536,7 +3536,8 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
* @Date 2022-07-26 * @Date 2022-07-26
**/ **/
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public List<ErrorMessage> addBatchApplyHandle(List<String> idsList, String typeSub, YifuUser user public List<ErrorMessage> addBatchApplyHandle(ConcurrentHashMap<String, String> socialMap,ConcurrentHashMap<String, String> fundMap,
List<String> idsList, String typeSub, YifuUser user
, int flag, String handleStatus, String handleRemark, String socialType, String remark) { , int flag, String handleStatus, String handleRemark, String socialType, String remark) {
List<ErrorMessage> errorList = new ArrayList<>(); List<ErrorMessage> errorList = new ArrayList<>();
if (!Common.isNotNull(idsList)) { if (!Common.isNotNull(idsList)) {
...@@ -3877,7 +3878,7 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T ...@@ -3877,7 +3878,7 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
&& (CommonConstants.FIVE_STRING.equals(sf.getSocialStatus()) && (CommonConstants.FIVE_STRING.equals(sf.getSocialStatus())
|| CommonConstants.FOUR_STRING.equals(sf.getFundStatus()))) { || CommonConstants.FOUR_STRING.equals(sf.getFundStatus()))) {
// 派增办理,全部失败 同步预估库数据 // 派增办理,全部失败 同步预估库数据
socialTask.asynchronousDisPatchHandle(sf, forecastFlag, null, null, CommonConstants.ZERO_INT); socialTask.asynchronousDisPatchHandle(socialMap,fundMap,sf, forecastFlag, null, null, CommonConstants.ZERO_INT);
} }
// 社保办理只要办理成功就刷新预估数据 公积金办理不用处理(前面公积金办理成功的时候处理过了) // 社保办理只要办理成功就刷新预估数据 公积金办理不用处理(前面公积金办理成功的时候处理过了)
if (CommonConstants.ZERO_STRING.equals(typeSub) if (CommonConstants.ZERO_STRING.equals(typeSub)
...@@ -3886,9 +3887,9 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T ...@@ -3886,9 +3887,9 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
|| CommonConstants.TWO_STRING.equals(sf.getSocialStatus()) || CommonConstants.TWO_STRING.equals(sf.getSocialStatus())
|| CommonConstants.THREE_STRING.equals(sf.getSocialStatus()))) { || CommonConstants.THREE_STRING.equals(sf.getSocialStatus()))) {
if (partSuccess) { if (partSuccess) {
forecastLibraryService.updateForecastLibaryByDispatch(sf); forecastLibraryService.updateForecastLibaryByDispatch(socialMap,fundMap,sf);
} else { } else {
socialTask.asynchronousDisPatchHandle(sf, 0, null, null, CommonConstants.ONE_INT); socialTask.asynchronousDisPatchHandle(socialMap,fundMap,sf, 0, null, null, CommonConstants.ONE_INT);
} }
} }
} }
...@@ -3898,7 +3899,7 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T ...@@ -3898,7 +3899,7 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
&& (CommonConstants.EIGHT_STRING.equals(sf.getSocialStatus()) && (CommonConstants.EIGHT_STRING.equals(sf.getSocialStatus())
|| CommonConstants.SEVEN_STRING.equals(sf.getFundStatus()))){ || CommonConstants.SEVEN_STRING.equals(sf.getFundStatus()))){
// 同步预估库数据 // 同步预估库数据
socialTask.asynchronousDisPatchHandle(sf, forecastFlag,null,null,CommonConstants.ZERO_INT); socialTask.asynchronousDisPatchHandle(socialMap,fundMap,sf, forecastFlag,null,null,CommonConstants.ZERO_INT);
} }
// 派减公积金办理失败不同步档案的相关字段信息 // 派减公积金办理失败不同步档案的相关字段信息
if (!(CommonConstants.ONE_STRING.equals(dis.getType()) if (!(CommonConstants.ONE_STRING.equals(dis.getType())
...@@ -5163,7 +5164,7 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T ...@@ -5163,7 +5164,7 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
} }
try { try {
// 执行数据插入操作 组装 // 执行数据插入操作 组装
messageList = addBatchApplyHandle(Collections.singletonList(dispatch.getId()), CommonConstants.ONE_STRING, user messageList = addBatchApplyHandle(null,null,Collections.singletonList(dispatch.getId()), CommonConstants.ONE_STRING, user
, flag, handleStatus, (Common.isEmpty(excel.getReasonType())?"":excel.getReasonType()+CommonConstants.COLON_STRING) , flag, handleStatus, (Common.isEmpty(excel.getReasonType())?"":excel.getReasonType()+CommonConstants.COLON_STRING)
+excel.getRemark(), null, excel.getReasonType()); +excel.getRemark(), null, excel.getReasonType());
if (Common.isNotNull(messageList)){ if (Common.isNotNull(messageList)){
...@@ -5289,6 +5290,8 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T ...@@ -5289,6 +5290,8 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
String handlerRemaek; String handlerRemaek;
List<TDispatchInfo> failueList = new ArrayList<>(); List<TDispatchInfo> failueList = new ArrayList<>();
ConcurrentHashMap<String, String> socialMap = new ConcurrentHashMap<>();
ConcurrentHashMap<String, String> fundMap = new ConcurrentHashMap<>();
for (int i = 0; i < excelVOList.size(); i++) { for (int i = 0; i < excelVOList.size(); i++) {
StringBuilder socialSucessType = new StringBuilder(); StringBuilder socialSucessType = new StringBuilder();
StringBuilder socialFailureType = new StringBuilder(); StringBuilder socialFailureType = new StringBuilder();
...@@ -5366,7 +5369,7 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T ...@@ -5366,7 +5369,7 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
continue; continue;
} }
// 执行数据插入操作 组装 // 执行数据插入操作 组装
messageList = addBatchApplyHandle(Collections.singletonList(dispatch.getId()), CommonConstants.ZERO_STRING, user messageList = addBatchApplyHandle(socialMap,fundMap,Collections.singletonList(dispatch.getId()), CommonConstants.ZERO_STRING, user
, 0, CommonConstants.ONE_STRING, ServiceUtil.ifNullToEmpty(excel.getRemark()), socialSucessType.substring(0, socialSucessType.length() - 1), ServiceUtil.ifNullToEmpty(excel.getRemark())); , 0, CommonConstants.ONE_STRING, ServiceUtil.ifNullToEmpty(excel.getRemark()), socialSucessType.substring(0, socialSucessType.length() - 1), ServiceUtil.ifNullToEmpty(excel.getRemark()));
if (Common.isNotNull(messageList)) { if (Common.isNotNull(messageList)) {
errorMessage = messageList.get(CommonConstants.ZERO_INT); errorMessage = messageList.get(CommonConstants.ZERO_INT);
...@@ -5397,7 +5400,7 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T ...@@ -5397,7 +5400,7 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
for (TDispatchInfo dispatchInfo : failueList) { for (TDispatchInfo dispatchInfo : failueList) {
vo = dispatchInfo.getExcel(); vo = dispatchInfo.getExcel();
// 执行数据插入操作 组装 // 执行数据插入操作 组装
messageList = addBatchApplyHandle(Collections.singletonList(dispatchInfo.getId()), CommonConstants.ZERO_STRING, user messageList = addBatchApplyHandle(socialMap,fundMap,Collections.singletonList(dispatchInfo.getId()), CommonConstants.ZERO_STRING, user
, 1, CommonConstants.TWO_STRING, dispatchInfo.getHandlerRemaek() + ServiceUtil.ifNullToEmpty(vo.getRemark()), dispatchInfo.getSocialFailureType().substring(0, dispatchInfo.getSocialFailureType().length() - 1), dispatchInfo.getHandlerRemaek() + ServiceUtil.ifNullToEmpty(vo.getRemark())); , 1, CommonConstants.TWO_STRING, dispatchInfo.getHandlerRemaek() + ServiceUtil.ifNullToEmpty(vo.getRemark()), dispatchInfo.getSocialFailureType().substring(0, dispatchInfo.getSocialFailureType().length() - 1), dispatchInfo.getHandlerRemaek() + ServiceUtil.ifNullToEmpty(vo.getRemark()));
if (Common.isNotNull(messageList)) { if (Common.isNotNull(messageList)) {
errorMessage = messageList.get(CommonConstants.ZERO_INT); errorMessage = messageList.get(CommonConstants.ZERO_INT);
......
...@@ -62,6 +62,7 @@ import java.math.BigDecimal; ...@@ -62,6 +62,7 @@ import java.math.BigDecimal;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.*; import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
/** /**
* 预估费用 * 预估费用
...@@ -1490,7 +1491,7 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap ...@@ -1490,7 +1491,7 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
sysBaseSetInfoMapper.updateById(sysBaseSetInfo); sysBaseSetInfoMapper.updateById(sysBaseSetInfo);
} }
for (TSocialFundInfo socialFundInfo : socialFundInfoMap.values()) { for (TSocialFundInfo socialFundInfo : socialFundInfoMap.values()) {
this.updateForecastLibaryCore(socialFundInfo, socialFundInfo.getDoMonth(), true, false,true); this.updateForecastLibaryCore(null,null,socialFundInfo, socialFundInfo.getDoMonth(), true, false,true);
socialFundInfoMapper.updateById(socialFundInfo); socialFundInfoMapper.updateById(socialFundInfo);
} }
} }
...@@ -1505,7 +1506,7 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap ...@@ -1505,7 +1506,7 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
**/ **/
@Override @Override
public R<String> updateToneForecastLibary(TSocialFundInfo socialFundInfo, String doMonth) { public R<String> updateToneForecastLibary(TSocialFundInfo socialFundInfo, String doMonth) {
return this.updateForecastLibaryCore(socialFundInfo, doMonth, false, false,true); return this.updateForecastLibaryCore(null,null,socialFundInfo, doMonth, false, false,true);
} }
/** /**
...@@ -1516,8 +1517,8 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap ...@@ -1516,8 +1517,8 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
* @return: void * @return: void
**/ **/
@Override @Override
public R<String> updateForecastLibaryByDispatch(TSocialFundInfo socialFundInfo) { public R<String> updateForecastLibaryByDispatch(ConcurrentHashMap<String, String> socialMap, ConcurrentHashMap<String, String> fundMap,TSocialFundInfo socialFundInfo) {
return this.updateForecastLibaryCore(socialFundInfo, null, false, true,false); return this.updateForecastLibaryCore(socialMap,fundMap,socialFundInfo, null, false, true,false);
} }
/** /**
...@@ -1714,7 +1715,7 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap ...@@ -1714,7 +1715,7 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
* @Date: 2022/7/26 19:01 * @Date: 2022/7/26 19:01
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String> * @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
**/ **/
private R<String> updateForecastLibaryCore(TSocialFundInfo socialFundInfo, String doMonth, boolean isOnly, boolean isDispatch,boolean synFlag) { private R<String> updateForecastLibaryCore(ConcurrentHashMap<String, String> socialMap,ConcurrentHashMap<String, String> fundMap,TSocialFundInfo socialFundInfo, String doMonth, boolean isOnly, boolean isDispatch,boolean synFlag) {
String empIdCard = socialFundInfo.getEmpIdcard(); String empIdCard = socialFundInfo.getEmpIdcard();
//定义未推送的按条件查询得到的预估数据 //定义未推送的按条件查询得到的预估数据
List<TForecastLibrary> librarySocialList = null; List<TForecastLibrary> librarySocialList = null;
...@@ -1906,8 +1907,29 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap ...@@ -1906,8 +1907,29 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
log.error("更新一条预估耗时:" + times + "毫秒"); log.error("更新一条预估耗时:" + times + "毫秒");
isSaveAndUpdate = true; isSaveAndUpdate = true;
} else { } else {
if (BigDecimal.ZERO.compareTo(BigDecimalUtils.isNullToZero(library.getUnitSocialSum())) != CommonConstants.ZERO_INT if (BigDecimal.ZERO.compareTo(BigDecimalUtils.isNullToZero(library.getUnitSocialSum())) != CommonConstants.ZERO_INT) {
|| BigDecimal.ZERO.compareTo(BigDecimalUtils.isNullToZero(library.getUnitFundSum())) != CommonConstants.ZERO_INT) { if (null != socialMap) {
String sameKey = library.getEmpIdcard() + "_" + library.getSocialCreateMonth() + "_" + library.getSocialPayMonth();
if (null == socialMap.get(sameKey)) {
socialMap.put(sameKey,CommonConstants.ONE_STRING);
} else {
continue;
}
}
library.setCreateBy(userId);
library.setCreateName(userName);
library.setCreateTime(LocalDateTime.now());
baseMapper.insert(library);
isSaveAndUpdate = true;
} else if (BigDecimal.ZERO.compareTo(BigDecimalUtils.isNullToZero(library.getUnitFundSum())) != CommonConstants.ZERO_INT) {
if (null != fundMap) {
String sameKey = library.getEmpIdcard() + "_" + library.getProvidentCreateMonth() + "_" + library.getProvidentPayMonth();
if (null == fundMap.get(sameKey)) {
fundMap.put(sameKey,CommonConstants.ONE_STRING);
} else {
continue;
}
}
library.setCreateBy(userId); library.setCreateBy(userId);
library.setCreateName(userName); library.setCreateName(userName);
library.setCreateTime(LocalDateTime.now()); library.setCreateTime(LocalDateTime.now());
......
...@@ -27,6 +27,7 @@ import java.math.BigDecimal; ...@@ -27,6 +27,7 @@ import java.math.BigDecimal;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.concurrent.ConcurrentHashMap;
/** /**
* @Author fxj * @Author fxj
...@@ -58,7 +59,7 @@ public class DoSocialTask { ...@@ -58,7 +59,7 @@ public class DoSocialTask {
* @param type=0 updateForecastLibaryByDispatchReduce type=1 updateForecastLibaryByDispatch type=2 pushForecastFundInfo createIncomeInfo(library); * @param type=0 updateForecastLibaryByDispatchReduce type=1 updateForecastLibaryByDispatch type=2 pushForecastFundInfo createIncomeInfo(library);
**/ **/
@Async @Async
public void asynchronousDisPatchHandle(TSocialFundInfo sf, int forecastFlag,List< TForecastLibrary > libs,TForecastLibrary library,int type) { public void asynchronousDisPatchHandle(ConcurrentHashMap<String, String> socialMap, ConcurrentHashMap<String, String> fundMap, TSocialFundInfo sf, int forecastFlag, List< TForecastLibrary > libs, TForecastLibrary library, int type) {
synchronized (this){ synchronized (this){
R<String> res; R<String> res;
String linkId = null; String linkId = null;
...@@ -74,7 +75,7 @@ public class DoSocialTask { ...@@ -74,7 +75,7 @@ public class DoSocialTask {
// 派单变更预估库 // 派单变更预估库
if (type == CommonConstants.ONE_INT){ if (type == CommonConstants.ONE_INT){
linkId = sf.getId(); linkId = sf.getId();
res = forecastLibraryService.updateForecastLibaryByDispatch(sf); res = forecastLibraryService.updateForecastLibaryByDispatch(socialMap,fundMap,sf);
if (Common.isEmpty(res) || CommonConstants.SUCCESS != res.getCode()){ if (Common.isEmpty(res) || CommonConstants.SUCCESS != res.getCode()){
initSendError(sf.getId(), res.getMsg(),"updateForecastLibaryByDispatch:"); initSendError(sf.getId(), res.getMsg(),"updateForecastLibaryByDispatch:");
} }
......
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