From 06dd1e51cf12a94525c85628f15aefa6f04c0b64 Mon Sep 17 00:00:00 2001 From: Harryxzy Date: Tue, 21 Jan 2025 10:13:52 +0800 Subject: [PATCH] =?UTF-8?q?=E9=92=B1=E6=99=BA=E7=A4=BE=E4=BF=9D=E6=A0=B8?= =?UTF-8?q?=E7=AE=97=E4=BA=8C=E5=BC=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SQLServer/sql2025012101039TEST.sql | 12 ++ .../po/InsuranceAccountDetailPO.java | 14 ++ .../po/InsuranceAccountDetailTempPO.java | 10 + .../entity/siaccount/po/UfTsrysjsbfldaPO.java | 36 ++++ .../InsuranceAccountDetailMapper.xml | 30 ++- .../siaccount/SIAccountDetailTempMapper.xml | 20 +- .../siaccount/UfTsrysjsbfldaMapper.java | 21 ++ .../mapper/siaccount/UfTsrysjsbfldaMapper.xml | 53 +++++ .../salary/service/UfTsrysjsbfldaService.java | 17 ++ .../service/impl/ColumnBuildServiceImpl.java | 63 ++++++ .../service/impl/RecordsBuildServiceImpl.java | 47 +++++ .../service/impl/SIAccountServiceImpl.java | 185 ++++++++++++++++-- .../service/impl/SIExportServiceImpl.java | 109 +++++++++++ .../impl/UfTsrysjsbfldaServiceImpl.java | 49 +++++ .../salary/web/SIAccountController.java | 4 +- .../salary/wrapper/SalaryFormulaWrapper.java | 12 +- 16 files changed, 648 insertions(+), 34 deletions(-) create mode 100644 resource/sqlupgrade/SQLServer/sql2025012101039TEST.sql create mode 100644 src/com/engine/salary/entity/siaccount/po/UfTsrysjsbfldaPO.java create mode 100644 src/com/engine/salary/mapper/siaccount/UfTsrysjsbfldaMapper.java create mode 100644 src/com/engine/salary/mapper/siaccount/UfTsrysjsbfldaMapper.xml create mode 100644 src/com/engine/salary/service/UfTsrysjsbfldaService.java create mode 100644 src/com/engine/salary/service/impl/UfTsrysjsbfldaServiceImpl.java diff --git a/resource/sqlupgrade/SQLServer/sql2025012101039TEST.sql b/resource/sqlupgrade/SQLServer/sql2025012101039TEST.sql new file mode 100644 index 000000000..3fed5329a --- /dev/null +++ b/resource/sqlupgrade/SQLServer/sql2025012101039TEST.sql @@ -0,0 +1,12 @@ +ALTER TABLE hrsa_bill_detail ADD social_special_json text NULL +GO + +ALTER TABLE hrsa_bill_detail ADD fund_special_json text NULL +GO + + +ALTER TABLE hrsa_bill_detail_temp ADD social_special_json text NULL +GO + +ALTER TABLE hrsa_bill_detail_temp ADD fund_special_json text NULL +GO \ No newline at end of file diff --git a/src/com/engine/salary/entity/siaccount/po/InsuranceAccountDetailPO.java b/src/com/engine/salary/entity/siaccount/po/InsuranceAccountDetailPO.java index 310009f9c..8f91fb856 100644 --- a/src/com/engine/salary/entity/siaccount/po/InsuranceAccountDetailPO.java +++ b/src/com/engine/salary/entity/siaccount/po/InsuranceAccountDetailPO.java @@ -178,6 +178,13 @@ public class InsuranceAccountDetailPO { @ElogTransform(name = "社保个人缴费明细") private String socialPerJson; + /** + * 特殊社保缴费明细 + */ + @Encrypt + @ElogTransform(name = "特殊社保缴费明细") + private String socialSpecialJson; + /** * 社保个人合计 */ @@ -192,6 +199,13 @@ public class InsuranceAccountDetailPO { @ElogTransform(name = "公积金个人缴费明细") private String fundPerJson; + /** + * 特殊公积金缴费明细 + */ + @Encrypt + @ElogTransform(name = "特殊公积金缴费明细") + private String fundSpecialJson; + /** * 公积金个人合计 */ diff --git a/src/com/engine/salary/entity/siaccount/po/InsuranceAccountDetailTempPO.java b/src/com/engine/salary/entity/siaccount/po/InsuranceAccountDetailTempPO.java index 8d6d5254f..dc2af39d6 100644 --- a/src/com/engine/salary/entity/siaccount/po/InsuranceAccountDetailTempPO.java +++ b/src/com/engine/salary/entity/siaccount/po/InsuranceAccountDetailTempPO.java @@ -147,6 +147,11 @@ public class InsuranceAccountDetailTempPO { */ @Encrypt private String socialPerJson; + /** + * 特殊社保缴费明细 + */ + @Encrypt + private String socialSpecialJson; /** * 社保个人合计 @@ -159,6 +164,11 @@ public class InsuranceAccountDetailTempPO { */ @Encrypt private String fundPerJson; + /** + * 特殊公积金缴费明细 + */ + @Encrypt + private String fundSpecialJson; /** * 公积金个人合计 diff --git a/src/com/engine/salary/entity/siaccount/po/UfTsrysjsbfldaPO.java b/src/com/engine/salary/entity/siaccount/po/UfTsrysjsbfldaPO.java new file mode 100644 index 000000000..6106b1317 --- /dev/null +++ b/src/com/engine/salary/entity/siaccount/po/UfTsrysjsbfldaPO.java @@ -0,0 +1,36 @@ +package com.engine.salary.entity.siaccount.po; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.math.BigDecimal; +import java.util.List; + +/** + * @author Harryxzy + * @ClassName UfTsrysjsbfldaPO + * @date 2025/01/20 11:12 + * @description 钱智 社保福利特殊人员 + */ + +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class UfTsrysjsbfldaPO { + + private Integer id; + private Integer yg; + private String sxyf; + + private String toSxyf; + + private BigDecimal dyjs; + private BigDecimal dybl; + private String sbflxm; + + private List ygs; + +} diff --git a/src/com/engine/salary/mapper/siaccount/InsuranceAccountDetailMapper.xml b/src/com/engine/salary/mapper/siaccount/InsuranceAccountDetailMapper.xml index f5b88a501..b55b73e92 100644 --- a/src/com/engine/salary/mapper/siaccount/InsuranceAccountDetailMapper.xml +++ b/src/com/engine/salary/mapper/siaccount/InsuranceAccountDetailMapper.xml @@ -58,6 +58,8 @@ + + @@ -122,6 +124,8 @@ , t.jobcall , t.jobcall_id , t.status + , t.social_special_json + , t.fund_special_json t @@ -571,7 +575,7 @@ t.other_com_json,t.social_per_sum,t.social_com_sum, t.fund_per_sum,t.fund_com_sum,t.other_per_sum, t.other_com_sum,t.per_sum,t.com_sum,t.payment_status, - t.social_payment_base_string,t.fund_payment_base_string,t.other_payment_base_string + t.social_payment_base_string,t.fund_payment_base_string,t.other_payment_base_string,t.social_special_json, t.fund_special_json FROM hrsa_bill_detail t WHERE t.delete_type = 0 @@ -596,7 +600,7 @@ t.other_com_sum,t.per_sum,t.com_sum,t.payment_organization, t.social_payment_base_string, t.fund_payment_base_string, t.other_payment_base_string, t.social_payment_com_base_string, t.fund_payment_com_base_string, t.other_payment_com_base_string, - t.payment_status + t.payment_status,t.social_special_json,t.fund_special_json FROM hrsa_bill_detail t WHERE t.delete_type = 0 @@ -612,7 +616,7 @@ t.other_com_json,t.social_per_sum,t.social_com_sum, t.fund_per_sum,t.fund_com_sum,t.other_per_sum, t.other_com_sum,t.per_sum,t.com_sum,t.payment_organization, - t.payment_status + t.payment_status,t.social_special_json,t.fund_special_json FROM hrsa_bill_detail t WHERE t.delete_type = 0 @@ -901,7 +905,7 @@ social_per_sum,fund_per_json,fund_per_sum,other_per_json,other_per_sum,per_sum,social_com_json,social_com_sum,fund_com_json,fund_com_sum,other_com_json,other_com_sum, com_sum,social_sum,fund_sum,other_sum,total,creator,create_time,update_time,delete_type,tenant_key,payment_organization, social_payment_com_base_string,fund_payment_com_base_string,other_payment_com_base_string, - subcompany_name,subcompany_id,department_name,department_id,jobtitle_name,jobtitle_id,jobcall,jobcall_id,status) + subcompany_name,subcompany_id,department_name,department_id,jobtitle_name,jobtitle_id,jobcall,jobcall_id,status,social_special_json,fund_special_json) VALUES ( @@ -959,7 +963,9 @@ #{item.jobtitleId}, #{item.jobcall}, #{item.jobcallId}, - #{item.status} + #{item.status}, + #{item.socialSpecialJson}, + #{item.fundSpecialJson} ) @@ -970,7 +976,7 @@ social_per_sum,fund_per_json,fund_per_sum,other_per_json,other_per_sum,per_sum,social_com_json,social_com_sum,fund_com_json,fund_com_sum,other_com_json,other_com_sum, com_sum,social_sum,fund_sum,other_sum,total,creator,create_time,update_time,delete_type,tenant_key,payment_organization, social_payment_com_base_string,fund_payment_com_base_string,other_payment_com_base_string, - subcompany_name,subcompany_id,department_name,department_id,jobtitle_name,jobtitle_id,jobcall,jobcall_id,status) + subcompany_name,subcompany_id,department_name,department_id,jobtitle_name,jobtitle_id,jobcall,jobcall_id,status,social_special_json,fund_special_json) select #{item.employeeId,jdbcType=DOUBLE}, @@ -1027,7 +1033,9 @@ #{item.jobtitleId,jdbcType=DOUBLE}, #{item.jobcall,jdbcType=VARCHAR}, #{item.jobcallId,jdbcType=DOUBLE}, - #{item.status,jdbcType=VARCHAR} + #{item.status,jdbcType=VARCHAR}, + #{item.socialSpecialJson,jdbcType=VARCHAR}, + #{item.fundSpecialJson,jdbcType=VARCHAR} from dual @@ -1039,7 +1047,7 @@ social_per_sum,fund_per_json,fund_per_sum,other_per_json,other_per_sum,per_sum,social_com_json,social_com_sum,fund_com_json,fund_com_sum,other_com_json,other_com_sum, com_sum,social_sum,fund_sum,other_sum,total,creator,create_time,update_time,delete_type,tenant_key,payment_organization, social_payment_com_base_string,fund_payment_com_base_string,other_payment_com_base_string, - subcompany_name,subcompany_id,department_name,department_id,jobtitle_name,jobtitle_id,jobcall,jobcall_id,status) + subcompany_name,subcompany_id,department_name,department_id,jobtitle_name,jobtitle_id,jobcall,jobcall_id,status,social_special_json,fund_special_json) VALUES ( #{item.employeeId}, @@ -1096,7 +1104,9 @@ #{item.jobtitleId}, #{item.jobcall}, #{item.jobcallId}, - #{item.status} + #{item.status}, + #{item.socialSpecialJson}, + #{item.fundSpecialJson} ) @@ -1313,6 +1323,8 @@ supplementary_month = #{supplementaryMonth}, + social_special_json = #{socialSpecialJson}, + fund_special_json = #{fundSpecialJson} WHERE id = #{id} diff --git a/src/com/engine/salary/mapper/siaccount/SIAccountDetailTempMapper.xml b/src/com/engine/salary/mapper/siaccount/SIAccountDetailTempMapper.xml index ca12fe478..dc69e462c 100644 --- a/src/com/engine/salary/mapper/siaccount/SIAccountDetailTempMapper.xml +++ b/src/com/engine/salary/mapper/siaccount/SIAccountDetailTempMapper.xml @@ -111,6 +111,8 @@ , t.jobcall as jobcall , t.jobcall_id as jobcallId , t.status as status + , t.social_special_json as socialSpecialJson + , t.fund_special_json as fundSpecialJson @@ -147,7 +149,7 @@ social_per_sum,fund_per_json,fund_per_sum,other_per_json,other_per_sum,per_sum,social_com_json,social_com_sum,fund_com_json,fund_com_sum,other_com_json,other_com_sum, com_sum,social_sum,fund_sum,other_sum,total,creator,create_time,update_time,delete_type,tenant_key,payment_organization, social_payment_com_base_string,fund_payment_com_base_string,other_payment_com_base_string, - subcompany_name,subcompany_id,department_name,department_id,jobtitle_name,jobtitle_id,jobcall,jobcall_id,status) + subcompany_name,subcompany_id,department_name,department_id,jobtitle_name,jobtitle_id,jobcall,jobcall_id,status,social_special_json,fund_special_json) VALUES ( @@ -204,7 +206,9 @@ #{item.jobtitleId}, #{item.jobcall}, #{item.jobcallId}, - #{item.status} + #{item.status}, + #{item.socialSpecialJson}, + #{item.fundSpecialJson} ) @@ -215,7 +219,7 @@ social_per_sum,fund_per_json,fund_per_sum,other_per_json,other_per_sum,per_sum,social_com_json,social_com_sum,fund_com_json,fund_com_sum,other_com_json,other_com_sum, com_sum,social_sum,fund_sum,other_sum,total,creator,create_time,update_time,delete_type,tenant_key,payment_organization, social_payment_com_base_string,fund_payment_com_base_string,other_payment_com_base_string, - subcompany_name,subcompany_id,department_name,department_id,jobtitle_name,jobtitle_id,jobcall,jobcall_id,status) + subcompany_name,subcompany_id,department_name,department_id,jobtitle_name,jobtitle_id,jobcall,jobcall_id,status,social_special_json,fund_special_json) select @@ -272,7 +276,9 @@ #{item.jobtitleId,jdbcType=DOUBLE}, #{item.jobcall,jdbcType=VARCHAR}, #{item.jobcallId,jdbcType=DOUBLE}, - #{item.status,jdbcType=VARCHAR} + #{item.status,jdbcType=VARCHAR}, + #{item.socialSpecialJson,jdbcType=VARCHAR}, + #{item.fundSpecialJson,jdbcType=VARCHAR} from dual @@ -284,7 +290,7 @@ social_per_sum,fund_per_json,fund_per_sum,other_per_json,other_per_sum,per_sum,social_com_json,social_com_sum,fund_com_json,fund_com_sum,other_com_json,other_com_sum, com_sum,social_sum,fund_sum,other_sum,total,creator,create_time,update_time,delete_type,tenant_key,payment_organization, social_payment_com_base_string,fund_payment_com_base_string,other_payment_com_base_string, - subcompany_name,subcompany_id,department_name,department_id,jobtitle_name,jobtitle_id,jobcall,jobcall_id,status) + subcompany_name,subcompany_id,department_name,department_id,jobtitle_name,jobtitle_id,jobcall,jobcall_id,status,social_special_json,fund_special_json) VALUES ( #{item.employeeId}, @@ -340,7 +346,9 @@ #{item.jobtitleId}, #{item.jobcall}, #{item.jobcallId}, - #{item.status} + #{item.status}, + #{item.socialSpecialJson}, + #{item.fundSpecialJson} ) diff --git a/src/com/engine/salary/mapper/siaccount/UfTsrysjsbfldaMapper.java b/src/com/engine/salary/mapper/siaccount/UfTsrysjsbfldaMapper.java new file mode 100644 index 000000000..62aef9aee --- /dev/null +++ b/src/com/engine/salary/mapper/siaccount/UfTsrysjsbfldaMapper.java @@ -0,0 +1,21 @@ +package com.engine.salary.mapper.siaccount; + +import com.engine.salary.entity.siaccount.po.UfTsrysjsbfldaPO; + +import java.util.List; + +/** + * @author Harryxzy + * @ClassName UfTsrysjsbfldaMapper + * @date 2025/01/20 11:14 + * @description + */ +public interface UfTsrysjsbfldaMapper { + /** + * 条件查询 + * + * @return 返回集合,没有返回空List + */ + List listSome(UfTsrysjsbfldaPO ufTsrysjsbfldaDt1); + +} diff --git a/src/com/engine/salary/mapper/siaccount/UfTsrysjsbfldaMapper.xml b/src/com/engine/salary/mapper/siaccount/UfTsrysjsbfldaMapper.xml new file mode 100644 index 000000000..604a3aa4e --- /dev/null +++ b/src/com/engine/salary/mapper/siaccount/UfTsrysjsbfldaMapper.xml @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + t.id + , t.yg + , t.sxyf + , dt1.dyjs + , dt1.dybl + , dt1.sbflxm + + + + + + + + \ No newline at end of file diff --git a/src/com/engine/salary/service/UfTsrysjsbfldaService.java b/src/com/engine/salary/service/UfTsrysjsbfldaService.java new file mode 100644 index 000000000..1db8699de --- /dev/null +++ b/src/com/engine/salary/service/UfTsrysjsbfldaService.java @@ -0,0 +1,17 @@ +package com.engine.salary.service; + +import com.engine.salary.entity.siaccount.po.UfTsrysjsbfldaPO; + +import java.util.List; + +/** + * @author Harryxzy + * @ClassName UfTsrysjsbfldaService + * @date 2025/01/20 11:21 + * @description + */ +public interface UfTsrysjsbfldaService { + List listSome(UfTsrysjsbfldaPO param); + + List listByEmpIdsAndMonth(List empIds, String billMonth); +} diff --git a/src/com/engine/salary/service/impl/ColumnBuildServiceImpl.java b/src/com/engine/salary/service/impl/ColumnBuildServiceImpl.java index d9edd129e..fbddc78a4 100644 --- a/src/com/engine/salary/service/impl/ColumnBuildServiceImpl.java +++ b/src/com/engine/salary/service/impl/ColumnBuildServiceImpl.java @@ -50,6 +50,7 @@ public class ColumnBuildServiceImpl extends Service implements ColumnBuildServic Map categoryIdNameMap = getICategoryMapper().listAll().stream().collect(Collectors.toMap(ICategoryPO -> String.valueOf(ICategoryPO.getId()), ICategoryPO::getInsuranceName)); Map> columns = buildPaymentTitle(pos, categoryIdNameMap, employeeId, tenantKey); Map> personColumns = buildPersonalTitle(pos, categoryIdNameMap, employeeId, tenantKey); + Map> specialColumns = buildSpecialTitle(pos, categoryIdNameMap, employeeId, tenantKey); Map> comColumns = buildComTitle(pos, categoryIdNameMap, employeeId, tenantKey); WeaTableColumn weaTableNameColumn = new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 85429, "姓名"), "userName"); weaTableNameColumn.setFixed("left"); @@ -103,10 +104,20 @@ public class ColumnBuildServiceImpl extends Service implements ColumnBuildServic list.add(new WeaTableColumn("150px",k, v)); }); list.add(new WeaTableColumn("150px","" + SalaryI18nUtil.getI18nLabel( 100388, "社保个人合计") + "", "socialPerSum")); + // 钱智 二开 + specialColumns.get(WelfareTypeEnum.SOCIAL_SECURITY.getValue()).forEach((k, v) -> { + list.add(new WeaTableColumn("150px",k, v)); + }); + list.add(new WeaTableColumn("150px","" + SalaryI18nUtil.getI18nLabel( 0, "个人额外-社保合计") + "", "socialSpecialSum")); personColumns.get(WelfareTypeEnum.ACCUMULATION_FUND.getValue()).forEach((k, v) -> { list.add(new WeaTableColumn("150px",k, v)); }); list.add(new WeaTableColumn("150px","" + SalaryI18nUtil.getI18nLabel( 100390, "公积金个人合计") + "", "fundPerSum")); + // 钱智 二开 + specialColumns.get(WelfareTypeEnum.ACCUMULATION_FUND.getValue()).forEach((k, v) -> { + list.add(new WeaTableColumn("150px",k, v)); + }); + list.add(new WeaTableColumn("150px","" + SalaryI18nUtil.getI18nLabel( 0, "个人额外-公积金合计") + "", "fundSpecialSum")); personColumns.get(WelfareTypeEnum.OTHER.getValue()).forEach((k, v) -> { list.add(new WeaTableColumn("150px",k, v)); }); @@ -367,6 +378,58 @@ public class ColumnBuildServiceImpl extends Service implements ColumnBuildServic return result; } + private Map> buildSpecialTitle(List pos, Map categoryIdNameMap, Long employeeId, String tenantKey) { + Set socailIds = new HashSet<>(); + Set fundIds = new HashSet<>(); + Map> result = new HashMap<>(); + + pos.stream().forEach(item -> { + if (StringUtils.isNotBlank(item.getSocialSpecialJson())) { + Map socialSpecialJson = JSON.parseObject(item.getSocialSpecialJson(), new HashMap().getClass()); + if(socialSpecialJson!=null){ + socialSpecialJson.forEach((k, v) -> { + socailIds.add(k); + }); + } + + } + if (StringUtils.isNotBlank(item.getFundSpecialJson())) { + Map fundSpecialJson = JSON.parseObject(item.getFundSpecialJson(), new HashMap().getClass()); + if(fundSpecialJson!=null){ + fundSpecialJson.forEach((k, v) -> { + fundIds.add(k); + }); + } + } + }); + Map socialColumns = new HashMap<>(); + Map fundColumns = new HashMap<>(); + socailIds.stream().forEach(social -> { + if (categoryIdNameMap.containsKey(social)) { + socialColumns.put(SalaryI18nUtil.getI18nLabel( 0, "个人额外-") + categoryIdNameMap.get(social) , social + "socialSpecial"); + } + }); + fundIds.stream().forEach(social -> { + if (categoryIdNameMap.containsKey(social)) { + fundColumns.put(SalaryI18nUtil.getI18nLabel( 0, "个人额外-") + categoryIdNameMap.get(social), social + "fundSpecial"); + } + }); + + // map根据value排序 + LinkedHashMap socialColumnsWithAscValue = socialColumns.entrySet().stream() + .sorted(Map.Entry.comparingByValue()) + .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (oldValue, newValue) -> oldValue, + LinkedHashMap::new)); + LinkedHashMap fundColumnsWithAscValue = fundColumns.entrySet().stream() + .sorted(Map.Entry.comparingByValue()) + .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (oldValue, newValue) -> oldValue, + LinkedHashMap::new)); + + result.put(WelfareTypeEnum.SOCIAL_SECURITY.getValue(), socialColumnsWithAscValue); + result.put(WelfareTypeEnum.ACCUMULATION_FUND.getValue(), fundColumnsWithAscValue); + return result; + } + private Map> buildComTitle(List pos, Map categoryIdNameMap, Long employeeId, String tenantKey) { Set socailIds = new HashSet<>(); Set fundIds = new HashSet<>(); diff --git a/src/com/engine/salary/service/impl/RecordsBuildServiceImpl.java b/src/com/engine/salary/service/impl/RecordsBuildServiceImpl.java index 29ee07ccc..17732eacf 100644 --- a/src/com/engine/salary/service/impl/RecordsBuildServiceImpl.java +++ b/src/com/engine/salary/service/impl/RecordsBuildServiceImpl.java @@ -30,9 +30,11 @@ import com.engine.salary.util.db.MapperProxyFactory; import com.google.common.collect.Lists; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.math.NumberUtils; import weaver.general.Util; import weaver.hrm.User; +import java.math.BigDecimal; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.*; @@ -269,7 +271,30 @@ public class RecordsBuildServiceImpl extends Service implements RecordsBuildServ } } + + // 钱智 社保差异 + final BigDecimal[] socialSpecialSum = {new BigDecimal(0)}; + if (StringUtils.isNotEmpty(item.getSocialSpecialJson())) { + Map socialSpecialJson = JSON.parseObject(item.getSocialSpecialJson(), new HashMap().getClass()); + if(socialSpecialJson!=null){ + socialSpecialJson.forEach((k, v) -> { + String standardSocialPer = Util.null2String(record.get(k + "socialPer")); + BigDecimal standardSocialPerVal = new BigDecimal(0); + BigDecimal specialSocialPerVal = new BigDecimal(0); + if (NumberUtils.isCreatable(standardSocialPer)) { + standardSocialPerVal = new BigDecimal(standardSocialPer); + } + if (v != null && NumberUtils.isCreatable(v.toString())) { + specialSocialPerVal = new BigDecimal(v.toString()); + } + BigDecimal subtract = specialSocialPerVal.subtract(standardSocialPerVal); + socialSpecialSum[0] = socialSpecialSum[0].add(subtract); + record.put(k + "socialSpecial", subtract.toString()); + }); + } + } record.put("socialPerSum", item.getSocialPerSum()); + record.put("socialSpecialSum", socialSpecialSum[0]); if (StringUtils.isNotEmpty(item.getFundPerJson())) { Map fundPerJson = JSON.parseObject(item.getFundPerJson(), new HashMap().getClass()); if(fundPerJson!=null){ @@ -279,7 +304,29 @@ public class RecordsBuildServiceImpl extends Service implements RecordsBuildServ } } + // 钱智 公积金差异 + final BigDecimal[] fundSpecialSum = {new BigDecimal(0)}; + if (StringUtils.isNotEmpty(item.getFundSpecialJson())) { + Map fundSpecialJson = JSON.parseObject(item.getFundSpecialJson(), new HashMap().getClass()); + if(fundSpecialJson!=null){ + fundSpecialJson.forEach((k, v) -> { + String standardFundPer = Util.null2String(record.get(k + "fundPer")); + BigDecimal standardFundPerVal = new BigDecimal(0); + BigDecimal specialFundPerVal = new BigDecimal(0); + if (NumberUtils.isCreatable(standardFundPer)) { + standardFundPerVal = new BigDecimal(standardFundPer); + } + if (v != null && NumberUtils.isCreatable(v.toString())) { + specialFundPerVal = new BigDecimal(v.toString()); + } + BigDecimal subtract = specialFundPerVal.subtract(standardFundPerVal); + fundSpecialSum[0] = fundSpecialSum[0].add(subtract); + record.put(k + "fundSpecial", subtract.toString()); + }); + } + } record.put("fundPerSum", item.getFundPerSum()); + record.put("fundSpecialSum", fundSpecialSum[0]); if (StringUtils.isNotEmpty(item.getOtherPerJson())) { Map fundPerJson = JSON.parseObject(item.getOtherPerJson(), new HashMap().getClass()); if(fundPerJson!=null){ diff --git a/src/com/engine/salary/service/impl/SIAccountServiceImpl.java b/src/com/engine/salary/service/impl/SIAccountServiceImpl.java index 18d48fccd..73db14b83 100644 --- a/src/com/engine/salary/service/impl/SIAccountServiceImpl.java +++ b/src/com/engine/salary/service/impl/SIAccountServiceImpl.java @@ -163,6 +163,10 @@ public class SIAccountServiceImpl extends Service implements SIAccountService { return ServiceUtil.getService(SalaryEmployeeServiceImpl.class, user); } + private UfTsrysjsbfldaService getUfTsrysjsbfldaService(User user) { + return ServiceUtil.getService(UfTsrysjsbfldaServiceImpl.class, user); + } + private SalarySysConfService getSalarySysConfService(User user) { return ServiceUtil.getService(SalarySysConfServiceImpl.class, user); } @@ -1087,6 +1091,28 @@ public class SIAccountServiceImpl extends Service implements SIAccountService { record.put(k + "socialCommonPer", v); }); } + + // 钱智 社保差异 + final BigDecimal[] socialSpecialSum = {new BigDecimal(0)}; + if (StringUtils.isNotEmpty(item.getSocialSpecialJson())) { + Map socialSpecialJson = JSON.parseObject(item.getSocialSpecialJson(), new HashMap().getClass()); + if(socialSpecialJson!=null){ + socialSpecialJson.forEach((k, v) -> { + String standardSocialPer = Util.null2String(record.get(k + "socialCommonPer")); + BigDecimal standardSocialPerVal = new BigDecimal(0); + BigDecimal specialSocialPerVal = new BigDecimal(0); + if (org.apache.commons.lang3.math.NumberUtils.isCreatable(standardSocialPer)) { + standardSocialPerVal = new BigDecimal(standardSocialPer); + } + if (v != null && org.apache.commons.lang3.math.NumberUtils.isCreatable(v.toString())) { + specialSocialPerVal = new BigDecimal(v.toString()); + } + BigDecimal subtract = specialSocialPerVal.subtract(standardSocialPerVal); + socialSpecialSum[0] = socialSpecialSum[0].add(subtract); + record.put(k + "socialSpecial", subtract.toString()); + }); + } + } if (commonSiAcct != null && StringUtils.isNotEmpty(commonSiAcct.getSocialComJson())) { Map socialJson = JSON.parseObject(commonSiAcct.getSocialComJson(), new HashMap().getClass()); socialJson.forEach((k, v) -> { @@ -1095,6 +1121,7 @@ public class SIAccountServiceImpl extends Service implements SIAccountService { } record.put("socialPerCommonSum", commonSiAcct != null ? commonSiAcct.getSocialPerSum() : new BigDecimal("0")); record.put("socialComCommonSum", commonSiAcct != null ? commonSiAcct.getSocialComSum() : new BigDecimal("0")); + record.put("socialSpecialSum", socialSpecialSum[0]); //社保-补缴 if (repairSiAcct != null && StringUtils.isNotEmpty(repairSiAcct.getSocialPerJson())) { Map socialJson = JSON.parseObject(repairSiAcct.getSocialPerJson(), new HashMap().getClass()); @@ -1133,6 +1160,27 @@ public class SIAccountServiceImpl extends Service implements SIAccountService { record.put(k + "fundCommonPer", v); }); } + // 钱智 公积金差异 + final BigDecimal[] fundSpecialSum = {new BigDecimal(0)}; + if (StringUtils.isNotEmpty(item.getFundSpecialJson())) { + Map fundSpecialJson = JSON.parseObject(item.getFundSpecialJson(), new HashMap().getClass()); + if(fundSpecialJson!=null){ + fundSpecialJson.forEach((k, v) -> { + String standardFundPer = Util.null2String(record.get(k + "fundCommonPer")); + BigDecimal standardFundPerVal = new BigDecimal(0); + BigDecimal specialFundPerVal = new BigDecimal(0); + if (org.apache.commons.lang3.math.NumberUtils.isCreatable(standardFundPer)) { + standardFundPerVal = new BigDecimal(standardFundPer); + } + if (v != null && org.apache.commons.lang3.math.NumberUtils.isCreatable(v.toString())) { + specialFundPerVal = new BigDecimal(v.toString()); + } + BigDecimal subtract = specialFundPerVal.subtract(standardFundPerVal); + fundSpecialSum[0] = fundSpecialSum[0].add(subtract); + record.put(k + "fundSpecial", subtract.toString()); + }); + } + } if (commonSiAcct != null && StringUtils.isNotEmpty(commonSiAcct.getFundComJson())) { Map socialJson = JSON.parseObject(commonSiAcct.getFundComJson(), new HashMap().getClass()); socialJson.forEach((k, v) -> { @@ -1141,6 +1189,7 @@ public class SIAccountServiceImpl extends Service implements SIAccountService { } record.put("fundPerCommonSum", commonSiAcct != null ? commonSiAcct.getFundPerSum() : new BigDecimal("0")); record.put("fundComCommonSum", commonSiAcct != null ? commonSiAcct.getFundComSum() : new BigDecimal("0")); + record.put("fundSpecialSum", fundSpecialSum[0]); //公积金-补缴 if (repairSiAcct != null && StringUtils.isNotEmpty(repairSiAcct.getFundPerJson())) { Map fundJson = JSON.parseObject(repairSiAcct.getFundPerJson(), new HashMap().getClass()); @@ -1254,6 +1303,8 @@ public class SIAccountServiceImpl extends Service implements SIAccountService { commonResult.put(SalaryI18nUtil.getI18nLabel(0, "社保个人正常缴纳合计"), "socialPerCommonSum"); commonResult.put(SalaryI18nUtil.getI18nLabel(0, "公积金个人正常缴纳合计"), "fundPerCommonSum"); commonResult.put(SalaryI18nUtil.getI18nLabel(0, "其他福利个人正常缴纳合计"), "otherPerCommonSum"); + commonResult.put(SalaryI18nUtil.getI18nLabel(0, "个人额外-社保合计"), "socialSpecialSum"); + commonResult.put(SalaryI18nUtil.getI18nLabel(0, "个人额外-公积金合计"), "fundSpecialSum"); repairResult.put(SalaryI18nUtil.getI18nLabel(0, "个人补缴合计"), "perRepairSum"); repairResult.put(SalaryI18nUtil.getI18nLabel(0, "社保个人补缴合计"), "socialPerRepairSum"); repairResult.put(SalaryI18nUtil.getI18nLabel(0, "公积金个人补缴合计"), "fundPerRepairSum"); @@ -1271,6 +1322,7 @@ public class SIAccountServiceImpl extends Service implements SIAccountService { } result.put(categoryIdNameMap.get(String.valueOf(item.getId())) + SalaryI18nUtil.getI18nLabel(87159, "个人"), item.getId() + "socialPer"); commonResult.put(categoryIdNameMap.get(String.valueOf(item.getId())) + SalaryI18nUtil.getI18nLabel(0, "正常缴纳个人"), item.getId() + "socialCommonPer"); + commonResult.put(SalaryI18nUtil.getI18nLabel(0, "个人额外-") + categoryIdNameMap.get(String.valueOf(item.getId())) , item.getId() + "socialSpecial"); repairResult.put(categoryIdNameMap.get(String.valueOf(item.getId())) + SalaryI18nUtil.getI18nLabel(0, "补缴个人"), item.getId() + "socialRepairPer"); balanceResult.put(categoryIdNameMap.get(String.valueOf(item.getId())) + SalaryI18nUtil.getI18nLabel(0, "补差个人"), item.getId() + "socialBalancePer"); } @@ -1280,6 +1332,7 @@ public class SIAccountServiceImpl extends Service implements SIAccountService { } result.put(categoryIdNameMap.get(String.valueOf(item.getId())) + SalaryI18nUtil.getI18nLabel(87159, "个人"), item.getId() + "fundPer"); commonResult.put(categoryIdNameMap.get(String.valueOf(item.getId())) + SalaryI18nUtil.getI18nLabel(0, "正常缴纳个人"), item.getId() + "fundCommonPer"); + commonResult.put(SalaryI18nUtil.getI18nLabel(0, "个人额外-") + categoryIdNameMap.get(String.valueOf(item.getId())) , item.getId() + "fundSpecial"); repairResult.put(categoryIdNameMap.get(String.valueOf(item.getId())) + SalaryI18nUtil.getI18nLabel(0, "补缴个人"), item.getId() + "fundRepairPer"); balanceResult.put(categoryIdNameMap.get(String.valueOf(item.getId())) + SalaryI18nUtil.getI18nLabel(0, "补差个人"), item.getId() + "fundBalancePer"); } @@ -1390,6 +1443,8 @@ public class SIAccountServiceImpl extends Service implements SIAccountService { Map socialComMap = new HashMap<>(); Map fundComMap = new HashMap<>(); Map otherComMap = new HashMap<>(); + Map socialSpecialMap = new HashMap<>(); + Map fundSpecialMap = new HashMap<>(); BigDecimal socialPer = new BigDecimal("0"); BigDecimal socialCom = new BigDecimal("0"); BigDecimal fundPer = new BigDecimal("0"); @@ -1455,6 +1510,24 @@ public class SIAccountServiceImpl extends Service implements SIAccountService { }); } + } + if (StringUtils.isNotBlank(item.getSocialSpecialJson())) { + Map socialJson = JSON.parseObject(item.getSocialSpecialJson(), new HashMap().getClass()); + if (socialJson != null) { + socialJson.forEach((insuranceId, num) -> { + if (socialSpecialMap.get(insuranceId) == null) { + socialSpecialMap.put(insuranceId, num); + } else { + String oldNum = socialSpecialMap.get(insuranceId); + BigDecimal insuanceNum = new BigDecimal("0"); + BigDecimal oldDecimal = new BigDecimal(oldNum); + BigDecimal numDecimal = num == null ? new BigDecimal("0") : new BigDecimal(num); + insuanceNum = insuanceNum.add(numDecimal).add(oldDecimal); + socialSpecialMap.put(insuranceId, insuanceNum.toPlainString()); + } + }); + } + } if (StringUtils.isNotBlank(item.getFundPerJson())) { Map fundJson = JSON.parseObject(item.getFundPerJson(), new HashMap().getClass()); @@ -1491,6 +1564,24 @@ public class SIAccountServiceImpl extends Service implements SIAccountService { }); } + } + if (StringUtils.isNotBlank(item.getFundSpecialJson())) { + Map fundJson = JSON.parseObject(item.getFundSpecialJson(), new HashMap().getClass()); + if (fundJson != null) { + fundJson.forEach((insuranceId, num) -> { + if (fundSpecialMap.get(insuranceId) == null) { + fundSpecialMap.put(insuranceId, num); + } else { + String oldNum = fundSpecialMap.get(insuranceId); + BigDecimal insuanceNum = new BigDecimal("0"); + BigDecimal oldDecimal = new BigDecimal(oldNum); + BigDecimal numDecimal = num == null ? new BigDecimal("0") : new BigDecimal(num); + insuanceNum = insuanceNum.add(numDecimal).add(oldDecimal); + fundSpecialMap.put(insuranceId, insuanceNum.toPlainString()); + } + }); + } + } if (StringUtils.isNotBlank(item.getOtherPerJson())) { Map otherJson = JSON.parseObject(item.getOtherPerJson(), new HashMap().getClass()); @@ -1543,6 +1634,8 @@ public class SIAccountServiceImpl extends Service implements SIAccountService { insuranceAccountDetailPO.setOtherComSum(otherCom.toPlainString()); insuranceAccountDetailPO.setPerSum(perSum.toPlainString()); insuranceAccountDetailPO.setComSum(comSum.toPlainString()); + insuranceAccountDetailPO.setSocialSpecialJson(JSON.toJSONString(socialSpecialMap)); + insuranceAccountDetailPO.setFundSpecialJson(JSON.toJSONString(fundSpecialMap)); newList.add(insuranceAccountDetailPO); } return newList; @@ -1618,7 +1711,7 @@ public class SIAccountServiceImpl extends Service implements SIAccountService { List welfareNames = (List) param.getWelfareNames(); headerList.addAll(welfareNames); //匹配welfareName对应的id - List welfareList = getSalaryFormulaWrapper(user).welfareList(); + List welfareList = getSalaryFormulaWrapper(user).welfareList(null); Map welfareNameMap = welfareList.stream().collect(Collectors.toMap(InsuranceAcctDetailImportFieldDTO::getSalaryItemName, InsuranceAcctDetailImportFieldDTO::getFieldId, (key1, key2) -> key2)); welfareNames.forEach(f -> { if (StringUtils.isNotBlank(welfareNameMap.get(f))) { @@ -2177,6 +2270,9 @@ public class SIAccountServiceImpl extends Service implements SIAccountService { Map fundComMap = new HashMap<>(); Map otherComMap = new HashMap<>(); + Map socialSpecialMap = new HashMap<>(); + Map fundSpecialMap = new HashMap<>(); + //筛选出福利核算项 Map toDealMap = baseMap.entrySet().stream() @@ -2231,6 +2327,28 @@ public class SIAccountServiceImpl extends Service implements SIAccountService { } } + // 钱智二开 + //获取元素名后缀,方便之后判断“个人”或“单位” + if (StringUtils.isNotBlank(keyName) && keyName.length() > 5) { + String specialScope = keyName.substring(0,5); + if (specialScope.equals("个人额外-")) { + categoryPOList = getSICategoryService(user).listByName(entry.getKey().substring(5)); + if (categoryPOList.size() == 1) { + ICategoryPO iCategoryPO = categoryPOList.get(0); + welfareType = iCategoryPO.getWelfareType(); + switch (welfareType) { + case 1: + socialSpecialMap.put(iCategoryPO.getId().toString(), entry.getValue().toString()); + break; + case 2: + fundSpecialMap.put(iCategoryPO.getId().toString(), entry.getValue().toString()); + break; + default: + throw new SalaryRunTimeException("福利类型不存在"); + } + } + } + } } //组装新的insuranceAccountDetailPO对象数据 @@ -2245,6 +2363,11 @@ public class SIAccountServiceImpl extends Service implements SIAccountService { insuranceAccountDetailPO.setSocialComJson(JSON.toJSONString(socialComMap)); } + if (!socialSpecialMap.isEmpty()) { + checkJsonMap(socialSpecialMap, insuranceAccountDetailPO.getSocialSpecialJson()); + insuranceAccountDetailPO.setSocialSpecialJson(JSON.toJSONString(socialSpecialMap)); + } + if (!fundPerMap.isEmpty()) { checkJsonMap(fundPerMap, insuranceAccountDetailPO.getFundPerJson()); insuranceAccountDetailPO.setFundPerJson(JSON.toJSONString(fundPerMap)); @@ -2254,6 +2377,10 @@ public class SIAccountServiceImpl extends Service implements SIAccountService { checkJsonMap(fundComMap, insuranceAccountDetailPO.getFundComJson()); insuranceAccountDetailPO.setFundComJson(JSON.toJSONString(fundComMap)); } + if (!fundSpecialMap.isEmpty()) { + checkJsonMap(fundSpecialMap, insuranceAccountDetailPO.getFundSpecialJson()); + insuranceAccountDetailPO.setFundSpecialJson(JSON.toJSONString(fundSpecialMap)); + } if (!otherPerMap.isEmpty()) { checkJsonMap(otherPerMap, insuranceAccountDetailPO.getOtherPerJson()); @@ -5069,6 +5196,9 @@ public class SIAccountServiceImpl extends Service implements SIAccountService { } public void siCommonAccount(String billMonth, List ids, Long paymentOrganization, boolean isFirstFlag) { + // 获取这些员工的特殊人员社保福利档案数据 + List ufTsrysjsbfldaPOS = getUfTsrysjsbfldaService(user).listByEmpIdsAndMonth(ids, billMonth); + Map> ufTsrysjsbfldaListMap = SalaryEntityUtil.group2Map(ufTsrysjsbfldaPOS, UfTsrysjsbfldaPO::getYg); // Map insuranceArchivesAccountPOS = siArchivesBiz.buildBatchAccount(ids, paymentOrganization); Map insuranceArchivesAccountPOS = getSIArchivesService(user).buildBatchAccount(ids, paymentOrganization); @@ -5130,10 +5260,12 @@ public class SIAccountServiceImpl extends Service implements SIAccountService { } } + // 获取特殊人员社保福利档案数据 + List ufTsrysjsbfldaList = ufTsrysjsbfldaListMap.get(k.intValue()); //核算社保 - accountSocial(insuranceAccountDetailPO, v, billMonth); + accountSocial(insuranceAccountDetailPO, v, billMonth, ufTsrysjsbfldaList); //核算公积金 - accountFund(insuranceAccountDetailPO, v, billMonth); + accountFund(insuranceAccountDetailPO, v, billMonth, ufTsrysjsbfldaList); //核算其他福利 accountOther(insuranceAccountDetailPO, v, billMonth); //计算合计 @@ -5335,7 +5467,7 @@ public class SIAccountServiceImpl extends Service implements SIAccountService { } - public InsuranceAccountDetailPO accountFund(InsuranceAccountDetailPO insuranceAccountDetailPO, InsuranceArchivesAccountPO accountPO, String billMonth) { + public InsuranceAccountDetailPO accountFund(InsuranceAccountDetailPO insuranceAccountDetailPO, InsuranceArchivesAccountPO accountPO, String billMonth, List ufTsrysjsbfldaList) { // boolean welBaseDiffSign = siArchivesBiz.isDiffWelBase(); boolean welBaseDiffSign = getSIArchivesService(user).isDiffWelBase(); if (accountPO.getFund() != null) { @@ -5382,13 +5514,18 @@ public class SIAccountServiceImpl extends Service implements SIAccountService { List fundPer = new ArrayList<>(); Map fundPerJsonMap = new HashMap<>(); + Map ufTsrysjsbfldaPOMap = SalaryEntityUtil.convert2Map(ufTsrysjsbfldaList, po -> Long.valueOf(po.getSbflxm())); + Map specialFundJsonMap = new HashMap<>(); needArchivesPerson.stream().forEach(e -> { + // 获取特殊台账数据 + UfTsrysjsbfldaPO ufTsrysjsbfldaPO = ufTsrysjsbfldaPOMap.get(e); InsuranceSchemeDetailPO po = fundperson.get(e); BigDecimal paymentProportion = new BigDecimal(StringUtils.isBlank(po.getPaymentProportion()) ? "0" : po.getPaymentProportion()).divide(new BigDecimal("100")); BigDecimal paymentNum = new BigDecimal((ObjectUtil.isEmpty(archivesPerson) || StringUtils.isBlank(archivesPerson.get(String.valueOf(e)))) ? "0" : archivesPerson.get(String.valueOf(e))); BigDecimal fixedCost = StringUtils.isBlank(po.getFixedCost()) ? new BigDecimal("0") : new BigDecimal(po.getFixedCost()); Integer newScale = po.getValidNum() == null ? 0 : po.getValidNum(); BigDecimal result = new BigDecimal("0"); + BigDecimal specialResult = new BigDecimal("0"); if (Objects.equals(po.getPaymentCycle(), 1)) { int monthValue = 1; for (int i = monthIndex - 1; i >= 0; i--) { @@ -5410,10 +5547,16 @@ public class SIAccountServiceImpl extends Service implements SIAccountService { } else { result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost)); } + if (ufTsrysjsbfldaPO != null && ufTsrysjsbfldaPO.getDybl() != null && ufTsrysjsbfldaPO.getDyjs() != null) { + BigDecimal specialProportion = ufTsrysjsbfldaPO.getDybl().divide(new BigDecimal("100")); + specialResult = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), ufTsrysjsbfldaPO.getDyjs().multiply(specialProportion)); + specialFundJsonMap.put(String.valueOf(e), specialResult.toPlainString()); + } fundPerJsonMap.put(String.valueOf(e), result.toPlainString()); fundPer.add(result); }); insuranceAccountDetailPO.setFundPerJson(JSON.toJSONString(fundPerJsonMap)); + insuranceAccountDetailPO.setFundSpecialJson(JSON.toJSONString(specialFundJsonMap)); BigDecimal funPerSum = new BigDecimal("0"); for (BigDecimal bigDecimal : fundPer) { funPerSum = funPerSum.add(bigDecimal); @@ -5499,7 +5642,7 @@ public class SIAccountServiceImpl extends Service implements SIAccountService { } - public InsuranceAccountDetailPO accountSocial(InsuranceAccountDetailPO insuranceAccountDetailPO, InsuranceArchivesAccountPO accountPO, String billMonth) { + public InsuranceAccountDetailPO accountSocial(InsuranceAccountDetailPO insuranceAccountDetailPO, InsuranceArchivesAccountPO accountPO, String billMonth, List ufTsrysjsbfldaList) { // boolean welBaseDiffSign = siArchivesBiz.isDiffWelBase(); boolean welBaseDiffSign = getSIArchivesService(user).isDiffWelBase(); if (accountPO.getSocial() != null) { @@ -5548,13 +5691,18 @@ public class SIAccountServiceImpl extends Service implements SIAccountService { List socialPer = new ArrayList<>(); Map socialPerJsonMap = new HashMap<>(); + Map ufTsrysjsbfldaPOMap = SalaryEntityUtil.convert2Map(ufTsrysjsbfldaList, po -> Long.valueOf(po.getSbflxm())); + Map specialSocialJsonMap = new HashMap<>(); needArchivesPerson.forEach(e -> { + // 获取特殊台账数据 + UfTsrysjsbfldaPO ufTsrysjsbfldaPO = ufTsrysjsbfldaPOMap.get(e); InsuranceSchemeDetailPO po = schemeperson.get(e); BigDecimal paymentProportion = new BigDecimal(StringUtils.isBlank(po.getPaymentProportion()) ? "0" : po.getPaymentProportion()).divide(new BigDecimal("100")); BigDecimal paymentNum = new BigDecimal((ObjectUtil.isEmpty(archivesPerson) || StringUtils.isBlank(archivesPerson.get(String.valueOf(e)))) ? "0" : archivesPerson.get(String.valueOf(e))); BigDecimal fixedCost = StringUtils.isBlank(po.getFixedCost()) ? new BigDecimal("0") : new BigDecimal(po.getFixedCost()); Integer newScale = po.getValidNum() == null ? 0 : po.getValidNum(); BigDecimal result = new BigDecimal("0"); + BigDecimal specialResult = new BigDecimal("0"); if (Objects.equals(po.getPaymentCycle(), 1)) { int monthValue = 1; for (int i = monthIndex - 1; i >= 0; i--) { @@ -5576,10 +5724,16 @@ public class SIAccountServiceImpl extends Service implements SIAccountService { } else { result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost)); } + if (ufTsrysjsbfldaPO != null && ufTsrysjsbfldaPO.getDybl() != null && ufTsrysjsbfldaPO.getDyjs() != null) { + BigDecimal specialProportion = ufTsrysjsbfldaPO.getDybl().divide(new BigDecimal("100")); + specialResult = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), ufTsrysjsbfldaPO.getDyjs().multiply(specialProportion)); + specialSocialJsonMap.put(String.valueOf(e), specialResult.toPlainString()); + } socialPerJsonMap.put(String.valueOf(e), result.toPlainString()); socialPer.add(result); }); insuranceAccountDetailPO.setSocialPerJson(JSON.toJSONString(socialPerJsonMap)); + insuranceAccountDetailPO.setSocialSpecialJson(JSON.toJSONString(specialSocialJsonMap)); BigDecimal socialPerSum = new BigDecimal("0"); for (BigDecimal bigDecimal : socialPer) { socialPerSum = socialPerSum.add(bigDecimal); @@ -6151,6 +6305,11 @@ public class SIAccountServiceImpl extends Service implements SIAccountService { baseParam.getProjects() == null ? new ArrayList<>() : baseParam.getProjects().stream().map(String::valueOf).collect(Collectors.toList()))); insuranceAccountDetailPO.setTenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY); insuranceAccountDetailPO.setResourceFrom(ResourceFromEnum.SYSTEM.getValue()); + + // 获取这些员工的特殊人员社保福利档案数据 + List ufTsrysjsbfldaPOS = getUfTsrysjsbfldaService(user).listByEmpIdsAndMonth(Collections.singletonList(baseParam.getEmployeeId()), baseParam.getBillMonth()); + Map> ufTsrysjsbfldaListMap = SalaryEntityUtil.group2Map(ufTsrysjsbfldaPOS, UfTsrysjsbfldaPO::getYg); + //缴纳组织=个税扣缴义务人 insuranceAccountDetailPO.setSocialPayOrg(baseParam.getPaymentOrganization()); if (projects.contains(ProjectTypeEnum.ALL.getValue())) { @@ -6164,16 +6323,16 @@ public class SIAccountServiceImpl extends Service implements SIAccountService { if (accountPO.getOther() != null) { accountPO.getOther().setOtherPaymentBaseString(baseParam.getOtherPaymentBaseString()); } - accountSocial(insuranceAccountDetailPO, accountPO, baseParam.getSupplementaryMonth()); - accountFund(insuranceAccountDetailPO, accountPO, baseParam.getSupplementaryMonth()); + accountSocial(insuranceAccountDetailPO, accountPO, baseParam.getSupplementaryMonth(), null); + accountFund(insuranceAccountDetailPO, accountPO, baseParam.getSupplementaryMonth(), null); accountOther(insuranceAccountDetailPO, accountPO, baseParam.getSupplementaryMonth()); } else if ("3".equals(baseParam.getSupplementType())) { accountSupSocialByData(insuranceAccountDetailPO, baseParam); accountSupFundByData(insuranceAccountDetailPO, baseParam); accountSupOtherByData(insuranceAccountDetailPO, baseParam); } else { - accountSocial(insuranceAccountDetailPO, accountPO, baseParam.getSupplementaryMonth()); - accountFund(insuranceAccountDetailPO, accountPO, baseParam.getSupplementaryMonth()); + accountSocial(insuranceAccountDetailPO, accountPO, baseParam.getSupplementaryMonth(), null); + accountFund(insuranceAccountDetailPO, accountPO, baseParam.getSupplementaryMonth(), null); accountOther(insuranceAccountDetailPO, accountPO, baseParam.getSupplementaryMonth()); } @@ -6184,11 +6343,11 @@ public class SIAccountServiceImpl extends Service implements SIAccountService { if (accountPO.getSocial() != null) { accountPO.getSocial().setSocialPaymentBaseString(baseParam.getSocialPaymentBaseString()); } - accountSocial(insuranceAccountDetailPO, accountPO, baseParam.getSupplementaryMonth()); + accountSocial(insuranceAccountDetailPO, accountPO, baseParam.getSupplementaryMonth(), null); } else if ("3".equals(baseParam.getSupplementType())) { accountSupSocialByData(insuranceAccountDetailPO, baseParam); } else { - accountSocial(insuranceAccountDetailPO, accountPO, baseParam.getSupplementaryMonth()); + accountSocial(insuranceAccountDetailPO, accountPO, baseParam.getSupplementaryMonth(), null); } } @@ -6223,11 +6382,11 @@ public class SIAccountServiceImpl extends Service implements SIAccountService { if (accountPO.getFund() != null) { accountPO.getFund().setFundPaymentBaseString(baseParam.getFundPaymentBaseString()); } - accountFund(insuranceAccountDetailPO, accountPO, baseParam.getSupplementaryMonth()); + accountFund(insuranceAccountDetailPO, accountPO, baseParam.getSupplementaryMonth(), null); } else if ("3".equals(baseParam.getSupplementType())) { accountSupFundByData(insuranceAccountDetailPO, baseParam); } else { - accountFund(insuranceAccountDetailPO, accountPO, baseParam.getSupplementaryMonth()); + accountFund(insuranceAccountDetailPO, accountPO, baseParam.getSupplementaryMonth(), null); } } if (projects.contains(ProjectTypeEnum.OTHER.getValue())) { diff --git a/src/com/engine/salary/service/impl/SIExportServiceImpl.java b/src/com/engine/salary/service/impl/SIExportServiceImpl.java index c0f281ae9..20790fba9 100644 --- a/src/com/engine/salary/service/impl/SIExportServiceImpl.java +++ b/src/com/engine/salary/service/impl/SIExportServiceImpl.java @@ -39,12 +39,14 @@ import com.engine.salary.util.SalaryI18nUtil; import com.engine.salary.util.db.MapperProxyFactory; import com.engine.salary.util.excel.ExcelUtil; import com.engine.salary.util.excel.ExcelUtilPlus; +import org.apache.commons.lang3.math.NumberUtils; import org.springframework.beans.BeanUtils; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.MapUtils; import org.apache.commons.lang3.StringUtils; import org.apache.poi.xssf.usermodel.XSSFWorkbook; import weaver.general.BaseBean; +import weaver.general.Util; import weaver.hrm.User; import java.math.BigDecimal; @@ -459,7 +461,29 @@ public class SIExportServiceImpl extends Service implements SIExportService { } } + // 钱智 社保差异 + final BigDecimal[] socialSpecialSum = {new BigDecimal(0)}; + if (StringUtils.isNotEmpty(item.getSocialSpecialJson())) { + Map socialSpecialJson = JSON.parseObject(item.getSocialSpecialJson(), new HashMap().getClass()); + if(socialSpecialJson!=null){ + socialSpecialJson.forEach((k, v) -> { + String standardSocialPer = Util.null2String(record.get(k + "socialPer")); + BigDecimal standardSocialPerVal = new BigDecimal(0); + BigDecimal specialSocialPerVal = new BigDecimal(0); + if (NumberUtils.isCreatable(standardSocialPer)) { + standardSocialPerVal = new BigDecimal(standardSocialPer); + } + if (v != null && NumberUtils.isCreatable(v.toString())) { + specialSocialPerVal = new BigDecimal(v.toString()); + } + BigDecimal subtract = specialSocialPerVal.subtract(standardSocialPerVal); + socialSpecialSum[0] = socialSpecialSum[0].add(subtract); + record.put(k + "socialSpecial", subtract.toString()); + }); + } + } record.put("socialPerSum", item.getSocialPerSum()); + record.put("socialSpecialSum", socialSpecialSum[0]); if (StringUtils.isNotEmpty(item.getFundPerJson())) { Map fundPerJson = JSON.parseObject(item.getFundPerJson(), new HashMap().getClass()); if (fundPerJson != null) { @@ -469,7 +493,28 @@ public class SIExportServiceImpl extends Service implements SIExportService { } } + final BigDecimal[] fundSpecialSum = {new BigDecimal(0)}; + if (StringUtils.isNotEmpty(item.getFundSpecialJson())) { + Map fundSpecialJson = JSON.parseObject(item.getFundSpecialJson(), new HashMap().getClass()); + if(fundSpecialJson!=null){ + fundSpecialJson.forEach((k, v) -> { + String standardFundPer = Util.null2String(record.get(k + "fundPer")); + BigDecimal standardFundPerVal = new BigDecimal(0); + BigDecimal specialFundPerVal = new BigDecimal(0); + if (NumberUtils.isCreatable(standardFundPer)) { + standardFundPerVal = new BigDecimal(standardFundPer); + } + if (v != null && NumberUtils.isCreatable(v.toString())) { + specialFundPerVal = new BigDecimal(v.toString()); + } + BigDecimal subtract = specialFundPerVal.subtract(standardFundPerVal); + fundSpecialSum[0] = fundSpecialSum[0].add(subtract); + record.put(k + "fundSpecial", subtract.toString()); + }); + } + } record.put("fundPerSum", item.getFundPerSum()); + record.put("fundSpecialSum", fundSpecialSum[0]); if (StringUtils.isNotEmpty(item.getOtherPerJson())) { Map fundPerJson = JSON.parseObject(item.getOtherPerJson(), new HashMap().getClass()); if (fundPerJson != null) { @@ -674,12 +719,64 @@ public class SIExportServiceImpl extends Service implements SIExportService { return result; } + private Map> buildSpecialTitle(List pos, Map categoryIdNameMap) { + Set socailIds = new HashSet<>(); + Set fundIds = new HashSet<>(); + Map> result = new HashMap<>(); + + pos.stream().forEach(item -> { + if (StringUtils.isNotBlank(item.getSocialSpecialJson())) { + Map socialSpecialJson = JSON.parseObject(item.getSocialSpecialJson(), new HashMap().getClass()); + if(socialSpecialJson!=null){ + socialSpecialJson.forEach((k, v) -> { + socailIds.add(k); + }); + } + + } + if (StringUtils.isNotBlank(item.getFundSpecialJson())) { + Map fundSpecialJson = JSON.parseObject(item.getFundSpecialJson(), new HashMap().getClass()); + if(fundSpecialJson!=null){ + fundSpecialJson.forEach((k, v) -> { + fundIds.add(k); + }); + } + } + }); + Map socialColumns = new HashMap<>(); + Map fundColumns = new HashMap<>(); + socailIds.stream().forEach(social -> { + if (categoryIdNameMap.containsKey(social)) { + socialColumns.put(SalaryI18nUtil.getI18nLabel( 0, "个人额外-") + categoryIdNameMap.get(social) , social + "socialSpecial"); + } + }); + fundIds.stream().forEach(social -> { + if (categoryIdNameMap.containsKey(social)) { + fundColumns.put(SalaryI18nUtil.getI18nLabel( 0, "个人额外-") + categoryIdNameMap.get(social), social + "fundSpecial"); + } + }); + + // map根据value排序 + LinkedHashMap socialColumnsWithAscValue = socialColumns.entrySet().stream() + .sorted(Map.Entry.comparingByValue()) + .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (oldValue, newValue) -> oldValue, + LinkedHashMap::new)); + LinkedHashMap fundColumnsWithAscValue = fundColumns.entrySet().stream() + .sorted(Map.Entry.comparingByValue()) + .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (oldValue, newValue) -> oldValue, + LinkedHashMap::new)); + + result.put(WelfareTypeEnum.SOCIAL_SECURITY.getValue(), socialColumnsWithAscValue); + result.put(WelfareTypeEnum.ACCUMULATION_FUND.getValue(), fundColumnsWithAscValue); + return result; + } private List buildCommonColumns(List pos, Integer paymentStatus) { List list = new ArrayList<>(); Map categoryIdNameMap = categoryIdNameMap(); Map> columns = buildPaymentTitle(pos, categoryIdNameMap); Map> personColumns = buildPersonalTitle(pos, categoryIdNameMap); + Map> specialColumns = buildSpecialTitle(pos, categoryIdNameMap); Map> comColumns = buildComTitle(pos, categoryIdNameMap); list.add(new WeaTableColumn("150px", SalaryI18nUtil.getI18nLabel(85429, "姓名"), "userName")); list.add(new WeaTableColumn("150px", SalaryI18nUtil.getI18nLabel(86185, "部门"), "department")); @@ -725,10 +822,22 @@ public class SIExportServiceImpl extends Service implements SIExportService { list.add(new WeaTableColumn("150px", k, v)); }); list.add(new WeaTableColumn("150px", SalaryI18nUtil.getI18nLabel(100388, "社保个人合计"), "socialPerSum")); + // 钱智 二开 + specialColumns.get(WelfareTypeEnum.SOCIAL_SECURITY.getValue()).forEach((k, v) -> { + list.add(new WeaTableColumn("150px",k, v)); + }); + list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 0, "个人额外-社保合计"), "socialSpecialSum")); + personColumns.get(WelfareTypeEnum.ACCUMULATION_FUND.getValue()).forEach((k, v) -> { list.add(new WeaTableColumn("150px", k, v)); }); list.add(new WeaTableColumn("150px", SalaryI18nUtil.getI18nLabel(100390, "公积金个人合计"), "fundPerSum")); + // 钱智 二开 + specialColumns.get(WelfareTypeEnum.ACCUMULATION_FUND.getValue()).forEach((k, v) -> { + list.add(new WeaTableColumn("150px",k, v)); + }); + list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 0, "个人额外-公积金合计"), "fundSpecialSum")); + personColumns.get(WelfareTypeEnum.OTHER.getValue()).forEach((k, v) -> { list.add(new WeaTableColumn("150px", k, v)); }); diff --git a/src/com/engine/salary/service/impl/UfTsrysjsbfldaServiceImpl.java b/src/com/engine/salary/service/impl/UfTsrysjsbfldaServiceImpl.java new file mode 100644 index 000000000..ea4b7c4b7 --- /dev/null +++ b/src/com/engine/salary/service/impl/UfTsrysjsbfldaServiceImpl.java @@ -0,0 +1,49 @@ +package com.engine.salary.service.impl; + +import com.engine.core.impl.Service; +import com.engine.salary.entity.siaccount.po.UfTsrysjsbfldaPO; +import com.engine.salary.mapper.siaccount.UfTsrysjsbfldaMapper; +import com.engine.salary.service.UfTsrysjsbfldaService; +import com.engine.salary.util.db.MapperProxyFactory; +import com.google.common.collect.Lists; +import org.apache.commons.collections4.CollectionUtils; +import weaver.general.BaseBean; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +/** + * @author Harryxzy + * @ClassName UfTsrysjsbfldaServicePO + * @date 2025/01/20 11:22 + * @description + */ +public class UfTsrysjsbfldaServiceImpl extends Service implements UfTsrysjsbfldaService { + + private UfTsrysjsbfldaMapper getUfTsrysjsbfldaMapper (){ + return MapperProxyFactory.getProxy(UfTsrysjsbfldaMapper.class); + } + + @Override + public List listSome(UfTsrysjsbfldaPO param) { + return getUfTsrysjsbfldaMapper().listSome(param); + } + + @Override + public List listByEmpIdsAndMonth(List empIds, String billMonth) { + if (CollectionUtils.isEmpty(empIds) || billMonth == null) { + return Collections.emptyList(); + } + List> partition = Lists.partition(empIds, 100); + ArrayList resultList = new ArrayList<>(); + partition.forEach(part -> { + List ygs = part.stream().map(Long::intValue).collect(Collectors.toList()); + resultList.addAll(listSome(UfTsrysjsbfldaPO.builder().toSxyf(billMonth).ygs(ygs).build())); + }); + BaseBean baseBean = new BaseBean(); + baseBean.writeLog("listByEmpIdsAndMonth"+billMonth + resultList.size()); + return resultList; + } +} diff --git a/src/com/engine/salary/web/SIAccountController.java b/src/com/engine/salary/web/SIAccountController.java index 80f37a159..2af4b59e3 100644 --- a/src/com/engine/salary/web/SIAccountController.java +++ b/src/com/engine/salary/web/SIAccountController.java @@ -438,9 +438,9 @@ public class SIAccountController { @GET @Path("/getWelfareList") @Produces(MediaType.APPLICATION_JSON) - public String getWelfareList(@Context HttpServletRequest request, @Context HttpServletResponse response) { + public String getWelfareList(@Context HttpServletRequest request, @Context HttpServletResponse response, @QueryParam(value = "listType") Integer listType) { User user = HrmUserVarify.getUser(request, response); - return new ResponseResult>(user).run(getSalaryFormulaWrapper(user)::welfareList); + return new ResponseResult>(user).run(getSalaryFormulaWrapper(user)::welfareList, listType); } /** diff --git a/src/com/engine/salary/wrapper/SalaryFormulaWrapper.java b/src/com/engine/salary/wrapper/SalaryFormulaWrapper.java index 1c62d921c..cb16cb46c 100644 --- a/src/com/engine/salary/wrapper/SalaryFormulaWrapper.java +++ b/src/com/engine/salary/wrapper/SalaryFormulaWrapper.java @@ -28,6 +28,7 @@ import com.engine.salary.util.JsonUtil; import com.engine.salary.util.db.MapperProxyFactory; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.lang3.math.NumberUtils; import weaver.hrm.User; import weaver.servicefiles.DataSourceXML; @@ -107,14 +108,17 @@ public class SalaryFormulaWrapper extends Service { /** * 获取薪资项目中福利类项目 */ - public List welfareList() { + public List welfareList(Integer listType) { List welfareList = new ArrayList<>(); SalaryFormulaFieldQueryParam param = new SalaryFormulaFieldQueryParam(); param.setSourceId("welfare"); //获取福利类薪资项目 List list = getRemoteExcelService(user).fieldList(param.getSourceId(), param.getExtendParam()); - list = list.stream().filter(f -> !(f.getName().contains("正常缴纳") || f.getName().contains("补缴") || f.getName().contains("补差") || f.getName().contains("申报基数"))).collect(Collectors.toList()); + list = list.stream().filter(f -> !(f.getName().contains("正常缴纳") || f.getName().contains("补缴") || f.getName().contains("补差") || f.getName().contains("申报基数") || f.getName().contains("个人额外-社保合计") || f.getName().contains("个人额外-公积金合计"))).collect(Collectors.toList()); + if (listType != null && listType.equals(NumberUtils.INTEGER_TWO)) { + list = list.stream().filter(f -> !(f.getName().contains("个人额外-"))).collect(Collectors.toList()); + } //提取出福利类项目名称 for (FormulaVar formulaVar : list) { InsuranceAcctDetailImportFieldDTO insuranceAcctDetailImportFieldDTO = new InsuranceAcctDetailImportFieldDTO(); @@ -146,8 +150,8 @@ public class SalaryFormulaWrapper extends Service { */ public List balanceWelfareList() { - List welfareList = welfareList(); - welfareList = welfareList.stream().filter(f -> !f.getSalaryItemName().contains("合计")).collect(Collectors.toList()); + List welfareList = welfareList(null); + welfareList = welfareList.stream().filter(f -> !(f.getSalaryItemName().contains("合计") || f.getSalaryItemName().contains("个人额外-"))).collect(Collectors.toList()); List noUseICategoryList= getICategoryMapper().listAll().stream().filter(f -> f.getIsUse() == 0).collect(Collectors.toList()); if (noUseICategoryList.size() > 0) {