diff --git a/src/com/engine/salary/action/StayDelToStopSIArchiveAction.java b/src/com/engine/salary/action/StayDelToStopSIArchiveAction.java index 1c75d42c0..8cc20eda7 100644 --- a/src/com/engine/salary/action/StayDelToStopSIArchiveAction.java +++ b/src/com/engine/salary/action/StayDelToStopSIArchiveAction.java @@ -5,14 +5,12 @@ 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; @@ -89,11 +87,24 @@ public class StayDelToStopSIArchiveAction implements Action { Long employeeId = Long.valueOf(importDataMap.getOrDefault("员工id", "-1").toString()); String payEndYearMonth = importDataMap.getOrDefault("最后缴纳月", "").toString(); + // 如果只有一个“最后缴纳月”, 代表社保、公积金、其他均使用同一个最后缴纳月 + String fundEndYearMonth = importDataMap.getOrDefault("公积金最后缴纳月", "").toString(); + String otherEndYearMonth = importDataMap.getOrDefault("其他福利最后缴纳月", "").toString(); if (StrUtil.isNotBlank(payEndYearMonth) && !SalaryDateUtil.checkYearMonth(payEndYearMonth)) { requestInfo.getRequestManager().setMessage("最后缴纳月格式有误,正确格式示例为'2021-01'"); return FAILURE_AND_CONTINUE; } + if (StrUtil.isNotBlank(payEndYearMonth) && !SalaryDateUtil.checkYearMonth(fundEndYearMonth)) { + requestInfo.getRequestManager().setMessage("公积金最后缴纳月格式有误,正确格式示例为'2021-01'"); + return FAILURE_AND_CONTINUE; + } + + if (StrUtil.isNotBlank(payEndYearMonth) && !SalaryDateUtil.checkYearMonth(otherEndYearMonth)) { + requestInfo.getRequestManager().setMessage("其他福利最后缴纳月格式有误,正确格式示例为'2021-01'"); + return FAILURE_AND_CONTINUE; + } + //操作人 String uid = importDataMap.getOrDefault("操作人","1").toString(); User user = new User(Integer.parseInt(uid)); @@ -111,7 +122,7 @@ public class StayDelToStopSIArchiveAction implements Action { if (StrUtil.isBlank(payEndYearMonth)) { resultMap = getSIArchivesService(user).stayDelToStop(Collections.singletonList(insuranceArchivesBaseInfoPO.getId())); } else { - resultMap = getSIArchivesService(user).stopWithoutLimit(Collections.singletonList(insuranceArchivesBaseInfoPO.getId()), payEndYearMonth); + resultMap = getSIArchivesService(user).stopWithoutLimit(Collections.singletonList(insuranceArchivesBaseInfoPO.getId()), payEndYearMonth, fundEndYearMonth, otherEndYearMonth); } if (resultMap.get("type").toString().equals("fail")) { requestInfo.getRequestManager().setMessage(resultMap.get("msg").toString()); diff --git a/src/com/engine/salary/service/SIArchivesService.java b/src/com/engine/salary/service/SIArchivesService.java index b6ff23d69..8e114c756 100644 --- a/src/com/engine/salary/service/SIArchivesService.java +++ b/src/com/engine/salary/service/SIArchivesService.java @@ -77,7 +77,7 @@ public interface SIArchivesService { /** * 批量减员,直接减员,并给予最后缴纳月 */ - Map stopWithoutLimit(Collection ids, String yearMonth); + Map stopWithoutLimit(Collection ids, String yearMonth, String fundEndYearMonth, String otherEndYearMonth); /** * 全量减员 diff --git a/src/com/engine/salary/service/impl/SIArchivesServiceImpl.java b/src/com/engine/salary/service/impl/SIArchivesServiceImpl.java index 1fe3ee033..b14d1b74a 100644 --- a/src/com/engine/salary/service/impl/SIArchivesServiceImpl.java +++ b/src/com/engine/salary/service/impl/SIArchivesServiceImpl.java @@ -989,7 +989,7 @@ public class SIArchivesServiceImpl extends Service implements SIArchivesService //获取社保档案 socialList = getSocialSchemeMapper().getSocialById(socialIds); //筛选可减员的社保档案相关信息 - toStopSocialIds = socialList.stream().filter(f-> f.getSocialSchemeId() == null || (f.getSocialEndTime() != null && f.getSocialEndTime().length() > 0 && (f.getSocialEndTime().compareTo(todayMonth)) <= 0)) + toStopSocialIds = socialList.stream().filter(f-> f.getSocialSchemeId() == null || (f.getSocialEndTime() != null && f.getSocialEndTime().length() > 0)) .map(InsuranceArchivesSocialSchemePO::getId).collect(Collectors.toList()); List finalToStopSocialIds = toStopSocialIds; @@ -999,7 +999,7 @@ public class SIArchivesServiceImpl extends Service implements SIArchivesService if (fundIds.size() > 0) { fundList = getFundSchemeMapper().getFundById(fundIds); - toStopFundIds = fundList.stream().filter(f->f.getFundSchemeId() == null || (f.getFundEndTime() != null && f.getFundEndTime().length() > 0 && (f.getFundEndTime().compareTo(todayMonth)) <= 0)) + toStopFundIds = fundList.stream().filter(f->f.getFundSchemeId() == null || (f.getFundEndTime() != null && f.getFundEndTime().length() > 0)) .map(InsuranceArchivesFundSchemePO::getId).collect(Collectors.toList()); List finalToStopFundIds = toStopFundIds; noStopBaseInfoIds = (List) CollectionUtils.union(noStopBaseInfoIds, baseInfoPOList.stream().filter(f -> !finalToStopFundIds.contains(f.getFundArchivesId())).map(InsuranceArchivesBaseInfoPO::getId).collect(Collectors.toList())); @@ -1008,7 +1008,7 @@ public class SIArchivesServiceImpl extends Service implements SIArchivesService if (otherIds.size() > 0) { otherList = getOtherSchemeMapper().getOtherById(otherIds); - toStopOtherIds= otherList.stream().filter(f->f.getOtherSchemeId() == null || (f.getOtherEndTime() != null && f.getOtherEndTime().length() > 0 && (f.getOtherEndTime().compareTo(todayMonth)) <= 0)) + toStopOtherIds= otherList.stream().filter(f->f.getOtherSchemeId() == null || (f.getOtherEndTime() != null && f.getOtherEndTime().length() > 0)) .map(InsuranceArchivesOtherSchemePO::getId).collect(Collectors.toList()); List finalToStopOtherIds = toStopOtherIds; noStopBaseInfoIds = (List) CollectionUtils.union(noStopBaseInfoIds, baseInfoPOList.stream().filter(f -> !finalToStopOtherIds.contains(f.getOtherArchivesId())).map(InsuranceArchivesBaseInfoPO::getId).collect(Collectors.toList())); @@ -1081,7 +1081,7 @@ public class SIArchivesServiceImpl extends Service implements SIArchivesService } @Override - public Map stopWithoutLimit(Collection ids, String yearMonth) { + public Map stopWithoutLimit(Collection ids, String yearMonth, String fundEndYearMonth, String otherEndYearMonth) { if (CollectionUtils.isEmpty(ids)) { throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(145969, "没有可以操作的记录")); @@ -1102,10 +1102,13 @@ public class SIArchivesServiceImpl extends Service implements SIArchivesService if (baseInfoIds.size() > 0) { getInsuranceBaseInfoMapper().updateRunStatusByIds(InsuranceArchivesBaseInfoPO.builder() .ids(baseInfoIds).runStatus(EmployeeStatusEnum.STOP_PAYMENT_FROM_DEL.getValue()).build()); + String socialEndYearMonth = yearMonth; + fundEndYearMonth = StringUtils.isBlank(fundEndYearMonth) ? yearMonth : fundEndYearMonth; + otherEndYearMonth = StringUtils.isBlank(otherEndYearMonth) ? yearMonth : otherEndYearMonth; - getSocialSchemeMapper().batchUpdateEndTime(socialIds, yearMonth); - getFundSchemeMapper().batchUpdateEndTime(fundIds, yearMonth); - getOtherSchemeMapper().batchUpdateEndTime(otherIds, yearMonth); + getSocialSchemeMapper().batchUpdateEndTime(socialIds, socialEndYearMonth); + getFundSchemeMapper().batchUpdateEndTime(fundIds, fundEndYearMonth); + getOtherSchemeMapper().batchUpdateEndTime(otherIds, otherEndYearMonth); }