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<>();