薪酬系统-福利档案结构改造,福利档案中增量数据自动处理功能v2

This commit is contained in:
sy 2022-10-13 16:04:54 +08:00
parent 1aaa8ce43e
commit b1cdeb0a4f
7 changed files with 69 additions and 69 deletions

View File

@ -40,8 +40,8 @@ public interface FundSchemeMapper {
/**
* 批量更新最后缴纳月
* @param employeeId
* @param ids
* @param endTime
*/
void batchUpdateEndTime(@Param("employeeIds")List<Long> employeeId, String endTime);
void batchUpdateEndTime(@Param("ids")List<Long> ids, @Param("endTime")String endTime);
}

View File

@ -231,10 +231,10 @@
UPDATE hrsa_fund_archives
SET fund_end_time = #{endTime}
WHERE delete_type = 0
<if test="employeeIds != null and employeeIds.size()>0">
AND employee_id IN
<foreach collection="employeeIds" open="(" item="employeeId" separator="," close=")">
#{employeeId}
<if test="ids != null and ids.size()>0">
AND id IN
<foreach collection="ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</if>
</update>

View File

@ -40,8 +40,8 @@ public interface OtherSchemeMapper {
/**
* 批量更新最后缴纳月
* @param employeeId
* @param ids
* @param endTime
*/
void batchUpdateEndTime(@Param("employeeIds")List<Long> employeeId, String endTime);
void batchUpdateEndTime(@Param("ids")List<Long> ids, @Param("endTime")String endTime);
}

View File

@ -222,10 +222,10 @@
UPDATE hrsa_other_archives
SET other_end_time = #{endTime}
WHERE delete_type = 0
<if test="employeeIds != null and employeeIds.size()>0">
AND employee_id IN
<foreach collection="employeeIds" open="(" item="employeeId" separator="," close=")">
#{employeeId}
<if test="ids != null and ids.size()>0">
AND id IN
<foreach collection="ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</if>
</update>

View File

@ -65,8 +65,8 @@ public interface SocialSchemeMapper {
/**
* 批量更新最后缴纳月
* @param employeeId
* @param ids
* @param endTime
*/
void batchUpdateEndTime(@Param("employeeIds")List<Long> employeeId, String endTime);
void batchUpdateEndTime(@Param("ids")List<Long> ids, @Param("endTime")String endTime);
}

View File

@ -563,10 +563,10 @@
UPDATE hrsa_social_archives
SET social_end_time = #{endTime}
WHERE delete_type = 0
<if test="employeeIds != null and employeeIds.size()>0">
AND employee_id IN
<foreach collection="employeeIds" open="(" item="employeeId" separator="," close=")">
#{employeeId}
<if test="ids != null and ids.size()>0">
AND id IN
<foreach collection="ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</if>
</update>

View File

@ -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<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));
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));
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));
//分批批量删除
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<>();
//设置社保公积金其他福利档案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<List<InsuranceArchivesBaseInfoPO>> 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<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));
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));
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));
//分批批量删除
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<>();
//设置社保公积金其他福利档案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<List<InsuranceArchivesBaseInfoPO>> partition = Lists.partition(newInsuranceArchivesBaseInfoList, 100);
partition.forEach(getInsuranceBaseInfoMapper()::batchSave);
}
return baseInfoPOList;
}