Commit 78450ec3 authored by huyuchen's avatar huyuchen

优化修改

parent aa4cf195
......@@ -603,4 +603,8 @@ public interface ErrorCodes {
* 派减异常: 单减公积金,是否同步终止合同、减项、减档不能为是
*/
String EMP_DISPATCH_FUND_NOT_EMPTY_SIGNLE = "emp.dispatch.fund.not.empty.signle";
/**
* 公积金未派减,请核实!
*/
String EMP_DISPATCH_SIGNLE_REDUCE = "emp.dispatch.signle.reduce";
}
......@@ -231,6 +231,8 @@ social.import.same.info=\u8BE5\u6570\u636E\u5DF2\u5904\u7406\uFF0C\u8BF7\u52FF\u
emp.dispatch.fund.not.empty.change=\u5355\u51CF\u793E\u4FDD\uFF0C\u5B58\u5728\u6B63\u5E38/\u5BA1\u6279\u4E2D\u7684\u516C\u79EF\u91D1\uFF0C\u7981\u6B62\u201C\u540C\u6B65\u7EC8\u6B62\u5408\u540C\u3001\u51CF\u9879\u3001\u51CF\u6863\u201D
emp.dispatch.fund.not.empty.signle=\u5355\u51CF\u516C\u79EF\u91D1\uFF0C\u662F\u5426\u540C\u6B65\u7EC8\u6B62\u5408\u540C\u3001\u51CF\u9879\u3001\u51CF\u6863\u4E0D\u80FD\u4E3A\u662F
emp.dispatch.signle.reduce=\u516C\u79EF\u91D1\u672A\u6D3E\u51CF\uFF0C\u8BF7\u6838\u5B9E\uFF01
......
......@@ -415,7 +415,8 @@ public class TDispatchInfoController {
@SysLog("派单信息记录表 批量导入-派减")
@PostMapping("/importListReduce")
//@PreAuthorize("@pms.hasPermission('demo_tdispatchinfo-batch-reduce')")
public R<List<ErrorMessage>> importListReduce(@RequestBody MultipartFile file, @RequestParam(required = false)String orderId){
public R<List<ErrorMessage>> importListReduce(@RequestBody MultipartFile file, @RequestParam(required = false)String orderId
,@RequestParam(required = false) String flag){
YifuUser user = SecurityUtils.getUser();
if (Common.isEmpty(user)){
return R.failed(CommonConstants.USER_FAIL);
......@@ -431,7 +432,7 @@ public class TDispatchInfoController {
try {
if (Common.isNotNull(requestId)) {
//主动释放锁
return tDispatchInfoService.importReduceDiy(file.getInputStream(),orderId);
return tDispatchInfoService.importReduceDiy(file.getInputStream(),orderId,flag);
} else {
return R.failed(ResultConstants.NO_GETLOCK_DATA);
}
......@@ -457,7 +458,7 @@ public class TDispatchInfoController {
list.add(excelVOList);
YifuUser user = SecurityUtils.getUser();
List<ErrorMessage> errorMessageList = new ArrayList<>();
tDispatchInfoService.batchReduceDispatch(list, errorMessageList, user, orderId);
tDispatchInfoService.batchReduceDispatch(list, errorMessageList, user, orderId,null);
return R.ok(errorMessageList);
}
......
......@@ -67,11 +67,11 @@ public interface TDispatchInfoService extends IService<TDispatchInfo> {
List<ErrorMessage> errorMessageList,
YifuUser user, String orderId, Map<String, String> idCardMap);
R<List<ErrorMessage>> importReduceDiy(InputStream inputStream, String orderId);
R<List<ErrorMessage>> importReduceDiy(InputStream inputStream, String orderId,String flag);
@Transactional
@ShardingTransactionType(TransactionType.BASE)
void batchReduceDispatch(List<TDispatchReduceVo> excelVOList, List<ErrorMessage> errorMessageList, YifuUser user, String orderId);
void batchReduceDispatch(List<TDispatchReduceVo> excelVOList, List<ErrorMessage> errorMessageList, YifuUser user, String orderId,String flag);
R<Boolean> removeByIdDiy(String id);
......
......@@ -2765,7 +2765,7 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
@Override
@Transactional(rollbackFor = Exception.class)
@ShardingTransactionType(TransactionType.BASE)
public R<List<ErrorMessage>> importReduceDiy(InputStream inputStream, String orderId) {
public R<List<ErrorMessage>> importReduceDiy(InputStream inputStream, String orderId,String flag) {
YifuUser user = SecurityUtils.getUser();
if (Common.isEmpty(user)){
R.failed(CommonConstants.USER_FAIL);
......@@ -2814,7 +2814,7 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
*/
private void saveData() {
log.info("{}条数据,开始存储数据库!", cachedDataList.size());
batchReduceDispatch(cachedDataList, errorMessageList,user,orderId);
batchReduceDispatch(cachedDataList, errorMessageList,user,orderId,flag);
log.info("存储数据库成功!");
}
}).sheet().doRead();
......@@ -2826,7 +2826,8 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
}
@Override
public void batchReduceDispatch(List<TDispatchReduceVo> excelVOList, List<ErrorMessage> errorMessageList, YifuUser user, String orderId) {
public void batchReduceDispatch(List<TDispatchReduceVo> excelVOList, List<ErrorMessage> errorMessageList,
YifuUser user, String orderId, String flag) {
if (!Common.isNotNull(excelVOList)){
return;
}
......@@ -2836,16 +2837,45 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
List<String> codes = new ArrayList<>();
// 初始化参数
initIdcard(excelVOList, idcards,codes);
// 通过身份证和项目编码获取档案&项目档案&最新合同
Map<String, DispatchEmpVo> empVoMap = getDispatchEmpVo(idcards, codes);
// 通过身份证查询社保&公积金&社保公积金查询信息: 身份证维度唯一
Map<String, TSocialFundInfo> socialFundMap = getSocialFundMap(idcards);
TSocialFundInfo socialFund;
TDispatchReduceVo excel;
//批量派减:校验待派减人员五险一金缴纳情况,若有公积金未派减,则会显示社保已派减,公积金未派减,并弹窗提示有派减失败数据,可同步导出派减数据表单
//flag为1时 单独派减社保时校验公积金是否可用
if (Common.isNotNull(flag) && CommonConstants.ONE_STRING.equals(flag)) {
for (int i = 0; i < excelVOList.size(); i++) {
socialFund = null;
excel = excelVOList.get(i);
if (Common.isNotNull(socialFundMap)) {
socialFund = socialFundMap.get(excel.getEmpIdcard());
}
//单减社保,判断是否有正常的公积金
if (Common.isNotNull(excel.getSocialReduceDate()) && Common.isEmpty(excel.getFundReduceDate())
&& Common.isNotNull(socialFund)
&& (CommonConstants.THREE_STRING.equals(socialFund.getFundStatus())
|| CommonConstants.EIGHT_STRING.equals(socialFund.getFundStatus())
|| CommonConstants.ZERO_STRING.equals(socialFund.getFundStatus())
|| CommonConstants.ONE_STRING.equals(socialFund.getFundStatus())
|| CommonConstants.FIVE_STRING.equals(socialFund.getFundStatus())
|| CommonConstants.SIX_STRING.equals(socialFund.getFundStatus()))) {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), MsgUtils.getMessage(ErrorCodes.EMP_DISPATCH_SIGNLE_REDUCE), CommonConstants.RED, CommonConstants.ONE_STRING));
}
}
if (!errorMessageList.isEmpty() && errorMessageList.stream().anyMatch(e -> CommonConstants.ONE_STRING.equals(e.getName()))) {
return;
}
}
// 通过身份证和项目编码获取档案&项目档案&最新合同
Map<String, DispatchEmpVo> empVoMap = getDispatchEmpVo(idcards, codes);
// 获取项目编码数据 以供校验
Map<String, ProjectSetInfoVo> projectVoMap = getProjectVoMap(codes);
DispatchEmpVo empVo;
TDispatchInfo dispatch;
TDispatchReduceVo excel;
TSocialFundInfo socialFund;
ProjectSetInfoVo setInfoVo;
// 是否SSC:SSC派单组-1659015946137583618L SSC审核组-1659016108176130049L
long roleId = 1659015946137583618L;
......
......@@ -434,7 +434,7 @@ public class TPreDispatchInfoServiceImpl extends ServiceImpl<TPreDispatchInfoMap
dispatchReduceVo.setChangeContractAndEmployee(preInfo.getChangeContractAndEmployee());
List<TDispatchReduceVo> dispatchImportList = new ArrayList<>();
dispatchImportList.add(dispatchReduceVo);
dispatchInfoService.batchReduceDispatch(dispatchImportList, errorMessageList, user, null);
dispatchInfoService.batchReduceDispatch(dispatchImportList, errorMessageList, user, null,null);
// 处理派减结果
errorMessage = handleDispatchAddRes(preInfo,errorMessageList);
if (null != errorMessage){
......@@ -620,7 +620,7 @@ public class TPreDispatchInfoServiceImpl extends ServiceImpl<TPreDispatchInfoMap
dispatchReduceVo.setChangeContractAndEmployee(pre.getChangeContractAndEmployee());
List<TDispatchReduceVo> dispatchImportList = new ArrayList<>();
dispatchImportList.add(dispatchReduceVo);
dispatchInfoService.batchReduceDispatch(dispatchImportList, errorMessageList, user, null);
dispatchInfoService.batchReduceDispatch(dispatchImportList, errorMessageList, user, null,null);
//处理派减结果
handleDispatchAddRes(pre, errorMessageList);
......
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