薪酬系统-福利档案一对多改造v1,档案删除逻辑修改,档案id获取逻辑修改
This commit is contained in:
parent
7279cfae05
commit
5a408e8bfc
|
|
@ -55,20 +55,20 @@ public class InsuranceArchivesBaseInfoBO {
|
|||
|
||||
Map<String, InsuranceArchivesBaseInfoPO> insuranceArchivesBaseInfoListMap = SalaryEntityUtil.convert2Map(insuranceArchivesBaseInfoList, k -> k.getPaymentOrganization() + "-" + k.getEmployeeId());
|
||||
taxAgentEmpChanges.forEach(change -> {
|
||||
//以人员id筛选出侧面比较的档案数据,避免存在当前个税扣缴义务人外的该人员档案数据
|
||||
List<InsuranceArchivesBaseInfoPO> moreBaseInfos = insuranceArchivesBaseInfoList.stream().filter(f -> f.getEmployeeId().equals(change.getEmployeeId())).collect(Collectors.toList());
|
||||
// //以人员id筛选出侧面比较的档案数据,避免存在当前个税扣缴义务人外的该人员档案数据
|
||||
// List<InsuranceArchivesBaseInfoPO> moreBaseInfos = insuranceArchivesBaseInfoList.stream().filter(f -> f.getEmployeeId().equals(change.getEmployeeId())).collect(Collectors.toList());
|
||||
//以个税扣缴义务人和人员id为条件筛选当前数据直接对比的档案数据
|
||||
InsuranceArchivesBaseInfoPO insuranceBaseInfo = insuranceArchivesBaseInfoListMap.get(change.getTaxAgentId() + "-" + change.getEmployeeId());
|
||||
// 如果是新增 说明:如果没有档案,则新增,如果有档案而且是停止缴纳,就转移到待增员中,以个税扣缴义务人和人员id判断唯一
|
||||
if (change.getChangeType() == TaxAgentEmpChangeTypeEnum.ADD.getValue()) {
|
||||
if (insuranceBaseInfo != null && moreBaseInfos.size() == 1) {
|
||||
if (insuranceBaseInfo != null) {
|
||||
// 停止缴纳->待增员
|
||||
if (insuranceBaseInfo.getRunStatus().equals(EmployeeStatusEnum.STOP_PAYMENT_FROM_DEL.getValue()) || insuranceBaseInfo.getRunStatus().equals(EmployeeStatusEnum.STOP_PAYMENT_FROM_ADD.getValue())) {
|
||||
insuranceBaseInfo.setRunStatus(EmployeeStatusEnum.STAY_ADD.getValue());
|
||||
insuranceBaseInfo.setUpdateTime(now);
|
||||
baseInfoUpdateTodoList.add(insuranceBaseInfo);
|
||||
}
|
||||
} else if (insuranceBaseInfo == null && moreBaseInfos.size() == 0) {
|
||||
} else {
|
||||
//新增社保、公积金、其他福利档案
|
||||
// 新增基础信息
|
||||
baseInfoAddTodoList.add(InsuranceArchivesBaseInfoPO.builder()
|
||||
|
|
@ -85,7 +85,7 @@ public class InsuranceArchivesBaseInfoBO {
|
|||
}
|
||||
// 如果是删除 说明:如果有档案并且是在缴纳中才处理,没档案不用管
|
||||
} else if (change.getChangeType() == TaxAgentEmpChangeTypeEnum.DEL.getValue()) {
|
||||
if (insuranceBaseInfo != null && moreBaseInfos.size() == 1) {
|
||||
if (insuranceBaseInfo != null) {
|
||||
if (insuranceBaseInfo.getRunStatus().equals(EmployeeStatusEnum.PAYING.getValue())) {
|
||||
// 正在缴纳->待减员
|
||||
insuranceBaseInfo.setRunStatus(EmployeeStatusEnum.STAY_DEL.getValue());
|
||||
|
|
|
|||
|
|
@ -35,6 +35,11 @@ public interface FundSchemeMapper {
|
|||
*/
|
||||
void batchDeleteByEmployeeIds(@Param("employeeIds") Collection<Long> singletonList);
|
||||
|
||||
/**
|
||||
* 根据人员id和个税扣缴义务人删除档案
|
||||
* @param insuranceArchivesFundSchemePO
|
||||
*/
|
||||
void deleteByEmployeeIdAndPayOrg(@Param("param") InsuranceArchivesFundSchemePO insuranceArchivesFundSchemePO);
|
||||
/**
|
||||
* 批量保存
|
||||
* @param singletonList
|
||||
|
|
|
|||
|
|
@ -86,6 +86,15 @@
|
|||
|
||||
</delete>
|
||||
|
||||
<!-- 根据人员id和个税扣缴义务人删除档案 -->
|
||||
<update id="deleteByEmployeeIdAndPayOrg" parameterType="com.engine.salary.entity.siarchives.po.InsuranceArchivesFundSchemePO">
|
||||
UPDATE hrsa_fund_archives
|
||||
SET delete_type = 1
|
||||
WHERE employee_id = #{param.employeeId}
|
||||
AND payment_organization = #{param.paymentOrganization}
|
||||
AND delete_type = 0
|
||||
</update>
|
||||
|
||||
<!-- 批量保存 -->
|
||||
<insert id="batchSave">
|
||||
INSERT INTO hrsa_fund_archives(
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package com.engine.salary.mapper.siarchives;
|
|||
import com.engine.salary.entity.salarysob.po.SalarySobEmpFieldPO;
|
||||
import com.engine.salary.entity.siarchives.param.InsuranceArchivesListParam;
|
||||
import com.engine.salary.entity.siarchives.po.InsuranceArchivesBaseInfoPO;
|
||||
import com.engine.salary.entity.siarchives.po.InsuranceArchivesOtherSchemePO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.Collection;
|
||||
|
|
@ -49,6 +50,11 @@ public interface InsuranceBaseInfoMapper {
|
|||
*/
|
||||
void batchDeleteByEmployeeIds(@Param("employeeIds")List<Long> employeeIds);
|
||||
|
||||
/**
|
||||
* 根据人员id和个税扣缴义务人删除档案
|
||||
* @param insuranceArchivesBaseInfoPO
|
||||
*/
|
||||
void deleteByEmployeeIdAndPayOrg(@Param("param") InsuranceArchivesBaseInfoPO insuranceArchivesBaseInfoPO);
|
||||
/**
|
||||
* 根据个税扣缴义务人id获取基础信息列表
|
||||
* @param paymentOrganization
|
||||
|
|
|
|||
|
|
@ -156,6 +156,15 @@
|
|||
</if>
|
||||
</delete>
|
||||
|
||||
<!-- 根据人员id和个税扣缴义务人删除档案 -->
|
||||
<update id="deleteByEmployeeIdAndPayOrg" parameterType="com.engine.salary.entity.siarchives.po.InsuranceArchivesBaseInfoPO">
|
||||
UPDATE hrsa_insurance_base_info
|
||||
SET delete_type = 1
|
||||
WHERE employee_id = #{param.employeeId}
|
||||
AND payment_organization = #{param.paymentOrganization}
|
||||
AND delete_type = 0
|
||||
</update>
|
||||
|
||||
<!-- 根据个税扣缴义务人id获取记录 -->
|
||||
<select id="getSocialByPaymentOrganization" resultType="com.engine.salary.entity.siarchives.po.InsuranceArchivesBaseInfoPO">
|
||||
SELECT
|
||||
|
|
|
|||
|
|
@ -35,6 +35,11 @@ public interface OtherSchemeMapper {
|
|||
*/
|
||||
void batchDeleteByEmployeeIds(@Param("employeeIds") Collection<Long> singletonList);
|
||||
|
||||
/**
|
||||
* 根据人员id和个税扣缴义务人删除档案
|
||||
* @param insuranceArchivesOtherSchemePO
|
||||
*/
|
||||
void deleteByEmployeeIdAndPayOrg(@Param("param") InsuranceArchivesOtherSchemePO insuranceArchivesOtherSchemePO);
|
||||
/**
|
||||
* 批量保存
|
||||
* @param singletonList
|
||||
|
|
|
|||
|
|
@ -82,6 +82,15 @@
|
|||
|
||||
</delete>
|
||||
|
||||
<!-- 根据人员id和个税扣缴义务人删除档案 -->
|
||||
<update id="deleteByEmployeeIdAndPayOrg" parameterType="com.engine.salary.entity.siarchives.po.InsuranceArchivesOtherSchemePO">
|
||||
UPDATE hrsa_other_archives
|
||||
SET delete_type = 1
|
||||
WHERE employee_id = #{param.employeeId}
|
||||
AND payment_organization = #{param.paymentOrganization}
|
||||
AND delete_type = 0
|
||||
</update>
|
||||
|
||||
<!-- 批量保存 -->
|
||||
<insert id="batchSave">
|
||||
INSERT INTO hrsa_other_archives(
|
||||
|
|
|
|||
|
|
@ -37,6 +37,11 @@ public interface SocialSchemeMapper {
|
|||
*/
|
||||
void batchDeleteByEmployeeIds(@Param("employeeIds") Collection<Long> singletonList);
|
||||
|
||||
/**
|
||||
* 根据人员id和个税扣缴义务人删除档案
|
||||
* @param insuranceArchivesSocialSchemePO
|
||||
*/
|
||||
void deleteByEmployeeIdAndPayOrg(@Param("param") InsuranceArchivesSocialSchemePO insuranceArchivesSocialSchemePO);
|
||||
/**
|
||||
* 批量保存
|
||||
* @param singletonList
|
||||
|
|
|
|||
|
|
@ -82,6 +82,15 @@
|
|||
</if>
|
||||
</delete>
|
||||
|
||||
<!-- 根据人员id和个税扣缴义务人删除档案 -->
|
||||
<update id="deleteByEmployeeIdAndPayOrg" parameterType="com.engine.salary.entity.siarchives.po.InsuranceArchivesSocialSchemePO">
|
||||
UPDATE hrsa_social_archives
|
||||
SET delete_type = 1
|
||||
WHERE employee_id = #{param.employeeId}
|
||||
AND payment_organization = #{param.paymentOrganization}
|
||||
AND delete_type = 0
|
||||
</update>
|
||||
|
||||
<!-- 批量保存 -->
|
||||
<insert id="batchSave">
|
||||
INSERT INTO hrsa_social_archives(
|
||||
|
|
|
|||
|
|
@ -302,43 +302,51 @@ 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));
|
||||
List<Long> socialEmployeeIds = socialList.stream().map(InsuranceArchivesSocialSchemePO::getEmployeeId).collect(Collectors.toList());
|
||||
List<List<Long>> socialEmployeeIdPartition = Lists.partition(socialEmployeeIds, 100);
|
||||
socialEmployeeIdPartition.forEach(getSocialSchemeMapper()::batchDeleteByEmployeeIds);
|
||||
//根据人员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));
|
||||
List<Long> fundEmployeeIds = fundList.stream().map(InsuranceArchivesFundSchemePO::getEmployeeId).collect(Collectors.toList());
|
||||
List<List<Long>> fundEmployeeIdsPartition = Lists.partition(fundEmployeeIds, 100);
|
||||
fundEmployeeIdsPartition.forEach(getFundSchemeMapper()::batchDeleteByEmployeeIds);
|
||||
//根据人员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));
|
||||
List<Long> otherEmployeeIds = otherList.stream().map(InsuranceArchivesOtherSchemePO::getEmployeeId).collect(Collectors.toList());
|
||||
List<List<Long>> otherEmployeeIdsPartition = Lists.partition(otherEmployeeIds, 100);
|
||||
otherEmployeeIdsPartition.forEach(getOtherSchemeMapper()::batchDeleteByEmployeeIds);
|
||||
//根据人员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);
|
||||
// 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);
|
||||
InsuranceArchivesBaseInfoPO moreBaseInfo = moreBaseInfoPOS.stream().filter(s -> Objects.equals(s.getEmployeeId(), po.getEmployeeId()) && Objects.equals(s.getPaymentOrganization(), po.getPaymentOrganization())).findFirst().orElse(null);
|
||||
po.setSocialArchivesId(moreBaseInfo.getSocialArchivesId());
|
||||
po.setFundArchivesId(moreBaseInfo.getFundArchivesId());
|
||||
po.setOtherArchivesId(moreBaseInfo.getOtherArchivesId());
|
||||
|
|
|
|||
|
|
@ -811,16 +811,16 @@ public class SISchemeServiceImpl extends Service implements SISchemeService {
|
|||
isError = true;
|
||||
}
|
||||
|
||||
//判断是否存在其他个税扣缴义务人下的该员工福利档案
|
||||
// 所有福利档案基础信息数据
|
||||
List<InsuranceArchivesBaseInfoPO> baseInfoPOList = getInsuranceBaseInfoMapper().listAll();
|
||||
List<InsuranceArchivesBaseInfoPO> otherTaxBaseInfos = baseInfoPOList.stream().filter(f -> f.getEmployeeId().equals(employeeId) && !f.getPaymentOrganization().equals(paymentOrgId)).collect(Collectors.toList());
|
||||
if (otherTaxBaseInfos.size() > 0) {
|
||||
Map<String, String> errorMessageMap = Maps.newHashMap();
|
||||
errorMessageMap.put("message", rowIndex + SalaryI18nUtil.getI18nLabel(100312, "该条数据相关人员已存在其他个税扣缴义务人下的福利档案,不可导入"));
|
||||
excelComments.add(errorMessageMap);
|
||||
isError = true;
|
||||
}
|
||||
// //判断是否存在其他个税扣缴义务人下的该员工福利档案
|
||||
// // 所有福利档案基础信息数据
|
||||
// List<InsuranceArchivesBaseInfoPO> baseInfoPOList = getInsuranceBaseInfoMapper().listAll();
|
||||
// List<InsuranceArchivesBaseInfoPO> otherTaxBaseInfos = baseInfoPOList.stream().filter(f -> f.getEmployeeId().equals(employeeId) && !f.getPaymentOrganization().equals(paymentOrgId)).collect(Collectors.toList());
|
||||
// if (otherTaxBaseInfos.size() > 0) {
|
||||
// Map<String, String> errorMessageMap = Maps.newHashMap();
|
||||
// errorMessageMap.put("message", rowIndex + SalaryI18nUtil.getI18nLabel(100312, "该条数据相关人员已存在其他个税扣缴义务人下的福利档案,不可导入"));
|
||||
// excelComments.add(errorMessageMap);
|
||||
// isError = true;
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1116,9 +1116,11 @@ public class SISchemeServiceImpl extends Service implements SISchemeService {
|
|||
List<InsuranceArchivesSocialSchemePO> socialSchemePOS = insuranceArchivesAccountPOS.stream().filter(Objects::nonNull).map(InsuranceArchivesAccountPO::getSocial).collect(Collectors.toList());
|
||||
if (CollectionUtils.isNotEmpty(socialSchemePOS)) {
|
||||
socialSchemePOS = socialSchemePOS.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(InsuranceArchivesSocialSchemePO::getEmployeeId))), ArrayList::new));
|
||||
List<Long> socialEmployeeIds = socialSchemePOS.stream().map(InsuranceArchivesSocialSchemePO::getEmployeeId).collect(Collectors.toList());
|
||||
List<List<Long>> socialEmployeeIdPartition = Lists.partition(socialEmployeeIds, 100);
|
||||
socialEmployeeIdPartition.forEach(getSocialSchemeMapper()::batchDeleteByEmployeeIds);
|
||||
//根据人员id和个税扣缴义务人id删除对应档案
|
||||
socialSchemePOS.forEach(getSocialSchemeMapper()::deleteByEmployeeIdAndPayOrg);
|
||||
// List<Long> socialEmployeeIds = socialSchemePOS.stream().map(InsuranceArchivesSocialSchemePO::getEmployeeId).collect(Collectors.toList());
|
||||
// List<List<Long>> socialEmployeeIdPartition = Lists.partition(socialEmployeeIds, 100);
|
||||
// socialEmployeeIdPartition.forEach(getSocialSchemeMapper()::batchDeleteByEmployeeIds);
|
||||
List<InsuranceArchivesSocialSchemePO> insuranceArchivesSocialSchemePOS = InsuranceArchivesSocialSchemePOEncrypt.encryptList(socialSchemePOS);
|
||||
List<List<InsuranceArchivesSocialSchemePO>> partition = Lists.partition(insuranceArchivesSocialSchemePOS, 100);
|
||||
partition.forEach(getSocialSchemeMapper()::batchSave);
|
||||
|
|
@ -1127,9 +1129,11 @@ public class SISchemeServiceImpl extends Service implements SISchemeService {
|
|||
List<InsuranceArchivesFundSchemePO> fundSchemePOS = insuranceArchivesAccountPOS.stream().filter(Objects::nonNull).map(InsuranceArchivesAccountPO::getFund).collect(Collectors.toList());
|
||||
if (CollectionUtils.isNotEmpty(fundSchemePOS)) {
|
||||
fundSchemePOS = fundSchemePOS.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(InsuranceArchivesFundSchemePO::getEmployeeId))), ArrayList::new));
|
||||
List<Long> fundEmployeeIds = fundSchemePOS.stream().map(InsuranceArchivesFundSchemePO::getEmployeeId).collect(Collectors.toList());
|
||||
List<List<Long>> fundEmployeeIdsPartition = Lists.partition(fundEmployeeIds, 100);
|
||||
fundEmployeeIdsPartition.forEach(getFundSchemeMapper()::batchDeleteByEmployeeIds);
|
||||
//根据人员id和个税扣缴义务人id删除对应档案
|
||||
fundSchemePOS.forEach(getFundSchemeMapper()::deleteByEmployeeIdAndPayOrg);
|
||||
// List<Long> fundEmployeeIds = fundSchemePOS.stream().map(InsuranceArchivesFundSchemePO::getEmployeeId).collect(Collectors.toList());
|
||||
// List<List<Long>> fundEmployeeIdsPartition = Lists.partition(fundEmployeeIds, 100);
|
||||
// fundEmployeeIdsPartition.forEach(getFundSchemeMapper()::batchDeleteByEmployeeIds);
|
||||
List<InsuranceArchivesFundSchemePO> insuranceArchivesFundSchemePOS = InsuranceArchivesFundSchemePOEncrypt.encryptList(fundSchemePOS);
|
||||
List<List<InsuranceArchivesFundSchemePO>> partition = Lists.partition(insuranceArchivesFundSchemePOS, 100);
|
||||
partition.forEach(getFundSchemeMapper()::batchSave);
|
||||
|
|
@ -1138,9 +1142,11 @@ public class SISchemeServiceImpl extends Service implements SISchemeService {
|
|||
List<InsuranceArchivesOtherSchemePO> otherSchemePOS = insuranceArchivesAccountPOS.stream().filter(Objects::nonNull).map(InsuranceArchivesAccountPO::getOther).collect(Collectors.toList());
|
||||
if (CollectionUtils.isNotEmpty(otherSchemePOS)) {
|
||||
otherSchemePOS = otherSchemePOS.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(InsuranceArchivesOtherSchemePO::getEmployeeId))), ArrayList::new));
|
||||
List<Long> otherEmployeeIds = otherSchemePOS.stream().map(InsuranceArchivesOtherSchemePO::getEmployeeId).collect(Collectors.toList());
|
||||
List<List<Long>> otherEmployeeIdsPartition = Lists.partition(otherEmployeeIds, 100);
|
||||
otherEmployeeIdsPartition.forEach(getOtherSchemeMapper()::batchDeleteByEmployeeIds);
|
||||
//根据人员id和个税扣缴义务人id删除对应档案
|
||||
otherSchemePOS.forEach(getOtherSchemeMapper()::deleteByEmployeeIdAndPayOrg);
|
||||
// List<Long> otherEmployeeIds = otherSchemePOS.stream().map(InsuranceArchivesOtherSchemePO::getEmployeeId).collect(Collectors.toList());
|
||||
// List<List<Long>> otherEmployeeIdsPartition = Lists.partition(otherEmployeeIds, 100);
|
||||
// otherEmployeeIdsPartition.forEach(getOtherSchemeMapper()::batchDeleteByEmployeeIds);
|
||||
List<InsuranceArchivesOtherSchemePO> insuranceArchivesOtherSchemePOS = InsuranceArchivesOtherSchemePOEncrypt.encryptList(otherSchemePOS);
|
||||
List<List<InsuranceArchivesOtherSchemePO>> partition = Lists.partition(insuranceArchivesOtherSchemePOS, 100);
|
||||
partition.forEach(getOtherSchemeMapper()::batchSave);
|
||||
|
|
@ -1149,16 +1155,18 @@ public class SISchemeServiceImpl extends Service implements SISchemeService {
|
|||
List<InsuranceArchivesBaseInfoPO> baseInfoPOS = insuranceArchivesAccountPOS.stream().filter(Objects::nonNull).map(InsuranceArchivesAccountPO::getBaseInfo).collect(Collectors.toList());
|
||||
if (CollectionUtils.isNotEmpty(baseInfoPOS)) {
|
||||
baseInfoPOS = baseInfoPOS.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(InsuranceArchivesBaseInfoPO::getEmployeeId))), ArrayList::new));
|
||||
//根据人员id和个税扣缴义务人id删除对应档案
|
||||
baseInfoPOS.forEach(getInsuranceBaseInfoMapper()::deleteByEmployeeIdAndPayOrg);
|
||||
//分批批量删除
|
||||
List<Long> baseInfoEmployeeIds = baseInfoPOS.stream().map(InsuranceArchivesBaseInfoPO::getEmployeeId).collect(Collectors.toList());
|
||||
List<List<Long>> employeeIdPartition = Lists.partition(baseInfoEmployeeIds, 100);
|
||||
employeeIdPartition.forEach(getInsuranceBaseInfoMapper()::batchDeleteByEmployeeIds);
|
||||
// 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 : baseInfoPOS) {
|
||||
InsuranceArchivesBaseInfoPO moreBaseInfo = moreBaseInfoPOS.stream().filter(s -> Objects.equals(s.getEmployeeId(), po.getEmployeeId())).findFirst().orElse(null);
|
||||
InsuranceArchivesBaseInfoPO moreBaseInfo = moreBaseInfoPOS.stream().filter(s -> Objects.equals(s.getEmployeeId(), po.getEmployeeId()) && Objects.equals(s.getPaymentOrganization(), po.getPaymentOrganization())).findFirst().orElse(null);
|
||||
po.setSocialArchivesId(moreBaseInfo.getSocialArchivesId());
|
||||
po.setFundArchivesId(moreBaseInfo.getFundArchivesId());
|
||||
po.setOtherArchivesId(moreBaseInfo.getOtherArchivesId());
|
||||
|
|
|
|||
Loading…
Reference in New Issue