社保停缴action最后缴纳月支持分开设置

This commit is contained in:
Harryxzy 2024-10-17 15:51:05 +08:00
parent cede931b0d
commit f664536bce
3 changed files with 25 additions and 11 deletions

View File

@ -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());

View File

@ -77,7 +77,7 @@ public interface SIArchivesService {
/**
* 批量减员直接减员并给予最后缴纳月
*/
Map<String, Object> stopWithoutLimit(Collection<Long> ids, String yearMonth);
Map<String, Object> stopWithoutLimit(Collection<Long> ids, String yearMonth, String fundEndYearMonth, String otherEndYearMonth);
/**
* 全量减员

View File

@ -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<Long> 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<Long> finalToStopFundIds = toStopFundIds;
noStopBaseInfoIds = (List<Long>) 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<Long> finalToStopOtherIds = toStopOtherIds;
noStopBaseInfoIds = (List<Long>) 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<String, Object> stopWithoutLimit(Collection<Long> ids, String yearMonth) {
public Map<String, Object> stopWithoutLimit(Collection<Long> 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);
}