From 40013d698bb891dbe936170ad3f423a5b4acc714 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=92=B1=E6=B6=9B?= <15850646081@163.com> Date: Thu, 18 Jan 2024 15:12:00 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E6=9A=82=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SalaryStatisticsReportServiceImpl.java | 118 ++++++++++++++---- .../SalaryStatisticsDimensionWrapper.java | 3 +- .../SalaryStatisticsReportWrapper.java | 14 +-- 3 files changed, 104 insertions(+), 31 deletions(-) diff --git a/src/com/engine/salary/report/service/impl/SalaryStatisticsReportServiceImpl.java b/src/com/engine/salary/report/service/impl/SalaryStatisticsReportServiceImpl.java index 3f9745f11..65a672424 100644 --- a/src/com/engine/salary/report/service/impl/SalaryStatisticsReportServiceImpl.java +++ b/src/com/engine/salary/report/service/impl/SalaryStatisticsReportServiceImpl.java @@ -495,12 +495,11 @@ public class SalaryStatisticsReportServiceImpl extends Service implements Salary String salaryReportConditions = getSalaryCacheService(user).get(SalaryCacheKey.SALARY_REPORT_CONDITIONS + id); if (StringUtils.isNotBlank(salaryReportConditions)) { Arrays.asList(salaryReportConditions.split(",")).forEach(paramMd5 -> { - if (StringUtils.isNotBlank(paramMd5)) { - //条件对应的结果 - getSalaryCacheService(user).remove(SalaryCacheKey.SALARY_REPORT_DATA + id + "_" + paramMd5); - } - } - ); + if (StringUtils.isNotBlank(paramMd5)) { + //条件对应的结果 + getSalaryCacheService(user).remove(SalaryCacheKey.SALARY_REPORT_DATA + id + "_" + paramMd5); + } + }); getSalaryCacheService(user).remove(SalaryCacheKey.SALARY_REPORT_CONDITIONS + id); } } @@ -523,14 +522,13 @@ public class SalaryStatisticsReportServiceImpl extends Service implements Salary List c = new ArrayList<>(); if (StringUtils.isNotBlank(salaryReportConditions)) { Arrays.asList(salaryReportConditions.split(",")).forEach(paramMd5 -> { - if (StringUtils.isNotBlank(paramMd5)) { - Map data = getSalaryCacheService(user).get(SalaryCacheKey.SALARY_REPORT_DATA + paramMd5); - Map kv = new HashMap<>(); - kv.put(paramMd5, data); - c.add(kv); - } - } - ); + if (StringUtils.isNotBlank(paramMd5)) { + Map data = getSalaryCacheService(user).get(SalaryCacheKey.SALARY_REPORT_DATA + paramMd5); + Map kv = new HashMap<>(); + kv.put(paramMd5, data); + c.add(kv); + } + }); report.add(c); } } @@ -639,7 +637,7 @@ public class SalaryStatisticsReportServiceImpl extends Service implements Salary case SalaryStatisticsDimensionConstant.DM_COMPANY_YEAR: return buildCompanyYearRecords(data, salaryAcctResultValueMap); default: - return new PageInfo<>(); + return buildSalaryItemRecords(data, dimension.getDimCode(), salaryAcctResultValueMap); } // 定量-组距式分组 } else if (SalaryStatisticsDimensionTypeEnum.RATION_GROUP_SPACING.getValue().equals(dimension.getDimType())) { @@ -1063,9 +1061,7 @@ public class SalaryStatisticsReportServiceImpl extends Service implements Salary Map> sameEmployeeListMap = data.getSameList().stream().collect(Collectors.groupingBy(SalaryAcctEmployeePO::getEmployeeId)); List empIds = accountDetailPOList.stream().map(SalaryAcctEmployeePO::getEmployeeId).distinct().collect(Collectors.toList()); - Map employeeByIdMap = getSalaryEmployeeService(user).getEmployeeByIdsAll(empIds) - .stream() - .collect(Collectors.toMap(DataCollectionEmployee::getEmployeeId, o -> o)); + Map employeeByIdMap = getSalaryEmployeeService(user).getEmployeeByIdsAll(empIds).stream().collect(Collectors.toMap(DataCollectionEmployee::getEmployeeId, o -> o)); //人员维度扩展属性 EmployeeInfoExpandDTO employeeInfoExpandDTO = getSalaryStatisticsDimensionService(user).getExpandFieldSettings("dim_employee"); @@ -1083,11 +1079,9 @@ public class SalaryStatisticsReportServiceImpl extends Service implements Salary Map temp = new HashMap<>(); // temp.put(DM, Objects.nonNull(employeeByIdMap.get(k)) ? employeeByIdMap.get(k) : employeeExtByIdMap.get(k)); temp.put(DM, employeeByIdMap.get(k).getUsername()); - fieldSettings.forEach( - fieldSetting -> { - temp.put(fieldSetting.getField(), expandEmployeeMap.getOrDefault(k, new HashMap<>()).get(fieldSetting.getField())); - } - ); + fieldSettings.forEach(fieldSetting -> { + temp.put(fieldSetting.getField(), expandEmployeeMap.getOrDefault(k, new HashMap<>()).get(fieldSetting.getField())); + }); temp.putAll(SalaryStatisticsReportBO.calculateItem(v, lastEmployeeListMap.get(k), sameEmployeeListMap.get(k), salaryAcctResultValueMap, data.getSalaryStatisticsItemList())); records.add(temp); } else if (StringUtils.equals(dimensionValue, employeeByIdMap.get(k).getUsername())) { @@ -1926,6 +1920,84 @@ public class SalaryStatisticsReportServiceImpl extends Service implements Salary return result; } + private PageInfo> buildSalaryItemRecords(SalaryStatisticsReportDataDTO data, String dimCode, Map> salaryAcctResultValueMap) { + + //查询薪资项目存在的种类 + Set itemValues = new HashSet<>(); + for (Long k : salaryAcctResultValueMap.keySet()) { + Map map = salaryAcctResultValueMap.get(k); + itemValues.add(map.getOrDefault(dimCode, "")); + } + + + PageInfo> result = new PageInfo<>(); + List> records = new ArrayList<>(); + Map> simpleUserInfoMap = getSimpleUserInfoList(data); + if (simpleUserInfoMap.isEmpty()) { + return result; + } + + + Set companyYearSet = new HashSet<>(); + + Map empIdCompanyYearMap = new HashMap<>(); + Map lastEmpIdCompanyYearMap = new HashMap<>(); + Map sameEmpIdCompanyYearMap = new HashMap<>(); + simpleUserInfoMap.get(NOW_INFO).forEach(employee -> { + if (employee.getCompanyWorkYear() != null) { + companyYearSet.add(Util.null2String(employee.getCompanyWorkYear())); + empIdCompanyYearMap.put(employee.getEmployeeId(), Util.null2String(employee.getCompanyWorkYear())); + } + }); + simpleUserInfoMap.get(LAST_INFO).forEach(employee -> { + if (employee.getCompanyWorkYear() != null) { + lastEmpIdCompanyYearMap.put(employee.getEmployeeId(), Util.null2String(employee.getCompanyWorkYear())); + } + }); + simpleUserInfoMap.get(SAME_INFO).forEach(employee -> { + if (employee.getCompanyWorkYear() != null) { + sameEmpIdCompanyYearMap.put(employee.getEmployeeId(), Util.null2String(employee.getCompanyWorkYear())); + } + }); + + List companyYears = Lists.newArrayList(companyYearSet); + companyYears = companyYears.stream().sorted().collect(Collectors.toList()); + + String dimensionValue = data.getDimensionValue(); + companyYears.forEach(k -> { + if (dimensionValue == null) { + List salaryAcctEmployees = data.getList().stream().filter(po -> Objects.equals(empIdCompanyYearMap.get(po.getEmployeeId()), k)).collect(Collectors.toList()); + List lastSalaryAcctEmployees = data.getLastList().stream().filter(po -> Objects.equals(lastEmpIdCompanyYearMap.get(po.getEmployeeId()), k)).collect(Collectors.toList()); + List sameSalaryAcctEmployees = data.getSameList().stream().filter(po -> Objects.equals(sameEmpIdCompanyYearMap.get(po.getEmployeeId()), k)).collect(Collectors.toList()); + Map temp = new HashMap<>(); + temp.put(DM, k); + temp.putAll(SalaryStatisticsReportBO.calculateItem(salaryAcctEmployees, lastSalaryAcctEmployees, sameSalaryAcctEmployees, salaryAcctResultValueMap, data.getSalaryStatisticsItemList())); + records.add(temp); + } else if (StringUtils.equals(dimensionValue, k)) { + List salaryAcctEmployees = data.getList().stream().filter(po -> Objects.equals(empIdCompanyYearMap.get(po.getEmployeeId()), k)).collect(Collectors.toList()); + data.setListByDimensionValue(salaryAcctEmployees); + } + }); + + if (dimensionValue == null) { + List noGroupingList = data.getList().stream().filter(po -> empIdCompanyYearMap.get(po.getEmployeeId()) == null).collect(Collectors.toList()); + List lastNoGroupingList = data.getLastList().stream().filter(po -> lastEmpIdCompanyYearMap.get(po.getEmployeeId()) == null).collect(Collectors.toList()); + List sameNoGroupingList = data.getSameList().stream().filter(po -> sameEmpIdCompanyYearMap.get(po.getEmployeeId()) == null).collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(noGroupingList)) { + Map noGrouping = new HashMap<>(); + noGrouping.put(DM, SalaryI18nUtil.getI18nLabel(153462, "无分组")); + noGrouping.putAll(SalaryStatisticsReportBO.calculateItem(noGroupingList, lastNoGroupingList, sameNoGroupingList, salaryAcctResultValueMap, data.getSalaryStatisticsItemList())); + records.add(noGrouping); + } + } else if (StringUtils.equals(dimensionValue, "无分组")) { + List noGroupingList = data.getList().stream().filter(po -> empIdCompanyYearMap.get(po.getEmployeeId()) == null).collect(Collectors.toList()); + data.setListByDimensionValue(noGroupingList); + } + + result.setList(records); + return result; + } + // private PageInfo> buildRationGroupSpacing4NoItemRecords(SalaryStatisticsDimensionPO dimension, SalaryStatisticsReportDataDTO data, Map> salaryAcctResultValueMap) { // PageInfo> result = new PageInfo<>(); // List> records = new ArrayList<>(); diff --git a/src/com/engine/salary/report/wrapper/SalaryStatisticsDimensionWrapper.java b/src/com/engine/salary/report/wrapper/SalaryStatisticsDimensionWrapper.java index 7e8c8a374..70261fc4d 100644 --- a/src/com/engine/salary/report/wrapper/SalaryStatisticsDimensionWrapper.java +++ b/src/com/engine/salary/report/wrapper/SalaryStatisticsDimensionWrapper.java @@ -114,6 +114,7 @@ public class SalaryStatisticsDimensionWrapper extends Service { * @return */ public SalaryStatisticsDimensionFormDTO getFrom(Long id) { + List salaryItemList = salaryItemService(user).listAll(); List statsDimOptions = Lists.newArrayList(); // statsDimOptions.add(new WeaFormOption(SalaryStatisticsDimensionConstant.DM_SEX, SalaryI18nUtil.getI18nLabel(98622, "性别"))); @@ -129,12 +130,12 @@ public class SalaryStatisticsDimensionWrapper extends Service { // statsDimOptions.add(new WeaFormOption(SalaryStatisticsDimensionConstant.DM_AGE, SalaryI18nUtil.getI18nLabel(174001, "年龄"))); statsDimOptions.add(new WeaFormOption(SalaryStatisticsDimensionConstant.DM_WORK_YEAR, SalaryI18nUtil.getI18nLabel(174000, "工龄"))); statsDimOptions.add(new WeaFormOption(SalaryStatisticsDimensionConstant.DM_COMPANY_YEAR, SalaryI18nUtil.getI18nLabel(174003, "司龄"))); + statsDimOptions.addAll(salaryItemList.stream().map(item -> new WeaFormOption(item.getId().toString(), item.getName())).collect(Collectors.toList())); List groupDimOptions = Lists.newArrayList(); // groupDimOptions.add(new WeaFormOption(SalaryStatisticsDimensionConstant.DM_AGE, SalaryI18nUtil.getI18nLabel(174001, "年龄"))); groupDimOptions.add(new WeaFormOption(SalaryStatisticsDimensionConstant.DM_WORK_YEAR, SalaryI18nUtil.getI18nLabel(174000, "工龄"))); groupDimOptions.add(new WeaFormOption(SalaryStatisticsDimensionConstant.DM_COMPANY_YEAR, SalaryI18nUtil.getI18nLabel(174003, "司龄"))); - List salaryItemList = salaryItemService(user).listAll(); groupDimOptions.addAll(salaryItemList.stream() .filter(item -> SalaryDataTypeEnum.NUMBER.getValue().equals(item.getDataType())) .map(item -> new WeaFormOption(item.getId().toString(), item.getName())).collect(Collectors.toList())); diff --git a/src/com/engine/salary/report/wrapper/SalaryStatisticsReportWrapper.java b/src/com/engine/salary/report/wrapper/SalaryStatisticsReportWrapper.java index 508877028..0da317ee9 100644 --- a/src/com/engine/salary/report/wrapper/SalaryStatisticsReportWrapper.java +++ b/src/com/engine/salary/report/wrapper/SalaryStatisticsReportWrapper.java @@ -319,13 +319,13 @@ public class SalaryStatisticsReportWrapper extends Service { //已缓存的报表id String salaryReportIds = Utils.null2String(getSalaryCacheService(user).get(SalaryCacheKey.SALARY_REPORT_IDS)); String salaryReportConditions = ""; - if (StringUtils.isNotBlank(salaryReportIds) && salaryReportIds.contains(id + "")) { - //报表中缓存的条件 - salaryReportConditions = Utils.null2String(getSalaryCacheService(user).get(SalaryCacheKey.SALARY_REPORT_CONDITIONS + id)); - if (StringUtils.isNotBlank(salaryReportConditions) && salaryReportConditions.contains(paramMd5)) { - return getSalaryCacheService(user).get(SalaryCacheKey.SALARY_REPORT_DATA + id + "_" + paramMd5); - } - } +// if (StringUtils.isNotBlank(salaryReportIds) && salaryReportIds.contains(id + "")) { +// //报表中缓存的条件 +// salaryReportConditions = Utils.null2String(getSalaryCacheService(user).get(SalaryCacheKey.SALARY_REPORT_CONDITIONS + id)); +// if (StringUtils.isNotBlank(salaryReportConditions) && salaryReportConditions.contains(paramMd5)) { +// return getSalaryCacheService(user).get(SalaryCacheKey.SALARY_REPORT_DATA + id + "_" + paramMd5); +// } +// } // 列表data From d09034b17b3f6301c3662ec1562e6986a1308d64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=92=B1=E6=B6=9B?= <15850646081@163.com> Date: Mon, 22 Jan 2024 10:38:18 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E6=8A=A5=E8=A1=A8=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E6=96=87=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../entity/bo/SalaryStatisticsReportBO.java | 27 ++++++++ .../entity/po/SalaryStatisticsItemPO.java | 38 +++++----- .../SalaryStatisticsReportServiceImpl.java | 69 ++++--------------- 3 files changed, 59 insertions(+), 75 deletions(-) diff --git a/src/com/engine/salary/report/entity/bo/SalaryStatisticsReportBO.java b/src/com/engine/salary/report/entity/bo/SalaryStatisticsReportBO.java index 10e42f83a..2f6986f7a 100644 --- a/src/com/engine/salary/report/entity/bo/SalaryStatisticsReportBO.java +++ b/src/com/engine/salary/report/entity/bo/SalaryStatisticsReportBO.java @@ -1,5 +1,6 @@ package com.engine.salary.report.entity.bo; +import cn.hutool.core.util.StrUtil; import com.alibaba.fastjson.JSON; import com.cloudstore.eccom.pc.table.WeaTableColumn; import com.engine.common.util.ServiceUtil; @@ -932,6 +933,16 @@ public class SalaryStatisticsReportBO { return sumDecimal; } + private static String handle4GroupValue(String dimCode, SalaryAcctEmployeePO sa, Map> salaryAcctResultValueMap, SalaryStatisticsItemPO item) { + if (salaryAcctResultValueMap.get(sa.getId()) != null) { + String value = salaryAcctResultValueMap.get(sa.getId()).get(dimCode); + if (StringUtils.isNotBlank(value)) { + return value; + } + } + return ""; + } + /** * 定量-单项式分组list分割 * @@ -960,6 +971,22 @@ public class SalaryStatisticsReportBO { return list.stream().filter(i -> ids.contains(i.getId())).collect(Collectors.toList()); } + public static List listAcctEmpByRationGroupIndividual(String groupIndividual, String dimCode, List list, Map yearMap, Map> salaryAcctResultValueMap, List salaryStatisticsItemList) { + Set ids = Sets.newHashSet(); + + for (SalaryAcctEmployeePO sa : list) { + salaryStatisticsItemList.forEach(item -> { + String value = handle4GroupValue(dimCode, sa, salaryAcctResultValueMap, item); + + if (StrUtil.equals(groupIndividual, value)) { + ids.add(sa.getId()); + } + }); + } + + return list.stream().filter(i -> ids.contains(i.getId())).collect(Collectors.toList()); + } + public static Map checkLoad(List salaryStatisticsItemList) { boolean isNow = false; boolean isLast = false; diff --git a/src/com/engine/salary/report/entity/po/SalaryStatisticsItemPO.java b/src/com/engine/salary/report/entity/po/SalaryStatisticsItemPO.java index bcf430d57..e87d1b282 100644 --- a/src/com/engine/salary/report/entity/po/SalaryStatisticsItemPO.java +++ b/src/com/engine/salary/report/entity/po/SalaryStatisticsItemPO.java @@ -12,22 +12,22 @@ import java.util.Date; @NoArgsConstructor @AllArgsConstructor @ToString -//hrsa_salary_statistics_item") -//薪酬报表统计子表自定义统计项") +//hrsa_salary_statistics_item +//薪酬报表统计子表自定义统计项 public class SalaryStatisticsItemPO implements Serializable { private static final long serialVersionUID = 5335849418826222822L; - //主键id") + //主键id private Long id; - //统计报表id") + //统计报表id private Long statReportId; - //统计项名称") + //统计项名称 private String itemName; - //统计项集合") + //统计项集合 private String itemValue; /** @@ -43,7 +43,7 @@ public class SalaryStatisticsItemPO implements Serializable { * } * jsonToString */ - //计数规则") + //计数规则 private String countRule; /** @@ -59,7 +59,7 @@ public class SalaryStatisticsItemPO implements Serializable { * } * jsonToString */ - //求和规则") + //求和规则 private String sumRule; /** @@ -75,7 +75,7 @@ public class SalaryStatisticsItemPO implements Serializable { * } * jsonToString */ - //平均值规则") + //平均值规则 private String avgRule; /** @@ -91,7 +91,7 @@ public class SalaryStatisticsItemPO implements Serializable { * } * jsonToString */ - //最大值规则") + //最大值规则 private String maxRule; /** @@ -107,7 +107,7 @@ public class SalaryStatisticsItemPO implements Serializable { * } * jsonToString */ - //最小值规则") + //最小值规则 private String minRule; /** @@ -123,7 +123,7 @@ public class SalaryStatisticsItemPO implements Serializable { * } * jsonToString */ - //中位数规则") + //中位数规则 private String medianRule; @@ -161,7 +161,7 @@ public class SalaryStatisticsItemPO implements Serializable { */ private String tileRule; - //顺序") + //顺序 private Integer indexValue; /** @@ -169,22 +169,22 @@ public class SalaryStatisticsItemPO implements Serializable { * * @see UnitTypeEnum */ - //统计单位") + //统计单位 private Integer unitType; - //创建时间") + //创建时间 private Date createTime; - //更新时间") + //更新时间 private Date updateTime; - //创建人") + //创建人 private Long creator; - //是否删除") + //是否删除 private Integer deleteType; - //租户key") + //租户key private String tenantKey; private Collection ids; diff --git a/src/com/engine/salary/report/service/impl/SalaryStatisticsReportServiceImpl.java b/src/com/engine/salary/report/service/impl/SalaryStatisticsReportServiceImpl.java index 65a672424..19290c385 100644 --- a/src/com/engine/salary/report/service/impl/SalaryStatisticsReportServiceImpl.java +++ b/src/com/engine/salary/report/service/impl/SalaryStatisticsReportServiceImpl.java @@ -637,7 +637,7 @@ public class SalaryStatisticsReportServiceImpl extends Service implements Salary case SalaryStatisticsDimensionConstant.DM_COMPANY_YEAR: return buildCompanyYearRecords(data, salaryAcctResultValueMap); default: - return buildSalaryItemRecords(data, dimension.getDimCode(), salaryAcctResultValueMap); + return buildSalaryItemRecords(dimension, data, salaryAcctResultValueMap); } // 定量-组距式分组 } else if (SalaryStatisticsDimensionTypeEnum.RATION_GROUP_SPACING.getValue().equals(dimension.getDimType())) { @@ -1920,80 +1920,37 @@ public class SalaryStatisticsReportServiceImpl extends Service implements Salary return result; } - private PageInfo> buildSalaryItemRecords(SalaryStatisticsReportDataDTO data, String dimCode, Map> salaryAcctResultValueMap) { + private PageInfo> buildSalaryItemRecords(SalaryStatisticsDimensionPO dimension, SalaryStatisticsReportDataDTO data, Map> salaryAcctResultValueMap) { - //查询薪资项目存在的种类 - Set itemValues = new HashSet<>(); + //查询薪资项目存在的种类(维度) + Set dimensionSet = new HashSet<>(); for (Long k : salaryAcctResultValueMap.keySet()) { Map map = salaryAcctResultValueMap.get(k); - itemValues.add(map.getOrDefault(dimCode, "")); + dimensionSet.add(map.getOrDefault(dimension.getDimCode(), "未分组")); } - PageInfo> result = new PageInfo<>(); List> records = new ArrayList<>(); - Map> simpleUserInfoMap = getSimpleUserInfoList(data); - if (simpleUserInfoMap.isEmpty()) { - return result; - } - - Set companyYearSet = new HashSet<>(); - - Map empIdCompanyYearMap = new HashMap<>(); - Map lastEmpIdCompanyYearMap = new HashMap<>(); - Map sameEmpIdCompanyYearMap = new HashMap<>(); - simpleUserInfoMap.get(NOW_INFO).forEach(employee -> { - if (employee.getCompanyWorkYear() != null) { - companyYearSet.add(Util.null2String(employee.getCompanyWorkYear())); - empIdCompanyYearMap.put(employee.getEmployeeId(), Util.null2String(employee.getCompanyWorkYear())); - } - }); - simpleUserInfoMap.get(LAST_INFO).forEach(employee -> { - if (employee.getCompanyWorkYear() != null) { - lastEmpIdCompanyYearMap.put(employee.getEmployeeId(), Util.null2String(employee.getCompanyWorkYear())); - } - }); - simpleUserInfoMap.get(SAME_INFO).forEach(employee -> { - if (employee.getCompanyWorkYear() != null) { - sameEmpIdCompanyYearMap.put(employee.getEmployeeId(), Util.null2String(employee.getCompanyWorkYear())); - } - }); - - List companyYears = Lists.newArrayList(companyYearSet); - companyYears = companyYears.stream().sorted().collect(Collectors.toList()); + Map empIdYearMap = new HashMap<>(); + Map lastEmpIdYearMap = new HashMap<>(); + Map sameEmpIdYearMap = new HashMap<>(); String dimensionValue = data.getDimensionValue(); - companyYears.forEach(k -> { + dimensionSet.forEach(k -> { if (dimensionValue == null) { - List salaryAcctEmployees = data.getList().stream().filter(po -> Objects.equals(empIdCompanyYearMap.get(po.getEmployeeId()), k)).collect(Collectors.toList()); - List lastSalaryAcctEmployees = data.getLastList().stream().filter(po -> Objects.equals(lastEmpIdCompanyYearMap.get(po.getEmployeeId()), k)).collect(Collectors.toList()); - List sameSalaryAcctEmployees = data.getSameList().stream().filter(po -> Objects.equals(sameEmpIdCompanyYearMap.get(po.getEmployeeId()), k)).collect(Collectors.toList()); + List salaryAcctEmployees = SalaryStatisticsReportBO.listAcctEmpByRationGroupIndividual(k, dimension.getDimCode(), data.getList(), empIdYearMap, salaryAcctResultValueMap, data.getSalaryStatisticsItemList()); + List lastSalaryAcctEmployees = SalaryStatisticsReportBO.listAcctEmpByRationGroupIndividual(k, dimension.getDimCode(), data.getLastList(), lastEmpIdYearMap, salaryAcctResultValueMap, data.getSalaryStatisticsItemList()); + List sameSalaryAcctEmployees = SalaryStatisticsReportBO.listAcctEmpByRationGroupIndividual(k, dimension.getDimCode(), data.getSameList(), sameEmpIdYearMap, salaryAcctResultValueMap, data.getSalaryStatisticsItemList()); Map temp = new HashMap<>(); temp.put(DM, k); temp.putAll(SalaryStatisticsReportBO.calculateItem(salaryAcctEmployees, lastSalaryAcctEmployees, sameSalaryAcctEmployees, salaryAcctResultValueMap, data.getSalaryStatisticsItemList())); records.add(temp); } else if (StringUtils.equals(dimensionValue, k)) { - List salaryAcctEmployees = data.getList().stream().filter(po -> Objects.equals(empIdCompanyYearMap.get(po.getEmployeeId()), k)).collect(Collectors.toList()); + List salaryAcctEmployees = SalaryStatisticsReportBO.listAcctEmpByRationGroupIndividual(k, dimension.getDimCode(), data.getList(), empIdYearMap, salaryAcctResultValueMap, data.getSalaryStatisticsItemList()); data.setListByDimensionValue(salaryAcctEmployees); } }); - - if (dimensionValue == null) { - List noGroupingList = data.getList().stream().filter(po -> empIdCompanyYearMap.get(po.getEmployeeId()) == null).collect(Collectors.toList()); - List lastNoGroupingList = data.getLastList().stream().filter(po -> lastEmpIdCompanyYearMap.get(po.getEmployeeId()) == null).collect(Collectors.toList()); - List sameNoGroupingList = data.getSameList().stream().filter(po -> sameEmpIdCompanyYearMap.get(po.getEmployeeId()) == null).collect(Collectors.toList()); - if (CollectionUtils.isNotEmpty(noGroupingList)) { - Map noGrouping = new HashMap<>(); - noGrouping.put(DM, SalaryI18nUtil.getI18nLabel(153462, "无分组")); - noGrouping.putAll(SalaryStatisticsReportBO.calculateItem(noGroupingList, lastNoGroupingList, sameNoGroupingList, salaryAcctResultValueMap, data.getSalaryStatisticsItemList())); - records.add(noGrouping); - } - } else if (StringUtils.equals(dimensionValue, "无分组")) { - List noGroupingList = data.getList().stream().filter(po -> empIdCompanyYearMap.get(po.getEmployeeId()) == null).collect(Collectors.toList()); - data.setListByDimensionValue(noGroupingList); - } - result.setList(records); return result; } From 5d3a371f56b80f872a6efc4190971682cdf372f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=92=B1=E6=B6=9B?= <15850646081@163.com> Date: Mon, 22 Jan 2024 11:45:40 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E6=8A=A5=E8=A1=A8=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E6=96=87=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/SalaryStatisticsReportServiceImpl.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/com/engine/salary/report/service/impl/SalaryStatisticsReportServiceImpl.java b/src/com/engine/salary/report/service/impl/SalaryStatisticsReportServiceImpl.java index 19290c385..9f1b4e245 100644 --- a/src/com/engine/salary/report/service/impl/SalaryStatisticsReportServiceImpl.java +++ b/src/com/engine/salary/report/service/impl/SalaryStatisticsReportServiceImpl.java @@ -398,7 +398,7 @@ public class SalaryStatisticsReportServiceImpl extends Service implements Salary Map> salaryAcctEmpResultMap = SalaryEntityUtil.group2Map(salaryAcctResultValues, SalaryAcctResultPO::getSalaryAcctEmpId); Map> map = new HashMap<>(); salaryAcctEmpResultMap.forEach((k, v) -> { - Map collect = v.stream().collect(Collectors.toMap(p -> Util.null2String(p.getSalaryItemId()), p -> Util.null2o(p.getResultValue()), (key1, key2) -> key2)); + Map collect = v.stream().collect(Collectors.toMap(p -> Util.null2String(p.getSalaryItemId()), SalaryAcctResultPO::getResultValue, (key1, key2) -> key2)); map.put(k, collect); }); @@ -444,7 +444,7 @@ public class SalaryStatisticsReportServiceImpl extends Service implements Salary List finalSalaryAcctEmpIds = getSalaryAcctResultService(user).listAcctEmpIdByAcctEmpId(salaryAcctEmployeeIds); Map> salaryAcctEmpResultMap = SalaryEntityUtil.group2Map(salaryAcctResultValues, SalaryAcctResultPO::getSalaryAcctEmpId); salaryAcctEmpResultMap.forEach((k, v) -> { - Map collect = v.stream().collect(Collectors.toMap(p -> Util.null2String(p.getSalaryItemId()), p -> Util.null2o(p.getResultValue()), (key1, key2) -> key2)); + Map collect = v.stream().collect(Collectors.toMap(p -> Util.null2String(p.getSalaryItemId()), SalaryAcctResultPO::getResultValue, (key1, key2) -> key2)); resultMap.put(k, collect); }); salaryAcctEmployeeIds.stream().forEach(id -> { @@ -1926,7 +1926,7 @@ public class SalaryStatisticsReportServiceImpl extends Service implements Salary Set dimensionSet = new HashSet<>(); for (Long k : salaryAcctResultValueMap.keySet()) { Map map = salaryAcctResultValueMap.get(k); - dimensionSet.add(map.getOrDefault(dimension.getDimCode(), "未分组")); + dimensionSet.add(map.getOrDefault(dimension.getDimCode(), "")); } PageInfo> result = new PageInfo<>(); From 336aaeabea3274ca67f11ed28f19feaf8e19d180 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=92=B1=E6=B6=9B?= <15850646081@163.com> Date: Tue, 30 Jan 2024 15:45:48 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E6=96=87=E6=9C=AC=E7=BB=B4=E5=BA=A6?= =?UTF-8?q?=EF=BC=8C=E6=97=A0=E5=88=86=E7=BB=84=E6=8E=92=E5=BA=8F=E6=94=BE?= =?UTF-8?q?=E5=88=B0=E6=9C=AB=E5=B0=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/SalaryStatisticsReportServiceImpl.java | 6 +++--- .../wrapper/SalaryStatisticsReportWrapper.java | 14 +++++++------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/com/engine/salary/report/service/impl/SalaryStatisticsReportServiceImpl.java b/src/com/engine/salary/report/service/impl/SalaryStatisticsReportServiceImpl.java index 5819ce821..261e6292b 100644 --- a/src/com/engine/salary/report/service/impl/SalaryStatisticsReportServiceImpl.java +++ b/src/com/engine/salary/report/service/impl/SalaryStatisticsReportServiceImpl.java @@ -31,13 +31,13 @@ import com.engine.salary.report.util.ReportTimeUtil; import com.engine.salary.service.*; import com.engine.salary.service.impl.*; import com.engine.salary.util.*; +import com.engine.salary.util.db.IdGenerator; import com.engine.salary.util.db.MapperProxyFactory; import com.engine.salary.util.page.PageInfo; import com.engine.salary.util.page.SalaryPageUtil; import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.google.common.collect.Sets; -import com.engine.salary.util.db.IdGenerator; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.math.NumberUtils; @@ -472,7 +472,7 @@ public class SalaryStatisticsReportServiceImpl extends Service implements Salary Map> salaryAcctEmpResultMap = SalaryEntityUtil.group2Map(salaryAcctResultValues, SalaryAcctResultPO::getSalaryAcctEmpId); Map> map = new HashMap<>(); salaryAcctEmpResultMap.forEach((k, v) -> { - Map collect = v.stream().collect(Collectors.toMap(p -> Util.null2String(p.getSalaryItemId()), p -> Util.null2o(p.getResultValue()), (key1, key2) -> key2)); + Map collect = v.stream().collect(Collectors.toMap(p -> Util.null2String(p.getSalaryItemId()), p -> Util.null2String(p.getResultValue()), (key1, key2) -> key2)); map.put(k, collect); }); @@ -1937,7 +1937,7 @@ public class SalaryStatisticsReportServiceImpl extends Service implements Salary Map sameEmpIdYearMap = new HashMap<>(); String dimensionValue = data.getDimensionValue(); - dimensionSet.forEach(k -> { + dimensionSet.stream().sorted((a,b)->b.length()-a.length()).forEach(k -> { if (dimensionValue == null) { List salaryAcctEmployees = SalaryStatisticsReportBO.listAcctEmpByRationGroupIndividual(k, dimension.getDimCode(), data.getList(), empIdYearMap, salaryAcctResultValueMap, data.getSalaryStatisticsItemList()); List lastSalaryAcctEmployees = SalaryStatisticsReportBO.listAcctEmpByRationGroupIndividual(k, dimension.getDimCode(), data.getLastList(), lastEmpIdYearMap, salaryAcctResultValueMap, data.getSalaryStatisticsItemList()); diff --git a/src/com/engine/salary/report/wrapper/SalaryStatisticsReportWrapper.java b/src/com/engine/salary/report/wrapper/SalaryStatisticsReportWrapper.java index 0da317ee9..508877028 100644 --- a/src/com/engine/salary/report/wrapper/SalaryStatisticsReportWrapper.java +++ b/src/com/engine/salary/report/wrapper/SalaryStatisticsReportWrapper.java @@ -319,13 +319,13 @@ public class SalaryStatisticsReportWrapper extends Service { //已缓存的报表id String salaryReportIds = Utils.null2String(getSalaryCacheService(user).get(SalaryCacheKey.SALARY_REPORT_IDS)); String salaryReportConditions = ""; -// if (StringUtils.isNotBlank(salaryReportIds) && salaryReportIds.contains(id + "")) { -// //报表中缓存的条件 -// salaryReportConditions = Utils.null2String(getSalaryCacheService(user).get(SalaryCacheKey.SALARY_REPORT_CONDITIONS + id)); -// if (StringUtils.isNotBlank(salaryReportConditions) && salaryReportConditions.contains(paramMd5)) { -// return getSalaryCacheService(user).get(SalaryCacheKey.SALARY_REPORT_DATA + id + "_" + paramMd5); -// } -// } + if (StringUtils.isNotBlank(salaryReportIds) && salaryReportIds.contains(id + "")) { + //报表中缓存的条件 + salaryReportConditions = Utils.null2String(getSalaryCacheService(user).get(SalaryCacheKey.SALARY_REPORT_CONDITIONS + id)); + if (StringUtils.isNotBlank(salaryReportConditions) && salaryReportConditions.contains(paramMd5)) { + return getSalaryCacheService(user).get(SalaryCacheKey.SALARY_REPORT_DATA + id + "_" + paramMd5); + } + } // 列表data