薪酬系统-福利档案一对多改造,福利档案增量数据处理功能逻辑调整

This commit is contained in:
sy 2022-10-27 18:21:53 +08:00
parent 7b4bc74c0b
commit 54a3f31cc2
2 changed files with 6 additions and 19 deletions

View File

@ -59,8 +59,8 @@
fund.id AS fundArchivesId,
other.id AS otherArchivesId
FROM hrsa_social_archives social
LEFT JOIN( SELECT fund.employee_id, fund.id FROM hrsa_fund_archives fund WHERE fund.delete_type = 0 )fund ON social.employee_id = fund.employee_id
LEFT JOIN( SELECT other.employee_id, other.id FROM hrsa_other_archives other WHERE other.delete_type = 0 )other ON social.employee_id = other.employee_id
LEFT JOIN( SELECT fund.payment_organization, fund.employee_id, fund.id FROM hrsa_fund_archives fund WHERE fund.delete_type = 0 )fund ON social.employee_id = fund.employee_id AND social.payment_organization = fund.payment_organization
LEFT JOIN( SELECT other.payment_organization, other.employee_id, other.id FROM hrsa_other_archives other WHERE other.delete_type = 0 )other ON social.employee_id = other.employee_id AND social.payment_organization = other.payment_organization
WHERE
social.delete_type = 0
<if test="employeeIds != null and employeeIds.size()>0">

View File

@ -303,46 +303,33 @@ public class SIArchivesServiceImpl extends Service implements SIArchivesService
}
//导入社保档案
if (CollectionUtils.isNotEmpty(socialList)) {
// socialList = socialList.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(InsuranceArchivesSocialSchemePO::getEmployeeId))), ArrayList::new));
//根据人员id和个税扣缴义务人id删除对应档案
socialList.forEach(getSocialSchemeMapper()::deleteByEmployeeIdAndPayOrg);
// List<Long> socialEmployeeIds = socialList.stream().map(InsuranceArchivesSocialSchemePO::getEmployeeId).collect(Collectors.toList());
// List<List<Long>> socialEmployeeIdPartition = Lists.partition(socialEmployeeIds, 100);
// socialEmployeeIdPartition.forEach(getSocialSchemeMapper()::batchDeleteByEmployeeIds);
List<List<InsuranceArchivesSocialSchemePO>> partition = Lists.partition(socialList, 100);
partition.forEach(getSocialSchemeMapper()::batchSave);
}
//导入公积金档案
if (CollectionUtils.isNotEmpty(fundList)) {
fundList = fundList.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(InsuranceArchivesFundSchemePO::getEmployeeId))), ArrayList::new));
//根据人员id和个税扣缴义务人id删除对应档案
// fundList.forEach(getFundSchemeMapper()::deleteByEmployeeIdAndPayOrg);
// List<Long> fundEmployeeIds = fundList.stream().map(InsuranceArchivesFundSchemePO::getEmployeeId).collect(Collectors.toList());
// List<List<Long>> fundEmployeeIdsPartition = Lists.partition(fundEmployeeIds, 100);
// fundEmployeeIdsPartition.forEach(getFundSchemeMapper()::batchDeleteByEmployeeIds);
List<List<InsuranceArchivesFundSchemePO>> partition = Lists.partition(fundList, 100);
partition.forEach(getFundSchemeMapper()::batchSave);
}
//导入其他福利档案
if (CollectionUtils.isNotEmpty(otherList)) {
// otherList = otherList.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(InsuranceArchivesOtherSchemePO::getEmployeeId))), ArrayList::new));
//根据人员id和个税扣缴义务人id删除对应档案
otherList.forEach(getOtherSchemeMapper()::deleteByEmployeeIdAndPayOrg);
// List<Long> otherEmployeeIds = otherList.stream().map(InsuranceArchivesOtherSchemePO::getEmployeeId).collect(Collectors.toList());
// List<List<Long>> otherEmployeeIdsPartition = Lists.partition(otherEmployeeIds, 100);
// otherEmployeeIdsPartition.forEach(getOtherSchemeMapper()::batchDeleteByEmployeeIds);
List<List<InsuranceArchivesOtherSchemePO>> partition = Lists.partition(otherList, 100);
partition.forEach(getOtherSchemeMapper()::batchSave);
}
//导入福利档案基础信息
if (CollectionUtils.isNotEmpty(baseInfoPOList)) {
// baseInfoPOList = baseInfoPOList.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(InsuranceArchivesBaseInfoPO::getEmployeeId))), ArrayList::new));
//根据人员id和个税扣缴义务人id删除对应档案
baseInfoPOList.forEach(getInsuranceBaseInfoMapper()::deleteByEmployeeIdAndPayOrg);
// //分批批量删除
List<Long> baseInfoEmployeeIds = baseInfoPOList.stream().map(InsuranceArchivesBaseInfoPO::getEmployeeId).collect(Collectors.toList());
// List<List<Long>> employeeIdPartition = Lists.partition(baseInfoEmployeeIds, 100);
// employeeIdPartition.forEach(getInsuranceBaseInfoMapper()::batchDeleteByEmployeeIds);
//查询目标人员的剩余的福利档案基础信息社保公积金其他福利档案id
List<InsuranceArchivesBaseInfoPO> moreBaseInfoPOS = getInsuranceBaseInfoMapper().getInsuranceBaseInfoListByInsuranceDetail(baseInfoEmployeeIds);
List<InsuranceArchivesBaseInfoPO> newInsuranceArchivesBaseInfoList = new ArrayList<>();