From c4adecf436dc5cd1b2dbc93f2d3879b55e51a8d9 Mon Sep 17 00:00:00 2001 From: sy Date: Mon, 29 Jan 2024 11:30:04 +0800 Subject: [PATCH] =?UTF-8?q?=E8=96=AA=E9=85=AC=E7=B3=BB=E7=BB=9F-=E7=A6=8F?= =?UTF-8?q?=E5=88=A9=E6=A1=A3=E6=A1=88=EF=BC=8C=E5=87=8F=E5=91=98action?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../action/StayDelToStopSIArchiveAction.java | 19 +++++++++- .../salary/service/SIArchivesService.java | 5 +++ .../service/impl/SIArchivesServiceImpl.java | 38 +++++++++++++++++++ 3 files changed, 60 insertions(+), 2 deletions(-) diff --git a/src/com/engine/salary/action/StayDelToStopSIArchiveAction.java b/src/com/engine/salary/action/StayDelToStopSIArchiveAction.java index c7aa0a8bf..1c75d42c0 100644 --- a/src/com/engine/salary/action/StayDelToStopSIArchiveAction.java +++ b/src/com/engine/salary/action/StayDelToStopSIArchiveAction.java @@ -1,14 +1,18 @@ package com.engine.salary.action; +import cn.hutool.core.util.StrUtil; import com.engine.common.util.ServiceUtil; import com.engine.salary.entity.siarchives.po.InsuranceArchivesBaseInfoPO; import com.engine.salary.entity.taxagent.po.TaxAgentPO; import com.engine.salary.enums.siaccount.EmployeeStatusEnum; +import com.engine.salary.exception.SalaryRunTimeException; import com.engine.salary.mapper.siarchives.InsuranceBaseInfoMapper; import com.engine.salary.mapper.taxagent.TaxAgentMapper; import com.engine.salary.service.SIArchivesService; import com.engine.salary.service.impl.SIArchivesServiceImpl; +import com.engine.salary.util.SalaryDateUtil; import com.engine.salary.util.SalaryEntityUtil; +import com.engine.salary.util.SalaryI18nUtil; import com.engine.salary.util.db.MapperProxyFactory; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; @@ -84,6 +88,12 @@ public class StayDelToStopSIArchiveAction implements Action { Long taxAgentId = Long.valueOf( taxAgentPOS.get(0).getId() ); Long employeeId = Long.valueOf(importDataMap.getOrDefault("员工id", "-1").toString()); + String payEndYearMonth = importDataMap.getOrDefault("最后缴纳月", "").toString(); + if (StrUtil.isNotBlank(payEndYearMonth) && !SalaryDateUtil.checkYearMonth(payEndYearMonth)) { + requestInfo.getRequestManager().setMessage("最后缴纳月格式有误,正确格式示例为'2021-01'"); + return FAILURE_AND_CONTINUE; + } + //操作人 String uid = importDataMap.getOrDefault("操作人","1").toString(); User user = new User(Integer.parseInt(uid)); @@ -92,12 +102,17 @@ public class StayDelToStopSIArchiveAction implements Action { if(insuranceArchivesBaseInfoPO == null){ requestInfo.getRequestManager().setMessage("该个税扣缴义务人下该员工不存在福利档案,请检查后重试!"); return FAILURE_AND_CONTINUE; - } else if(!insuranceArchivesBaseInfoPO.getRunStatus().equals(EmployeeStatusEnum.STAY_DEL.getValue())){ + } else if(StrUtil.isBlank(payEndYearMonth) && !insuranceArchivesBaseInfoPO.getRunStatus().equals(EmployeeStatusEnum.STAY_DEL.getValue())){ requestInfo.getRequestManager().setMessage("该个税扣缴义务人下该员工的福利档案状态不是待减员,无法进行减员操作,请检查后重试!"); return FAILURE_AND_CONTINUE; } //减员 - Map resultMap = getSIArchivesService(user).stayDelToStop(Collections.singletonList(insuranceArchivesBaseInfoPO.getId())); + Map resultMap = new HashMap<>(); + if (StrUtil.isBlank(payEndYearMonth)) { + resultMap = getSIArchivesService(user).stayDelToStop(Collections.singletonList(insuranceArchivesBaseInfoPO.getId())); + } else { + resultMap = getSIArchivesService(user).stopWithoutLimit(Collections.singletonList(insuranceArchivesBaseInfoPO.getId()), payEndYearMonth); + } if (resultMap.get("type").toString().equals("fail")) { requestInfo.getRequestManager().setMessage(resultMap.get("msg").toString()); return FAILURE_AND_CONTINUE; diff --git a/src/com/engine/salary/service/SIArchivesService.java b/src/com/engine/salary/service/SIArchivesService.java index 3e98c15d3..0bdc90cd9 100644 --- a/src/com/engine/salary/service/SIArchivesService.java +++ b/src/com/engine/salary/service/SIArchivesService.java @@ -74,6 +74,11 @@ public interface SIArchivesService { */ Map stayDelToStop(Collection ids); + /** + * 批量减员,直接减员,并给予最后缴纳月 + */ + Map stopWithoutLimit(Collection ids, String yearMonth); + /** * 全量减员 */ diff --git a/src/com/engine/salary/service/impl/SIArchivesServiceImpl.java b/src/com/engine/salary/service/impl/SIArchivesServiceImpl.java index 8738c66f9..6e1f5e94a 100644 --- a/src/com/engine/salary/service/impl/SIArchivesServiceImpl.java +++ b/src/com/engine/salary/service/impl/SIArchivesServiceImpl.java @@ -876,6 +876,44 @@ public class SIArchivesServiceImpl extends Service implements SIArchivesService return resultMap; } + @Override + public Map stopWithoutLimit(Collection ids, String yearMonth) { + + if (CollectionUtils.isEmpty(ids)) { + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(145969, "没有可以操作的记录")); + } + List baseInfoPOList = getInsuranceBaseInfoMapper().listByIds(ids); + + //分别新建福利档案基础信息相关的社保、公积金、其他福利档案列表 + List socialList = new ArrayList<>(); + List fundList = new ArrayList<>(); + List otherList = new ArrayList<>(); + //获取待处理的福利档案基础信息id列表 + List baseInfoIds = baseInfoPOList.stream().map(InsuranceArchivesBaseInfoPO::getId).collect(Collectors.toList()); + //分别获取福利档案基础信息相关的社保、公积金、其他福利档案id列表 + List socialIds = baseInfoPOList.stream().map(InsuranceArchivesBaseInfoPO::getSocialArchivesId).collect(Collectors.toList()); + List fundIds = baseInfoPOList.stream().map(InsuranceArchivesBaseInfoPO::getFundArchivesId).collect(Collectors.toList()); + List otherIds = baseInfoPOList.stream().map(InsuranceArchivesBaseInfoPO::getOtherArchivesId).collect(Collectors.toList()); + //进行减员操作 + if (baseInfoIds.size() > 0) { + getInsuranceBaseInfoMapper().updateRunStatusByIds(InsuranceArchivesBaseInfoPO.builder() + .ids(baseInfoIds).runStatus(EmployeeStatusEnum.STOP_PAYMENT_FROM_DEL.getValue()).build()); + + getSocialSchemeMapper().batchUpdateEndTime(socialIds, yearMonth); + getFundSchemeMapper().batchUpdateEndTime(fundIds, yearMonth); + getOtherSchemeMapper().batchUpdateEndTime(otherIds, yearMonth); + } + + + Map resultMap = new HashMap<>(2); + String resultMsg = "操作成功"; + String resultType = "success"; + + resultMap.put("type", resultType); + resultMap.put("msg", resultMsg); + return resultMap; + } + /** * 全量减员 */