diff --git a/src/com/engine/salary/biz/SIArchivesBiz.java b/src/com/engine/salary/biz/SIArchivesBiz.java index 6bc2deed5..7d6f1c316 100644 --- a/src/com/engine/salary/biz/SIArchivesBiz.java +++ b/src/com/engine/salary/biz/SIArchivesBiz.java @@ -556,28 +556,34 @@ public class SIArchivesBiz { InsuranceArchivesOtherSaveParam param = JSONObject.parseObject(paramReq.getBaseForm(), InsuranceArchivesOtherSaveParam.class); SalaryAssert.notNull("员工id为空", param, param.getEmployeeId()); - otherSchemeMapper.batchDeleteByEmployeeIds(Collections.singletonList(param.getEmployeeId())); - InsuranceArchivesOtherSchemePO insuranceArchivesOtherSchemePO = - InsuranceArchivesOtherSchemePO.builder() - .otherSchemeId(param.getOtherName()) - .otherStartTime(param.getOtherStartTime()) - .underTake(param.getUnderTake()) - .tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY) - .welfareType(paramReq.getWelfareType().getValue()) - .otherEndTime(param.getOtherEndTime()) - .employeeId(param.getEmployeeId()) - .deleteType(DeleteTypeEnum.NOT_DELETED.getValue()) - .updateTime(new Date()) - .createTime(new Date()) - .nonPayment(param.getNonPayment()) - .creator(employeeId) - .paymentOrganization(param.getPaymentOrganization()) - .otherPaymentBaseString(paramReq.getPaymentForm()) - .build(); - InsuranceArchivesOtherSchemePOEncrypt.encryptItem(insuranceArchivesOtherSchemePO); - otherSchemeMapper.batchSave(Collections.singletonList(insuranceArchivesOtherSchemePO)); +// otherSchemeMapper.batchDeleteByEmployeeIds(Collections.singletonList(param.getEmployeeId())); + List oldOtherInfoList = otherSchemeMapper.getOtherByEmployeeId(Collections.singletonList(param.getEmployeeId())); + if (oldOtherInfoList.size() == 1) { + InsuranceArchivesOtherSchemePO oldOtherInfo = oldOtherInfoList.get(0); + InsuranceArchivesOtherSchemePO updateOtherInfo = + InsuranceArchivesOtherSchemePO.builder() + .id(oldOtherInfo.getId()) + .otherSchemeId(param.getOtherName()) + .otherStartTime(param.getOtherStartTime()) + .underTake(param.getUnderTake()) + .tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY) + .welfareType(paramReq.getWelfareType().getValue()) + .otherEndTime(param.getOtherEndTime()) + .employeeId(param.getEmployeeId()) + .deleteType(DeleteTypeEnum.NOT_DELETED.getValue()) + .updateTime(new Date()) + .nonPayment(param.getNonPayment()) + .creator(employeeId) + .paymentOrganization(param.getPaymentOrganization()) + .otherPaymentBaseString(paramReq.getPaymentForm()) + .build(); + InsuranceArchivesOtherSchemePOEncrypt.encryptItem(updateOtherInfo); + otherSchemeMapper.updateById(updateOtherInfo); + sqlSession.commit(); + } else { + throw new SalaryRunTimeException("该员工已关联的其他福利档案不存在或存在多条,请处理后再重复当前操作!"); + } - sqlSession.commit(); } finally { sqlSession.close(); } @@ -593,28 +599,36 @@ public class SIArchivesBiz { FundSchemeMapper fundSchemeMapper = sqlSession.getMapper(FundSchemeMapper.class); InsuranceArchivesFundSaveParam param = JSONObject.parseObject(paramReq.getBaseForm(), InsuranceArchivesFundSaveParam.class); SalaryAssert.notNull("员工id为空", param, param.getEmployeeId()); - fundSchemeMapper.batchDeleteByEmployeeIds(Collections.singletonList(param.getEmployeeId())); - InsuranceArchivesFundSchemePO insuranceArchivesFundSchemePO = InsuranceArchivesFundSchemePO.builder() - .fundSchemeId(param.getFundName()) - .fundAccount(param.getFundAccount()) - .fundEndTime(param.getFundEndTime()) - .fundStartTime(param.getFundStartTime()) - .fundPaymentBaseString(paramReq.getPaymentForm()) - .supplementFundAccount(param.getSupplementFundAccount()) - .createTime(new Date()) - .creator(employeeId) - .nonPayment(param.getNonPayment()) - .deleteType(DeleteTypeEnum.NOT_DELETED.getValue()) - .tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY) - .underTake(param.getUnderTake()) - .paymentOrganization(param.getPaymentOrganization()) - .updateTime(new Date()) - .welfareType(paramReq.getWelfareType().getValue()) - .employeeId(param.getEmployeeId()) - .build(); - InsuranceArchivesFundSchemePOEncrypt.encryptItem(insuranceArchivesFundSchemePO); - fundSchemeMapper.batchSave(Collections.singletonList(insuranceArchivesFundSchemePO)); - sqlSession.commit(); +// fundSchemeMapper.batchDeleteByEmployeeIds(Collections.singletonList(param.getEmployeeId())); + List oldFundInfoList = fundSchemeMapper.getFundByEmployeeId(Collections.singletonList(param.getEmployeeId())); + if (oldFundInfoList.size() == 1) { + InsuranceArchivesFundSchemePO oldFundInfo = oldFundInfoList.get(0); + InsuranceArchivesFundSchemePO updateFundInfo = InsuranceArchivesFundSchemePO.builder() + .id(oldFundInfo.getId()) + .fundSchemeId(param.getFundName()) + .fundAccount(param.getFundAccount()) + .fundEndTime(param.getFundEndTime()) + .fundStartTime(param.getFundStartTime()) + .fundPaymentBaseString(paramReq.getPaymentForm()) + .supplementFundAccount(param.getSupplementFundAccount()) + .creator(employeeId) + .nonPayment(param.getNonPayment()) + .deleteType(DeleteTypeEnum.NOT_DELETED.getValue()) + .tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY) + .underTake(param.getUnderTake()) + .paymentOrganization(param.getPaymentOrganization()) + .updateTime(new Date()) + .welfareType(paramReq.getWelfareType().getValue()) + .employeeId(param.getEmployeeId()) + .build(); + InsuranceArchivesFundSchemePOEncrypt.encryptItem(updateFundInfo); + fundSchemeMapper.updateById(updateFundInfo); + + sqlSession.commit(); + } else { + throw new SalaryRunTimeException("该员工已关联的公积金档案不存在或存在多条,请处理后再重复当前操作!"); + } + } finally { sqlSession.close(); } @@ -633,31 +647,41 @@ public class SIArchivesBiz { InsuranceArchivesSocialSaveParam param = JSONObject.parseObject(paramReq.getBaseForm(), InsuranceArchivesSocialSaveParam.class); SalaryAssert.notNull("员工id为空", param, param.getEmployeeId()); - //删除社保数据 - socialSchemeMapper.batchDeleteByEmployeeIds(Collections.singletonList(param.getEmployeeId())); +// //删除社保数据 +// socialSchemeMapper.batchDeleteByEmployeeIds(Collections.singletonList(param.getEmployeeId())); - InsuranceArchivesSocialSchemePO insuranceArchivesSocialSchemePO = - InsuranceArchivesSocialSchemePO.builder() - .welfareType(paramReq.getWelfareType().getValue()) - .deleteType(DeleteTypeEnum.NOT_DELETED.getValue()) - .socialPaymentBaseString(paramReq.getPaymentForm()) - .socialSchemeId(param.getSocialName()) - .createTime(new Date()) - .socialEndTime(param.getSocialEndTime()) - .socialStartTime(param.getSocialStartTime()) - .creator(employeeId) - .nonPayment(param.getNonPayment()) - .tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY) - .employeeId(param.getEmployeeId()) - .updateTime(new Date()) - .underTake(param.getUnderTake()) - .socialAccount(param.getSchemeAccount()) - .paymentOrganization(param.getPaymentOrganization()) - .build(); - InsuranceArchivesSocialSchemePOEncrypt.encryptItem(insuranceArchivesSocialSchemePO); - socialSchemeMapper.batchSave(Collections.singletonList(insuranceArchivesSocialSchemePO)); + //查询已有数据 + List oldSocialInfoList = socialSchemeMapper.getSocialByEmployeeId(Collections.singletonList(param.getEmployeeId())); + //组装新数据 + if (oldSocialInfoList.size() == 1) { + InsuranceArchivesSocialSchemePO oldSocialInfo = oldSocialInfoList.get(0); + + InsuranceArchivesSocialSchemePO updateSocialInfo = + InsuranceArchivesSocialSchemePO.builder() + .id(oldSocialInfo.getId()) + .welfareType(paramReq.getWelfareType().getValue()) + .deleteType(DeleteTypeEnum.NOT_DELETED.getValue()) + .socialPaymentBaseString(paramReq.getPaymentForm()) + .socialSchemeId(param.getSocialName()) + .socialEndTime(param.getSocialEndTime()) + .socialStartTime(param.getSocialStartTime()) + .creator(employeeId) + .nonPayment(param.getNonPayment()) + .tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY) + .employeeId(param.getEmployeeId()) + .updateTime(new Date()) + .underTake(param.getUnderTake()) + .socialAccount(param.getSchemeAccount()) + .paymentOrganization(param.getPaymentOrganization()) + .build(); + InsuranceArchivesSocialSchemePOEncrypt.encryptItem(updateSocialInfo); + socialSchemeMapper.updateById(updateSocialInfo); + + sqlSession.commit(); + } else { + throw new SalaryRunTimeException("该员工已关联的社保档案不存在或存在多条,请处理后再重复当前操作!"); + } - sqlSession.commit(); } finally { sqlSession.close(); } diff --git a/src/com/engine/salary/mapper/siarchives/FundSchemeMapper.java b/src/com/engine/salary/mapper/siarchives/FundSchemeMapper.java index 3c2637901..f55930382 100644 --- a/src/com/engine/salary/mapper/siarchives/FundSchemeMapper.java +++ b/src/com/engine/salary/mapper/siarchives/FundSchemeMapper.java @@ -51,4 +51,6 @@ public interface FundSchemeMapper { * @param endTime */ void batchUpdateEndTime(@Param("ids")List ids, @Param("endTime")String endTime); + + int updateById(InsuranceArchivesFundSchemePO insuranceArchivesFundSchemePO); } diff --git a/src/com/engine/salary/mapper/siarchives/FundSchemeMapper.xml b/src/com/engine/salary/mapper/siarchives/FundSchemeMapper.xml index e876269d2..db9f435af 100644 --- a/src/com/engine/salary/mapper/siarchives/FundSchemeMapper.xml +++ b/src/com/engine/salary/mapper/siarchives/FundSchemeMapper.xml @@ -252,4 +252,24 @@ + + + + UPDATE hrsa_fund_archives + + welfare_type = #{welfareType}, + fund_payment_base_string = #{fundPaymentBaseString}, + fund_scheme_id = #{fundSchemeId}, + fund_end_time = #{fundEndTime}, + fund_start_time = #{fundStartTime}, + non_payment = #{nonPayment}, + tenant_key = #{tenantKey}, + employee_id = #{employeeId}, + update_time = #{updateTime}, + under_take = #{underTake}, + fund_account = #{fundAccount}, + payment_organization = #{paymentOrganization}, + + WHERE id = #{id} AND delete_type = 0 + \ No newline at end of file diff --git a/src/com/engine/salary/mapper/siarchives/OtherSchemeMapper.java b/src/com/engine/salary/mapper/siarchives/OtherSchemeMapper.java index a75090a48..8cece7df2 100644 --- a/src/com/engine/salary/mapper/siarchives/OtherSchemeMapper.java +++ b/src/com/engine/salary/mapper/siarchives/OtherSchemeMapper.java @@ -51,4 +51,6 @@ public interface OtherSchemeMapper { * @param endTime */ void batchUpdateEndTime(@Param("ids")List ids, @Param("endTime")String endTime); + + int updateById(InsuranceArchivesOtherSchemePO insuranceArchivesOtherSchemePO); } diff --git a/src/com/engine/salary/mapper/siarchives/OtherSchemeMapper.xml b/src/com/engine/salary/mapper/siarchives/OtherSchemeMapper.xml index 4d6d8361a..c056b83e6 100644 --- a/src/com/engine/salary/mapper/siarchives/OtherSchemeMapper.xml +++ b/src/com/engine/salary/mapper/siarchives/OtherSchemeMapper.xml @@ -242,4 +242,23 @@ + + + + UPDATE hrsa_other_archives + + welfare_type = #{welfareType}, + other_payment_base_string = #{otherPaymentBaseString}, + other_scheme_id = #{otherSchemeId}, + other_end_time = #{otherEndTime}, + other_start_time = #{otherStartTime}, + non_payment = #{nonPayment}, + tenant_key = #{tenantKey}, + employee_id = #{employeeId}, + update_time = #{updateTime}, + under_take = #{underTake}, + payment_organization = #{paymentOrganization}, + + WHERE id = #{id} AND delete_type = 0 + \ No newline at end of file diff --git a/src/com/engine/salary/mapper/siarchives/SocialSchemeMapper.java b/src/com/engine/salary/mapper/siarchives/SocialSchemeMapper.java index efeaf18f4..ee4ebcf5d 100644 --- a/src/com/engine/salary/mapper/siarchives/SocialSchemeMapper.java +++ b/src/com/engine/salary/mapper/siarchives/SocialSchemeMapper.java @@ -76,4 +76,11 @@ public interface SocialSchemeMapper { * @param endTime */ void batchUpdateEndTime(@Param("ids")List ids, @Param("endTime")String endTime); + + /** + * 更新,更新全部字段 + * @param insuranceArchivesSocialSchemePO + * @return + */ + int updateById(InsuranceArchivesSocialSchemePO insuranceArchivesSocialSchemePO); } diff --git a/src/com/engine/salary/mapper/siarchives/SocialSchemeMapper.xml b/src/com/engine/salary/mapper/siarchives/SocialSchemeMapper.xml index e015b6331..04775c642 100644 --- a/src/com/engine/salary/mapper/siarchives/SocialSchemeMapper.xml +++ b/src/com/engine/salary/mapper/siarchives/SocialSchemeMapper.xml @@ -584,4 +584,24 @@ + + + + UPDATE hrsa_social_archives + + welfare_type = #{welfareType}, + social_payment_base_string = #{socialPaymentBaseString}, + social_scheme_id = #{socialSchemeId}, + social_end_time = #{socialEndTime}, + social_start_time = #{socialStartTime}, + non_payment = #{nonPayment}, + tenant_key = #{tenantKey}, + employee_id = #{employeeId}, + update_time = #{updateTime}, + under_take = #{underTake}, + social_account = #{socialAccount}, + payment_organization = #{paymentOrganization}, + + WHERE id = #{id} AND delete_type = 0 + \ No newline at end of file