薪酬系统-福利档案一对多改造,福利档案增员功能逻辑调整

This commit is contained in:
sy 2022-10-27 18:00:05 +08:00
parent 825c72a892
commit 7b4bc74c0b
1 changed files with 34 additions and 45 deletions

View File

@ -701,20 +701,13 @@ public class SIArchivesServiceImpl extends Service implements SIArchivesService
List<InsuranceArchivesSocialSchemePO> socialList = new ArrayList<>();
List<InsuranceArchivesFundSchemePO> fundList = new ArrayList<>();
List<InsuranceArchivesOtherSchemePO> otherList = new ArrayList<>();
//分别新建福利档案基础信息相关的社保公积金其他福利档案可以进行增员的人员列表
List<Long> toPaySocialEmployeeIdList = new ArrayList<>();
List<Long> toPayFundEmployeeIdList = new ArrayList<>();
List<Long> toPayOtherEmployeeIdList = new ArrayList<>();
//分别新建福利档案基础信息相关的社保公积金其他福利档案不可以进行增员的人员列表
List<Long> noPaySocialEmployeeIdList = new ArrayList<>();
List<Long> noPayFundEmployeeIdList = new ArrayList<>();
List<Long> noPayOtherEmployeeIdList = new ArrayList<>();
//新建最终可以进行增员的人员列表
List<Long> toPayEmployeeIdList = new ArrayList<>();
//新建最终不可以进行增员的人员列表
List<Long> noPayEmployeeIds = new ArrayList<>();
//获取待处理的员工id列表
List<Long> employeeIds = baseInfoPOList.stream().map(InsuranceArchivesBaseInfoPO::getEmployeeId).collect(Collectors.toList());
//新建最终可以进行增员的福利档案基础信息id列表
List<Long> toPayBaseInfoIdList = new ArrayList<>();
//新建最终不可以进行增员的福利档案基础信息id列表
List<Long> noPayBaseInfoIds = new ArrayList<>();
//获取待处理的福利档案基础信息id列表
List<Long> baseInfoIds = baseInfoPOList.stream().map(InsuranceArchivesBaseInfoPO::getId).collect(Collectors.toList());
//设置最后缴纳月的比较月份
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM");
String todayMonth = simpleDateFormat.format(new Date());
@ -722,12 +715,16 @@ public class SIArchivesServiceImpl extends Service implements SIArchivesService
List<Long> socialIds = baseInfoPOList.stream().map(InsuranceArchivesBaseInfoPO::getSocialArchivesId).collect(Collectors.toList());
List<Long> fundIds = baseInfoPOList.stream().map(InsuranceArchivesBaseInfoPO::getFundArchivesId).collect(Collectors.toList());
List<Long> otherIds = baseInfoPOList.stream().map(InsuranceArchivesBaseInfoPO::getOtherArchivesId).collect(Collectors.toList());
List<Long> toStopSocialIds = new ArrayList<>();
List<Long> toStopFundIds = new ArrayList<>();
List<Long> toStopOtherIds = new ArrayList<>();
//获取可进行增员的社保档案相关人员数据
if (socialIds.size() > 0) {
//获取社保档案
socialList = getSocialSchemeMapper().getSocialById(socialIds);
//筛选可增员的社保档案相关人员信息
toPaySocialEmployeeIdList = socialList.stream().filter(f->
toStopSocialIds = socialList.stream().filter(f->
{
boolean flag = true;
if (f.getSocialStartTime() == null || f.getSocialStartTime().length() == 0 || f.getSocialSchemeId() == null) {
@ -738,16 +735,15 @@ public class SIArchivesServiceImpl extends Service implements SIArchivesService
}
return flag;
})
.map(InsuranceArchivesSocialSchemePO::getEmployeeId).collect(Collectors.toList());
//获取不可增员的社保档案相关人员信息
if (toPaySocialEmployeeIdList.size() != baseInfoPOList.size()) {
noPaySocialEmployeeIdList = (List<Long>) CollectionUtils.subtract(employeeIds, toPaySocialEmployeeIdList);
}
.map(InsuranceArchivesSocialSchemePO::getId).collect(Collectors.toList());
List<Long> finalToStopSocialIds = toStopSocialIds;
toPayBaseInfoIdList = baseInfoPOList.stream().filter(f -> finalToStopSocialIds.contains(f.getSocialArchivesId())).map(InsuranceArchivesBaseInfoPO::getId).collect(Collectors.toList());
}
if (fundIds.size() > 0) {
fundList = getFundSchemeMapper().getFundById(fundIds);
toPayFundEmployeeIdList = fundList.stream().filter(f->
toStopFundIds = fundList.stream().filter(f->
{
boolean flag = true;
if (f.getFundStartTime() == null || f.getFundStartTime().length() == 0 || f.getFundSchemeId() == null) {
@ -759,13 +755,13 @@ public class SIArchivesServiceImpl extends Service implements SIArchivesService
return flag;
})
.map(InsuranceArchivesFundSchemePO::getEmployeeId).collect(Collectors.toList());
if (toPayFundEmployeeIdList.size() != baseInfoPOList.size()) {
noPayFundEmployeeIdList = (List<Long>) CollectionUtils.subtract(employeeIds, toPayFundEmployeeIdList);
}
List<Long> finalToStopFundIds = toStopFundIds;
toPayBaseInfoIdList = (List<Long>) CollectionUtils.union(toPayBaseInfoIdList, baseInfoPOList.stream().filter(f -> finalToStopFundIds.contains(f.getFundArchivesId())).map(InsuranceArchivesBaseInfoPO::getId).collect(Collectors.toList()));
}
if (otherIds.size() > 0) {
otherList = getOtherSchemeMapper().getOtherById(otherIds);
toPayOtherEmployeeIdList = otherList.stream().filter(f->
toStopOtherIds = otherList.stream().filter(f->
{
boolean flag = true;
if (f.getOtherStartTime() == null || f.getOtherStartTime().length() == 0 || f.getOtherSchemeId() == null) {
@ -777,26 +773,19 @@ public class SIArchivesServiceImpl extends Service implements SIArchivesService
return flag;
})
.map(InsuranceArchivesOtherSchemePO::getEmployeeId).collect(Collectors.toList());
if (toPayOtherEmployeeIdList.size() != baseInfoPOList.size()) {
noPayOtherEmployeeIdList = (List<Long>) CollectionUtils.subtract(employeeIds, toPayOtherEmployeeIdList);
}
}
//获取最终基础信息表中的可增员数据
if (noPaySocialEmployeeIdList.size() == 0 && noPayFundEmployeeIdList.size() == 0 && noPayOtherEmployeeIdList.size() ==0) {
//社保公积金其他福利档案的可增员的人员信息与入参中的人员信息一致时
toPayEmployeeIdList = employeeIds;
} else {
//社保公积金其他福利档案的可增员的人员信息与入参中的人员信息不一致时取三类档案可增员的人员并集作为最终可增员的人员信息
toPayEmployeeIdList = (List<Long>) CollectionUtils.union(CollectionUtils.union(toPaySocialEmployeeIdList, toPayFundEmployeeIdList), toPayOtherEmployeeIdList);
//入参人员信息和最终可增员的人员信息做差集获得最终不可增员的人员信息
noPayEmployeeIds = (List<Long>) CollectionUtils.subtract(employeeIds, toPayEmployeeIdList);
List<Long> finalToStopOtherIds = toStopOtherIds;
toPayBaseInfoIdList = (List<Long>) CollectionUtils.union(toPayBaseInfoIdList, baseInfoPOList.stream().filter(f -> finalToStopOtherIds.contains(f.getOtherArchivesId())).map(InsuranceArchivesBaseInfoPO::getId).collect(Collectors.toList()));
}
//获取最终基础信息表中的不可增员数据
noPayBaseInfoIds = (List<Long>) CollectionUtils.subtract(baseInfoIds, toPayBaseInfoIdList);
//其他的个税扣缴义务人下的在缴员工中存在该员工在缴员工未进入停缴员工时不可进行增员
//进行增员操作
if (toPayEmployeeIdList.size() > 0) {
getInsuranceBaseInfoMapper().updateRunStatusByEmployeeIds(InsuranceArchivesBaseInfoPO.builder()
.employeeIds(toPayEmployeeIdList).runStatus(EmployeeStatusEnum.PAYING.getValue()).build());
if (toPayBaseInfoIdList.size() > 0) {
getInsuranceBaseInfoMapper().updateRunStatusByIds(InsuranceArchivesBaseInfoPO.builder()
.ids(toPayBaseInfoIdList).runStatus(EmployeeStatusEnum.PAYING.getValue()).build());
}
Map<String, Object> resultMap = new HashMap<>(2);
@ -805,7 +794,7 @@ public class SIArchivesServiceImpl extends Service implements SIArchivesService
// 批量设为定薪提示
//输出结果此处需区分单一增员和批量增员
if (baseInfoPOList.size() == toPayEmployeeIdList.size()) {
if (baseInfoPOList.size() == toPayBaseInfoIdList.size()) {
//增员成功
if (baseInfoPOList.size() == 1) {
resultMsg = "增员成功";
@ -820,9 +809,9 @@ public class SIArchivesServiceImpl extends Service implements SIArchivesService
resultMsg = "增员失败,失败原因:数据未正常维护";
} else {
resultMsg = "部分或全部失败:【共提交增员数据"
+ employeeIds.size()
+"条,成功" + toPayEmployeeIdList.size()
+"条,失败" + noPayEmployeeIds.size()
+ baseInfoIds.size()
+"条,成功" + toPayBaseInfoIdList.size()
+"条,失败" + noPayBaseInfoIds.size()
+"条,失败原因:数据未正常维护】";
}