From 9d0d7a00fcf99f89b98f6dd8e29862107d60cb2c Mon Sep 17 00:00:00 2001 From: sy Date: Fri, 8 Dec 2023 18:06:54 +0800 Subject: [PATCH] =?UTF-8?q?=E8=96=AA=E9=85=AC=E7=B3=BB=E7=BB=9F-=E7=A6=8F?= =?UTF-8?q?=E5=88=A9=E5=8F=B0=E8=B4=A6=EF=BC=8C=E7=BA=BF=E4=B8=8B=E5=AF=B9?= =?UTF-8?q?=E6=AF=94=E5=88=97=E8=A1=A8=E3=80=81=E5=AF=BC=E5=85=A5=E3=80=81?= =?UTF-8?q?=E5=AF=BC=E5=87=BA=EF=BC=8C=E9=80=82=E9=85=8D=E6=8B=86=E5=88=86?= =?UTF-8?q?=E7=A6=8F=E5=88=A9=E6=A1=A3=E6=A1=88=E4=B8=AA=E4=BA=BA=E5=92=8C?= =?UTF-8?q?=E5=85=AC=E5=8F=B8=E5=9F=BA=E6=95=B0=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bo/InsuranceComparisonResultBO.java | 6 - .../param/ExcelInsuranceImportParam.java | 3 +- .../siaccount/ExcelInsuranceDetailMapper.xml | 24 +- .../impl/SIAComparisonResultServiceImpl.java | 46 +- .../service/impl/SIAccountServiceImpl.java | 557 ++++++++++++++---- 5 files changed, 479 insertions(+), 157 deletions(-) diff --git a/src/com/engine/salary/entity/siaccount/bo/InsuranceComparisonResultBO.java b/src/com/engine/salary/entity/siaccount/bo/InsuranceComparisonResultBO.java index 79909c1e2..c6e6b40a3 100644 --- a/src/com/engine/salary/entity/siaccount/bo/InsuranceComparisonResultBO.java +++ b/src/com/engine/salary/entity/siaccount/bo/InsuranceComparisonResultBO.java @@ -242,12 +242,6 @@ public class InsuranceComparisonResultBO { //其他福利基数,otherPaymentBaseString welfareElementCompare(map, accountExportPO.getOtherPaymentBaseString(), excelAccountExportPO.getOtherPaymentBaseString(), "Base", 3); } - //社保基数,socialPaymentBaseString - welfareElementCompare(map, accountExportPO.getSocialPaymentBaseString(), excelAccountExportPO.getSocialPaymentBaseString(), "Base", 1); - //公积金基数,fundPaymentBaseString - welfareElementCompare(map, accountExportPO.getFundPaymentBaseString(), excelAccountExportPO.getFundPaymentBaseString(), "Base", 2); - //其他福利基数,otherPaymentBaseString - welfareElementCompare(map, accountExportPO.getOtherPaymentBaseString(), excelAccountExportPO.getOtherPaymentBaseString(), "Base", 3); //社保个人socialPerJson welfareElementCompare(map, accountExportPO.getSocialPerJson(), excelAccountExportPO.getSocialPerJson(), "Per", 1); //公积金个人fundPerJson diff --git a/src/com/engine/salary/entity/siaccount/param/ExcelInsuranceImportParam.java b/src/com/engine/salary/entity/siaccount/param/ExcelInsuranceImportParam.java index 17b926b08..7a9090845 100644 --- a/src/com/engine/salary/entity/siaccount/param/ExcelInsuranceImportParam.java +++ b/src/com/engine/salary/entity/siaccount/param/ExcelInsuranceImportParam.java @@ -25,5 +25,6 @@ public class ExcelInsuranceImportParam { /** * 账单月份 */ - private String billMonth; + private String billMonth; + private String paymentOrganization; } diff --git a/src/com/engine/salary/mapper/siaccount/ExcelInsuranceDetailMapper.xml b/src/com/engine/salary/mapper/siaccount/ExcelInsuranceDetailMapper.xml index d45fdec16..15ac635ce 100644 --- a/src/com/engine/salary/mapper/siaccount/ExcelInsuranceDetailMapper.xml +++ b/src/com/engine/salary/mapper/siaccount/ExcelInsuranceDetailMapper.xml @@ -157,7 +157,8 @@ (id,employee_id,bill_month,bill_status,payment_status,supplementary_month,supplementary_projects,resource_from,social_pay_org,social_account,social_scheme_id,social_payment_base_string, fund_pay_org,fund_account,supplement_fund_account,fund_scheme_id,fund_payment_base_string,other_pay_org,other_scheme_id,other_payment_base_string,social_per_json, 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) + 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) VALUES ( @@ -204,7 +205,10 @@ #{item.updateTime}, #{item.deleteType}, #{item.tenantKey}, - #{item.paymentOrganization} + #{item.paymentOrganization}, + #{item.socialPaymentComBaseString}, + #{item.fundPaymentComBaseString}, + #{item.otherPaymentComBaseString} ) @@ -213,7 +217,8 @@ (id,employee_id,bill_month,bill_status,payment_status,supplementary_month,supplementary_projects,resource_from,social_pay_org,social_account,social_scheme_id,social_payment_base_string, fund_pay_org,fund_account,supplement_fund_account,fund_scheme_id,fund_payment_base_string,other_pay_org,other_scheme_id,other_payment_base_string,social_per_json, 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) + 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) select #{item.id,jdbcType=DOUBLE}, @@ -259,7 +264,10 @@ #{item.updateTime}, #{item.deleteType}, #{item.tenantKey,jdbcType=VARCHAR}, - #{item.paymentOrganization,jdbcType=DOUBLE} + #{item.paymentOrganization,jdbcType=DOUBLE}, + #{item.socialPaymentComBaseString,jdbcType=VARCHAR}, + #{item.fundPaymentComBaseString,jdbcType=VARCHAR}, + #{item.otherPaymentComBaseString,jdbcType=VARCHAR} from dual @@ -269,7 +277,8 @@ (id,employee_id,bill_month,bill_status,payment_status,supplementary_month,supplementary_projects,resource_from,social_pay_org,social_account,social_scheme_id,social_payment_base_string, fund_pay_org,fund_account,supplement_fund_account,fund_scheme_id,fund_payment_base_string,other_pay_org,other_scheme_id,other_payment_base_string,social_per_json, 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) + 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) VALUES ( #{item.id}, @@ -315,7 +324,10 @@ #{item.updateTime}, #{item.deleteType}, #{item.tenantKey}, - #{item.paymentOrganization} + #{item.paymentOrganization}, + #{item.socialPaymentComBaseString}, + #{item.fundPaymentComBaseString}, + #{item.otherPaymentComBaseString} ) diff --git a/src/com/engine/salary/service/impl/SIAComparisonResultServiceImpl.java b/src/com/engine/salary/service/impl/SIAComparisonResultServiceImpl.java index 23587a874..389e4ef2b 100644 --- a/src/com/engine/salary/service/impl/SIAComparisonResultServiceImpl.java +++ b/src/com/engine/salary/service/impl/SIAComparisonResultServiceImpl.java @@ -25,6 +25,7 @@ import com.engine.salary.sys.service.SalarySysConfService; import com.engine.salary.sys.service.impl.SalarySysConfServiceImpl; import com.engine.salary.util.db.MapperProxyFactory; import com.engine.salary.util.excel.ExcelUtil; +import com.engine.salary.util.excel.ExcelUtilPlus; import com.engine.salary.util.page.Column; import com.engine.salary.util.page.PageInfo; import com.engine.salary.util.page.SalaryPageUtil; @@ -134,7 +135,7 @@ public class SIAComparisonResultServiceImpl extends Service implements SIACompar String sheetName = "线下对比结果"; - return ExcelUtil.genWorkbookV2(rows, sheetName); + return ExcelUtilPlus.genWorkbookV2(rows, sheetName); } @@ -231,7 +232,7 @@ public class SIAComparisonResultServiceImpl extends Service implements SIACompar } private Set welfareInfo() { - + boolean welBaseDiffSign = siArchivesBiz.isDiffWelBase(); Set info = new HashSet<>(); List listAll = getICategoryMapper().listAll(); @@ -239,18 +240,37 @@ public class SIAComparisonResultServiceImpl extends Service implements SIACompar List fundWelfareList = listAll.stream().filter(e -> e.getWelfareType() == 2).collect(Collectors.toList()); List otherWelfareList = listAll.stream().filter(e -> e.getWelfareType() == 3).collect(Collectors.toList()); - //组装社保基数 - for (ICategoryPO po : socialWelfareList) { - info.add(po.getId() + "socialBase"); - } - //组装公积金基数 - for (ICategoryPO po : fundWelfareList) { - info.add(po.getId() + "fundBase"); - } - //组装其他福利基数 - for (ICategoryPO po : otherWelfareList) { - info.add(po.getId() + "otherBase"); + if (welBaseDiffSign) { + //组装社保基数 + for (ICategoryPO po : socialWelfareList) { + info.add(po.getId() + "socialPerBase"); + info.add(po.getId() + "socialComBase"); + } + //组装公积金基数 + for (ICategoryPO po : fundWelfareList) { + info.add(po.getId() + "fundPerBase"); + info.add(po.getId() + "fundComBase"); + } + //组装其他福利基数 + for (ICategoryPO po : otherWelfareList) { + info.add(po.getId() + "otherPerBase"); + info.add(po.getId() + "otherComBase"); + } + } else { + //组装社保基数 + for (ICategoryPO po : socialWelfareList) { + info.add(po.getId() + "socialBase"); + } + //组装公积金基数 + for (ICategoryPO po : fundWelfareList) { + info.add(po.getId() + "fundBase"); + } + //组装其他福利基数 + for (ICategoryPO po : otherWelfareList) { + info.add(po.getId() + "otherBase"); + } } + //社保个人(生育保险个人、工伤保险个人、失业保险个人、养老保险个人、医疗保险个人) for (ICategoryPO po : socialWelfareList) { info.add(po.getId() + "socialPer"); diff --git a/src/com/engine/salary/service/impl/SIAccountServiceImpl.java b/src/com/engine/salary/service/impl/SIAccountServiceImpl.java index d9387e62c..1385b84d7 100644 --- a/src/com/engine/salary/service/impl/SIAccountServiceImpl.java +++ b/src/com/engine/salary/service/impl/SIAccountServiceImpl.java @@ -2222,6 +2222,78 @@ public class SIAccountServiceImpl extends Service implements SIAccountService { */ @Override public XSSFWorkbook exportComparisonWelfareTemplate(InsuranceAccountDetailParam param) { + Map> welColumnMap = createWelColumnMap(param); + + List headerList = Lists.newArrayList(SalaryI18nUtil.getI18nLabel(85429, "姓名"), + SalaryI18nUtil.getI18nLabel(86185, "部门"), + SalaryI18nUtil.getI18nLabel(86186, "手机号"), + SalaryI18nUtil.getI18nLabel(86317, "工号"), + SalaryI18nUtil.getI18nLabel(86187, "员工状态"), + SalaryI18nUtil.getI18nLabel(100377, "数据来源"), + SalaryI18nUtil.getI18nLabel(91325, "个税扣缴义务人")); + headerList.add(SalaryI18nUtil.getI18nLabel(91324, "社保账号")); + headerList.add(SalaryI18nUtil.getI18nLabel(91323, "社保方案名称")); + //组装社保基数 + if (welColumnMap.get("socialBase") != null) { + headerList.addAll(welColumnMap.get("socialBase")); + } + headerList.add(SalaryI18nUtil.getI18nLabel(91486, "公积金账号")); + headerList.add(SalaryI18nUtil.getI18nLabel(91485, "公积金方案名称")); + //组装公积金基数 + if (welColumnMap.get("fundBase") != null) { + headerList.addAll(welColumnMap.get("fundBase")); + } + headerList.add(SalaryI18nUtil.getI18nLabel(91487, "补充公积金账号")); + headerList.add(SalaryI18nUtil.getI18nLabel(91496, "其他福利方案名称")); + //组装其他福利基数 + if (welColumnMap.get("otherBase") != null) { + headerList.addAll(welColumnMap.get("otherBase")); + } + //社保个人(生育保险个人、工伤保险个人、失业保险个人、养老保险个人、医疗保险个人) + if (welColumnMap.get("socialPer") != null) { + headerList.addAll(welColumnMap.get("socialPer")); + } + headerList.add(SalaryI18nUtil.getI18nLabel(100388, "社保个人合计")); + //住房公积金个人、补充住房公积金个人 + if (welColumnMap.get("fundPer") != null) { + headerList.addAll(welColumnMap.get("fundPer")); + } + headerList.add(SalaryI18nUtil.getI18nLabel(100390, "公积金个人合计")); + //其他个人(比如企业年金个人) + if (welColumnMap.get("otherPer") != null) { + headerList.addAll(welColumnMap.get("otherPer")); + } + headerList.add(SalaryI18nUtil.getI18nLabel(100392, "其他福利个人合计")); + headerList.add(SalaryI18nUtil.getI18nLabel(100393, "个人合计")); + //社保单位(生育保险单位、工伤保险单位、失业保险单位、养老保险单位、医疗保险单位) + if (welColumnMap.get("socialCom") != null) { + headerList.addAll(welColumnMap.get("socialCom")); + } + headerList.add(SalaryI18nUtil.getI18nLabel(100394, "社保单位合计")); + //住房公积金单位、补充住房公积金单位 + if (welColumnMap.get("fundCom") != null) { + headerList.addAll(welColumnMap.get("fundCom")); + } + headerList.add(SalaryI18nUtil.getI18nLabel(100395, "公积金单位合计")); + //其他单位(比如企业年金单位) + if (welColumnMap.get("otherCom") != null) { + headerList.addAll(welColumnMap.get("otherCom")); + } + headerList.add(SalaryI18nUtil.getI18nLabel(100396, "其他福利单位合计")); + headerList.add(SalaryI18nUtil.getI18nLabel(100397, "单位合计")); + headerList.add(SalaryI18nUtil.getI18nLabel(100398, "社保合计")); + headerList.add(SalaryI18nUtil.getI18nLabel(100399, "公积金合计")); + headerList.add(SalaryI18nUtil.getI18nLabel(100400, "其他福利合计")); + headerList.add(SalaryI18nUtil.getI18nLabel(93278, "合计")); + + List> rows = new ArrayList<>(); + rows.add(headerList); + String sheetName = "福利核算-线下对比导入模板"; + + return ExcelUtilPlus.genWorkbookV2(rows, sheetName); + } + + public Map> createWelColumnMap(InsuranceAccountDetailParam param) { boolean welBaseDiffSign = siArchivesBiz.isDiffWelBase(); //查询线上福利核算记录 InsuranceExportParam insuranceExportParam = new InsuranceExportParam(); @@ -2266,114 +2338,238 @@ public class SIAccountServiceImpl extends Service implements SIAccountService { List fundWelComList = listAll.stream().filter(e -> e.getWelfareType() == 2 && e.getIsUse() == 1 && insuranceComPaySet.contains(e.getId())).collect(Collectors.toList()); List otherWelComList = listAll.stream().filter(e -> e.getWelfareType() == 3 && e.getIsUse() == 1 && insuranceComPaySet.contains(e.getId())).collect(Collectors.toList()); - List headerList = Lists.newArrayList(SalaryI18nUtil.getI18nLabel(85429, "姓名"), - SalaryI18nUtil.getI18nLabel(86185, "部门"), - SalaryI18nUtil.getI18nLabel(86186, "手机号"), - SalaryI18nUtil.getI18nLabel(86317, "工号"), - SalaryI18nUtil.getI18nLabel(86187, "员工状态"), - SalaryI18nUtil.getI18nLabel(100377, "数据来源"), - SalaryI18nUtil.getI18nLabel(91325, "个税扣缴义务人")); - headerList.add(SalaryI18nUtil.getI18nLabel(91324, "社保账号")); - headerList.add(SalaryI18nUtil.getI18nLabel(91323, "社保方案名称")); -// "失业保险申报基数" -// "生育保险申报基数" -// "养老保险申报基数" -// "医疗保险申报基数" -// "工伤保险申报基数" -// for (ICategoryPO po : socialWelfareList) { -// headerList.add(po.getInsuranceName() + "申报基数"); -// } //组装社保基数 + List socialBaseColumns = new ArrayList<>(); + List socialPerBaseColumns = new ArrayList<>(); + List socialComBaseColumns = Lists.newArrayList(); if (welBaseDiffSign) { - List socialComColumns = Lists.newArrayList(); for (ICategoryPO po : socialWelfareList) { - headerList.add(po.getInsuranceName() + SalaryI18nUtil.getI18nLabel(0, "申报基数") + SalaryI18nUtil.getI18nLabel(0,"个人")); - socialComColumns.add(po.getInsuranceName() + SalaryI18nUtil.getI18nLabel(0, "申报基数") + SalaryI18nUtil.getI18nLabel(0,"单位")); + socialPerBaseColumns.add(po.getInsuranceName() + SalaryI18nUtil.getI18nLabel(0, "申报基数") + SalaryI18nUtil.getI18nLabel(0,"个人")); + socialComBaseColumns.add(po.getInsuranceName() + SalaryI18nUtil.getI18nLabel(0, "申报基数") + SalaryI18nUtil.getI18nLabel(0,"单位")); } - headerList.addAll(socialComColumns); + socialBaseColumns.addAll(socialPerBaseColumns); + socialBaseColumns.addAll(socialComBaseColumns); } else { for (ICategoryPO po : socialWelfareList) { - headerList.add(po.getInsuranceName() + SalaryI18nUtil.getI18nLabel(0, "申报基数")); + socialBaseColumns.add(po.getInsuranceName() + SalaryI18nUtil.getI18nLabel(0, "申报基数")); } } - headerList.add(SalaryI18nUtil.getI18nLabel(91486, "公积金账号")); - headerList.add(SalaryI18nUtil.getI18nLabel(91485, "公积金方案名称")); + //组装公积金基数 -// for (ICategoryPO po : fundWelfareList) { -// headerList.add(po.getInsuranceName() + "申报基数"); -// } + List fundBaseColumns = new ArrayList<>(); + List fundPerBaseColumns = Lists.newArrayList(); + List fundComBaseColumns = Lists.newArrayList(); if (welBaseDiffSign) { - List fundComColumns = Lists.newArrayList(); for (ICategoryPO po : fundWelfareList) { - headerList.add(po.getInsuranceName() + SalaryI18nUtil.getI18nLabel(0, "申报基数") + SalaryI18nUtil.getI18nLabel(0,"个人")); - fundComColumns.add(po.getInsuranceName() + SalaryI18nUtil.getI18nLabel(0, "申报基数") + SalaryI18nUtil.getI18nLabel(0,"单位")); + fundPerBaseColumns.add(po.getInsuranceName() + SalaryI18nUtil.getI18nLabel(0, "申报基数") + SalaryI18nUtil.getI18nLabel(0,"个人")); + fundComBaseColumns.add(po.getInsuranceName() + SalaryI18nUtil.getI18nLabel(0, "申报基数") + SalaryI18nUtil.getI18nLabel(0,"单位")); } - headerList.addAll(fundComColumns); + fundBaseColumns.addAll(fundPerBaseColumns); + fundBaseColumns.addAll(fundComBaseColumns); } else { for (ICategoryPO po : fundWelfareList) { - headerList.add(po.getInsuranceName() + SalaryI18nUtil.getI18nLabel(0, "申报基数")); + fundBaseColumns.add(po.getInsuranceName() + SalaryI18nUtil.getI18nLabel(0, "申报基数")); } } - headerList.add(SalaryI18nUtil.getI18nLabel(91487, "补充公积金账号")); - headerList.add(SalaryI18nUtil.getI18nLabel(91496, "其他福利方案名称")); + //组装其他福利基数 -// for (ICategoryPO po : otherWelfareList) { -// headerList.add(po.getInsuranceName() + "申报基数"); -// } + List otherBaseColumns = new ArrayList<>(); + List otherPerBaseColumns = new ArrayList<>(); + List otherComBaseColumns = Lists.newArrayList(); if (welBaseDiffSign) { - List otherComColumns = Lists.newArrayList(); for (ICategoryPO po : otherWelfareList) { - headerList.add(po.getInsuranceName() + SalaryI18nUtil.getI18nLabel(0, "申报基数") + SalaryI18nUtil.getI18nLabel(0,"个人")); - otherComColumns.add(po.getInsuranceName() + SalaryI18nUtil.getI18nLabel(0, "申报基数") + SalaryI18nUtil.getI18nLabel(0,"单位")); + otherPerBaseColumns.add(po.getInsuranceName() + SalaryI18nUtil.getI18nLabel(0, "申报基数") + SalaryI18nUtil.getI18nLabel(0,"个人")); + otherComBaseColumns.add(po.getInsuranceName() + SalaryI18nUtil.getI18nLabel(0, "申报基数") + SalaryI18nUtil.getI18nLabel(0,"单位")); } - headerList.addAll(otherComColumns); + otherBaseColumns.addAll(otherPerBaseColumns); + otherBaseColumns.addAll(otherComBaseColumns); } else { for (ICategoryPO po : otherWelfareList) { - headerList.add(po.getInsuranceName() + SalaryI18nUtil.getI18nLabel(0, "申报基数")); + otherBaseColumns.add(po.getInsuranceName() + SalaryI18nUtil.getI18nLabel(0, "申报基数")); } } + + //社保个人(生育保险个人、工伤保险个人、失业保险个人、养老保险个人、医疗保险个人) + List socialPerColumns = new ArrayList<>(); + for (ICategoryPO po : socialWelPerList) { + socialPerColumns.add(po.getInsuranceName() + SalaryI18nUtil.getI18nLabel(0,"个人")); + } + //住房公积金个人、补充住房公积金个人 + List fundPerColumns = new ArrayList<>(); + for (ICategoryPO po : fundWelPerList) { + fundPerColumns.add(po.getInsuranceName() + SalaryI18nUtil.getI18nLabel(0,"个人")); + } + //其他个人(比如企业年金个人) + List otherPerColumns = new ArrayList<>(); + for (ICategoryPO po : otherWelPerList) { + otherPerColumns.add(po.getInsuranceName() + SalaryI18nUtil.getI18nLabel(0,"个人")); + } + //社保单位(生育保险单位、工伤保险单位、失业保险单位、养老保险单位、医疗保险单位) + List socialComColumns = new ArrayList<>(); + for (ICategoryPO po : socialWelComList) { + socialComColumns.add(po.getInsuranceName() + SalaryI18nUtil.getI18nLabel(0,"单位")); + } + //住房公积金单位、补充住房公积金单位 + List fundComColumns = new ArrayList<>(); + for (ICategoryPO po : fundWelComList) { + fundComColumns.add(po.getInsuranceName() + SalaryI18nUtil.getI18nLabel(0,"单位")); + } + + //其他单位(比如企业年金单位) + List otherComColumns = new ArrayList<>(); + for (ICategoryPO po : otherWelComList) { + otherComColumns.add(po.getInsuranceName() + SalaryI18nUtil.getI18nLabel(0,"单位")); + } + + Map> welColumnMap = new HashMap<>(); + welColumnMap.put("socialPerBase", socialPerBaseColumns); + welColumnMap.put("fundPerBase", fundPerBaseColumns); + welColumnMap.put("otherPerBase", otherPerBaseColumns); + welColumnMap.put("socialComBase", socialComBaseColumns); + welColumnMap.put("fundComBase", fundComBaseColumns); + welColumnMap.put("otherComBase", otherComBaseColumns); + welColumnMap.put("socialBase", socialBaseColumns); + welColumnMap.put("fundBase", fundBaseColumns); + welColumnMap.put("otherBase", otherBaseColumns); + welColumnMap.put("socialPer", socialPerColumns); + welColumnMap.put("fundPer", fundPerColumns); + welColumnMap.put("otherPer", otherPerColumns); + welColumnMap.put("socialCom", socialComColumns); + welColumnMap.put("fundCom", fundComColumns); + welColumnMap.put("otherCom", otherComColumns); + return welColumnMap; + } + + public Map welColumnNameCodeMap(InsuranceAccountDetailParam param) { + boolean welBaseDiffSign = siArchivesBiz.isDiffWelBase(); + //查询线上福利核算记录 + InsuranceExportParam insuranceExportParam = new InsuranceExportParam(); + insuranceExportParam.setBillMonth(param.getBillMonth()); + insuranceExportParam.setPaymentOrganization(param.getPaymentOrganization()); + List accountExportPOS = getInsuranceExportMapper().exportAccount(param.getPaymentStatus(), insuranceExportParam); + + //整理线上核算记录相关的福利方案,并以此整理需要对比的福利项类别数据 + Set welfareSchemeIds = new HashSet<>(); + accountExportPOS.forEach(f -> { + welfareSchemeIds.add(f.getSocialSchemeId()); + welfareSchemeIds.add(f.getFundSchemeId()); + welfareSchemeIds.add(f.getOtherSchemeId()); + }); + List insuranceSchemeDetailPos = getInsuranceSchemeDetailMapper().listAll(); + List insuranceBaseIds = insuranceSchemeDetailPos.stream() + .filter(f -> welfareSchemeIds.contains(f.getPrimaryId()) && f.getIsPayment() == 1) + .map(InsuranceSchemeDetailPO::getInsuranceId) + .collect(Collectors.toList()); + List insurancePerPayIds = insuranceSchemeDetailPos.stream() + .filter(f -> welfareSchemeIds.contains(f.getPrimaryId()) && f.getIsPayment() == 1 && f.getPaymentScope() == 2) + .map(InsuranceSchemeDetailPO::getInsuranceId) + .collect(Collectors.toList()); + List insuranceComPayIds = insuranceSchemeDetailPos.stream() + .filter(f -> welfareSchemeIds.contains(f.getPrimaryId()) && f.getIsPayment() == 1 && f.getPaymentScope() == 1) + .map(InsuranceSchemeDetailPO::getInsuranceId) + .collect(Collectors.toList()); + Set insuranceBaseSet = new HashSet<>(insuranceBaseIds); + Set insurancePerPaySet = new HashSet<>(insurancePerPayIds); + Set insuranceComPaySet = new HashSet<>(insuranceComPayIds); + + List listAll = getICategoryMapper().listAll(); + List socialWelfareList = listAll.stream().filter(e -> e.getWelfareType() == 1 && e.getIsUse() == 1 && insuranceBaseSet.contains(e.getId())).collect(Collectors.toList()); + List fundWelfareList = listAll.stream().filter(e -> e.getWelfareType() == 2 && e.getIsUse() == 1 && insuranceBaseSet.contains(e.getId())).collect(Collectors.toList()); + List otherWelfareList = listAll.stream().filter(e -> e.getWelfareType() == 3 && e.getIsUse() == 1 && insuranceBaseSet.contains(e.getId())).collect(Collectors.toList()); + + List socialWelPerList = listAll.stream().filter(e -> e.getWelfareType() == 1 && e.getIsUse() == 1 && insurancePerPaySet.contains(e.getId())).collect(Collectors.toList()); + List fundWelPerList = listAll.stream().filter(e -> e.getWelfareType() == 2 && e.getIsUse() == 1 && insurancePerPaySet.contains(e.getId())).collect(Collectors.toList()); + List otherWelPerList = listAll.stream().filter(e -> e.getWelfareType() == 3 && e.getIsUse() == 1 && insurancePerPaySet.contains(e.getId())).collect(Collectors.toList()); + + List socialWelComList = listAll.stream().filter(e -> e.getWelfareType() == 1 && e.getIsUse() == 1 && insuranceComPaySet.contains(e.getId())).collect(Collectors.toList()); + List fundWelComList = listAll.stream().filter(e -> e.getWelfareType() == 2 && e.getIsUse() == 1 && insuranceComPaySet.contains(e.getId())).collect(Collectors.toList()); + List otherWelComList = listAll.stream().filter(e -> e.getWelfareType() == 3 && e.getIsUse() == 1 && insuranceComPaySet.contains(e.getId())).collect(Collectors.toList()); + + //组装社保基数 + Map result = new HashMap<>(); + if (welBaseDiffSign) { + for (ICategoryPO po : socialWelfareList) { + result.put(Util.formatMultiLang(po.getInsuranceName(), String.valueOf(user.getLanguage())) + + SalaryI18nUtil.getI18nLabel(0, "申报基数") + + SalaryI18nUtil.getI18nLabel(0,"个人"), po.getId() + "socialPerBase"); + result.put(Util.formatMultiLang(po.getInsuranceName(), String.valueOf(user.getLanguage())) + + SalaryI18nUtil.getI18nLabel(0, "申报基数") + + SalaryI18nUtil.getI18nLabel(0,"单位"), po.getId() + "socialComBase"); + } + } else { + for (ICategoryPO po : socialWelfareList) { + result.put(Util.formatMultiLang(po.getInsuranceName(), String.valueOf(user.getLanguage())) + + SalaryI18nUtil.getI18nLabel(0, "申报基数"), po.getId() + "socialBase"); + } + } + + //组装公积金基数 + if (welBaseDiffSign) { + for (ICategoryPO po : fundWelfareList) { + result.put(Util.formatMultiLang(po.getInsuranceName(), String.valueOf(user.getLanguage())) + + SalaryI18nUtil.getI18nLabel(0, "申报基数") + + SalaryI18nUtil.getI18nLabel(0,"个人"), po.getId() + "fundPerBase"); + result.put(Util.formatMultiLang(po.getInsuranceName(), String.valueOf(user.getLanguage())) + + SalaryI18nUtil.getI18nLabel(0, "申报基数") + + SalaryI18nUtil.getI18nLabel(0,"单位"), po.getId() + "fundComBase"); + } + } else { + for (ICategoryPO po : fundWelfareList) { + result.put(Util.formatMultiLang(po.getInsuranceName(), String.valueOf(user.getLanguage())) + + SalaryI18nUtil.getI18nLabel(0, "申报基数"), po.getId() + "fundBase"); + } + } + + //组装其他福利基数 + if (welBaseDiffSign) { + for (ICategoryPO po : otherWelfareList) { + result.put(Util.formatMultiLang(po.getInsuranceName(), String.valueOf(user.getLanguage())) + + SalaryI18nUtil.getI18nLabel(0, "申报基数") + + SalaryI18nUtil.getI18nLabel(0,"个人"), po.getId() + "otherPerBase"); + result.put(Util.formatMultiLang(po.getInsuranceName(), String.valueOf(user.getLanguage())) + + SalaryI18nUtil.getI18nLabel(0, "申报基数") + + SalaryI18nUtil.getI18nLabel(0,"单位"), po.getId() + "otherComBase"); + } + } else { + for (ICategoryPO po : otherWelfareList) { + result.put(Util.formatMultiLang(po.getInsuranceName(), String.valueOf(user.getLanguage())) + + SalaryI18nUtil.getI18nLabel(0, "申报基数"), po.getId() + "otherBase"); + } + } + //社保个人(生育保险个人、工伤保险个人、失业保险个人、养老保险个人、医疗保险个人) for (ICategoryPO po : socialWelPerList) { - headerList.add(po.getInsuranceName() + "个人"); + result.put(Util.formatMultiLang(po.getInsuranceName(), String.valueOf(user.getLanguage())) + + SalaryI18nUtil.getI18nLabel(0, "申报基数"), po.getId() + "socialPer"); } - headerList.add(SalaryI18nUtil.getI18nLabel(100388, "社保个人合计")); //住房公积金个人、补充住房公积金个人 for (ICategoryPO po : fundWelPerList) { - headerList.add(po.getInsuranceName() + "个人"); + result.put(Util.formatMultiLang(po.getInsuranceName(), String.valueOf(user.getLanguage())) + + SalaryI18nUtil.getI18nLabel(0, "申报基数"), po.getId() + "fundPer"); } - headerList.add(SalaryI18nUtil.getI18nLabel(100390, "公积金个人合计")); //其他个人(比如企业年金个人) for (ICategoryPO po : otherWelPerList) { - headerList.add(po.getInsuranceName() + "个人"); + result.put(Util.formatMultiLang(po.getInsuranceName(), String.valueOf(user.getLanguage())) + + SalaryI18nUtil.getI18nLabel(0, "申报基数"), po.getId() + "otherPer"); } - headerList.add(SalaryI18nUtil.getI18nLabel(100392, "其他福利个人合计")); - headerList.add(SalaryI18nUtil.getI18nLabel(100393, "个人合计")); //社保单位(生育保险单位、工伤保险单位、失业保险单位、养老保险单位、医疗保险单位) for (ICategoryPO po : socialWelComList) { - headerList.add(po.getInsuranceName() + "单位"); + result.put(Util.formatMultiLang(po.getInsuranceName(), String.valueOf(user.getLanguage())) + + SalaryI18nUtil.getI18nLabel(0, "申报基数"), po.getId() + "socialCom"); } - headerList.add(SalaryI18nUtil.getI18nLabel(100394, "社保单位合计")); //住房公积金单位、补充住房公积金单位 for (ICategoryPO po : fundWelComList) { - headerList.add(po.getInsuranceName() + "单位"); + result.put(Util.formatMultiLang(po.getInsuranceName(), String.valueOf(user.getLanguage())) + + SalaryI18nUtil.getI18nLabel(0, "申报基数"), po.getId() + "fundCom"); } - headerList.add(SalaryI18nUtil.getI18nLabel(100395, "公积金单位合计")); + //其他单位(比如企业年金单位) for (ICategoryPO po : otherWelComList) { - headerList.add(po.getInsuranceName() + "单位"); + result.put(Util.formatMultiLang(po.getInsuranceName(), String.valueOf(user.getLanguage())) + + SalaryI18nUtil.getI18nLabel(0, "申报基数"), po.getId() + "otherCom"); } - headerList.add(SalaryI18nUtil.getI18nLabel(100396, "其他福利单位合计")); - headerList.add(SalaryI18nUtil.getI18nLabel(100397, "单位合计")); - headerList.add(SalaryI18nUtil.getI18nLabel(100398, "社保合计")); - headerList.add(SalaryI18nUtil.getI18nLabel(100399, "公积金合计")); - headerList.add(SalaryI18nUtil.getI18nLabel(100400, "其他福利合计")); - headerList.add(SalaryI18nUtil.getI18nLabel(93278, "合计")); - List> rows = new ArrayList<>(); - rows.add(headerList); - String sheetName = "福利核算-线下对比导入模板"; - - return ExcelUtilPlus.genWorkbookV2(rows, sheetName); + return result; } /** @@ -2424,6 +2620,12 @@ public class SIAccountServiceImpl extends Service implements SIAccountService { } String billMonth = importParam.getBillMonth(); + + Map welColumnNameCodeMap = welColumnNameCodeMap(InsuranceAccountDetailParam.builder() + .billMonth(billMonth) + .paymentOrganization(importParam.getPaymentOrganization()) + .paymentStatus(PaymentStatusEnum.COMMON.getValue()) + .build()); //存储待更新的InsuranceAccountDetailPO数据 List addCompareList = new ArrayList<>(); //记录待删除hrsa_excel_bill_detail.id @@ -2518,7 +2720,7 @@ public class SIAccountServiceImpl extends Service implements SIAccountService { idList.addAll(ids); } //拼装待更新数据 - addCompareList.add(handleExcelInsuranceDetail(billMonth, employeeId, paymentOrganization, map)); + addCompareList.add(handleExcelInsuranceDetail(billMonth, employeeId, paymentOrganization, map, welColumnNameCodeMap)); } @@ -2557,7 +2759,8 @@ public class SIAccountServiceImpl extends Service implements SIAccountService { * @param billMonth 对比的账单月份 * @param baseMap excel导入的对比数据 */ - private ExcelInsuranceDetailPO handleExcelInsuranceDetail(String billMonth, Long employeeId, Long paymentOrganization, Map baseMap) { + private ExcelInsuranceDetailPO handleExcelInsuranceDetail(String billMonth, Long employeeId, Long paymentOrganization, Map baseMap, Map welColumnNameCodeMap) { + boolean welBaseDiffSign = siArchivesBiz.isDiffWelBase(); ExcelInsuranceDetailPO excelInsuranceDetailPO = new ExcelInsuranceDetailPO(); excelInsuranceDetailPO.setId(IdGenerator.generate()); @@ -2573,6 +2776,10 @@ public class SIAccountServiceImpl extends Service implements SIAccountService { Map fundPaymentBaseMap = new HashMap<>(); Map otherPaymentBaseMap = new HashMap<>(); + Map socialPaymentComBaseMap = new HashMap<>(); + Map fundPaymentComBaseMap = new HashMap<>(); + Map otherPaymentComBaseMap = new HashMap<>(); + //筛选出福利核算项 Map toDealMap = baseMap.entrySet().stream() @@ -2586,73 +2793,157 @@ public class SIAccountServiceImpl extends Service implements SIAccountService { .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)); for(Map.Entry entry : toDealMap.entrySet()) { - //判断元素是否属于福利类 - String keyName = entry.getKey(); - //获取元素名后缀,方便之后判断“个人”或“单位”或者“基数” - String payScope = keyName.substring(keyName.length() - 2); - //获取福利类型 - Integer welfareType; - //根据元素名后缀,区分截取内容 - String targetWelfareName; - if ("基数".equals(payScope)) { - targetWelfareName = entry.getKey().substring(0, keyName.length() - 4); - } else { - targetWelfareName = entry.getKey().substring(0, keyName.length() - 2); - } - List categoryPOList = siCategoryBiz.listByName(targetWelfareName); - if (categoryPOList.size() == 1) { - ICategoryPO iCategoryPO = categoryPOList.get(0); - welfareType = iCategoryPO.getWelfareType(); +// //判断元素是否属于福利类 +// String keyName = entry.getKey(); +// //获取元素名后缀,方便之后判断“个人”或“单位”或者“基数” +// String payScope = keyName.substring(keyName.length() - 2); +// //获取福利类型 +// Integer welfareType; +// //根据元素名后缀,区分截取内容 +// String targetWelfareName; +// if ("基数".equals(payScope)) { +// targetWelfareName = entry.getKey().substring(0, keyName.length() - 4); +// } else { +// targetWelfareName = entry.getKey().substring(0, keyName.length() - 2); +// } +// List categoryPOList = siCategoryBiz.listByName(targetWelfareName); +// if (categoryPOList.size() == 1) { +// ICategoryPO iCategoryPO = categoryPOList.get(0); +// welfareType = iCategoryPO.getWelfareType(); +// +// switch (payScope) { +// case "个人": +// switch (welfareType) { +// case 1: +// socialPerMap.put(iCategoryPO.getId().toString(), entry.getValue().toString()); +// break; +// case 2: +// fundPerMap.put(iCategoryPO.getId().toString(), entry.getValue().toString()); +// break; +// case 3: +// otherPerMap.put(iCategoryPO.getId().toString(), entry.getValue().toString()); +// break; +// default: +// throw new SalaryRunTimeException("福利类型不存在"); +// } +// break; +// case "单位": +// switch (welfareType) { +// case 1: +// socialComMap.put(iCategoryPO.getId().toString(), entry.getValue().toString()); +// break; +// case 2: +// fundComMap.put(iCategoryPO.getId().toString(), entry.getValue().toString()); +// break; +// case 3: +// otherComMap.put(iCategoryPO.getId().toString(), entry.getValue().toString()); +// break; +// default: +// throw new SalaryRunTimeException("福利类型不存在"); +// } +// break; +// case "基数": +// switch (welfareType) { +// case 1: +// socialPaymentBaseMap.put(iCategoryPO.getId().toString(), entry.getValue().toString()); +// break; +// case 2: +// fundPaymentBaseMap.put(iCategoryPO.getId().toString(), entry.getValue().toString()); +// break; +// case 3: +// otherPaymentBaseMap.put(iCategoryPO.getId().toString(), entry.getValue().toString()); +// break; +// default: +// throw new SalaryRunTimeException("福利类型不存在"); +// } +// break; +// } +// } - switch (payScope) { - case "个人": - switch (welfareType) { - case 1: - socialPerMap.put(iCategoryPO.getId().toString(), entry.getValue().toString()); - break; - case 2: - fundPerMap.put(iCategoryPO.getId().toString(), entry.getValue().toString()); - break; - case 3: - otherPerMap.put(iCategoryPO.getId().toString(), entry.getValue().toString()); - break; - default: - throw new SalaryRunTimeException("福利类型不存在"); - } - break; - case "单位": - switch (welfareType) { - case 1: - socialComMap.put(iCategoryPO.getId().toString(), entry.getValue().toString()); - break; - case 2: - fundComMap.put(iCategoryPO.getId().toString(), entry.getValue().toString()); - break; - case 3: - otherComMap.put(iCategoryPO.getId().toString(), entry.getValue().toString()); - break; - default: - throw new SalaryRunTimeException("福利类型不存在"); - } - break; - case "基数": - switch (welfareType) { - case 1: - socialPaymentBaseMap.put(iCategoryPO.getId().toString(), entry.getValue().toString()); - break; - case 2: - fundPaymentBaseMap.put(iCategoryPO.getId().toString(), entry.getValue().toString()); - break; - case 3: - otherPaymentBaseMap.put(iCategoryPO.getId().toString(), entry.getValue().toString()); - break; - default: - throw new SalaryRunTimeException("福利类型不存在"); - } - break; + if (welColumnNameCodeMap.get(entry.getKey()) != null) { + String code = welColumnNameCodeMap.get(entry.getKey()); + if (welBaseDiffSign) { + if (code.contains("socialPerBase")) { + code = code.replace("socialPerBase", ""); + socialPaymentBaseMap.put(code, entry.getValue().toString()); + continue; + } + if (code.contains("socialComBase")) { + code = code.replace("socialComBase", ""); + socialPaymentComBaseMap.put(code, entry.getValue().toString()); + continue; + } + if (code.contains("fundPerBase")) { + code = code.replace("fundPerBase", ""); + fundPaymentBaseMap.put(code, entry.getValue().toString()); + continue; + } + if (code.contains("fundComBase")) { + code = code.replace("fundComBase", ""); + fundPaymentComBaseMap.put(code, entry.getValue().toString()); + continue; + } + if (code.contains("otherPerBase")) { + code = code.replace("otherPerBase", ""); + otherPaymentBaseMap.put(code, entry.getValue().toString()); + continue; + } + if (code.contains("otherComBase")) { + code = code.replace("otherComBase", ""); + otherPaymentComBaseMap.put(code, entry.getValue().toString()); + continue; + } + } else { + if (code.contains("socialBase")) { + code = code.replace("socialBase", ""); + socialPaymentBaseMap.put(code, entry.getValue().toString()); + continue; + } + if (code.contains("fundBase")) { + code = code.replace("fundBase", ""); + fundPaymentBaseMap.put(code, entry.getValue().toString()); + continue; + } + if (code.contains("otherBase")) { + code = code.replace("otherBase", ""); + otherPaymentBaseMap.put(code, entry.getValue().toString()); + continue; + } + } + + + if (code.contains("socialPer") && !code.contains("socialPerBase")) { + code = code.replace("socialPer", ""); + socialPerMap.put(code, entry.getValue().toString()); + continue; + } + if (code.contains("fundPer") && !code.contains("fundPerBase")) { + code = code.replace("fundPer", ""); + fundPerMap.put(code, entry.getValue().toString()); + continue; + } + if (code.contains("otherPer") && !code.contains("otherPerBase")) { + code = code.replace("otherPer", ""); + otherPerMap.put(code, entry.getValue().toString()); + continue; + } + + if (code.contains("socialCom") && !code.contains("socialComBase")) { + code = code.replace("socialCom", ""); + socialComMap.put(code, entry.getValue().toString()); + continue; + } + if (code.contains("fundCom") && !code.contains("fundComBase")) { + code = code.replace("fundCom", ""); + fundComMap.put(code, entry.getValue().toString()); + continue; + } + if (code.contains("otherCom") && !code.contains("otherComBase")) { + code = code.replace("otherCom", ""); + otherComMap.put(code, entry.getValue().toString()); + continue; } } - } //设置社保个人和公司缴纳明细 @@ -2669,6 +2960,10 @@ public class SIAccountServiceImpl extends Service implements SIAccountService { excelInsuranceDetailPO.setFundPaymentBaseString(JSON.toJSONString(fundPaymentBaseMap)); excelInsuranceDetailPO.setOtherPaymentBaseString(JSON.toJSONString(otherPaymentBaseMap)); + excelInsuranceDetailPO.setSocialPaymentComBaseString(JSON.toJSONString(socialPaymentComBaseMap)); + excelInsuranceDetailPO.setFundPaymentComBaseString(JSON.toJSONString(fundPaymentComBaseMap)); + excelInsuranceDetailPO.setOtherPaymentComBaseString(JSON.toJSONString(otherPaymentComBaseMap)); + //组装新的insuranceAccountDetailPO对象数据 excelInsuranceDetailPO.setEmployeeId(employeeId); excelInsuranceDetailPO.setBillMonth(billMonth);