diff --git a/src/com/engine/salary/biz/SIArchivesBiz.java b/src/com/engine/salary/biz/SIArchivesBiz.java index 51da1aa57..1e9f2c756 100644 --- a/src/com/engine/salary/biz/SIArchivesBiz.java +++ b/src/com/engine/salary/biz/SIArchivesBiz.java @@ -662,11 +662,10 @@ public class SIArchivesBiz { throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(542533, "其他福利最后缴纳时间格式错误,正确格式为YYYY-MM或者yyyy-MM-dd")); } -// List oldOtherInfoList = otherSchemeMapper.getOtherByEmployeeId(Collections.singletonList(param.getEmployeeId())); - List oldOtherInfoList = otherSchemeMapper.getOtherByEmployeeIdAndPayOrg(InsuranceArchivesEmployeePO.builder() - .employeeId(param.getEmployeeId()) - .paymentOrganization(param.getPaymentOrganization()) - .build()); + List otherIds = new ArrayList(); + otherIds.add(param.getId()); + List oldOtherInfoList = otherSchemeMapper.getOtherById(otherIds); + if (oldOtherInfoList.size() == 1) { InsuranceArchivesOtherSchemePO oldOtherInfo = oldOtherInfoList.get(0); InsuranceArchivesOtherSchemePO updateOtherInfo = @@ -694,7 +693,48 @@ public class SIArchivesBiz { otherSchemeMapper.updateById(updateOtherInfo); sqlSession.commit(); } else { - throw new SalaryRunTimeException("该员工已关联的其他福利档案不存在或存在多条,请处理后再重复当前操作!"); + otherSchemeMapper.deleteByEmployeeIdAndPayOrg(InsuranceArchivesOtherSchemePO.builder() + .employeeId(param.getEmployeeId()) + .paymentOrganization(param.getPaymentOrganization()) + .build()); + //新建社保档案,并关联主表 + InsuranceArchivesOtherSchemePO insertOtherInfo = InsuranceArchivesOtherSchemePO.builder() + .otherSchemeId(param.getOtherSchemeId()) + .otherStartTime(StringUtils.isNotBlank(param.getOtherStartTime()) ? param.getOtherStartTime() : null) + .underTake(param.getUnderTake()) + .tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY) + .welfareType(paramReq.getWelfareType().getValue()) + .otherEndTime(StringUtils.isNotBlank(param.getOtherEndTime()) ? param.getOtherEndTime() : null) + .employeeId(param.getEmployeeId()) + .deleteType(DeleteTypeEnum.NOT_DELETED.getValue()) + .createTime(new Date()) + .updateTime(new Date()) + .nonPayment(param.getNonPayment()) + .creator(employeeId) + .paymentOrganization(param.getPaymentOrganization()) + .otherPaymentBaseString(paramReq.getPaymentForm()) + .build(); + //校验福利基数是否符合上下限要求, + if (!checkWelBaseLimit(insertOtherInfo.getOtherSchemeId(),insertOtherInfo.getOtherPaymentBaseString())) { + throw new SalaryRunTimeException("其他福利明细中的基数更新内容不符合相关基数上下限要求,请检查后重试!"); + } + encryptUtil.encrypt(insertOtherInfo, InsuranceArchivesOtherSchemePO.class); + otherSchemeMapper.insert(insertOtherInfo); + sqlSession.commit(); + + InsuranceArchivesBaseInfoPO baseInfoPO = getInsuranceBaseInfoMapper().getOneByEmployeeIdAndPayOrg(param.getPaymentOrganization(), param.getEmployeeId()); + if(baseInfoPO != null) { + List otherInfos = otherSchemeMapper.getOtherByEmployeeIdAndPayOrg(InsuranceArchivesEmployeePO.builder() + .employeeId(param.getEmployeeId()) + .paymentOrganization(param.getPaymentOrganization()) + .build()); + baseInfoPO.setOtherArchivesId(otherInfos.get(0).getId()); + getInsuranceBaseInfoMapper().updateById(baseInfoPO); + } else { + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0, "档案不存在!")); + } + + } } finally { @@ -720,11 +760,10 @@ public class SIArchivesBiz { throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(542531, "公积金最后缴纳时间格式错误,正确格式为YYYY-MM或者yyyy-MM-dd")); } -// List oldFundInfoList = fundSchemeMapper.getFundByEmployeeId(Collections.singletonList(param.getEmployeeId())); - List oldFundInfoList = fundSchemeMapper.getFundByEmployeeIdAndPayOrg(InsuranceArchivesEmployeePO.builder() - .employeeId(param.getEmployeeId()) - .paymentOrganization(param.getPaymentOrganization()) - .build()); + List fundIds = new ArrayList(); + fundIds.add(param.getId()); + List oldFundInfoList = fundSchemeMapper.getFundById(fundIds); + if (oldFundInfoList.size() == 1) { InsuranceArchivesFundSchemePO oldFundInfo = oldFundInfoList.get(0); InsuranceArchivesFundSchemePO updateFundInfo = InsuranceArchivesFundSchemePO.builder() @@ -754,7 +793,49 @@ public class SIArchivesBiz { sqlSession.commit(); } else { - throw new SalaryRunTimeException("该员工已关联的公积金档案不存在或存在多条,请处理后再重复当前操作!"); + fundSchemeMapper.deleteByEmployeeIdAndPayOrg(InsuranceArchivesFundSchemePO.builder() + .employeeId(param.getEmployeeId()) + .paymentOrganization(param.getPaymentOrganization()) + .build()); + //新建社保档案,并关联主表 + InsuranceArchivesFundSchemePO insertFundInfo = InsuranceArchivesFundSchemePO.builder() + .fundSchemeId(param.getFundSchemeId()) + .fundAccount(param.getFundAccount()) + .fundEndTime(StringUtils.isNotBlank(param.getFundEndTime()) ? param.getFundEndTime() : null) + .fundStartTime(StringUtils.isNotBlank(param.getFundStartTime()) ? param.getFundStartTime() : null) + .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()) + .createTime(new Date()) + .updateTime(new Date()) + .welfareType(paramReq.getWelfareType().getValue()) + .employeeId(param.getEmployeeId()) + .build(); + //校验福利基数是否符合上下限要求, + if (!checkWelBaseLimit(insertFundInfo.getFundSchemeId(),insertFundInfo.getFundPaymentBaseString())) { + throw new SalaryRunTimeException("公积金福利明细中的基数更新内容不符合相关基数上下限要求,请检查后重试!"); + } + encryptUtil.encrypt(insertFundInfo, InsuranceArchivesFundSchemePO.class); + fundSchemeMapper.insert(insertFundInfo); + sqlSession.commit(); + + InsuranceArchivesBaseInfoPO baseInfoPO = getInsuranceBaseInfoMapper().getOneByEmployeeIdAndPayOrg(param.getPaymentOrganization(), param.getEmployeeId()); + if(baseInfoPO != null) { + List fundInfos = fundSchemeMapper.getFundByEmployeeIdAndPayOrg(InsuranceArchivesEmployeePO.builder() + .employeeId(param.getEmployeeId()) + .paymentOrganization(param.getPaymentOrganization()) + .build()); + baseInfoPO.setFundArchivesId(fundInfos.get(0).getId()); + getInsuranceBaseInfoMapper().updateById(baseInfoPO); + } else { + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0, "档案不存在!")); + } + } } finally { @@ -787,11 +868,9 @@ public class SIArchivesBiz { // socialSchemeMapper.batchDeleteByEmployeeIds(Collections.singletonList(param.getEmployeeId())); //查询已有数据 -// List oldSocialInfoList = socialSchemeMapper.getSocialByEmployeeId(Collections.singletonList(param.getEmployeeId())); - List oldSocialInfoList = socialSchemeMapper.getSocialByEmployeeIdAndPayOrg(InsuranceArchivesEmployeePO.builder() - .employeeId(param.getEmployeeId()) - .paymentOrganization(param.getPaymentOrganization()) - .build()); + List socialIds = new ArrayList(); + socialIds.add(param.getId()); + List oldSocialInfoList = socialSchemeMapper.getSocialById(socialIds); //组装新数据 if (oldSocialInfoList.size() == 1) { InsuranceArchivesSocialSchemePO oldSocialInfo = oldSocialInfoList.get(0); @@ -823,7 +902,49 @@ public class SIArchivesBiz { sqlSession.commit(); } else { - throw new SalaryRunTimeException("该员工已关联的社保档案不存在或存在多条,请处理后再重复当前操作!"); + socialSchemeMapper.deleteByEmployeeIdAndPayOrg(InsuranceArchivesSocialSchemePO.builder() + .employeeId(param.getEmployeeId()) + .paymentOrganization(param.getPaymentOrganization()) + .build()); + //新建社保档案,并关联主表 + InsuranceArchivesSocialSchemePO insertSocialInfo = + InsuranceArchivesSocialSchemePO.builder() + .welfareType(paramReq.getWelfareType().getValue()) + .deleteType(DeleteTypeEnum.NOT_DELETED.getValue()) + .socialPaymentBaseString(paramReq.getPaymentForm()) + .socialSchemeId(param.getSocialSchemeId()) + .socialEndTime(StringUtils.isNotBlank(param.getSocialEndTime()) ? param.getSocialEndTime() : null) + .socialStartTime(StringUtils.isNotBlank(param.getSocialStartTime()) ? param.getSocialStartTime() : null) + .creator(employeeId) + .nonPayment(param.getNonPayment()) + .tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY) + .employeeId(param.getEmployeeId()) + .createTime(new Date()) + .updateTime(new Date()) + .underTake(param.getUnderTake()) + .socialAccount(param.getSchemeAccount()) + .paymentOrganization(param.getPaymentOrganization()) + .build(); + //校验福利基数是否符合上下限要求 + if (!checkWelBaseLimit(insertSocialInfo.getSocialSchemeId(),insertSocialInfo.getSocialPaymentBaseString())) { + throw new SalaryRunTimeException("社保福利明细中的基数更新内容不符合相关基数上下限要求,请检查后重试!"); + } + encryptUtil.encrypt(insertSocialInfo, InsuranceArchivesSocialSchemePO.class); + socialSchemeMapper.insert(insertSocialInfo); + sqlSession.commit(); + + InsuranceArchivesBaseInfoPO baseInfoPO = getInsuranceBaseInfoMapper().getOneByEmployeeIdAndPayOrg(param.getPaymentOrganization(), param.getEmployeeId()); + if(baseInfoPO != null) { + List socialInfos = socialSchemeMapper.getSocialByEmployeeIdAndPayOrg(InsuranceArchivesEmployeePO.builder() + .employeeId(param.getEmployeeId()) + .paymentOrganization(param.getPaymentOrganization()) + .build()); + baseInfoPO.setSocialArchivesId(socialInfos.get(0).getId()); + getInsuranceBaseInfoMapper().updateById(baseInfoPO); + } else { + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0, "档案不存在!")); + } + } } finally { @@ -1078,7 +1199,7 @@ public class SIArchivesBiz { list.add(new WeaTableColumn("150px", "工号", "jobNum")); list.add(new WeaTableColumn("150px", "入职日期", "companystartdate")); - list.add(new WeaTableColumn("150px", "合同到期日期", "dismissdate")); +// list.add(new WeaTableColumn("150px", "合同到期日期", "dismissdate")); list.add(new WeaTableColumn("150px", "社保方案名称", "socialName")); titleMap.get(WelfareTypeEnum.SOCIAL_SECURITY.getValue()).forEach((k, v) -> list.add(new WeaTableColumn("150px", v, k))); diff --git a/src/com/engine/salary/entity/salaryacct/dto/SalaryAccEmployeeListDTO.java b/src/com/engine/salary/entity/salaryacct/dto/SalaryAccEmployeeListDTO.java index 3f067cb1c..5f9d256f8 100644 --- a/src/com/engine/salary/entity/salaryacct/dto/SalaryAccEmployeeListDTO.java +++ b/src/com/engine/salary/entity/salaryacct/dto/SalaryAccEmployeeListDTO.java @@ -66,6 +66,6 @@ public class SalaryAccEmployeeListDTO { private String hireDate; //离职日期 - @TableTitle(title = "离职日期", dataIndex = "dismissDate", key = "dismissDate") +// @TableTitle(title = "离职日期", dataIndex = "dismissDate", key = "dismissDate") private String dismissDate; } diff --git a/src/com/engine/salary/entity/salaryarchive/bo/SalaryArchiveBO.java b/src/com/engine/salary/entity/salaryarchive/bo/SalaryArchiveBO.java index 555c2a1cb..552856821 100644 --- a/src/com/engine/salary/entity/salaryarchive/bo/SalaryArchiveBO.java +++ b/src/com/engine/salary/entity/salaryarchive/bo/SalaryArchiveBO.java @@ -82,7 +82,7 @@ public class SalaryArchiveBO { columns.add(new WeaTableColumn("100px", SalaryI18nUtil.getI18nLabel(86187, "起始发薪日期"), "payStartDate")); columns.add(new WeaTableColumn("100px", SalaryI18nUtil.getI18nLabel(86187, "最后发薪日期"), "payEndDate")); columns.add(new WeaTableColumn("100px", SalaryI18nUtil.getI18nLabel(86187, "入职日期"), "companystartdate").setDisplay(WeaBoolAttr.FALSE)); - columns.add(new WeaTableColumn("100px", SalaryI18nUtil.getI18nLabel(86187, "离职日期"), "dismissdate").setDisplay(WeaBoolAttr.FALSE)); +// columns.add(new WeaTableColumn("100px", SalaryI18nUtil.getI18nLabel(86187, "离职日期"), "dismissdate").setDisplay(WeaBoolAttr.FALSE)); for (SalaryItemPO salaryItem : salaryItems) { columns.add(new WeaTableColumn("100px", salaryItem.getName(), salaryItem.getId() + SalaryItemConstant.DYNAMIC_SUFFIX)); } diff --git a/src/com/engine/salary/entity/siaccount/bo/InsuranceComparisonResultBO.java b/src/com/engine/salary/entity/siaccount/bo/InsuranceComparisonResultBO.java index c24a2f513..e8ffcf358 100644 --- a/src/com/engine/salary/entity/siaccount/bo/InsuranceComparisonResultBO.java +++ b/src/com/engine/salary/entity/siaccount/bo/InsuranceComparisonResultBO.java @@ -129,7 +129,7 @@ public class InsuranceComparisonResultBO { */ public static List> buildComparisonTableData(List accountExportPOS, List excelAccountExportPOS, Map schemeIdNameMap) { - Map> excelResultMap = SalaryEntityUtil.group2Map(excelAccountExportPOS, ExcelAccountExportPO::getWorkcode); + Map> excelResultMap = SalaryEntityUtil.group2Map(excelAccountExportPOS, ExcelAccountExportPO::getEmployeeId); // Map> acctResultMap = SalaryEntityUtil.group2Map(accountExportPOS, AccountExportPO::getWorkcode); List paymentList = MapperProxyFactory.getProxy(TaxAgentMapper.class).listAll(); @@ -172,7 +172,7 @@ public class InsuranceComparisonResultBO { map.put("otherSchemeName", schemeIdNameMap.get(accountExportPO.getOtherSchemeId())); //线下值 - List excelResultValueList = excelResultMap.get(accountExportPO.getWorkcode()); + List excelResultValueList = excelResultMap.get(accountExportPO.getEmployeeId()); ExcelAccountExportPO excelAccountExportPO = new ExcelAccountExportPO(); if (excelResultValueList != null && excelResultValueList.size() == 1) { excelAccountExportPO = excelResultValueList.get(0); diff --git a/src/com/engine/salary/mapper/siarchives/FundSchemeMapper.java b/src/com/engine/salary/mapper/siarchives/FundSchemeMapper.java index 558d84eb0..ca0cb78fb 100644 --- a/src/com/engine/salary/mapper/siarchives/FundSchemeMapper.java +++ b/src/com/engine/salary/mapper/siarchives/FundSchemeMapper.java @@ -85,4 +85,10 @@ public interface FundSchemeMapper { * @param fundArchiveDelIds */ void deleteByIds(@Param("ids")List fundArchiveDelIds); + + /** + * 新增 + * @param insuranceArchivesFundSchemePO + */ + void insert(InsuranceArchivesFundSchemePO insuranceArchivesFundSchemePO); } diff --git a/src/com/engine/salary/mapper/siarchives/FundSchemeMapper.xml b/src/com/engine/salary/mapper/siarchives/FundSchemeMapper.xml index 17416d13c..8590a88e6 100644 --- a/src/com/engine/salary/mapper/siarchives/FundSchemeMapper.xml +++ b/src/com/engine/salary/mapper/siarchives/FundSchemeMapper.xml @@ -327,4 +327,45 @@ + + + + INSERT INTO hrsa_fund_archives( + fund_scheme_id, + fund_account, + fund_end_time, + fund_start_time, + fund_payment_base_string, + supplement_fund_account, + create_time, + creator, + non_payment, + delete_type, + tenant_key, + under_take, + payment_organization, + update_time, + welfare_type, + employee_id) + VALUES + ( + #{fundSchemeId}, + #{fundAccount}, + #{fundEndTime}, + #{fundStartTime}, + #{fundPaymentBaseString}, + #{supplementFundAccount}, + #{createTime}, + #{creator}, + #{nonPayment}, + #{deleteType}, + #{tenantKey}, + #{underTake}, + #{paymentOrganization}, + #{updateTime}, + #{welfareType}, + #{employeeId} + ) + + \ No newline at end of file diff --git a/src/com/engine/salary/mapper/siarchives/InsuranceBaseInfoMapper.java b/src/com/engine/salary/mapper/siarchives/InsuranceBaseInfoMapper.java index 4f308f1b4..b604d49ef 100644 --- a/src/com/engine/salary/mapper/siarchives/InsuranceBaseInfoMapper.java +++ b/src/com/engine/salary/mapper/siarchives/InsuranceBaseInfoMapper.java @@ -113,4 +113,11 @@ public interface InsuranceBaseInfoMapper { * @param archiveDelIds */ void deleteByIds(@Param("ids")List archiveDelIds); + + /** + * 根据id更新 + * + * @param po + */ + void updateById(InsuranceArchivesBaseInfoPO po); } diff --git a/src/com/engine/salary/mapper/siarchives/InsuranceBaseInfoMapper.xml b/src/com/engine/salary/mapper/siarchives/InsuranceBaseInfoMapper.xml index 2d63845b8..252c1dd70 100644 --- a/src/com/engine/salary/mapper/siarchives/InsuranceBaseInfoMapper.xml +++ b/src/com/engine/salary/mapper/siarchives/InsuranceBaseInfoMapper.xml @@ -318,4 +318,23 @@ + + UPDATE hrsa_insurance_base_info + + + employee_id = #{employeeId}, + payment_organization = #{paymentOrganization}, + social_archives_id = #{socialArchivesId}, + fund_archives_id = #{fundArchivesId}, + other_archives_id = #{otherArchivesId}, + run_status = #{runStatus}, + create_time = #{createTime}, + update_time = #{updateTime}, + creator = #{creator}, + delete_type = #{deleteType}, + tenant_key = #{tenantKey}, + + WHERE id = #{id} + + \ 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 80d9785f4..26d684d21 100644 --- a/src/com/engine/salary/mapper/siarchives/OtherSchemeMapper.java +++ b/src/com/engine/salary/mapper/siarchives/OtherSchemeMapper.java @@ -77,4 +77,10 @@ public interface OtherSchemeMapper { * @param otherArchiveDelIds */ void deleteByIds(@Param("ids") List otherArchiveDelIds); + + /** + * 新增 + * @param insuranceArchivesOtherSchemePO + */ + void insert(InsuranceArchivesOtherSchemePO insuranceArchivesOtherSchemePO); } diff --git a/src/com/engine/salary/mapper/siarchives/OtherSchemeMapper.xml b/src/com/engine/salary/mapper/siarchives/OtherSchemeMapper.xml index fcfd38706..74c514a6e 100644 --- a/src/com/engine/salary/mapper/siarchives/OtherSchemeMapper.xml +++ b/src/com/engine/salary/mapper/siarchives/OtherSchemeMapper.xml @@ -305,4 +305,39 @@ + + + INSERT INTO hrsa_other_archives( + other_scheme_id, + other_start_time, + under_take, + tenant_key, + welfare_type, + other_end_time, + employee_id, + delete_type, + update_time, + create_time, + non_payment, + creator, + payment_organization, + other_payment_base_string) + VALUES + ( + #{otherSchemeId}, + #{otherStartTime}, + #{underTake}, + #{tenantKey}, + #{welfareType}, + #{otherEndTime}, + #{employeeId}, + #{deleteType}, + #{updateTime}, + #{createTime}, + #{nonPayment}, + #{creator}, + #{paymentOrganization}, + #{otherPaymentBaseString} + ) + \ 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 28f1bc511..0c730ed15 100644 --- a/src/com/engine/salary/mapper/siarchives/SocialSchemeMapper.java +++ b/src/com/engine/salary/mapper/siarchives/SocialSchemeMapper.java @@ -113,4 +113,10 @@ public interface SocialSchemeMapper { * @param socialArchiveDelIds */ void deleteByIds(@Param("ids")List socialArchiveDelIds); + + /** + * 新增 + * @param insuranceArchivesSocialSchemePO + */ + void insert(InsuranceArchivesSocialSchemePO insuranceArchivesSocialSchemePO); } diff --git a/src/com/engine/salary/mapper/siarchives/SocialSchemeMapper.xml b/src/com/engine/salary/mapper/siarchives/SocialSchemeMapper.xml index 10395159b..ebd5af0c3 100644 --- a/src/com/engine/salary/mapper/siarchives/SocialSchemeMapper.xml +++ b/src/com/engine/salary/mapper/siarchives/SocialSchemeMapper.xml @@ -709,4 +709,42 @@ + + + INSERT INTO hrsa_social_archives( + welfare_type, + delete_type, + social_payment_base_string, + social_scheme_id, + create_time, + social_end_time, + social_start_time, + creator, + non_payment, + tenant_key, + employee_id, + update_time, + under_take, + social_account, + payment_organization) + VALUES + ( + #{welfareType}, + #{deleteType}, + #{socialPaymentBaseString}, + #{socialSchemeId}, + #{createTime}, + #{socialEndTime}, + #{socialStartTime}, + #{creator}, + #{nonPayment}, + #{tenantKey}, + #{employeeId}, + #{updateTime}, + #{underTake}, + #{socialAccount}, + #{paymentOrganization} + ) + + \ No newline at end of file diff --git a/src/com/engine/salary/mapper/sicategory/ICategoryMapper.java b/src/com/engine/salary/mapper/sicategory/ICategoryMapper.java index cfc7d17ed..cf50c9395 100644 --- a/src/com/engine/salary/mapper/sicategory/ICategoryMapper.java +++ b/src/com/engine/salary/mapper/sicategory/ICategoryMapper.java @@ -70,6 +70,12 @@ public interface ICategoryMapper { */ void updateNameById(ICategoryPO iCategoryPO); + /** + * 根据id更新福利名称和缴费对象 + * @param iCategoryPO + */ + void updateNameAndPayScopeById(ICategoryPO iCategoryPO); + /** * 根据类型查询福利类型 * @@ -91,4 +97,10 @@ public interface ICategoryMapper { * @return */ List listCustomInsurance(@Param("welfareType") Integer welfareType); + + /** + * 根据id删除自定义福利项 + * @param iCategoryPO + */ + void deleteCustomCategoryById(ICategoryPO iCategoryPO); } diff --git a/src/com/engine/salary/mapper/sicategory/ICategoryMapper.xml b/src/com/engine/salary/mapper/sicategory/ICategoryMapper.xml index 51529b92c..9045bb11f 100644 --- a/src/com/engine/salary/mapper/sicategory/ICategoryMapper.xml +++ b/src/com/engine/salary/mapper/sicategory/ICategoryMapper.xml @@ -178,6 +178,17 @@ WHERE id = #{id} AND data_type = 0 + + + UPDATE hrsa_insurance_category + + update_time=#{updateTime}, + insurance_name=#{insuranceName}, + payment_scope=#{paymentScope}, + + WHERE id = #{id} AND data_type = 0 + + + + + UPDATE hrsa_insurance_category + + update_time=#{updateTime}, + delete_type = 1 + + WHERE id = #{id} AND delete_type = 0 AND data_type = 0 + \ No newline at end of file diff --git a/src/com/engine/salary/service/SICategoryService.java b/src/com/engine/salary/service/SICategoryService.java index d38b8357d..dfaa84349 100644 --- a/src/com/engine/salary/service/SICategoryService.java +++ b/src/com/engine/salary/service/SICategoryService.java @@ -58,4 +58,11 @@ public interface SICategoryService { * @date 2022/10/14 14:50 */ Map updateCategoryName(ICategoryFormDTO iCategoryFormDTO); + + /*** + * @description 修改自定义福利 名称、缴费对象 + */ + Map updateCategoryNameAndPayScope(ICategoryFormDTO iCategoryFormDTO); + + Map deleteCustomCategory(ICategoryFormDTO iCategoryFormDTO); } diff --git a/src/com/engine/salary/service/impl/RecordsBuildServiceImpl.java b/src/com/engine/salary/service/impl/RecordsBuildServiceImpl.java index 86543188a..138eb8cf1 100644 --- a/src/com/engine/salary/service/impl/RecordsBuildServiceImpl.java +++ b/src/com/engine/salary/service/impl/RecordsBuildServiceImpl.java @@ -66,7 +66,7 @@ public class RecordsBuildServiceImpl extends Service implements RecordsBuildServ if (CollectionUtils.isEmpty(list)) { return result; } - List employeeIds = list.stream().map(item -> item.getEmployeeId()).collect(Collectors.toList()); + List employeeIds = list.stream().map(item -> item.getEmployeeId()).distinct().collect(Collectors.toList()); List employeeByIds = new ArrayList<>(); List> partition = Lists.partition(employeeIds, 1000); for (List longs : partition) { diff --git a/src/com/engine/salary/service/impl/SIAccountServiceImpl.java b/src/com/engine/salary/service/impl/SIAccountServiceImpl.java index 97093a2ec..15ced811c 100644 --- a/src/com/engine/salary/service/impl/SIAccountServiceImpl.java +++ b/src/com/engine/salary/service/impl/SIAccountServiceImpl.java @@ -2381,7 +2381,10 @@ public class SIAccountServiceImpl extends Service implements SIAccountService { getExcelInsuranceDetailMapper().batchDelByIds(idList); } //新增 - getExcelInsuranceDetailMapper().batchSave(addCompareList); + List> partition = Lists.partition((List) addCompareList, 20); + partition.forEach(getExcelInsuranceDetailMapper()::batchSave); + +// getExcelInsuranceDetailMapper().batchSave(addCompareList); apidatas.put("successCount", successCount); apidatas.put("errorCount", failCount); diff --git a/src/com/engine/salary/service/impl/SICategoryServiceImpl.java b/src/com/engine/salary/service/impl/SICategoryServiceImpl.java index ab02e8a6f..5cf300cf5 100644 --- a/src/com/engine/salary/service/impl/SICategoryServiceImpl.java +++ b/src/com/engine/salary/service/impl/SICategoryServiceImpl.java @@ -1,10 +1,13 @@ package com.engine.salary.service.impl; +import com.engine.common.util.ServiceUtil; import com.engine.core.impl.Service; import com.engine.salary.cmd.sicategory.SICategoryGetFormCmd; import com.engine.salary.cmd.sicategory.SICategoryInsertCmd; import com.engine.salary.cmd.sicategory.SICategoryUpdateCmd; import com.engine.salary.cmd.sicategory.SICategoryUpdateStatusByIdCmd; +import com.engine.salary.encrypt.EncryptUtil; +import com.engine.salary.entity.siaccount.po.InsuranceAccountDetailPO; import com.engine.salary.entity.sicategory.dto.ICategoryDTO; import com.engine.salary.entity.sicategory.dto.ICategoryFormDTO; import com.engine.salary.entity.sicategory.dto.ICategoryListDTO; @@ -14,16 +17,20 @@ import com.engine.salary.enums.sicategory.DataTypeEnum; import com.engine.salary.enums.sicategory.PaymentScopeEnum; import com.engine.salary.enums.sicategory.WelfareTypeEnum; import com.engine.salary.exception.SalaryRunTimeException; +import com.engine.salary.mapper.siaccount.InsuranceAccountDetailMapper; import com.engine.salary.mapper.sicategory.ICategoryMapper; +import com.engine.salary.service.RecordsBuildService; import com.engine.salary.service.SICategoryService; import com.engine.salary.util.SalaryEntityUtil; import com.engine.salary.util.SalaryEnumUtil; +import com.engine.salary.util.SalaryI18nUtil; import com.engine.salary.util.db.MapperProxyFactory; import com.engine.salary.util.page.PageInfo; import com.engine.salary.util.page.SalaryPageUtil; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.MapUtils; import org.apache.commons.lang3.StringUtils; +import weaver.hrm.User; import java.util.*; import java.util.stream.Collectors; @@ -40,6 +47,15 @@ public class SICategoryServiceImpl extends Service implements SICategoryService return MapperProxyFactory.getProxy(ICategoryMapper.class); } + private InsuranceAccountDetailMapper getInsuranceAccountDetailMapper() { + return MapperProxyFactory.getProxy(InsuranceAccountDetailMapper.class); + } + + public RecordsBuildService getRecordsBuildService(User user) { + return ServiceUtil.getService(RecordsBuildServiceImpl.class, user); + } + + private EncryptUtil encryptUtil = new EncryptUtil(); @Override public Map getForm(Map params) { @@ -136,6 +152,78 @@ public class SICategoryServiceImpl extends Service implements SICategoryService return null; } + @Override + public Map updateCategoryNameAndPayScope(ICategoryFormDTO iCategoryFormDTO) { + ICategoryPO categoryPO = getICategoryMapper().getByIdAndDataType(iCategoryFormDTO.getId(), DataTypeEnum.CUSTOM.getValue()); + if(categoryPO == null){ + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0, "自定义福利不存在")); + } + // 判断是否启用 + Integer isUse = categoryPO.getIsUse(); + if(isUse == 1){ + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0, "编辑失败,请先关闭启用按钮!")); + } + // 判断福利名称是否重复 + List iCategoryPOS = getICategoryMapper().listByName(iCategoryFormDTO.getInsuranceName()); + iCategoryPOS = iCategoryPOS.stream().filter(f -> !f.getId().equals(iCategoryFormDTO.getId())).collect(Collectors.toList()); + if(CollectionUtils.isNotEmpty(iCategoryPOS)){ + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0, "福利名称不能重复")); + } + ICategoryPO iCategoryPO = ICategoryPO.builder().id(iCategoryFormDTO.getId()).insuranceName(iCategoryFormDTO.getInsuranceName()) + .paymentScope(SalaryEnumUtil.enumArrToString(iCategoryFormDTO.getPaymentScope())) + .updateTime(new Date()) + .build(); + getICategoryMapper().updateNameAndPayScopeById(iCategoryPO); + return null; + } + + @Override + public Map deleteCustomCategory(ICategoryFormDTO iCategoryFormDTO) { + ICategoryPO categoryPO = getICategoryMapper().getByIdAndDataType(iCategoryFormDTO.getId(), DataTypeEnum.CUSTOM.getValue()); + if(categoryPO == null){ + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0, "自定义福利不存在")); + } + // 判断是否启用 + Integer isUse = categoryPO.getIsUse(); + if(isUse == 1){ + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0, "删除失败,请先关闭启用按钮!")); + } + // 判断自定义福利项是否存在核算数据 + //获取所有福利核算数据 + List insuranceAccountDetailPOS = getInsuranceAccountDetailMapper().listAll(); + encryptUtil.decryptList(insuranceAccountDetailPOS, InsuranceAccountDetailPO.class); + //数据组装 + List> records = getRecordsBuildService(user).buildCommonRecords(insuranceAccountDetailPOS, null); + String welfareTypeName = ""; + switch (categoryPO.getWelfareType()) { + case 1: + welfareTypeName = "social"; + break; + case 2: + welfareTypeName = "fund"; + break; + case 3: + welfareTypeName = "other"; + break; + default: + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(542456, "福利类型不在")); + } + String welfareNameStart = categoryPO.getId() + welfareTypeName; + //校验福利项是否存在核算记录 + records.forEach(f -> { + if (!Objects.isNull(f.get(welfareNameStart + "Per")) + || !Objects.isNull(f.get(welfareNameStart + "Com")) + || !Objects.isNull(f.get(welfareNameStart + "Base"))) { + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0, "删除失败,已存在福利核算记录")); + } + }); + + //删除自定义福利项 + categoryPO.setUpdateTime(new Date()); + getICategoryMapper().deleteCustomCategoryById(categoryPO); + return null; + } + private ICategoryDTO convertICategoryPO2DTO(ICategoryPO iCategoryPO){ return ICategoryDTO.builder().id(iCategoryPO.getId()).insuranceName(iCategoryPO.getInsuranceName()) .welfareType(iCategoryPO.getWelfareType()) diff --git a/src/com/engine/salary/service/impl/SalaryAcctExcelServiceImpl.java b/src/com/engine/salary/service/impl/SalaryAcctExcelServiceImpl.java index 3e808cb80..7dad4d050 100644 --- a/src/com/engine/salary/service/impl/SalaryAcctExcelServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalaryAcctExcelServiceImpl.java @@ -154,8 +154,8 @@ public class SalaryAcctExcelServiceImpl extends Service implements SalaryAcctExc SalaryI18nUtil.getI18nLabel(86186, "手机号"), SalaryI18nUtil.getI18nLabel(86186, "工号"), SalaryI18nUtil.getI18nLabel(91075, "员工状态"), - SalaryI18nUtil.getI18nLabel(91075, "入职日期"), - SalaryI18nUtil.getI18nLabel(91075, "离职日期") + SalaryI18nUtil.getI18nLabel(91075, "入职日期") +// SalaryI18nUtil.getI18nLabel(91075, "离职日期") }; List headerList = new ArrayList<>(Arrays.asList(header)); // 查询薪资核算人员 @@ -187,8 +187,8 @@ public class SalaryAcctExcelServiceImpl extends Service implements SalaryAcctExc SalaryI18nUtil.getI18nLabel(86186, "手机号"), SalaryI18nUtil.getI18nLabel(86186, "工号"), SalaryI18nUtil.getI18nLabel(91075, "员工状态"), - SalaryI18nUtil.getI18nLabel(91075, "入职日期"), - SalaryI18nUtil.getI18nLabel(91075, "离职日期") + SalaryI18nUtil.getI18nLabel(91075, "入职日期") +// SalaryI18nUtil.getI18nLabel(91075, "离职日期") }; List headerList = new ArrayList<>(Arrays.asList(header)); // 查询薪资核算人员(环比上月减少) @@ -219,8 +219,8 @@ public class SalaryAcctExcelServiceImpl extends Service implements SalaryAcctExc SalaryI18nUtil.getI18nLabel(86186, "手机号"), SalaryI18nUtil.getI18nLabel(86186, "工号"), SalaryI18nUtil.getI18nLabel(91075, "员工状态"), - SalaryI18nUtil.getI18nLabel(91075, "入职日期"), - SalaryI18nUtil.getI18nLabel(91075, "离职日期") + SalaryI18nUtil.getI18nLabel(91075, "入职日期") +// SalaryI18nUtil.getI18nLabel(91075, "离职日期") }; List headerList = new ArrayList<>(Arrays.asList(header)); // 查询薪资核算人员(环比上月增加) @@ -263,7 +263,7 @@ public class SalaryAcctExcelServiceImpl extends Service implements SalaryAcctExc row.add(dto.getJobNum()); row.add(dto.getStatus()); row.add(dto.getHireDate()); - row.add(dto.getDismissDate()); +// row.add(dto.getDismissDate()); rows.add(row); } return rows; diff --git a/src/com/engine/salary/web/SICategoryController.java b/src/com/engine/salary/web/SICategoryController.java index d4f6626eb..0cbb6216b 100644 --- a/src/com/engine/salary/web/SICategoryController.java +++ b/src/com/engine/salary/web/SICategoryController.java @@ -110,7 +110,8 @@ public class SICategoryController { public String updateCustomCategoryName(@Context HttpServletRequest request, @Context HttpServletResponse response,@RequestBody ICategoryFormDTO iCategoryFormDTO) { User user = HrmUserVarify.getUser(request, response); Map map = ParamUtil.request2Map(request); - return new ResponseResult< ICategoryFormDTO, Map>(user).run(getService(user)::updateCategoryName, iCategoryFormDTO); +// return new ResponseResult< ICategoryFormDTO, Map>(user).run(getService(user)::updateCategoryName, iCategoryFormDTO); + return new ResponseResult< ICategoryFormDTO, Map>(user).run(getService(user)::updateCategoryNameAndPayScope, iCategoryFormDTO); } @@ -126,20 +127,18 @@ public class SICategoryController { /** - * 该接口暂时没用,删除福利类型对档案和台账核算都有很大的影响,暂时还没考虑好怎么做 - * 删除福利类型 - * - * @param request - * @param response - * @return + * 删除自定义福利项 + * 必要条件: + * 1-福利项未启用, + * 2-福利核算数据中不能存在该福利项的核算数据 */ + @POST @Path("/deleteCustomCategory") @Produces(MediaType.APPLICATION_JSON) - public String deleteSoftById(@Context HttpServletRequest request, @Context HttpServletResponse response) { + public String deleteCustomCategory(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody ICategoryFormDTO iCategoryFormDTO) { User user = HrmUserVarify.getUser(request, response); - return null; - //return ResponseResult.run(getService(user)::delete, map); + return new ResponseResult< ICategoryFormDTO, Map>(user).run(getService(user)::deleteCustomCategory, iCategoryFormDTO); }