|
|
|
|
@ -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;
|
|
|
|
|
}
|
|
|
|
|
|