薪酬系统-福利台账,线下对比列表、导入、导出,适配拆分福利档案个人和公司基数逻辑

This commit is contained in:
sy 2023-12-08 18:06:54 +08:00
parent 1c5249c76e
commit 9d0d7a00fc
5 changed files with 479 additions and 157 deletions

View File

@ -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

View File

@ -25,5 +25,6 @@ public class ExcelInsuranceImportParam {
/**
* 账单月份
*/
private String billMonth;
private String billMonth;
private String paymentOrganization;
}

View File

@ -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
<foreach collection="accounts" item="item" separator=",">
(
@ -204,7 +205,10 @@
#{item.updateTime},
#{item.deleteType},
#{item.tenantKey},
#{item.paymentOrganization}
#{item.paymentOrganization},
#{item.socialPaymentComBaseString},
#{item.fundPaymentComBaseString},
#{item.otherPaymentComBaseString}
)
</foreach>
</insert>
@ -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)
<foreach collection="accounts" item="item" separator="union all">
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
</foreach>
</insert>
@ -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}
)
</foreach>
</insert>

View File

@ -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<String> welfareInfo() {
boolean welBaseDiffSign = siArchivesBiz.isDiffWelBase();
Set<String> info = new HashSet<>();
List<ICategoryPO> listAll = getICategoryMapper().listAll();
@ -239,18 +240,37 @@ public class SIAComparisonResultServiceImpl extends Service implements SIACompar
List<ICategoryPO> fundWelfareList = listAll.stream().filter(e -> e.getWelfareType() == 2).collect(Collectors.toList());
List<ICategoryPO> 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");

View File

@ -2222,6 +2222,78 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
*/
@Override
public XSSFWorkbook exportComparisonWelfareTemplate(InsuranceAccountDetailParam param) {
Map<String, List<Object>> welColumnMap = createWelColumnMap(param);
List<Object> 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<List<Object>> rows = new ArrayList<>();
rows.add(headerList);
String sheetName = "福利核算-线下对比导入模板";
return ExcelUtilPlus.genWorkbookV2(rows, sheetName);
}
public Map<String, List<Object>> createWelColumnMap(InsuranceAccountDetailParam param) {
boolean welBaseDiffSign = siArchivesBiz.isDiffWelBase();
//查询线上福利核算记录
InsuranceExportParam insuranceExportParam = new InsuranceExportParam();
@ -2266,114 +2338,238 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
List<ICategoryPO> fundWelComList = listAll.stream().filter(e -> e.getWelfareType() == 2 && e.getIsUse() == 1 && insuranceComPaySet.contains(e.getId())).collect(Collectors.toList());
List<ICategoryPO> otherWelComList = listAll.stream().filter(e -> e.getWelfareType() == 3 && e.getIsUse() == 1 && insuranceComPaySet.contains(e.getId())).collect(Collectors.toList());
List<Object> 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<Object> socialBaseColumns = new ArrayList<>();
List<Object> socialPerBaseColumns = new ArrayList<>();
List<Object> socialComBaseColumns = Lists.newArrayList();
if (welBaseDiffSign) {
List<Object> 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<Object> fundBaseColumns = new ArrayList<>();
List<Object> fundPerBaseColumns = Lists.newArrayList();
List<Object> fundComBaseColumns = Lists.newArrayList();
if (welBaseDiffSign) {
List<Object> 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<Object> otherBaseColumns = new ArrayList<>();
List<Object> otherPerBaseColumns = new ArrayList<>();
List<Object> otherComBaseColumns = Lists.newArrayList();
if (welBaseDiffSign) {
List<Object> 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<Object> socialPerColumns = new ArrayList<>();
for (ICategoryPO po : socialWelPerList) {
socialPerColumns.add(po.getInsuranceName() + SalaryI18nUtil.getI18nLabel(0,"个人"));
}
//住房公积金个人补充住房公积金个人
List<Object> fundPerColumns = new ArrayList<>();
for (ICategoryPO po : fundWelPerList) {
fundPerColumns.add(po.getInsuranceName() + SalaryI18nUtil.getI18nLabel(0,"个人"));
}
//其他个人比如企业年金个人
List<Object> otherPerColumns = new ArrayList<>();
for (ICategoryPO po : otherWelPerList) {
otherPerColumns.add(po.getInsuranceName() + SalaryI18nUtil.getI18nLabel(0,"个人"));
}
//社保单位生育保险单位工伤保险单位失业保险单位养老保险单位医疗保险单位
List<Object> socialComColumns = new ArrayList<>();
for (ICategoryPO po : socialWelComList) {
socialComColumns.add(po.getInsuranceName() + SalaryI18nUtil.getI18nLabel(0,"单位"));
}
//住房公积金单位补充住房公积金单位
List<Object> fundComColumns = new ArrayList<>();
for (ICategoryPO po : fundWelComList) {
fundComColumns.add(po.getInsuranceName() + SalaryI18nUtil.getI18nLabel(0,"单位"));
}
//其他单位比如企业年金单位
List<Object> otherComColumns = new ArrayList<>();
for (ICategoryPO po : otherWelComList) {
otherComColumns.add(po.getInsuranceName() + SalaryI18nUtil.getI18nLabel(0,"单位"));
}
Map<String, List<Object>> 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<String, String> welColumnNameCodeMap(InsuranceAccountDetailParam param) {
boolean welBaseDiffSign = siArchivesBiz.isDiffWelBase();
//查询线上福利核算记录
InsuranceExportParam insuranceExportParam = new InsuranceExportParam();
insuranceExportParam.setBillMonth(param.getBillMonth());
insuranceExportParam.setPaymentOrganization(param.getPaymentOrganization());
List<AccountExportPO> accountExportPOS = getInsuranceExportMapper().exportAccount(param.getPaymentStatus(), insuranceExportParam);
//整理线上核算记录相关的福利方案并以此整理需要对比的福利项类别数据
Set<Long> welfareSchemeIds = new HashSet<>();
accountExportPOS.forEach(f -> {
welfareSchemeIds.add(f.getSocialSchemeId());
welfareSchemeIds.add(f.getFundSchemeId());
welfareSchemeIds.add(f.getOtherSchemeId());
});
List<InsuranceSchemeDetailPO> insuranceSchemeDetailPos = getInsuranceSchemeDetailMapper().listAll();
List<Long> insuranceBaseIds = insuranceSchemeDetailPos.stream()
.filter(f -> welfareSchemeIds.contains(f.getPrimaryId()) && f.getIsPayment() == 1)
.map(InsuranceSchemeDetailPO::getInsuranceId)
.collect(Collectors.toList());
List<Long> insurancePerPayIds = insuranceSchemeDetailPos.stream()
.filter(f -> welfareSchemeIds.contains(f.getPrimaryId()) && f.getIsPayment() == 1 && f.getPaymentScope() == 2)
.map(InsuranceSchemeDetailPO::getInsuranceId)
.collect(Collectors.toList());
List<Long> insuranceComPayIds = insuranceSchemeDetailPos.stream()
.filter(f -> welfareSchemeIds.contains(f.getPrimaryId()) && f.getIsPayment() == 1 && f.getPaymentScope() == 1)
.map(InsuranceSchemeDetailPO::getInsuranceId)
.collect(Collectors.toList());
Set<Long> insuranceBaseSet = new HashSet<>(insuranceBaseIds);
Set<Long> insurancePerPaySet = new HashSet<>(insurancePerPayIds);
Set<Long> insuranceComPaySet = new HashSet<>(insuranceComPayIds);
List<ICategoryPO> listAll = getICategoryMapper().listAll();
List<ICategoryPO> socialWelfareList = listAll.stream().filter(e -> e.getWelfareType() == 1 && e.getIsUse() == 1 && insuranceBaseSet.contains(e.getId())).collect(Collectors.toList());
List<ICategoryPO> fundWelfareList = listAll.stream().filter(e -> e.getWelfareType() == 2 && e.getIsUse() == 1 && insuranceBaseSet.contains(e.getId())).collect(Collectors.toList());
List<ICategoryPO> otherWelfareList = listAll.stream().filter(e -> e.getWelfareType() == 3 && e.getIsUse() == 1 && insuranceBaseSet.contains(e.getId())).collect(Collectors.toList());
List<ICategoryPO> socialWelPerList = listAll.stream().filter(e -> e.getWelfareType() == 1 && e.getIsUse() == 1 && insurancePerPaySet.contains(e.getId())).collect(Collectors.toList());
List<ICategoryPO> fundWelPerList = listAll.stream().filter(e -> e.getWelfareType() == 2 && e.getIsUse() == 1 && insurancePerPaySet.contains(e.getId())).collect(Collectors.toList());
List<ICategoryPO> otherWelPerList = listAll.stream().filter(e -> e.getWelfareType() == 3 && e.getIsUse() == 1 && insurancePerPaySet.contains(e.getId())).collect(Collectors.toList());
List<ICategoryPO> socialWelComList = listAll.stream().filter(e -> e.getWelfareType() == 1 && e.getIsUse() == 1 && insuranceComPaySet.contains(e.getId())).collect(Collectors.toList());
List<ICategoryPO> fundWelComList = listAll.stream().filter(e -> e.getWelfareType() == 2 && e.getIsUse() == 1 && insuranceComPaySet.contains(e.getId())).collect(Collectors.toList());
List<ICategoryPO> otherWelComList = listAll.stream().filter(e -> e.getWelfareType() == 3 && e.getIsUse() == 1 && insuranceComPaySet.contains(e.getId())).collect(Collectors.toList());
//组装社保基数
Map<String, String> 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<List<Object>> 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<String, String> welColumnNameCodeMap = welColumnNameCodeMap(InsuranceAccountDetailParam.builder()
.billMonth(billMonth)
.paymentOrganization(importParam.getPaymentOrganization())
.paymentStatus(PaymentStatusEnum.COMMON.getValue())
.build());
//存储待更新的InsuranceAccountDetailPO数据
List<ExcelInsuranceDetailPO> 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<String, Object> baseMap) {
private ExcelInsuranceDetailPO handleExcelInsuranceDetail(String billMonth, Long employeeId, Long paymentOrganization, Map<String, Object> baseMap, Map<String, String> 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<String, String> fundPaymentBaseMap = new HashMap<>();
Map<String, String> otherPaymentBaseMap = new HashMap<>();
Map<String, String> socialPaymentComBaseMap = new HashMap<>();
Map<String, String> fundPaymentComBaseMap = new HashMap<>();
Map<String, String> otherPaymentComBaseMap = new HashMap<>();
//筛选出福利核算项
Map<String, Object> 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<String, Object> 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<ICategoryPO> 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<ICategoryPO> 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);