薪酬系统-福利档案结构改造,社保、公积金、其他福利信息编辑后的保存功能优化

This commit is contained in:
sy 2022-10-18 15:33:27 +08:00
parent 833163f77a
commit e59627776d
7 changed files with 160 additions and 66 deletions

View File

@ -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<InsuranceArchivesOtherSchemePO> 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<InsuranceArchivesFundSchemePO> 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<InsuranceArchivesSocialSchemePO> 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();
}

View File

@ -51,4 +51,6 @@ public interface FundSchemeMapper {
* @param endTime
*/
void batchUpdateEndTime(@Param("ids")List<Long> ids, @Param("endTime")String endTime);
int updateById(InsuranceArchivesFundSchemePO insuranceArchivesFundSchemePO);
}

View File

@ -252,4 +252,24 @@
</foreach>
</if>
</update>
<!-- 更新,更新全部字段 -->
<update id="updateById" parameterType="com.engine.salary.entity.siarchives.po.InsuranceArchivesFundSchemePO">
UPDATE hrsa_fund_archives
<set>
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},
</set>
WHERE id = #{id} AND delete_type = 0
</update>
</mapper>

View File

@ -51,4 +51,6 @@ public interface OtherSchemeMapper {
* @param endTime
*/
void batchUpdateEndTime(@Param("ids")List<Long> ids, @Param("endTime")String endTime);
int updateById(InsuranceArchivesOtherSchemePO insuranceArchivesOtherSchemePO);
}

View File

@ -242,4 +242,23 @@
</foreach>
</if>
</update>
<!-- 更新,更新全部字段 -->
<update id="updateById" parameterType="com.engine.salary.entity.siarchives.po.InsuranceArchivesOtherSchemePO">
UPDATE hrsa_other_archives
<set>
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},
</set>
WHERE id = #{id} AND delete_type = 0
</update>
</mapper>

View File

@ -76,4 +76,11 @@ public interface SocialSchemeMapper {
* @param endTime
*/
void batchUpdateEndTime(@Param("ids")List<Long> ids, @Param("endTime")String endTime);
/**
* 更新,更新全部字段
* @param insuranceArchivesSocialSchemePO
* @return
*/
int updateById(InsuranceArchivesSocialSchemePO insuranceArchivesSocialSchemePO);
}

View File

@ -584,4 +584,24 @@
</foreach>
</if>
</update>
<!-- 更新,更新全部字段 -->
<update id="updateById" parameterType="com.engine.salary.entity.siarchives.po.InsuranceArchivesSocialSchemePO">
UPDATE hrsa_social_archives
<set>
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},
</set>
WHERE id = #{id} AND delete_type = 0
</update>
</mapper>