diff --git a/src/com/engine/salary/mapper/siarchives/FundSchemeMapper.java b/src/com/engine/salary/mapper/siarchives/FundSchemeMapper.java index ccdc3cf75..8625749ce 100644 --- a/src/com/engine/salary/mapper/siarchives/FundSchemeMapper.java +++ b/src/com/engine/salary/mapper/siarchives/FundSchemeMapper.java @@ -40,8 +40,8 @@ public interface FundSchemeMapper { /** * 批量更新最后缴纳月 - * @param employeeId + * @param ids * @param endTime */ - void batchUpdateEndTime(@Param("employeeIds")List employeeId, String endTime); + void batchUpdateEndTime(@Param("ids")List ids, @Param("endTime")String endTime); } diff --git a/src/com/engine/salary/mapper/siarchives/FundSchemeMapper.xml b/src/com/engine/salary/mapper/siarchives/FundSchemeMapper.xml index 243b10f3e..be39c94bb 100644 --- a/src/com/engine/salary/mapper/siarchives/FundSchemeMapper.xml +++ b/src/com/engine/salary/mapper/siarchives/FundSchemeMapper.xml @@ -231,10 +231,10 @@ UPDATE hrsa_fund_archives SET fund_end_time = #{endTime} WHERE delete_type = 0 - - AND employee_id IN - - #{employeeId} + + AND id IN + + #{id} diff --git a/src/com/engine/salary/mapper/siarchives/OtherSchemeMapper.java b/src/com/engine/salary/mapper/siarchives/OtherSchemeMapper.java index 2f51a3b51..31d5fedde 100644 --- a/src/com/engine/salary/mapper/siarchives/OtherSchemeMapper.java +++ b/src/com/engine/salary/mapper/siarchives/OtherSchemeMapper.java @@ -40,8 +40,8 @@ public interface OtherSchemeMapper { /** * 批量更新最后缴纳月 - * @param employeeId + * @param ids * @param endTime */ - void batchUpdateEndTime(@Param("employeeIds")List employeeId, String endTime); + void batchUpdateEndTime(@Param("ids")List ids, @Param("endTime")String endTime); } diff --git a/src/com/engine/salary/mapper/siarchives/OtherSchemeMapper.xml b/src/com/engine/salary/mapper/siarchives/OtherSchemeMapper.xml index aba9e77bd..5b1a38c9e 100644 --- a/src/com/engine/salary/mapper/siarchives/OtherSchemeMapper.xml +++ b/src/com/engine/salary/mapper/siarchives/OtherSchemeMapper.xml @@ -222,10 +222,10 @@ UPDATE hrsa_other_archives SET other_end_time = #{endTime} WHERE delete_type = 0 - - AND employee_id IN - - #{employeeId} + + AND id IN + + #{id} diff --git a/src/com/engine/salary/mapper/siarchives/SocialSchemeMapper.java b/src/com/engine/salary/mapper/siarchives/SocialSchemeMapper.java index 3441417f8..991bd13b8 100644 --- a/src/com/engine/salary/mapper/siarchives/SocialSchemeMapper.java +++ b/src/com/engine/salary/mapper/siarchives/SocialSchemeMapper.java @@ -65,8 +65,8 @@ public interface SocialSchemeMapper { /** * 批量更新最后缴纳月 - * @param employeeId + * @param ids * @param endTime */ - void batchUpdateEndTime(@Param("employeeIds")List employeeId, String endTime); + void batchUpdateEndTime(@Param("ids")List ids, @Param("endTime")String endTime); } diff --git a/src/com/engine/salary/mapper/siarchives/SocialSchemeMapper.xml b/src/com/engine/salary/mapper/siarchives/SocialSchemeMapper.xml index 79e4bec0a..31de5af0a 100644 --- a/src/com/engine/salary/mapper/siarchives/SocialSchemeMapper.xml +++ b/src/com/engine/salary/mapper/siarchives/SocialSchemeMapper.xml @@ -563,10 +563,10 @@ UPDATE hrsa_social_archives SET social_end_time = #{endTime} WHERE delete_type = 0 - - AND employee_id IN - - #{employeeId} + + AND id IN + + #{id} diff --git a/src/com/engine/salary/service/impl/SIArchivesServiceImpl.java b/src/com/engine/salary/service/impl/SIArchivesServiceImpl.java index 819caf0b4..9ab1fd034 100644 --- a/src/com/engine/salary/service/impl/SIArchivesServiceImpl.java +++ b/src/com/engine/salary/service/impl/SIArchivesServiceImpl.java @@ -197,6 +197,7 @@ public class SIArchivesServiceImpl extends Service implements SIArchivesService * 福利档案中增量数据处理 * @param currentEmployeeId */ + @Transactional(rollbackFor = Exception.class) private void handleChangeData(long currentEmployeeId) { // 所有增量人员列表 @@ -216,7 +217,7 @@ public class SIArchivesServiceImpl extends Service implements SIArchivesService InsuranceArchivesBaseInfoBO.ChangeData changeData = InsuranceArchivesBaseInfoBO.buildChangeData(taxAgentEmpChangeList, baseInfoPOList, currentEmployeeId); // 批量修改福利档案 if (CollectionUtils.isNotEmpty(changeData.getBaseInfoUpdateTodoList())) { - //对于即将职位“待减员”的数据,更新社保、公积金、其他福利档案的停止缴纳时间 + //对于即将调整为“待减员”的数据,更新社保、公积金、其他福利档案的停止缴纳时间 SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM"); String today = simpleDateFormat.format(new Date()); @@ -296,57 +297,56 @@ public class SIArchivesServiceImpl extends Service implements SIArchivesService insuranceArchivesOtherSchemePO.setEmployeeId(baseInfoPO.getEmployeeId()); otherList.add(insuranceArchivesOtherSchemePO); - //导入社保档案 - if (CollectionUtils.isNotEmpty(socialList)) { - socialList = socialList.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(InsuranceArchivesSocialSchemePO::getEmployeeId))), ArrayList::new)); - List socialEmployeeIds = socialList.stream().map(InsuranceArchivesSocialSchemePO::getEmployeeId).collect(Collectors.toList()); - List> socialEmployeeIdPartition = Lists.partition(socialEmployeeIds, 100); - socialEmployeeIdPartition.forEach(getSocialSchemeMapper()::batchDeleteByEmployeeIds); - List> 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)); - List fundEmployeeIds = fundList.stream().map(InsuranceArchivesFundSchemePO::getEmployeeId).collect(Collectors.toList()); - List> fundEmployeeIdsPartition = Lists.partition(fundEmployeeIds, 100); - fundEmployeeIdsPartition.forEach(getFundSchemeMapper()::batchDeleteByEmployeeIds); - List> 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)); - List otherEmployeeIds = otherList.stream().map(InsuranceArchivesOtherSchemePO::getEmployeeId).collect(Collectors.toList()); - List> otherEmployeeIdsPartition = Lists.partition(otherEmployeeIds, 100); - otherEmployeeIdsPartition.forEach(getOtherSchemeMapper()::batchDeleteByEmployeeIds); - List> 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)); - //分批批量删除 - List baseInfoEmployeeIds = baseInfoPOList.stream().map(InsuranceArchivesBaseInfoPO::getEmployeeId).collect(Collectors.toList()); - List> employeeIdPartition = Lists.partition(baseInfoEmployeeIds, 100); - employeeIdPartition.forEach(getInsuranceBaseInfoMapper()::batchDeleteByEmployeeIds); - //查询目标人员的剩余的福利档案基础信息(社保、公积金、其他福利档案id) - List moreBaseInfoPOS = getInsuranceBaseInfoMapper().getInsuranceBaseInfoListByInsuranceDetail(baseInfoEmployeeIds); - List newInsuranceArchivesBaseInfoList = new ArrayList<>(); - //设置社保、公积金、其他福利档案id - for (InsuranceArchivesBaseInfoPO po : baseInfoPOList) { - InsuranceArchivesBaseInfoPO moreBaseInfo = moreBaseInfoPOS.stream().filter(s -> Objects.equals(s.getEmployeeId(), po.getEmployeeId())).findFirst().orElse(null); - po.setSocialArchivesId(moreBaseInfo.getSocialArchivesId()); - po.setFundArchivesId(moreBaseInfo.getFundArchivesId()); - po.setOtherArchivesId(moreBaseInfo.getOtherArchivesId()); - newInsuranceArchivesBaseInfoList.add(po); - } - //分批批量入库 - List> partition = Lists.partition(newInsuranceArchivesBaseInfoList, 100); - partition.forEach(getInsuranceBaseInfoMapper()::batchSave); - } } - + //导入社保档案 + if (CollectionUtils.isNotEmpty(socialList)) { + socialList = socialList.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(InsuranceArchivesSocialSchemePO::getEmployeeId))), ArrayList::new)); + List socialEmployeeIds = socialList.stream().map(InsuranceArchivesSocialSchemePO::getEmployeeId).collect(Collectors.toList()); + List> socialEmployeeIdPartition = Lists.partition(socialEmployeeIds, 100); + socialEmployeeIdPartition.forEach(getSocialSchemeMapper()::batchDeleteByEmployeeIds); + List> 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)); + List fundEmployeeIds = fundList.stream().map(InsuranceArchivesFundSchemePO::getEmployeeId).collect(Collectors.toList()); + List> fundEmployeeIdsPartition = Lists.partition(fundEmployeeIds, 100); + fundEmployeeIdsPartition.forEach(getFundSchemeMapper()::batchDeleteByEmployeeIds); + List> 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)); + List otherEmployeeIds = otherList.stream().map(InsuranceArchivesOtherSchemePO::getEmployeeId).collect(Collectors.toList()); + List> otherEmployeeIdsPartition = Lists.partition(otherEmployeeIds, 100); + otherEmployeeIdsPartition.forEach(getOtherSchemeMapper()::batchDeleteByEmployeeIds); + List> 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)); + //分批批量删除 + List baseInfoEmployeeIds = baseInfoPOList.stream().map(InsuranceArchivesBaseInfoPO::getEmployeeId).collect(Collectors.toList()); + List> employeeIdPartition = Lists.partition(baseInfoEmployeeIds, 100); + employeeIdPartition.forEach(getInsuranceBaseInfoMapper()::batchDeleteByEmployeeIds); + //查询目标人员的剩余的福利档案基础信息(社保、公积金、其他福利档案id) + List moreBaseInfoPOS = getInsuranceBaseInfoMapper().getInsuranceBaseInfoListByInsuranceDetail(baseInfoEmployeeIds); + List newInsuranceArchivesBaseInfoList = new ArrayList<>(); + //设置社保、公积金、其他福利档案id + for (InsuranceArchivesBaseInfoPO po : baseInfoPOList) { + InsuranceArchivesBaseInfoPO moreBaseInfo = moreBaseInfoPOS.stream().filter(s -> Objects.equals(s.getEmployeeId(), po.getEmployeeId())).findFirst().orElse(null); + po.setSocialArchivesId(moreBaseInfo.getSocialArchivesId()); + po.setFundArchivesId(moreBaseInfo.getFundArchivesId()); + po.setOtherArchivesId(moreBaseInfo.getOtherArchivesId()); + newInsuranceArchivesBaseInfoList.add(po); + } + //分批批量入库 + List> partition = Lists.partition(newInsuranceArchivesBaseInfoList, 100); + partition.forEach(getInsuranceBaseInfoMapper()::batchSave); + } return baseInfoPOList; }