薪酬系统-福利模块bug修复v6,历史数据生成为“待增员”,并触发一次全量增员

This commit is contained in:
sy 2022-11-03 19:03:41 +08:00
parent 51a181f3d1
commit f6141a894e
2 changed files with 47 additions and 12 deletions

View File

@ -1508,7 +1508,7 @@ public class SIArchivesBiz {
po.setCreateTime(new Date());
po.setDeleteType(0);
po.setCreator(creator);
po.setRunStatus(EmployeeStatusEnum.PAYING.getValue());
po.setRunStatus(EmployeeStatusEnum.STAY_ADD.getValue());
po.setUpdateTime(new Date());
po.setTenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY);

View File

@ -143,7 +143,7 @@ public class SIArchivesServiceImpl extends Service implements SIArchivesService
StopWatch sw = new StopWatch();
sw.start("福利档案-历史数据处理");
// 1.历史数据处理
siArchivesBiz.createOldInsuranceBaseInfo(currentEmployeeId);
handleHistoryData(currentEmployeeId);
sw.stop();
sw.start("福利档案-待减员自动处理");
@ -181,6 +181,22 @@ public class SIArchivesServiceImpl extends Service implements SIArchivesService
return apidatas;
}
/**
* 福利档案中历史数据自动处理
* @param currentEmployeeId
*/
private void handleHistoryData(long currentEmployeeId) {
List<InsuranceArchivesBaseInfoPO> nowBaseInfoList = getInsuranceBaseInfoMapper().getInsuranceBaseInfoList();
if (nowBaseInfoList.size() == 0) {
siArchivesBiz.createOldInsuranceBaseInfo(currentEmployeeId);
//全量增员
allStayAddToPay();
}
}
/**
* 福利档案中待减员数据自动处理
* @param currentEmployeeId
@ -708,14 +724,14 @@ public class SIArchivesServiceImpl extends Service implements SIArchivesService
//减员失败
resultType = "fail";
if (baseInfoPOList.size() == 1) {
resultMsg = "减员失败,失败原因:数据未正常维护";
resultMsg = "减员失败,失败原因:最后缴纳月数据未正常维护";
} else {
resultMsg = "部分或全部失败:【共提交减员数据"
+ baseInfoIds.size()
+"条,成功" + toStopBaseInfoIdList.size()
+"条,失败" + noStopBaseInfoIds.size()
+"条,失败原因:数据未正常维护】";
+"条,失败原因:最后缴纳月数据未正常维护】";
}
}
@ -751,7 +767,13 @@ public class SIArchivesServiceImpl extends Service implements SIArchivesService
if (CollectionUtils.isEmpty(ids)) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(145969, "没有可以操作的记录"));
}
List<InsuranceArchivesBaseInfoPO> baseInfoPOList = getInsuranceBaseInfoMapper().listByIds(ids);
//
List<InsuranceArchivesBaseInfoPO> baseInfoPOList = new ArrayList<>();
List<List<Long>> partitionInfo = Lists.partition((List<Long>) ids, 100);
partitionInfo.forEach(part -> baseInfoPOList.addAll(
getInsuranceBaseInfoMapper().listByIds(part)));
//
//分别新建福利档案基础信息相关的社保公积金其他福利档案列表
List<InsuranceArchivesSocialSchemePO> socialList = new ArrayList<>();
@ -778,7 +800,10 @@ public class SIArchivesServiceImpl extends Service implements SIArchivesService
//获取可进行增员的社保档案相关人员数据
if (socialIds.size() > 0) {
//获取社保档案
socialList = getSocialSchemeMapper().getSocialById(socialIds);
List<List<Long>> partitionSocial = Lists.partition((List<Long>) socialIds, 100);
partitionSocial.forEach(part -> socialList.addAll(
getSocialSchemeMapper().getSocialById(part)));
//筛选可增员的社保档案相关人员信息
toStopSocialIds = socialList.stream().filter(f->
{
@ -798,7 +823,10 @@ public class SIArchivesServiceImpl extends Service implements SIArchivesService
}
if (fundIds.size() > 0) {
fundList = getFundSchemeMapper().getFundById(fundIds);
List<List<Long>> partitionFund = Lists.partition((List<Long>) fundIds, 100);
partitionFund.forEach(part -> fundList.addAll(
getFundSchemeMapper().getFundById(part)));
toStopFundIds = fundList.stream().filter(f->
{
boolean flag = true;
@ -816,7 +844,10 @@ public class SIArchivesServiceImpl extends Service implements SIArchivesService
}
if (otherIds.size() > 0) {
otherList = getOtherSchemeMapper().getOtherById(otherIds);
List<List<Long>> partitionOther = Lists.partition((List<Long>) otherIds, 100);
partitionOther.forEach(part -> otherList.addAll(
getOtherSchemeMapper().getOtherById(part)));
toStopOtherIds = otherList.stream().filter(f->
{
boolean flag = true;
@ -840,8 +871,12 @@ public class SIArchivesServiceImpl extends Service implements SIArchivesService
//进行增员操作
if (toPayBaseInfoIdList.size() > 0) {
getInsuranceBaseInfoMapper().updateRunStatusByIds(InsuranceArchivesBaseInfoPO.builder()
.ids(toPayBaseInfoIdList).runStatus(EmployeeStatusEnum.PAYING.getValue()).build());
List<List<Long>> partitionToPay = Lists.partition((List<Long>) toPayBaseInfoIdList, 100);
partitionToPay.forEach(part -> {
getInsuranceBaseInfoMapper().updateRunStatusByIds(InsuranceArchivesBaseInfoPO.builder()
.ids(part).runStatus(EmployeeStatusEnum.PAYING.getValue()).build());
});
}
Map<String, Object> resultMap = new HashMap<>(2);
@ -862,13 +897,13 @@ public class SIArchivesServiceImpl extends Service implements SIArchivesService
//增员失败
resultType = "fail";
if (baseInfoPOList.size() == 1) {
resultMsg = "增员失败,失败原因:数据未正常维护";
resultMsg = "增员失败,失败原因:起始缴纳月/福利方案数据未正常维护";
} else {
resultMsg = "部分或全部失败:【共提交增员数据"
+ baseInfoIds.size()
+"条,成功" + toPayBaseInfoIdList.size()
+"条,失败" + noPayBaseInfoIds.size()
+"条,失败原因:数据未正常维护】";
+"条,失败原因:起始缴纳月/福利方案数据未正常维护】";
}
}