From 16f46ae2dab9167e2bf3d87c0dad092919a39af4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=92=B1=E6=B6=9B?= <15850646081@163.com> Date: Wed, 25 Oct 2023 14:33:19 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8A=A5=E8=A1=A8=E4=BA=BA=E5=91=98=E7=BB=B4?= =?UTF-8?q?=E5=BA=A6=E5=A2=9E=E5=8A=A0=E9=83=A8=E9=97=A8=E5=92=8C=E5=B7=A5?= =?UTF-8?q?=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../report/entity/bo/SalaryStatisticsReportBO.java | 11 +++++++++-- .../impl/SalaryStatisticsReportServiceImpl.java | 8 +++++--- .../report/wrapper/SalaryStatisticsReportWrapper.java | 4 ++-- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/src/com/engine/salary/report/entity/bo/SalaryStatisticsReportBO.java b/src/com/engine/salary/report/entity/bo/SalaryStatisticsReportBO.java index 008569ce1..1a76e5883 100644 --- a/src/com/engine/salary/report/entity/bo/SalaryStatisticsReportBO.java +++ b/src/com/engine/salary/report/entity/bo/SalaryStatisticsReportBO.java @@ -827,10 +827,17 @@ public class SalaryStatisticsReportBO { * @param salaryStatisticsItemList * @return */ - public static List buildReportColumns(String dimensionName, List salaryStatisticsItemList) { + public static List buildReportColumns(SalaryStatisticsDimensionPO dimensionName, List salaryStatisticsItemList) { List result = new ArrayList<>(); - result.add(new WeaTableColumnGroup("150", dimensionName, "dimension")); + result.add(new WeaTableColumnGroup("150", dimensionName.getDimName(), "dimension")); + + //人员维度新增部门和工号 + if (SalaryStatisticsDimensionConstant.DM_EMPLOYEE.equals(dimensionName.getDimCode())) { + result.add(new WeaTableColumnGroup("150", "部门", "departmentName")); + result.add(new WeaTableColumnGroup("150", "工号", "workcode")); + } + Map itemMap = salaryStatisticsItemList.stream().collect(Collectors.toMap(SalaryStatisticsItemPO::getId, Function.identity())); Map itemIdNameMap = salaryStatisticsItemList.stream().collect(LinkedHashMap::new, (map, item) -> map.put(item.getId(), item.getItemName()), LinkedHashMap::putAll); itemIdNameMap.forEach((k, v) -> { diff --git a/src/com/engine/salary/report/service/impl/SalaryStatisticsReportServiceImpl.java b/src/com/engine/salary/report/service/impl/SalaryStatisticsReportServiceImpl.java index 715d9306c..ecadc58bf 100644 --- a/src/com/engine/salary/report/service/impl/SalaryStatisticsReportServiceImpl.java +++ b/src/com/engine/salary/report/service/impl/SalaryStatisticsReportServiceImpl.java @@ -1014,7 +1014,7 @@ public class SalaryStatisticsReportServiceImpl extends Service implements Salary Map> employeeListMap = accountDetailPOList.stream().collect(Collectors.groupingBy(SalaryAcctEmployeePO::getEmployeeId)); Map> lastEmployeeListMap = data.getLastList().stream().collect(Collectors.groupingBy(SalaryAcctEmployeePO::getEmployeeId)); Map> sameEmployeeListMap = data.getSameList().stream().collect(Collectors.groupingBy(SalaryAcctEmployeePO::getEmployeeId)); - Map employeeByIdMap = getSalaryEmployeeService(user).getEmployeeByIds(accountDetailPOList.stream().map(SalaryAcctEmployeePO::getEmployeeId).distinct().collect(Collectors.toList())).stream().collect(Collectors.toMap(DataCollectionEmployee::getEmployeeId, o -> Util.null2String(o.getUsername()))); + Map employeeByIdMap = getSalaryEmployeeService(user).getEmployeeByIdsAll(accountDetailPOList.stream().map(SalaryAcctEmployeePO::getEmployeeId).distinct().collect(Collectors.toList())).stream().collect(Collectors.toMap(DataCollectionEmployee::getEmployeeId, o -> o)); // List extEmployees = extEmployeeService.listByIdsWithDeleted(accountDetailPOList.stream().filter(e -> EmployeeTypeEnum.EXT_EMPLOYEE.getValue().equals(e.getEmployeeType())).map(SalaryAcctEmployeePO::getEmployeeId).distinct().collect(Collectors.toList()), data.getTenantKey()); // Map employeeExtByIdMap = SalaryEntityUtil.convert2Map(extEmployees, ExtEmployeePO::getId, ExtEmployeePO::getUsername); @@ -1024,10 +1024,12 @@ public class SalaryStatisticsReportServiceImpl extends Service implements Salary if (dimensionValue == null) { Map temp = new HashMap<>(); // temp.put(DM, Objects.nonNull(employeeByIdMap.get(k)) ? employeeByIdMap.get(k) : employeeExtByIdMap.get(k)); - temp.put(DM, employeeByIdMap.get(k)); + temp.put(DM, employeeByIdMap.get(k).getUsername()); + temp.put("departmentName", employeeByIdMap.get(k).getDepartmentName()); + temp.put("workcode", employeeByIdMap.get(k).getWorkcode()); 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))) { + } else if (StringUtils.equals(dimensionValue, employeeByIdMap.get(k).getUsername())) { data.setListByDimensionValue(v); } }); diff --git a/src/com/engine/salary/report/wrapper/SalaryStatisticsReportWrapper.java b/src/com/engine/salary/report/wrapper/SalaryStatisticsReportWrapper.java index 5ee853229..895b09ba9 100644 --- a/src/com/engine/salary/report/wrapper/SalaryStatisticsReportWrapper.java +++ b/src/com/engine/salary/report/wrapper/SalaryStatisticsReportWrapper.java @@ -321,7 +321,7 @@ public class SalaryStatisticsReportWrapper extends Service { Map countResultMap = SalaryStatisticsReportBO.buildTotal(page, salaryStatisticsItemList, (long) user.getUID()); // 列表columns - List weaTableColumns = SalaryStatisticsReportBO.buildReportColumns(dimension.getDimName(), salaryStatisticsItemList); + List weaTableColumns = SalaryStatisticsReportBO.buildReportColumns(dimension, salaryStatisticsItemList); Map resultMap = Maps.newHashMap(); resultMap.putAll(JsonUtil.parseMap(weaTable, Object.class)); @@ -377,7 +377,7 @@ public class SalaryStatisticsReportWrapper extends Service { List> records = list.stream().map(m -> m.entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey, e -> e.getValue() + StringUtils.EMPTY))).collect(Collectors.toList()); // 获取列头 - List weaTableColumns = SalaryStatisticsReportBO.buildReportColumns(dimension.getDimName(), salaryStatisticsItemList); + List weaTableColumns = SalaryStatisticsReportBO.buildReportColumns(dimension, salaryStatisticsItemList); // 组装导出参数 // ExportCommonParam exportParam = SalaryStatisticsReportBO.buildExportParam(dimension.getDimName(), weaTableColumns, records);