weaver-hrm-salary/src/com/engine/salary/service/impl/ColumnBuildServiceImpl.java

568 lines
32 KiB
Java
Raw Normal View History

2022-04-12 19:29:19 +08:00
package com.engine.salary.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.TypeReference;
2022-04-12 19:29:19 +08:00
import com.cloudstore.eccom.constant.WeaBoolAttr;
import com.cloudstore.eccom.pc.table.WeaTableColumn;
import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
2022-04-12 19:29:19 +08:00
import com.engine.salary.entity.siaccount.po.InsuranceAccountDetailPO;
import com.engine.salary.entity.siaccount.po.InsuranceAccountInspectPO;
2022-04-16 16:43:33 +08:00
import com.engine.salary.entity.siarchives.po.InsuranceArchivesAccountPO;
import com.engine.salary.entity.siarchives.po.InsuranceArchivesFundSchemePO;
import com.engine.salary.entity.siarchives.po.InsuranceArchivesOtherSchemePO;
import com.engine.salary.entity.siarchives.po.InsuranceArchivesSocialSchemePO;
2022-04-12 19:29:19 +08:00
import com.engine.salary.entity.sicategory.po.ICategoryPO;
import com.engine.salary.enums.siaccount.PaymentStatusEnum;
2022-04-12 19:29:19 +08:00
import com.engine.salary.enums.sicategory.WelfareTypeEnum;
import com.engine.salary.mapper.sicategory.ICategoryMapper;
import com.engine.salary.service.ColumnBuildService;
import com.engine.salary.service.SIArchivesService;
2022-04-12 19:29:19 +08:00
import com.engine.salary.util.SalaryI18nUtil;
import com.engine.salary.util.db.MapperProxyFactory;
import org.apache.commons.lang3.StringUtils;
import weaver.hrm.User;
2022-04-12 19:29:19 +08:00
import java.util.*;
import java.util.stream.Collectors;
/**
* @Author weaver_cl
2022-07-13 11:45:16 +08:00
* @Description:
2022-04-12 19:29:19 +08:00
* @Date 2022/4/12
* @Version V1.0
**/
public class ColumnBuildServiceImpl extends Service implements ColumnBuildService {
// private SIArchivesBiz siArchivesBiz = new SIArchivesBiz();
private ICategoryMapper getICategoryMapper() {
return MapperProxyFactory.getProxy(ICategoryMapper.class);
}
public SIArchivesService getSIArchivesService(User user) {
return ServiceUtil.getService(SIArchivesServiceImpl.class, user);
}
2022-04-12 19:29:19 +08:00
@Override
public List<WeaTableColumn> buildCommonColumnsWithStyle(List<InsuranceAccountDetailPO> pos, Long employeeId, String tenantKey, Integer paymentStatus) {
2022-04-12 19:29:19 +08:00
List<WeaTableColumn> list = new ArrayList<>();
Map<String, String> categoryIdNameMap = getICategoryMapper().listAll().stream().collect(Collectors.toMap(ICategoryPO -> String.valueOf(ICategoryPO.getId()), ICategoryPO::getInsuranceName));
2022-04-12 19:29:19 +08:00
Map<Integer, Map<String, String>> columns = buildPaymentTitle(pos, categoryIdNameMap, employeeId, tenantKey);
Map<Integer, Map<String, String>> personColumns = buildPersonalTitle(pos, categoryIdNameMap, employeeId, tenantKey);
Map<Integer, Map<String, String>> comColumns = buildComTitle(pos, categoryIdNameMap, employeeId, tenantKey);
WeaTableColumn weaTableNameColumn = new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 85429, "姓名"), "userName");
weaTableNameColumn.setFixed("left");
WeaTableColumn idColumn = new WeaTableColumn("150px", "id", "id");
idColumn.setIsPrimarykey(WeaBoolAttr.TRUE);
idColumn.setDisplay(WeaBoolAttr.FALSE);
list.add(idColumn);
WeaTableColumn employeeIdColumn = new WeaTableColumn("150px", "人员信息表的主键id", "employeeId");
employeeIdColumn.setDisplay(WeaBoolAttr.FALSE);
list.add(employeeIdColumn);
list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 86185, "部门"), "department"));
list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 86186, "手机号"), "mobile"));
list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 1933, "工号"), "workcode"));
list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 86187, "员工状态"), "employeeStatus"));
2024-05-29 15:32:19 +08:00
list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 86187, "证件号码"), "idNo"));
2022-04-12 19:29:19 +08:00
list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 100377, "数据来源"), "sourceFrom"));
if (paymentStatus.equals(PaymentStatusEnum.REPAIR.getValue())) {
2022-04-12 19:29:19 +08:00
list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 100379, "补缴月份"), "supplementaryMonth"));
} else if (paymentStatus.equals(PaymentStatusEnum.RECESSION.getValue())) {
list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 100379, "退差月份"), "supplementaryMonth"));
2022-04-12 19:29:19 +08:00
}
list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 91325, "个税扣缴义务人"), "socialPayOrg"));
if (!paymentStatus.equals(PaymentStatusEnum.BALANCE.getValue())) {
list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 91324, "社保账号"), "socialAccount"));
list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 91323, "社保方案名称"), "socialSchemeName"));
}
2022-04-12 19:29:19 +08:00
//组装社保基数
columns.get(WelfareTypeEnum.SOCIAL_SECURITY.getValue()).forEach((k, v) -> {
list.add(new WeaTableColumn("150px",k, v));
});
if (!paymentStatus.equals(PaymentStatusEnum.BALANCE.getValue())) {
list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 91486, "公积金账号"), "fundAccount"));
list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 91485, "公积金方案名称"), "fundSchemeName"));
}
2022-04-12 19:29:19 +08:00
//组装公积金基数
columns.get(WelfareTypeEnum.ACCUMULATION_FUND.getValue()).forEach((k, v) -> {
list.add(new WeaTableColumn("150px",k, v));
});
if (!paymentStatus.equals(PaymentStatusEnum.BALANCE.getValue())) {
list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 91487, "补充公积金账号"), "supplementFundAccount"));
list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel(91496, "其他福利方案名称"), "otherSchemeName"));
}
2022-04-12 19:29:19 +08:00
columns.get(WelfareTypeEnum.OTHER.getValue()).forEach((k, v) -> {
list.add(new WeaTableColumn("150px",k, v));
});
personColumns.get(WelfareTypeEnum.SOCIAL_SECURITY.getValue()).forEach((k, v) -> {
list.add(new WeaTableColumn("150px",k, v));
});
list.add(new WeaTableColumn("150px","<span style=\"color:blue\">" + SalaryI18nUtil.getI18nLabel( 100388, "社保个人合计") + "</span>", "socialPerSum"));
personColumns.get(WelfareTypeEnum.ACCUMULATION_FUND.getValue()).forEach((k, v) -> {
list.add(new WeaTableColumn("150px",k, v));
});
list.add(new WeaTableColumn("150px","<span style=\"color:blue\">" + SalaryI18nUtil.getI18nLabel( 100390, "公积金个人合计") + "</span>", "fundPerSum"));
personColumns.get(WelfareTypeEnum.OTHER.getValue()).forEach((k, v) -> {
list.add(new WeaTableColumn("150px",k, v));
});
list.add(new WeaTableColumn("150px","<span style=\"color:blue\">" + SalaryI18nUtil.getI18nLabel( 100392, "其他福利个人合计") + "</span>", "otherPerSum"));
list.add(new WeaTableColumn("150px","<span style=\"color:blue\">" + SalaryI18nUtil.getI18nLabel( 100393, "个人合计") + "</span>", "perSum"));
comColumns.get(WelfareTypeEnum.SOCIAL_SECURITY.getValue()).forEach((k, v) -> {
list.add(new WeaTableColumn("150px",k, v));
});
list.add(new WeaTableColumn("150px","<span style=\"color:blue\">" + SalaryI18nUtil.getI18nLabel( 100394, "社保单位合计") + "</span>", "socialComSum"));
comColumns.get(WelfareTypeEnum.ACCUMULATION_FUND.getValue()).forEach((k, v) -> {
list.add(new WeaTableColumn("150px",k, v));
});
list.add(new WeaTableColumn("150px","<span style=\"color:blue\">" + SalaryI18nUtil.getI18nLabel( 100395, "公积金单位合计") + "</span>", "fundComSum"));
comColumns.get(WelfareTypeEnum.OTHER.getValue()).forEach((k, v) -> {
list.add(new WeaTableColumn("150px",k, v));
});
list.add(new WeaTableColumn("150px","<span style=\"color:blue\">" + SalaryI18nUtil.getI18nLabel( 100396, "其他福利单位合计") + "</span>", "otherComSum"));
list.add(new WeaTableColumn("150px","<span style=\"color:blue\">" + SalaryI18nUtil.getI18nLabel( 100397, "单位合计") + "</span>", "comSum"));
list.add(new WeaTableColumn("150px","<span style=\"color:blue\">" + SalaryI18nUtil.getI18nLabel( 100398, "社保合计") + "</span>", "socialSum"));
list.add(new WeaTableColumn("150px","<span style=\"color:blue\">" + SalaryI18nUtil.getI18nLabel( 100399, "公积金合计") + "</span>", "fundSum"));
list.add(new WeaTableColumn("150px","<span style=\"color:blue\">" + SalaryI18nUtil.getI18nLabel( 100400, "其他福利合计") + "</span>", "otherSum"));
list.add(new WeaTableColumn("150px","<span style=\"color:blue\">" + SalaryI18nUtil.getI18nLabel( 93278, "合计") + "</span>", "total"));
return list;
}
private Map<Integer, Map<String, String>> buildPaymentTitle(List<InsuranceAccountDetailPO> pos, Map<String, String> categoryIdNameMap, Long employeeId, String tenantKey) {
// boolean welBaseDiffSign = siArchivesBiz.isDiffWelBase();
boolean welBaseDiffSign = getSIArchivesService(user).isDiffWelBase();
2022-04-12 19:29:19 +08:00
Set<String> socailIds = new HashSet<>();
Set<String> fundIds = new HashSet<>();
Set<String> otherIds = new HashSet<>();
Set<String> socailComIds = new HashSet<>();
Set<String> fundComIds = new HashSet<>();
Set<String> otherComIds = new HashSet<>();
2022-04-12 19:29:19 +08:00
Map<Integer, Map<String, String>> result = new HashMap<>();
pos.stream().forEach(item -> {
if (StringUtils.isNotBlank(item.getSocialPaymentBaseString()) || StringUtils.isNotBlank(item.getSocialPaymentComBaseString())) {
2022-04-12 19:29:19 +08:00
Map<String, String> socialJson = JSON.parseObject(item.getSocialPaymentBaseString(), new HashMap<String, String>().getClass());
2022-07-21 17:28:47 +08:00
if(socialJson!=null){
socialJson.forEach((k, v) -> {
socailIds.add(k);
});
}
//如果需要区分个人和公司福利基数
if (welBaseDiffSign) {
Map<String, Object> socialComJson = JSON.parseObject(item.getSocialPaymentComBaseString(), new TypeReference<Map<String, Object>>() {
});
if (socialComJson != null) {
socialComJson.forEach((k, v) -> socailComIds.add(k));
}
}
2022-07-21 17:28:47 +08:00
2022-04-12 19:29:19 +08:00
}
if (StringUtils.isNotBlank(item.getFundPaymentBaseString()) || StringUtils.isNotBlank(item.getFundPaymentComBaseString())) {
2022-04-12 19:29:19 +08:00
Map<String, String> fundJson = JSON.parseObject(item.getFundPaymentBaseString(), new HashMap<String, String>().getClass());
2022-07-21 17:28:47 +08:00
if(fundJson!=null){
fundJson.forEach((k, v) -> {
fundIds.add(k);
});
}
//如果需要区分个人和公司福利基数
if (welBaseDiffSign) {
Map<String, Object> fundComJson = JSON.parseObject(item.getFundPaymentComBaseString(), new TypeReference<Map<String, Object>>() {
});
if (fundComJson != null) {
fundComJson.forEach((k, v) -> fundComIds.add(k));
}
}
2022-07-21 17:28:47 +08:00
2022-04-12 19:29:19 +08:00
}
if (StringUtils.isNotBlank(item.getOtherPaymentBaseString()) || StringUtils.isNotBlank(item.getOtherPaymentComBaseString())) {
2022-04-12 19:29:19 +08:00
Map<String, String> otherJson = JSON.parseObject(item.getOtherPaymentBaseString(), new HashMap<String, String>().getClass());
2022-07-21 17:28:47 +08:00
if(otherJson!=null){
otherJson.forEach((k, v) -> {
otherIds.add(k);
});
}
//如果需要区分个人和公司福利基数
if (welBaseDiffSign) {
Map<String, Object> otherComJson = JSON.parseObject(item.getOtherPaymentComBaseString(), new TypeReference<Map<String, Object>>() {
});
if (otherComJson != null) {
otherComJson.forEach((k, v) -> otherComIds.add(k));
}
}
2022-07-21 17:28:47 +08:00
2022-04-12 19:29:19 +08:00
}
});
Map<String, String> socialColumns = new HashMap<>();
Map<String, String> fundColumns = new HashMap<>();
Map<String, String> otherColumns = new HashMap<>();
Map<String, String> socialComColumns = new HashMap<>();
Map<String, String> fundComColumns = new HashMap<>();
Map<String, String> otherComColumns = new HashMap<>();
if (welBaseDiffSign) {
socailIds.stream().forEach(social -> {
if (categoryIdNameMap.containsKey(social)) {
socialColumns.put(categoryIdNameMap.get(social) + SalaryI18nUtil.getI18nLabel(0, "申报基数") + SalaryI18nUtil.getI18nLabel( 0, "个人"), social + "socialPerBase");
}
});
fundIds.stream().forEach(social -> {
if (categoryIdNameMap.containsKey(social)) {
fundColumns.put(categoryIdNameMap.get(social) + SalaryI18nUtil.getI18nLabel( 0, "申报基数") + SalaryI18nUtil.getI18nLabel( 0, "个人"), social + "fundPerBase");
}
});
otherIds.stream().forEach(social -> {
if (categoryIdNameMap.containsKey(social)) {
otherColumns.put(categoryIdNameMap.get(social) + SalaryI18nUtil.getI18nLabel( 0, "申报基数") + SalaryI18nUtil.getI18nLabel( 0, "个人"), social + "otherPerBase");
}
});
socailComIds.stream().forEach(social -> {
if (categoryIdNameMap.containsKey(social)) {
socialComColumns.put(categoryIdNameMap.get(social) + SalaryI18nUtil.getI18nLabel(0, "申报基数") + SalaryI18nUtil.getI18nLabel( 0, "单位"), social + "socialComBase");
}
});
fundComIds.stream().forEach(social -> {
if (categoryIdNameMap.containsKey(social)) {
fundComColumns.put(categoryIdNameMap.get(social) + SalaryI18nUtil.getI18nLabel( 0, "申报基数") + SalaryI18nUtil.getI18nLabel( 0, "单位"), social + "fundComBase");
}
});
otherComIds.stream().forEach(social -> {
if (categoryIdNameMap.containsKey(social)) {
otherComColumns.put(categoryIdNameMap.get(social) + SalaryI18nUtil.getI18nLabel( 0, "申报基数") + SalaryI18nUtil.getI18nLabel( 0, "单位"), social + "otherComBase");
}
});
} else {
socailIds.stream().forEach(social -> {
if (categoryIdNameMap.containsKey(social)) {
socialColumns.put(categoryIdNameMap.get(social) + SalaryI18nUtil.getI18nLabel(0, "申报基数"), social + "socialBase");
}
});
fundIds.stream().forEach(social -> {
if (categoryIdNameMap.containsKey(social)) {
fundColumns.put(categoryIdNameMap.get(social) + SalaryI18nUtil.getI18nLabel( 0, "申报基数"), social + "fundBase");
}
});
otherIds.stream().forEach(social -> {
if (categoryIdNameMap.containsKey(social)) {
otherColumns.put(categoryIdNameMap.get(social) + SalaryI18nUtil.getI18nLabel( 0, "申报基数"), social + "otherBase");
}
});
}
// map根据value排序
LinkedHashMap<String, String> socialColumnsWithAscValue = socialColumns.entrySet().stream()
.sorted(Map.Entry.comparingByValue())
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (oldValue, newValue) -> oldValue,
LinkedHashMap::new));
LinkedHashMap<String, String> fundColumnsWithAscValue = fundColumns.entrySet().stream()
.sorted(Map.Entry.comparingByValue())
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (oldValue, newValue) -> oldValue,
LinkedHashMap::new));
LinkedHashMap<String, String> otherColumnsWithAscValue = otherColumns.entrySet().stream()
.sorted(Map.Entry.comparingByValue())
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (oldValue, newValue) -> oldValue,
LinkedHashMap::new));
if (welBaseDiffSign) {
LinkedHashMap<String, String> socialComMapWithAscKey = socialComColumns.entrySet().stream()
.sorted(Map.Entry.comparingByKey())
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (oldValue, newValue) -> oldValue,
LinkedHashMap::new));
LinkedHashMap<String, String> fundComMapWithAscKey = fundComColumns.entrySet().stream()
.sorted(Map.Entry.comparingByKey())
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (oldValue, newValue) -> oldValue,
LinkedHashMap::new));
LinkedHashMap<String, String> otherComMapWithAscKey = otherComColumns.entrySet().stream()
.sorted(Map.Entry.comparingByKey())
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (oldValue, newValue) -> oldValue,
LinkedHashMap::new));
socialColumnsWithAscValue.putAll(socialComMapWithAscKey);
fundColumnsWithAscValue.putAll(fundComMapWithAscKey);
otherColumnsWithAscValue.putAll(otherComMapWithAscKey);
}
result.put(WelfareTypeEnum.SOCIAL_SECURITY.getValue(), socialColumnsWithAscValue);
result.put(WelfareTypeEnum.ACCUMULATION_FUND.getValue(), fundColumnsWithAscValue);
result.put(WelfareTypeEnum.OTHER.getValue(), otherColumnsWithAscValue);
2022-04-12 19:29:19 +08:00
return result;
}
private Map<Integer, Map<String, String>> buildPersonalTitle(List<InsuranceAccountDetailPO> pos, Map<String, String> categoryIdNameMap, Long employeeId, String tenantKey) {
Set<String> socailIds = new HashSet<>();
Set<String> fundIds = new HashSet<>();
Set<String> otherIds = new HashSet<>();
Map<Integer, Map<String, String>> result = new HashMap<>();
pos.stream().forEach(item -> {
if (StringUtils.isNotBlank(item.getSocialPerJson())) {
Map<String, String> socialJson = JSON.parseObject(item.getSocialPerJson(), new HashMap<String, String>().getClass());
2022-07-21 17:28:47 +08:00
if(socialJson!=null){
socialJson.forEach((k, v) -> {
socailIds.add(k);
});
}
2022-04-12 19:29:19 +08:00
}
if (StringUtils.isNotBlank(item.getFundPerJson())) {
Map<String, String> fundJson = JSON.parseObject(item.getFundPerJson(), new HashMap<String, String>().getClass());
2022-07-21 17:28:47 +08:00
if(fundJson!=null){
fundJson.forEach((k, v) -> {
fundIds.add(k);
});
}
2022-04-12 19:29:19 +08:00
}
if (StringUtils.isNotBlank(item.getOtherPerJson())) {
Map<String, String> otherJson = JSON.parseObject(item.getOtherPerJson(), new HashMap<String, String>().getClass());
2022-07-21 17:28:47 +08:00
if(otherJson!=null){
otherJson.forEach((k, v) -> {
otherIds.add(k);
});
}
2022-04-12 19:29:19 +08:00
}
});
Map<String, String> socialColumns = new HashMap<>();
Map<String, String> fundColumns = new HashMap<>();
Map<String, String> otherColumns = new HashMap<>();
socailIds.stream().forEach(social -> {
if (categoryIdNameMap.containsKey(social)) {
socialColumns.put(categoryIdNameMap.get(social) + SalaryI18nUtil.getI18nLabel( 87159, "个人"), social + "socialPer");
}
});
fundIds.stream().forEach(social -> {
if (categoryIdNameMap.containsKey(social)) {
fundColumns.put(categoryIdNameMap.get(social) + SalaryI18nUtil.getI18nLabel( 87159, "个人"), social + "fundPer");
}
});
otherIds.stream().forEach(social -> {
if (categoryIdNameMap.containsKey(social)) {
otherColumns.put(categoryIdNameMap.get(social) + SalaryI18nUtil.getI18nLabel( 87159, "个人"), social + "otherPer");
}
});
// map根据value排序
LinkedHashMap<String, String> socialColumnsWithAscValue = socialColumns.entrySet().stream()
.sorted(Map.Entry.comparingByValue())
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (oldValue, newValue) -> oldValue,
LinkedHashMap::new));
LinkedHashMap<String, String> fundColumnsWithAscValue = fundColumns.entrySet().stream()
.sorted(Map.Entry.comparingByValue())
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (oldValue, newValue) -> oldValue,
LinkedHashMap::new));
LinkedHashMap<String, String> otherColumnsWithAscValue = otherColumns.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);
result.put(WelfareTypeEnum.OTHER.getValue(), otherColumnsWithAscValue);
2022-04-12 19:29:19 +08:00
return result;
}
private Map<Integer, Map<String, String>> buildComTitle(List<InsuranceAccountDetailPO> pos, Map<String, String> categoryIdNameMap, Long employeeId, String tenantKey) {
Set<String> socailIds = new HashSet<>();
Set<String> fundIds = new HashSet<>();
Set<String> otherIds = new HashSet<>();
Map<Integer, Map<String, String>> result = new HashMap<>();
pos.stream().forEach(item -> {
if (StringUtils.isNotBlank(item.getSocialComJson())) {
Map<String, String> socialJson = JSON.parseObject(item.getSocialComJson(), new HashMap<String, String>().getClass());
2022-07-21 17:28:47 +08:00
if(socialJson!=null){
socialJson.forEach((k, v) -> {
socailIds.add(k);
});
}
2022-04-12 19:29:19 +08:00
}
if (StringUtils.isNotBlank(item.getFundComJson())) {
Map<String, String> fundJson = JSON.parseObject(item.getFundComJson(), new HashMap<String, String>().getClass());
2022-07-21 17:28:47 +08:00
if(fundJson!=null){
fundJson.forEach((k, v) -> {
fundIds.add(k);
});
}
2022-04-12 19:29:19 +08:00
}
if (StringUtils.isNotBlank(item.getOtherComJson())) {
Map<String, String> otherJson = JSON.parseObject(item.getOtherComJson(), new HashMap<String, String>().getClass());
2022-07-21 17:28:47 +08:00
if(otherJson!=null){
otherJson.forEach((k, v) -> {
otherIds.add(k);
});
}
2022-04-12 19:29:19 +08:00
}
});
Map<String, String> socialColumns = new HashMap<>();
Map<String, String> fundColumns = new HashMap<>();
Map<String, String> otherColumns = new HashMap<>();
socailIds.stream().forEach(social -> {
if (categoryIdNameMap.containsKey(social)) {
socialColumns.put(categoryIdNameMap.get(social) + SalaryI18nUtil.getI18nLabel( 100289, "单位"), social + "socialCom");
}
});
fundIds.stream().forEach(social -> {
if (categoryIdNameMap.containsKey(social)) {
fundColumns.put(categoryIdNameMap.get(social) + SalaryI18nUtil.getI18nLabel( 100289, "单位"), social + "fundCom");
}
});
otherIds.stream().forEach(social -> {
if (categoryIdNameMap.containsKey(social)) {
otherColumns.put(categoryIdNameMap.get(social) + SalaryI18nUtil.getI18nLabel( 100289, "单位"), social + "otherCom");
}
});
// map根据value排序
LinkedHashMap<String, String> socialColumnsWithAscValue = socialColumns.entrySet().stream()
.sorted(Map.Entry.comparingByValue())
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (oldValue, newValue) -> oldValue,
LinkedHashMap::new));
LinkedHashMap<String, String> fundColumnsWithAscValue = fundColumns.entrySet().stream()
.sorted(Map.Entry.comparingByValue())
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (oldValue, newValue) -> oldValue,
LinkedHashMap::new));
LinkedHashMap<String, String> otherColumnsWithAscValue = otherColumns.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);
result.put(WelfareTypeEnum.OTHER.getValue(), otherColumnsWithAscValue);
2022-04-12 19:29:19 +08:00
return result;
}
@Override
2022-04-16 16:43:33 +08:00
public List<WeaTableColumn> buildCommonColumns(List<InsuranceAccountDetailPO> pos) {
2022-04-12 19:29:19 +08:00
return null;
}
@Override
public List<WeaTableColumn> buildInspectColumns(List<InsuranceAccountInspectPO> pos, Long paymentOrganization) {
2022-04-16 16:43:33 +08:00
List<WeaTableColumn> list = new ArrayList<>();
2022-04-16 16:43:33 +08:00
List<Long> employeeIds = pos.stream().map(InsuranceAccountInspectPO::getEmployeeId).collect(Collectors.toList());
// Map<Long, InsuranceArchivesAccountPO> insuranceArchivesAccountPOMap = siArchivesBiz.buildBatchAccount(employeeIds, paymentOrganization);
Map<Long, InsuranceArchivesAccountPO> insuranceArchivesAccountPOMap = getSIArchivesService(user).buildBatchAccount(employeeIds, paymentOrganization);
Map<String, String> categoryIdNameMap = getICategoryMapper().listAll().stream().collect(Collectors.toMap(ICategoryPO -> String.valueOf(ICategoryPO.getId()), ICategoryPO::getInsuranceName));
2022-04-16 16:43:33 +08:00
Map<Integer, Map<String, String>> columns = buildInspectTableTitle(new ArrayList<>(insuranceArchivesAccountPOMap.values()), categoryIdNameMap);
WeaTableColumn weaTableNameColumn = new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 85429, "姓名"), "userName");
weaTableNameColumn.setFixed("left");
WeaTableColumn idColumn = new WeaTableColumn("150px", "id", "id");
idColumn.setIsPrimarykey(WeaBoolAttr.TRUE);
idColumn.setDisplay(WeaBoolAttr.FALSE);
list.add(idColumn);
list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 86185, "部门"), "department"));
list.add(new WeaTableColumn("150px", SalaryI18nUtil.getI18nLabel(86186, "手机号"), "mobile"));
list.add(new WeaTableColumn("150px", SalaryI18nUtil.getI18nLabel(86187, "员工状态"), "employeeStatus"));
list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 100544, "缴纳情况"), "supplementaryMonth"));
list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 91323, "社保方案名称"), "socialSchemeName"));
//组装社保基数
columns.get(WelfareTypeEnum.SOCIAL_SECURITY.getValue()).forEach((k, v) -> {
list.add(new WeaTableColumn("150px",k, v));
});
list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 91485, "公积金方案名称"), "fundSchemeName"));
//组装公积金基数
columns.get(WelfareTypeEnum.ACCUMULATION_FUND.getValue()).forEach((k, v) -> {
list.add(new WeaTableColumn("150px",k, v));
});
list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 91496, "其他福利方案名称"), "otherSchemeName"));
columns.get(WelfareTypeEnum.OTHER.getValue()).forEach((k, v) -> {
list.add(new WeaTableColumn("150px",k, v));
});
return list;
}
private Map<Integer, Map<String, String>> buildInspectTableTitle(List<InsuranceArchivesAccountPO> pos, Map<String, String> categoryIdNameMap
) {
Set<String> socailIds = new HashSet<>();
Set<String> fundIds = new HashSet<>();
Set<String> otherIds = new HashSet<>();
Map<Integer, Map<String, String>> result = new HashMap<>();
pos.stream().forEach(item -> {
InsuranceArchivesSocialSchemePO social = item.getSocial();
if (social != null && StringUtils.isNotBlank(social.getSocialPaymentBaseString())) {
Map<String, String> socialJson = JSON.parseObject(social.getSocialPaymentBaseString(), new HashMap<String, String>().getClass());
2022-07-21 17:28:47 +08:00
if(socialJson!=null){
socialJson.forEach((k, v) -> {
socailIds.add(k);
});
}
2022-04-16 16:43:33 +08:00
}
InsuranceArchivesFundSchemePO fund = item.getFund();
if (fund != null && StringUtils.isNotBlank(fund.getFundPaymentBaseString())) {
Map<String, String> fundJson = JSON.parseObject(fund.getFundPaymentBaseString(), new HashMap<String, String>().getClass());
2022-07-21 17:28:47 +08:00
if(fundJson!=null){
fundJson.forEach((k, v) -> {
fundIds.add(k);
});
}
2022-04-16 16:43:33 +08:00
}
InsuranceArchivesOtherSchemePO other = item.getOther();
if (other != null && StringUtils.isNotBlank(other.getOtherPaymentBaseString())) {
Map<String, String> otherJson = JSON.parseObject(other.getOtherPaymentBaseString(), new HashMap<String, String>().getClass());
2022-07-21 17:28:47 +08:00
if(otherJson!=null){
otherJson.forEach((k, v) -> {
otherIds.add(k);
});
}
2022-04-16 16:43:33 +08:00
}
});
Map<String, String> socialColumns = new HashMap<>();
Map<String, String> fundColumns = new HashMap<>();
Map<String, String> otherColumns = new HashMap<>();
socailIds.stream().forEach(social -> {
if (categoryIdNameMap.containsKey(social)) {
socialColumns.put(categoryIdNameMap.get(social) + SalaryI18nUtil.getI18nLabel( 100293, "申报基数"), social + "socialBase");
}
});
fundIds.stream().forEach(social -> {
if (categoryIdNameMap.containsKey(social)) {
fundColumns.put(categoryIdNameMap.get(social) + SalaryI18nUtil.getI18nLabel( 100293, "申报基数"), social + "fundBase");
}
});
otherIds.stream().forEach(social -> {
if (categoryIdNameMap.containsKey(social)) {
otherColumns.put(categoryIdNameMap.get(social) + SalaryI18nUtil.getI18nLabel( 100293, "申报基数"), social + "otherBase");
}
});
result.put(WelfareTypeEnum.SOCIAL_SECURITY.getValue(), socialColumns);
result.put(WelfareTypeEnum.ACCUMULATION_FUND.getValue(), fundColumns);
result.put(WelfareTypeEnum.OTHER.getValue(), otherColumns);
return result;
2022-04-12 19:29:19 +08:00
}
@Override
public List<WeaTableColumn> buildCompensationColumns() {
List<WeaTableColumn> list = new ArrayList<>();
WeaTableColumn weaTableNameColumn = new WeaTableColumn("300px",SalaryI18nUtil.getI18nLabel( 87000, "调差对象"), "target");
weaTableNameColumn.setFixed("left");
list.add(weaTableNameColumn);
list.add(new WeaTableColumn("100px",SalaryI18nUtil.getI18nLabel( 87001, "统计调差福利"), "welfareType"));
list.add(new WeaTableColumn("200px",SalaryI18nUtil.getI18nLabel( 87001, "统计调差福利类型(单位)"), "categoryType"));
list.add(new WeaTableColumn("200px",SalaryI18nUtil.getI18nLabel( 87002, "国家核算金额(单位)"), "countryTotal"));
list.add(new WeaTableColumn("200px",SalaryI18nUtil.getI18nLabel( 87003, "公司核算金额(单位)"), "companyTotal"));
list.add(new WeaTableColumn("100px",SalaryI18nUtil.getI18nLabel( 87004, "应调差金额"), "adjustmentTotal"));
list.add(new WeaTableColumn("200px",SalaryI18nUtil.getI18nLabel( 87005, "调差到(单位)"), "adjustTo"));
return list;
}
2022-04-12 19:29:19 +08:00
}