From d60d24ea2eae100c618c3456c832e26ca730d23e Mon Sep 17 00:00:00 2001 From: Harryxzy Date: Tue, 20 Jun 2023 14:31:06 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=BB=BA=E5=AE=9A=E9=87=8F=E7=BB=B4?= =?UTF-8?q?=E5=BA=A6=E6=97=B6=E6=95=B0=E6=8D=AE=E9=80=8F=E8=A7=86=E6=B2=A1?= =?UTF-8?q?=E6=9C=89=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SalaryStatisticsReportServiceImpl.java | 19 ++++++++++++++++--- 1 file changed, 16 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 ce8491b15..fbf0cd1a4 100644 --- a/src/com/engine/salary/report/service/impl/SalaryStatisticsReportServiceImpl.java +++ b/src/com/engine/salary/report/service/impl/SalaryStatisticsReportServiceImpl.java @@ -36,6 +36,7 @@ import com.google.common.collect.Sets; import dm.jdbc.util.IdGenerator; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.math.NumberUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.BeanUtils; @@ -401,8 +402,20 @@ public class SalaryStatisticsReportServiceImpl extends Service implements Salary .dimensionValue(param.getDimensionValue()) .build(); + Map> resultMap = new HashMap<>(); + List salaryAcctEmployeeIds = salaryAcctEmployeeList.stream().map(SalaryAcctEmployeePO::getId).collect(Collectors.toList()); + if( NumberUtils.isCreatable(dimension.getDimCode()) ){ + List salaryAcctResultValues = getSalaryAcctResultService(user).listByAcctEmployeeIdsAndSalaryItemIds(salaryAcctEmployeeIds,Collections.singleton(Long.valueOf(dimension.getDimCode()))); + 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)); + resultMap.put(k, collect); + }); + } + + // 获取根据维度值过滤出的本次核算人员信息 - calculateReportRecordsByDimension(dimension, SalaryStatisticsReportDataQueryParam.builder().build(), salaryStatisticsReportData, Collections.EMPTY_MAP); + calculateReportRecordsByDimension(dimension, SalaryStatisticsReportDataQueryParam.builder().build(), salaryStatisticsReportData, resultMap); List listByDimensionValue = salaryStatisticsReportData.getListByDimensionValue(); if(CollectionUtils.isEmpty(listByDimensionValue)){ throw new SalaryRunTimeException("该维度值中无数据!"); @@ -412,9 +425,9 @@ public class SalaryStatisticsReportServiceImpl extends Service implements Salary List salaryAcctEmployeePOList = SalaryPageUtil.subList(param.getCurrent(), param.getPageSize(), listByDimensionValue); // 获取此分页的核算人员 - List salaryAcctEmployeeIds = salaryAcctEmployeePOList.stream().map(SalaryAcctEmployeePO::getId).collect(Collectors.toList()); + List pageSalaryAcctEmployeeIds = salaryAcctEmployeePOList.stream().map(SalaryAcctEmployeePO::getId).collect(Collectors.toList()); // 获取核算结果 - List salaryAcctResultValues = getSalaryAcctResultService(user).listByAcctEmployeeIdsAndSalaryItemIds(salaryAcctEmployeeIds, salaryItemIds); + List salaryAcctResultValues = getSalaryAcctResultService(user).listByAcctEmployeeIdsAndSalaryItemIds(pageSalaryAcctEmployeeIds, salaryItemIds); // 封装核算结果 Map> salaryAcctEmpResultMap = SalaryEntityUtil.group2Map(salaryAcctResultValues, SalaryAcctResultPO::getSalaryAcctEmpId); Map> map = new HashMap<>();