From bc590b9ee8e257c877c233fff44e2e4bb98674fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=92=B1=E6=B6=9B?= <15850646081@163.com> Date: Fri, 14 Apr 2023 15:18:18 +0800 Subject: [PATCH] =?UTF-8?q?=E8=87=AA=E5=AE=9A=E4=B9=89=E6=8A=A5=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/SalaryStatisticsItemServiceImpl.java | 17 +- .../SalaryStatisticsReportServiceImpl.java | 1468 +++++++++-------- .../impl/SubTableExportServiceImpl.java | 3 +- .../SalaryStatisticsReportWrapper.java | 59 +- .../salary/service/SalaryEmployeeService.java | 2 + .../impl/SalaryEmployeeServiceImpl.java | 5 + 6 files changed, 797 insertions(+), 757 deletions(-) diff --git a/src/com/engine/salary/report/service/impl/SalaryStatisticsItemServiceImpl.java b/src/com/engine/salary/report/service/impl/SalaryStatisticsItemServiceImpl.java index 7aeb178b6..cabb494f0 100644 --- a/src/com/engine/salary/report/service/impl/SalaryStatisticsItemServiceImpl.java +++ b/src/com/engine/salary/report/service/impl/SalaryStatisticsItemServiceImpl.java @@ -12,6 +12,7 @@ import com.engine.salary.report.enums.UnitTypeEnum; import com.engine.salary.report.service.SalaryStatisticsItemService; import com.engine.salary.util.SalaryAssert; import com.engine.salary.util.SalaryI18nUtil; +import com.engine.salary.util.db.MapperProxyFactory; import dm.jdbc.util.IdGenerator; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang.StringUtils; @@ -27,14 +28,16 @@ import java.util.stream.Collectors; public class SalaryStatisticsItemServiceImpl extends Service implements SalaryStatisticsItemService { - private SalaryStatisticsItemMapper salaryStatisticsItemMapper; + private SalaryStatisticsItemMapper getSalaryStatisticsItemMapper() { + return MapperProxyFactory.getProxy(SalaryStatisticsItemMapper.class); + } @Override public SalaryStatisticsItemPO getById(Long id) { if (id == null) { return null; } - return salaryStatisticsItemMapper.getById(id); + return getSalaryStatisticsItemMapper().getById(id); } @Override @@ -42,7 +45,7 @@ public class SalaryStatisticsItemServiceImpl extends Service implements SalarySt if (statisticsReportId == null) { return null; } - return salaryStatisticsItemMapper.listSome(SalaryStatisticsItemPO.builder().statReportId(statisticsReportId).build()); + return getSalaryStatisticsItemMapper().listSome(SalaryStatisticsItemPO.builder().statReportId(statisticsReportId).build()); } public List listByIds(Collection ids) { @@ -51,7 +54,7 @@ public class SalaryStatisticsItemServiceImpl extends Service implements SalarySt return new ArrayList<>(); } - return salaryStatisticsItemMapper.listSome(SalaryStatisticsItemPO.builder().ids(ids).build()); + return getSalaryStatisticsItemMapper().listSome(SalaryStatisticsItemPO.builder().ids(ids).build()); } @Override @@ -59,7 +62,7 @@ public class SalaryStatisticsItemServiceImpl extends Service implements SalarySt SalaryAssert.notEmpty(ids, SalaryI18nUtil.getI18nLabel(152638, "id不可为空")); List list = this.listByIds(ids); if (CollectionUtils.isNotEmpty(list)) { - salaryStatisticsItemMapper.deleteByIds(ids); + getSalaryStatisticsItemMapper().deleteByIds(ids); // list.forEach(po -> { // LoggerContext loggerContext = new LoggerContext<>(); // loggerContext.setTargetId(String.valueOf(po.getId())); @@ -117,7 +120,7 @@ public class SalaryStatisticsItemServiceImpl extends Service implements SalarySt .updateTime(now) .tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY) .build(); - salaryStatisticsItemMapper.insertIgnoreNull(subTableItemPO); + getSalaryStatisticsItemMapper().insertIgnoreNull(subTableItemPO); // 记录操作日志 // LoggerContext loggerContext = new LoggerContext<>(); @@ -145,7 +148,7 @@ public class SalaryStatisticsItemServiceImpl extends Service implements SalarySt itemPO.setMedianRule(Objects.nonNull(saveParam.getMedianRule()) ? JSON.toJSONString(saveParam.getMedianRule()) : ""); } - salaryStatisticsItemMapper.updateIgnoreNull(itemPO); + getSalaryStatisticsItemMapper().updateIgnoreNull(itemPO); // 记录操作日志 // LoggerContext loggerContext = new LoggerContext<>(); diff --git a/src/com/engine/salary/report/service/impl/SalaryStatisticsReportServiceImpl.java b/src/com/engine/salary/report/service/impl/SalaryStatisticsReportServiceImpl.java index b887abaef..49ebd855b 100644 --- a/src/com/engine/salary/report/service/impl/SalaryStatisticsReportServiceImpl.java +++ b/src/com/engine/salary/report/service/impl/SalaryStatisticsReportServiceImpl.java @@ -3,16 +3,15 @@ package com.engine.salary.report.service.impl; import com.engine.common.util.ServiceUtil; import com.engine.core.impl.Service; import com.engine.salary.constant.SalaryDefaultTenantConstant; +import com.engine.salary.entity.datacollection.DataCollectionEmployee; import com.engine.salary.entity.salaryacct.po.SalaryAcctEmployeePO; import com.engine.salary.entity.salaryacct.po.SalaryAcctResultPO; import com.engine.salary.entity.taxagent.po.TaxAgentPO; -import com.engine.salary.enums.salarysob.IncomeCategoryEnum; import com.engine.salary.exception.SalaryRunTimeException; import com.engine.salary.mapper.report.SalaryStatisticsReportMapper; import com.engine.salary.report.common.constant.SalaryStatisticsDimensionConstant; import com.engine.salary.report.entity.bo.SalaryStatisticsReportBO; import com.engine.salary.report.entity.dto.SalaryStatisticsReportDataDTO; -import com.engine.salary.report.entity.param.SalaryStatisticsDimensionSaveParam; import com.engine.salary.report.entity.param.SalaryStatisticsReportDataQueryParam; import com.engine.salary.report.entity.param.SalaryStatisticsReportSaveParam; import com.engine.salary.report.entity.param.SalaryStatisticsSearchConditionSaveParam; @@ -27,10 +26,13 @@ import com.engine.salary.service.SalaryAcctEmployeeService; import com.engine.salary.service.SalaryAcctResultService; import com.engine.salary.service.SalaryEmployeeService; import com.engine.salary.service.TaxAgentService; +import com.engine.salary.service.impl.SalaryAcctEmployeeServiceImpl; +import com.engine.salary.service.impl.SalaryAcctResultServiceImpl; import com.engine.salary.service.impl.SalaryEmployeeServiceImpl; -import com.engine.salary.util.JsonUtil; +import com.engine.salary.service.impl.TaxAgentServiceImpl; import com.engine.salary.util.SalaryEntityUtil; import com.engine.salary.util.SalaryI18nUtil; +import com.engine.salary.util.db.MapperProxyFactory; import com.engine.salary.util.page.PageInfo; import com.google.common.collect.Lists; import dm.jdbc.util.IdGenerator; @@ -59,15 +61,25 @@ public class SalaryStatisticsReportServiceImpl extends Service implements Salary public static final String SAME_INFO = "sameInfoList"; - private SalaryStatisticsReportMapper salaryStatisticsReportMapper; + private SalaryStatisticsReportMapper getSalaryStatisticsReportMapper() { + return MapperProxyFactory.getProxy(SalaryStatisticsReportMapper.class); + } - private SalaryStatisticsItemService salaryStatisticsItemService; + private SalaryStatisticsItemService getSalaryStatisticsItemService(User user) { + return ServiceUtil.getService(SalaryStatisticsItemServiceImpl.class, user); + } - private SalaryAcctEmployeeService salaryAcctEmployeeService; + private SalaryAcctEmployeeService getSalaryAcctEmployeeService(User user) { + return ServiceUtil.getService(SalaryAcctEmployeeServiceImpl.class, user); + } - private SalaryAcctResultService salaryAcctResultValueService; + private SalaryAcctResultService getSalaryAcctResultService(User user) { + return ServiceUtil.getService(SalaryAcctResultServiceImpl.class, user); + } - private TaxAgentService taxAgentService; + private TaxAgentService getTaxAgentService(User user) { + return ServiceUtil.getService(TaxAgentServiceImpl.class, user); + } private SalaryEmployeeService getSalaryEmployeeService(User user) { return ServiceUtil.getService(SalaryEmployeeServiceImpl.class, user); @@ -87,17 +99,17 @@ public class SalaryStatisticsReportServiceImpl extends Service implements Salary @Override public List listAll() { - return salaryStatisticsReportMapper.listAll(); + return getSalaryStatisticsReportMapper().listAll(); } @Override public List list() { - return salaryStatisticsReportMapper.listSome(SalaryStatisticsReportPO.builder().creator((long) user.getUID()).build()); + return getSalaryStatisticsReportMapper().listSome(SalaryStatisticsReportPO.builder().creator((long) user.getUID()).build()); } @Override public SalaryStatisticsReportPO getById(Long id) { - return salaryStatisticsReportMapper.getById(id); + return getSalaryStatisticsReportMapper().getById(id); } /** @@ -107,7 +119,7 @@ public class SalaryStatisticsReportServiceImpl extends Service implements Salary * @return */ private List listByName(String fieldName) { - return salaryStatisticsReportMapper.listSome(SalaryStatisticsReportPO.builder().reportName(fieldName).build()); + return getSalaryStatisticsReportMapper().listSome(SalaryStatisticsReportPO.builder().reportName(fieldName).build()); } @Override @@ -129,7 +141,7 @@ public class SalaryStatisticsReportServiceImpl extends Service implements Salary BeanUtils.copyProperties(po, poNew); poNew.setReportName(saveParam.getReportName()); poNew.setDimension(StringUtils.join(saveParam.getDimensionIds(), ",")); - this.salaryStatisticsReportMapper.updateIgnoreNull(poNew); + this.getSalaryStatisticsReportMapper().updateIgnoreNull(poNew); // 记录日志 // LoggerContext loggerContext = new LoggerContext<>(); @@ -155,7 +167,7 @@ public class SalaryStatisticsReportServiceImpl extends Service implements Salary .deleteType(0) .tenantKey("") .build(); - salaryStatisticsReportMapper.insertIgnoreNull(poNew); + getSalaryStatisticsReportMapper().insertIgnoreNull(poNew); // 记录日志 // LoggerContext loggerContext = new LoggerContext<>(); @@ -201,16 +213,16 @@ public class SalaryStatisticsReportServiceImpl extends Service implements Salary // po.setEmployeeSetting(JSON.toJSONString(param.getEmployee())); // po.setHiredateSetting(JSON.toJSONString(param.getHiredate())); // po.setLeavedateSetting(JSON.toJSONString(param.getLeavedate())); -// salaryStatisticsReportMapper.updateIgnoreNull(po); +// getSalaryStatisticsReportMapper().updateIgnoreNull(po); // // // 获取自定义统计项目 -// List salaryStatisticsItemList = salaryStatisticsItemService.listByStatisticsReportId(po.getId()); +// List salaryStatisticsItemList = getSalaryStatisticsItemService(user).listByStatisticsReportId(po.getId()); // // salaryStatisticsItemList.forEach(e -> param.getItems().stream().filter(i -> i.getId().equals(e.getId())).findFirst().ifPresent(salaryStatisticsItem -> { // e.setUnitType(salaryStatisticsItem.getUnitType()); // e.setIndexValue(salaryStatisticsItem.getIndexValue()); // })); -// this.salaryStatisticsItemService.saveOrUpdateBatch(salaryStatisticsItemList); +// this.getSalaryStatisticsItemService(user).saveOrUpdateBatch(salaryStatisticsItemList); // 记录日志 // LoggerContext loggerContext = new LoggerContext<>(); @@ -229,12 +241,12 @@ public class SalaryStatisticsReportServiceImpl extends Service implements Salary throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(84026, "参数错误")); } int total = ids.size(); - List list = salaryStatisticsReportMapper.listSome(SalaryStatisticsReportPO.builder().ids(ids).build()); + List list = getSalaryStatisticsReportMapper().listSome(SalaryStatisticsReportPO.builder().ids(ids).build()); int success = list.size(); if (success > 0) { List deleteIds = list.stream().map(SalaryStatisticsReportPO::getId).collect(Collectors.toList()); - salaryStatisticsReportMapper.deleteByIds(deleteIds); + getSalaryStatisticsReportMapper().deleteByIds(deleteIds); // list.forEach(e -> { @@ -278,13 +290,13 @@ public class SalaryStatisticsReportServiceImpl extends Service implements Salary SalaryStatisticsReportBO.poToQueryParam(param, po); // 获取本期报表分权后的核算人员 - List list = salaryAcctEmployeeService.listBySalaryStatisticsReportParam(param); + List list = getSalaryAcctEmployeeService(user).listBySalaryStatisticsReportParam(param); SalaryStatisticsReportDataQueryParam lastParam = SalaryStatisticsReportBO.lastParamConvert(param, dimension); // 获取上期报表分权后的核算人员 - List lastList = checkMap.get("isLast") ? salaryAcctEmployeeService.listBySalaryStatisticsReportParam(lastParam) : Lists.newArrayList(); + List lastList = checkMap.get("isLast") ? getSalaryAcctEmployeeService(user).listBySalaryStatisticsReportParam(lastParam) : Lists.newArrayList(); SalaryStatisticsReportDataQueryParam sameParam = SalaryStatisticsReportBO.sameParamConvert(param); // 获取去年同期报表分权后的核算人员 - List sameList = checkMap.get("isSame") ? salaryAcctEmployeeService.listBySalaryStatisticsReportParam(sameParam) : Lists.newArrayList(); + List sameList = checkMap.get("isSame") ? getSalaryAcctEmployeeService(user).listBySalaryStatisticsReportParam(sameParam) : Lists.newArrayList(); SalaryStatisticsReportDataDTO salaryStatisticsReportData = SalaryStatisticsReportDataDTO.builder() .list(list) @@ -300,13 +312,13 @@ public class SalaryStatisticsReportServiceImpl extends Service implements Salary allList.addAll(lastList); allList.addAll(sameList); Set salaryAcctEmployeeIds = allList.stream().map(SalaryAcctEmployeePO::getId).collect(Collectors.toSet()); - List salaryAcctResultValues = salaryAcctResultValueService.listBySalaryAcctEmployeeIds(salaryAcctEmployeeIds); + List salaryAcctResultValues = getSalaryAcctResultService(user).listBySalaryAcctEmployeeIds(salaryAcctEmployeeIds); // Map> salaryAcctResultValueMap = SalaryEntityUtil.convert2Map(); Map> salaryAcctEmpResultMap = SalaryEntityUtil.group2Map(salaryAcctResultValues, SalaryAcctResultPO::getSalaryAcctEmpId); - Map> map = new HashMap<>(); + Map> map = new HashMap<>(); salaryAcctEmpResultMap.forEach((k, v) -> { - Map collect = v.stream().collect(Collectors.toMap(p->p.getSalaryItemId().toString(), SalaryAcctResultPO::getResultValue, (key1, key2) -> key2)); - map.put(k,collect); + Map collect = v.stream().collect(Collectors.toMap(p -> p.getSalaryItemId().toString(), SalaryAcctResultPO::getResultValue, (key1, key2) -> key2)); + map.put(k, collect); }); // 根据统计维度进行计算 @@ -351,32 +363,33 @@ public class SalaryStatisticsReportServiceImpl extends Service implements Salary return buildSuperiorRecords(data, salaryAcctResultValueMap); case SalaryStatisticsDimensionConstant.DM_MARITAL_STATUS: return buildMaritalStatusRecords(data, salaryAcctResultValueMap); - case SalaryStatisticsDimensionConstant.DM_EDUCATION: - return buildEducationRecords(data, salaryAcctResultValueMap); - case SalaryStatisticsDimensionConstant.DM_DEGREE: - return buildDegreeRecords(data, salaryAcctResultValueMap); - case SalaryStatisticsDimensionConstant.DM_NATION: - return buildNationRecords(data, salaryAcctResultValueMap); - case SalaryStatisticsDimensionConstant.DM_HOUSEHOLD_TYPE: - return buildHouseholdTypeRecords(data, salaryAcctResultValueMap); - case SalaryStatisticsDimensionConstant.DM_POLITICS_STATUS: - return buildPoliticsStatusRecords(data, salaryAcctResultValueMap); - case SalaryStatisticsDimensionConstant.DM_AGE: - return buildAgeRecords(data, salaryAcctResultValueMap); - case SalaryStatisticsDimensionConstant.DM_WORK_YEAR: - return buildWorkYearRecords(data, salaryAcctResultValueMap); - case SalaryStatisticsDimensionConstant.DM_COMPANY_YEAR: - return buildCompanyYearRecords(data, salaryAcctResultValueMap); +// case SalaryStatisticsDimensionConstant.DM_EDUCATION: +// return buildEducationRecords(data, salaryAcctResultValueMap); +// case SalaryStatisticsDimensionConstant.DM_DEGREE: +// return buildDegreeRecords(data, salaryAcctResultValueMap); +// case SalaryStatisticsDimensionConstant.DM_NATION: +// return buildNationRecords(data, salaryAcctResultValueMap); +// case SalaryStatisticsDimensionConstant.DM_HOUSEHOLD_TYPE: +// return buildHouseholdTypeRecords(data, salaryAcctResultValueMap); +// case SalaryStatisticsDimensionConstant.DM_POLITICS_STATUS: +// return buildPoliticsStatusRecords(data, salaryAcctResultValueMap); +// case SalaryStatisticsDimensionConstant.DM_AGE: +// return buildAgeRecords(data, salaryAcctResultValueMap); +// case SalaryStatisticsDimensionConstant.DM_WORK_YEAR: +// return buildWorkYearRecords(data, salaryAcctResultValueMap); +// case SalaryStatisticsDimensionConstant.DM_COMPANY_YEAR: +// return buildCompanyYearRecords(data, salaryAcctResultValueMap); default: return new PageInfo<>(); } // 定量-组距式分组 - } else if (SalaryStatisticsDimensionTypeEnum.RATION_GROUP_SPACING.getValue().equals(dimension.getDimType())) { - return buildRationGroupSpacing4Records(dimension, data, salaryAcctResultValueMap); - // 定量-单项式分组 - } else if (SalaryStatisticsDimensionTypeEnum.RATION_GROUP_INDIVIDUAL.getValue().equals(dimension.getDimType())) { - return buildRationGroupIndividual4Records(dimension, data, salaryAcctResultValueMap); } +// else if (SalaryStatisticsDimensionTypeEnum.RATION_GROUP_SPACING.getValue().equals(dimension.getDimType())) { +// return buildRationGroupSpacing4Records(dimension, data, salaryAcctResultValueMap); +// // 定量-单项式分组 +// } else if (SalaryStatisticsDimensionTypeEnum.RATION_GROUP_INDIVIDUAL.getValue().equals(dimension.getDimType())) { +// return buildRationGroupIndividual4Records(dimension, data, salaryAcctResultValueMap); +// } return new PageInfo<>(); } @@ -405,7 +418,7 @@ public class SalaryStatisticsReportServiceImpl extends Service implements Salary Map> lastListMap = data.getLastList().stream().collect(Collectors.groupingBy(SalaryAcctEmployeePO::getTaxAgentId)); Map> sameListMap = data.getSameList().stream().collect(Collectors.groupingBy(SalaryAcctEmployeePO::getTaxAgentId)); - List taxAgentList = taxAgentService.listAll(); + List taxAgentList = getTaxAgentService(user).listAll(); Map taxAgentMap = SalaryEntityUtil.convert2Map(taxAgentList, TaxAgentPO::getId, TaxAgentPO::getName); listMap.forEach((k, v) -> { @@ -421,24 +434,24 @@ public class SalaryStatisticsReportServiceImpl extends Service implements Salary private PageInfo> buildIncomeCategoryRecords(SalaryStatisticsReportDataDTO data, Map> salaryAcctResultValueMap) { PageInfo> result = new PageInfo<>(); - List> records = new ArrayList<>(); - - Map> listMap = data.getList().stream().collect(Collectors.groupingBy(SalaryAcctEmployeePO::getIncomeCategory)); - Map> lastListMap = data.getLastList().stream().collect(Collectors.groupingBy(SalaryAcctEmployeePO::getIncomeCategory)); - Map> sameListMap = data.getSameList().stream().collect(Collectors.groupingBy(SalaryAcctEmployeePO::getIncomeCategory)); - - List incomeCategoryList = listMap.keySet().stream().sorted().collect(Collectors.toList()); - incomeCategoryList.forEach(k -> { - IncomeCategoryEnum incomeCategory = IncomeCategoryEnum.parseByValue(Integer.parseInt(k)); - if (Objects.nonNull(incomeCategory)) { - Map temp = new HashMap<>(); - temp.put(DM, SalaryI18nUtil.getI18nLabel(incomeCategory.getLabelId(), incomeCategory.getDefaultLabel())); - temp.putAll(SalaryStatisticsReportBO.calculateItem(listMap.get(k), lastListMap.get(k), sameListMap.get(k), salaryAcctResultValueMap, data.getSalaryStatisticsItemList())); - records.add(temp); - } - }); - - result.setList(records); +// List> records = new ArrayList<>(); +// +// Map> listMap = data.getList().stream().collect(Collectors.groupingBy(SalaryAcctEmployeePO::getIncomeCategory)); +// Map> lastListMap = data.getLastList().stream().collect(Collectors.groupingBy(SalaryAcctEmployeePO::getIncomeCategory)); +// Map> sameListMap = data.getSameList().stream().collect(Collectors.groupingBy(SalaryAcctEmployeePO::getIncomeCategory)); +// +// List incomeCategoryList = listMap.keySet().stream().sorted().collect(Collectors.toList()); +// incomeCategoryList.forEach(k -> { +// IncomeCategoryEnum incomeCategory = IncomeCategoryEnum.parseByValue(Integer.parseInt(k)); +// if (Objects.nonNull(incomeCategory)) { +// Map temp = new HashMap<>(); +// temp.put(DM, SalaryI18nUtil.getI18nLabel(incomeCategory.getLabelId(), incomeCategory.getDefaultLabel())); +// temp.putAll(SalaryStatisticsReportBO.calculateItem(listMap.get(k), lastListMap.get(k), sameListMap.get(k), salaryAcctResultValueMap, data.getSalaryStatisticsItemList())); +// records.add(temp); +// } +// }); +// +// result.setList(records); return result; } @@ -451,9 +464,12 @@ public class SalaryStatisticsReportServiceImpl extends Service implements Salary List sameEmployeeIds = data.getSameList().stream().map(SalaryAcctEmployeePO::getEmployeeId).distinct().collect(Collectors.toList()); - Map comInfoMap = hrmCommonEmployeeService.querySubcompanyInfoByEmployeeIds(employeeIds, data.getTenantKey()); - Map lastComInfoMap = hrmCommonEmployeeService.querySubcompanyInfoByEmployeeIds(lastEmployeeIds, data.getTenantKey()); - Map sameComInfoMap = hrmCommonEmployeeService.querySubcompanyInfoByEmployeeIds(sameEmployeeIds, data.getTenantKey()); + List comInfos = getSalaryEmployeeService(user).getEmployeeByIdsAll(employeeIds); + Map comInfoMap = SalaryEntityUtil.convert2Map(comInfos, DataCollectionEmployee::getEmployeeId); + List lastComInfos = getSalaryEmployeeService(user).getEmployeeByIdsAll(lastEmployeeIds); + Map lastComInfoMap = SalaryEntityUtil.convert2Map(lastComInfos, DataCollectionEmployee::getEmployeeId); + List sameComInfos = getSalaryEmployeeService(user).getEmployeeByIdsAll(lastEmployeeIds); + Map sameComInfoMap = SalaryEntityUtil.convert2Map(sameComInfos, DataCollectionEmployee::getEmployeeId); Set subComIds = new HashSet<>(); Map empIdSubComMap = new HashMap<>(); @@ -461,15 +477,15 @@ public class SalaryStatisticsReportServiceImpl extends Service implements Salary Map lastEmpIdSubComMap = new HashMap<>(); Map sameEmpIdSubComMap = new HashMap<>(); comInfoMap.forEach((k, v) -> { - subComIdNameMap.put(v.getId(), v.getName()); - empIdSubComMap.put(k, v.getId()); - subComIds.add(v.getId()); + subComIdNameMap.put(v.getSubcompanyid(), v.getSubcompanyName()); + empIdSubComMap.put(k, v.getSubcompanyid()); + subComIds.add(v.getSubcompanyid()); }); lastComInfoMap.forEach((k, v) -> { - lastEmpIdSubComMap.put(k, v.getId()); + lastEmpIdSubComMap.put(k, v.getSubcompanyid()); }); sameComInfoMap.forEach((k, v) -> { - sameEmpIdSubComMap.put(k, v.getId()); + sameEmpIdSubComMap.put(k, v.getSubcompanyid()); }); subComIds.forEach(subComId -> { @@ -487,7 +503,7 @@ public class SalaryStatisticsReportServiceImpl extends Service implements Salary List sameNoGroupingList = data.getSameList().stream().filter(po -> sameEmpIdSubComMap.get(po.getEmployeeId()) == null).collect(Collectors.toList()); if (CollectionUtils.isNotEmpty(noGroupingList)) { Map noGrouping = new HashMap<>(); - noGrouping.put(DM, SalaryI18nUtil.getI18nLabel( 153462, "无分组")); + noGrouping.put(DM, SalaryI18nUtil.getI18nLabel(153462, "无分组")); noGrouping.putAll(SalaryStatisticsReportBO.calculateItem(noGroupingList, lastNoGroupingList, sameNoGroupingList, salaryAcctResultValueMap, data.getSalaryStatisticsItemList())); records.add(noGrouping); } @@ -498,59 +514,59 @@ public class SalaryStatisticsReportServiceImpl extends Service implements Salary private PageInfo> buildDepartRecords(SalaryStatisticsReportDataDTO data, Map> salaryAcctResultValueMap) { PageInfo> result = new PageInfo<>(); -// List> records = new ArrayList<>(); -// -// List employeeIds = data.getList().stream().map(SalaryAcctEmployeePO::getEmployeeId).distinct().collect(Collectors.toList()); -// List lastEmployeeIds = data.getLastList().stream().map(SalaryAcctEmployeePO::getEmployeeId).distinct().collect(Collectors.toList()); -// List sameEmployeeIds = data.getSameList().stream().map(SalaryAcctEmployeePO::getEmployeeId).distinct().collect(Collectors.toList()); -// List simpleEmployeeList = hrmCommonEmployeeService.getEmployeeByIds(employeeIds, data.getTenantKey()); -// List lastSimpleEmployeeList = hrmCommonEmployeeService.getEmployeeByIds(lastEmployeeIds, data.getTenantKey()); -// List sameSimpleEmployeeList = hrmCommonEmployeeService.getEmployeeByIds(sameEmployeeIds, data.getTenantKey()); -// -// Set departIds = new HashSet<>(); -// Map empIdDepartIdMap = new HashMap<>(); -// Map lastEmpIdDepartIdMap = new HashMap<>(); -// Map sameEmpIdDepartIdMap = new HashMap<>(); -// Map departIdNameMap = new HashMap<>(); -// simpleEmployeeList.forEach(employee -> { -// if (employee.getDepartment() != null && employee.getDepartment().getId() != null) { -// departIdNameMap.put(employee.getDepartment().getId(), employee.getDepartment().getName()); -// departIds.add(employee.getDepartment().getId()); -// empIdDepartIdMap.put(employee.getId(), employee.getDepartment().getId()); -// } -// }); -// lastSimpleEmployeeList.forEach(employee -> { -// if (employee.getDepartment() != null && employee.getDepartment().getId() != null) { -// lastEmpIdDepartIdMap.put(employee.getId(), employee.getDepartment().getId()); -// } -// }); -// sameSimpleEmployeeList.forEach(employee -> { -// if (employee.getDepartment() != null && employee.getDepartment().getId() != null) { -// sameEmpIdDepartIdMap.put(employee.getId(), employee.getDepartment().getId()); -// } -// }); -// -// departIds.forEach(departId -> { -// List departEmployeePOS = data.getList().stream().filter(po -> Objects.equals(empIdDepartIdMap.get(po.getEmployeeId()), departId)).collect(Collectors.toList()); -// List lastDepartEmployeePOS = data.getLastList().stream().filter(po -> Objects.equals(lastEmpIdDepartIdMap.get(po.getEmployeeId()), departId)).collect(Collectors.toList()); -// List sameDepartEmployeePOS = data.getSameList().stream().filter(po -> Objects.equals(sameEmpIdDepartIdMap.get(po.getEmployeeId()), departId)).collect(Collectors.toList()); -// Map temp = new HashMap<>(); -// temp.put(DM, departIdNameMap.get(departId)); -// temp.putAll(SalaryStatisticsReportBO.calculateItem(departEmployeePOS, lastDepartEmployeePOS, sameDepartEmployeePOS, salaryAcctResultValueMap, data.getSalaryStatisticsItemList())); -// records.add(temp); -// }); -// -// List noGroupingList = data.getList().stream().filter(po -> empIdDepartIdMap.get(po.getEmployeeId()) == null).collect(Collectors.toList()); -// List lastNoGroupingList = data.getLastList().stream().filter(po -> lastEmpIdDepartIdMap.get(po.getEmployeeId()) == null).collect(Collectors.toList()); -// List sameNoGroupingList = data.getSameList().stream().filter(po -> lastEmpIdDepartIdMap.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); -// } -// -// result.setList(records); + List> records = new ArrayList<>(); + + List employeeIds = data.getList().stream().map(SalaryAcctEmployeePO::getEmployeeId).distinct().collect(Collectors.toList()); + List lastEmployeeIds = data.getLastList().stream().map(SalaryAcctEmployeePO::getEmployeeId).distinct().collect(Collectors.toList()); + List sameEmployeeIds = data.getSameList().stream().map(SalaryAcctEmployeePO::getEmployeeId).distinct().collect(Collectors.toList()); + List simpleEmployeeList = getSalaryEmployeeService(user).getEmployeeByIdsAll(employeeIds); + List lastSimpleEmployeeList = getSalaryEmployeeService(user).getEmployeeByIdsAll(lastEmployeeIds); + List sameSimpleEmployeeList = getSalaryEmployeeService(user).getEmployeeByIdsAll(sameEmployeeIds); + + Set departIds = new HashSet<>(); + Map empIdDepartIdMap = new HashMap<>(); + Map lastEmpIdDepartIdMap = new HashMap<>(); + Map sameEmpIdDepartIdMap = new HashMap<>(); + Map departIdNameMap = new HashMap<>(); + simpleEmployeeList.forEach(employee -> { + if (employee.getDepartmentName() != null && employee.getDepartmentId() != null) { + departIdNameMap.put(employee.getDepartmentId(), employee.getDepartmentName()); + departIds.add(employee.getDepartmentId()); + empIdDepartIdMap.put(employee.getEmployeeId(), employee.getDepartmentId()); + } + }); + lastSimpleEmployeeList.forEach(employee -> { + if (employee.getDepartmentName() != null && employee.getDepartmentId() != null) { + lastEmpIdDepartIdMap.put(employee.getEmployeeId(), employee.getDepartmentId()); + } + }); + sameSimpleEmployeeList.forEach(employee -> { + if (employee.getDepartmentName() != null && employee.getDepartmentId() != null) { + sameEmpIdDepartIdMap.put(employee.getEmployeeId(), employee.getDepartmentId()); + } + }); + + departIds.forEach(departId -> { + List departEmployeePOS = data.getList().stream().filter(po -> Objects.equals(empIdDepartIdMap.get(po.getEmployeeId()), departId)).collect(Collectors.toList()); + List lastDepartEmployeePOS = data.getLastList().stream().filter(po -> Objects.equals(lastEmpIdDepartIdMap.get(po.getEmployeeId()), departId)).collect(Collectors.toList()); + List sameDepartEmployeePOS = data.getSameList().stream().filter(po -> Objects.equals(sameEmpIdDepartIdMap.get(po.getEmployeeId()), departId)).collect(Collectors.toList()); + Map temp = new HashMap<>(); + temp.put(DM, departIdNameMap.get(departId)); + temp.putAll(SalaryStatisticsReportBO.calculateItem(departEmployeePOS, lastDepartEmployeePOS, sameDepartEmployeePOS, salaryAcctResultValueMap, data.getSalaryStatisticsItemList())); + records.add(temp); + }); + + List noGroupingList = data.getList().stream().filter(po -> empIdDepartIdMap.get(po.getEmployeeId()) == null).collect(Collectors.toList()); + List lastNoGroupingList = data.getLastList().stream().filter(po -> lastEmpIdDepartIdMap.get(po.getEmployeeId()) == null).collect(Collectors.toList()); + List sameNoGroupingList = data.getSameList().stream().filter(po -> lastEmpIdDepartIdMap.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); + } + + result.setList(records); return result; } @@ -1076,603 +1092,603 @@ public class SalaryStatisticsReportServiceImpl extends Service implements Salary return result; } - private Map> getSimpleUserInfoList(SalaryStatisticsReportDataDTO data) { - List employeeIds = data.getList().stream().map(SalaryAcctEmployeePO::getEmployeeId).distinct().collect(Collectors.toList()); - List lastEmployeeIds = data.getLastList().stream().map(SalaryAcctEmployeePO::getEmployeeId).distinct().collect(Collectors.toList()); - List sameEmployeeIds = data.getSameList().stream().map(SalaryAcctEmployeePO::getEmployeeId).distinct().collect(Collectors.toList()); - - List simpleUserInfoList; - List lastSimpleUserInfoList; - List sameSimpleUserInfoList; - Map> map = Maps.newHashMap(); - try { - simpleUserInfoList = CollectionUtils.isEmpty(employeeIds) ? Lists.newArrayList() : remoteUserInfoService.querySimpleUserInfoByUserIds(employeeIds, data.getTenantKey()); - lastSimpleUserInfoList = CollectionUtils.isEmpty(lastEmployeeIds) ? Lists.newArrayList() : remoteUserInfoService.querySimpleUserInfoByUserIds(lastEmployeeIds, data.getTenantKey()); - sameSimpleUserInfoList = CollectionUtils.isEmpty(sameEmployeeIds) ? Lists.newArrayList() : remoteUserInfoService.querySimpleUserInfoByUserIds(sameEmployeeIds, data.getTenantKey()); - } catch (Exception e) { - log.info("获取员工个人信息失败: {}", e.getMessage()); - return map; - } - map.put(NOW_INFO, simpleUserInfoList); - map.put(LAST_INFO, lastSimpleUserInfoList); - map.put(SAME_INFO, sameSimpleUserInfoList); - return map; - } - - private PageInfo> buildEducationRecords(SalaryStatisticsReportDataDTO data, Map> salaryAcctResultValueMap) { - PageInfo> result = new PageInfo<>(); - List> records = new ArrayList<>(); - Map> simpleUserInfoMap = getSimpleUserInfoList(data); - if (simpleUserInfoMap.isEmpty()) { - return result; - } - - Set educationIds = new HashSet<>(); - Map educationMap = Maps.newHashMap(); - - Map empIdEducationMap = new HashMap<>(); - Map lastEmpIdEducationMap = new HashMap<>(); - Map sameEmpIdEducationMap = new HashMap<>(); - simpleUserInfoMap.get(NOW_INFO).forEach(employee -> { - if (employee.getEducation() != null && employee.getEducation().getId() != null) { - educationIds.add(employee.getEducation().getId()); - empIdEducationMap.put(Objects.isNull(employee.getUser()) ? null : employee.getUser().getId(), employee.getEducation().getId()); - educationMap.put(employee.getEducation().getId(), employee.getEducation().getName()); - } - }); - simpleUserInfoMap.get(LAST_INFO).forEach(employee -> { - if (employee.getEducation() != null && employee.getEducation().getId() != null) { - lastEmpIdEducationMap.put(Objects.isNull(employee.getUser()) ? null : employee.getUser().getId(), employee.getEducation().getId()); - educationMap.put(employee.getEducation().getId(), employee.getEducation().getName()); - } - }); - simpleUserInfoMap.get(SAME_INFO).forEach(employee -> { - if (employee.getEducation() != null && employee.getEducation().getId() != null) { - sameEmpIdEducationMap.put(Objects.isNull(employee.getUser()) ? null : employee.getUser().getId(), employee.getEducation().getId()); - educationMap.put(employee.getEducation().getId(), employee.getEducation().getName()); - } - }); - - educationIds.forEach(k -> { - List salaryAcctEmployees = data.getList().stream().filter(po -> Objects.equals(empIdEducationMap.get(po.getEmployeeId()), k)).collect(Collectors.toList()); - List lastSalaryAcctEmployees = data.getLastList().stream().filter(po -> Objects.equals(lastEmpIdEducationMap.get(po.getEmployeeId()), k)).collect(Collectors.toList()); - List sameSalaryAcctEmployees = data.getSameList().stream().filter(po -> Objects.equals(sameEmpIdEducationMap.get(po.getEmployeeId()), k)).collect(Collectors.toList()); - Map temp = new HashMap<>(); - temp.put(DM, educationMap.get(k)); - temp.putAll(SalaryStatisticsReportBO.calculateItem(salaryAcctEmployees, lastSalaryAcctEmployees, sameSalaryAcctEmployees, salaryAcctResultValueMap, data.getSalaryStatisticsItemList())); - records.add(temp); - }); - - List noGroupingList = data.getList().stream().filter(po -> empIdEducationMap.get(po.getEmployeeId()) == null).collect(Collectors.toList()); - List lastNoGroupingList = data.getLastList().stream().filter(po -> lastEmpIdEducationMap.get(po.getEmployeeId()) == null).collect(Collectors.toList()); - List sameNoGroupingList = data.getSameList().stream().filter(po -> sameEmpIdEducationMap.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); - } - - result.setList(records); - return result; - } - - private PageInfo> buildDegreeRecords(SalaryStatisticsReportDataDTO data, Map> salaryAcctResultValueMap) { - PageInfo> result = new PageInfo<>(); - List> records = new ArrayList<>(); - Map> simpleUserInfoMap = getSimpleUserInfoList(data); - if (simpleUserInfoMap.isEmpty()) { - return result; - } - - Set degreeIds = new HashSet<>(); - Map degreeMap = Maps.newHashMap(); - - Map empIdDegreeMap = new HashMap<>(); - Map lastEmpIdDegreeMap = new HashMap<>(); - Map sameEmpIdDegreeMap = new HashMap<>(); - simpleUserInfoMap.get(NOW_INFO).forEach(employee -> { - if (employee.getDegree() != null && employee.getDegree().getId() != null) { - degreeIds.add(employee.getDegree().getId()); - empIdDegreeMap.put(Objects.isNull(employee.getUser()) ? null : employee.getUser().getId(), employee.getDegree().getId()); - degreeMap.put(employee.getDegree().getId(), employee.getDegree().getName()); - } - }); - simpleUserInfoMap.get(LAST_INFO).forEach(employee -> { - if (employee.getDegree() != null && employee.getDegree().getId() != null) { - lastEmpIdDegreeMap.put(Objects.isNull(employee.getUser()) ? null : employee.getUser().getId(), employee.getDegree().getId()); - degreeMap.put(employee.getDegree().getId(), employee.getDegree().getName()); - } - }); - simpleUserInfoMap.get(SAME_INFO).forEach(employee -> { - if (employee.getDegree() != null && employee.getDegree().getId() != null) { - sameEmpIdDegreeMap.put(Objects.isNull(employee.getUser()) ? null : employee.getUser().getId(), employee.getDegree().getId()); - degreeMap.put(employee.getDegree().getId(), employee.getDegree().getName()); - } - }); - - degreeIds.forEach(k -> { - List salaryAcctEmployees = data.getList().stream().filter(po -> Objects.equals(empIdDegreeMap.get(po.getEmployeeId()), k)).collect(Collectors.toList()); - List lastSalaryAcctEmployees = data.getLastList().stream().filter(po -> Objects.equals(lastEmpIdDegreeMap.get(po.getEmployeeId()), k)).collect(Collectors.toList()); - List sameSalaryAcctEmployees = data.getSameList().stream().filter(po -> Objects.equals(sameEmpIdDegreeMap.get(po.getEmployeeId()), k)).collect(Collectors.toList()); - Map temp = new HashMap<>(); - temp.put(DM, degreeMap.get(k)); - temp.putAll(SalaryStatisticsReportBO.calculateItem(salaryAcctEmployees, lastSalaryAcctEmployees, sameSalaryAcctEmployees, salaryAcctResultValueMap, data.getSalaryStatisticsItemList())); - records.add(temp); - }); - - List noGroupingList = data.getList().stream().filter(po -> empIdDegreeMap.get(po.getEmployeeId()) == null).collect(Collectors.toList()); - List lastNoGroupingList = data.getLastList().stream().filter(po -> lastEmpIdDegreeMap.get(po.getEmployeeId()) == null).collect(Collectors.toList()); - List sameNoGroupingList = data.getSameList().stream().filter(po -> sameEmpIdDegreeMap.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); - } - - result.setList(records); - return result; - } - - private PageInfo> buildNationRecords(SalaryStatisticsReportDataDTO data, Map> salaryAcctResultValueMap) { - PageInfo> result = new PageInfo<>(); - List> records = new ArrayList<>(); - Map> simpleUserInfoMap = getSimpleUserInfoList(data); - if (simpleUserInfoMap.isEmpty()) { - return result; - } - - Set nationIds = new HashSet<>(); - Map nationMap = Maps.newHashMap(); - - Map empIdNationMap = new HashMap<>(); - Map lastEmpIdNationMap = new HashMap<>(); - Map sameEmpIdNationMap = new HashMap<>(); - simpleUserInfoMap.get(NOW_INFO).forEach(employee -> { - if (employee.getNation() != null && employee.getNation().getId() != null) { - nationIds.add(employee.getNation().getId()); - empIdNationMap.put(Objects.isNull(employee.getUser()) ? null : employee.getUser().getId(), employee.getNation().getId()); - nationMap.put(employee.getNation().getId(), employee.getNation().getName()); - } - }); - simpleUserInfoMap.get(LAST_INFO).forEach(employee -> { - if (employee.getNation() != null && employee.getNation().getId() != null) { - lastEmpIdNationMap.put(Objects.isNull(employee.getUser()) ? null : employee.getUser().getId(), employee.getNation().getId()); - nationMap.put(employee.getNation().getId(), employee.getNation().getName()); - } - }); - simpleUserInfoMap.get(SAME_INFO).forEach(employee -> { - if (employee.getNation() != null && employee.getNation().getId() != null) { - sameEmpIdNationMap.put(Objects.isNull(employee.getUser()) ? null : employee.getUser().getId(), employee.getNation().getId()); - nationMap.put(employee.getNation().getId(), employee.getNation().getName()); - } - }); - - nationIds.forEach(k -> { - List salaryAcctEmployees = data.getList().stream().filter(po -> Objects.equals(empIdNationMap.get(po.getEmployeeId()), k)).collect(Collectors.toList()); - List lastSalaryAcctEmployees = data.getLastList().stream().filter(po -> Objects.equals(lastEmpIdNationMap.get(po.getEmployeeId()), k)).collect(Collectors.toList()); - List sameSalaryAcctEmployees = data.getSameList().stream().filter(po -> Objects.equals(sameEmpIdNationMap.get(po.getEmployeeId()), k)).collect(Collectors.toList()); - Map temp = new HashMap<>(); - temp.put(DM, nationMap.get(k)); - temp.putAll(SalaryStatisticsReportBO.calculateItem(salaryAcctEmployees, lastSalaryAcctEmployees, sameSalaryAcctEmployees, salaryAcctResultValueMap, data.getSalaryStatisticsItemList())); - records.add(temp); - }); - - List noGroupingList = data.getList().stream().filter(po -> empIdNationMap.get(po.getEmployeeId()) == null).collect(Collectors.toList()); - List lastNoGroupingList = data.getLastList().stream().filter(po -> lastEmpIdNationMap.get(po.getEmployeeId()) == null).collect(Collectors.toList()); - List sameNoGroupingList = data.getSameList().stream().filter(po -> sameEmpIdNationMap.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); - } - - result.setList(records); - return result; - } - - private PageInfo> buildHouseholdTypeRecords(SalaryStatisticsReportDataDTO data, Map> salaryAcctResultValueMap) { - PageInfo> result = new PageInfo<>(); - List> records = new ArrayList<>(); - Map> simpleUserInfoMap = getSimpleUserInfoList(data); - if (simpleUserInfoMap.isEmpty()) { - return result; - } - - Set householdTypeIds = new HashSet<>(); - Map householdTypeMap = Maps.newHashMap(); - - Map empIdHouseholdTypeMap = new HashMap<>(); - Map lastEmpIdHouseholdTypeMap = new HashMap<>(); - Map sameEmpIdHouseholdTypeMap = new HashMap<>(); - simpleUserInfoMap.get(NOW_INFO).forEach(employee -> { - if (employee.getHouseholdType() != null && employee.getHouseholdType().getId() != null) { - householdTypeIds.add(employee.getHouseholdType().getId()); - empIdHouseholdTypeMap.put(Objects.isNull(employee.getUser()) ? null : employee.getUser().getId(), employee.getHouseholdType().getId()); - householdTypeMap.put(employee.getHouseholdType().getId(), employee.getHouseholdType().getName()); - } - }); - simpleUserInfoMap.get(LAST_INFO).forEach(employee -> { - if (employee.getHouseholdType() != null && employee.getHouseholdType().getId() != null) { - lastEmpIdHouseholdTypeMap.put(Objects.isNull(employee.getUser()) ? null : employee.getUser().getId(), employee.getHouseholdType().getId()); - householdTypeMap.put(employee.getHouseholdType().getId(), employee.getHouseholdType().getName()); - } - }); - simpleUserInfoMap.get(SAME_INFO).forEach(employee -> { - if (employee.getHouseholdType() != null && employee.getHouseholdType().getId() != null) { - sameEmpIdHouseholdTypeMap.put(Objects.isNull(employee.getUser()) ? null : employee.getUser().getId(), employee.getHouseholdType().getId()); - householdTypeMap.put(employee.getHouseholdType().getId(), employee.getHouseholdType().getName()); - } - }); - - householdTypeIds.forEach(k -> { - List salaryAcctEmployees = data.getList().stream().filter(po -> Objects.equals(empIdHouseholdTypeMap.get(po.getEmployeeId()), k)).collect(Collectors.toList()); - List lastSalaryAcctEmployees = data.getLastList().stream().filter(po -> Objects.equals(lastEmpIdHouseholdTypeMap.get(po.getEmployeeId()), k)).collect(Collectors.toList()); - List sameSalaryAcctEmployees = data.getSameList().stream().filter(po -> Objects.equals(sameEmpIdHouseholdTypeMap.get(po.getEmployeeId()), k)).collect(Collectors.toList()); - Map temp = new HashMap<>(); - temp.put(DM, householdTypeMap.get(k)); - temp.putAll(SalaryStatisticsReportBO.calculateItem(salaryAcctEmployees, lastSalaryAcctEmployees, sameSalaryAcctEmployees, salaryAcctResultValueMap, data.getSalaryStatisticsItemList())); - records.add(temp); - }); - - List noGroupingList = data.getList().stream().filter(po -> empIdHouseholdTypeMap.get(po.getEmployeeId()) == null).collect(Collectors.toList()); - List lastNoGroupingList = data.getLastList().stream().filter(po -> lastEmpIdHouseholdTypeMap.get(po.getEmployeeId()) == null).collect(Collectors.toList()); - List sameNoGroupingList = data.getSameList().stream().filter(po -> sameEmpIdHouseholdTypeMap.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); - } - - result.setList(records); - return result; - } - - private PageInfo> buildPoliticsStatusRecords(SalaryStatisticsReportDataDTO data, Map> salaryAcctResultValueMap) { - PageInfo> result = new PageInfo<>(); - List> records = new ArrayList<>(); - Map> simpleUserInfoMap = getSimpleUserInfoList(data); - if (simpleUserInfoMap.isEmpty()) { - return result; - } - - Set politicsStatusIds = new HashSet<>(); - Map politicsStatusMap = Maps.newHashMap(); - - Map empIdPoliticsStatusMap = new HashMap<>(); - Map lastEmpIdPoliticsStatusMap = new HashMap<>(); - Map sameEmpIdPoliticsStatusMap = new HashMap<>(); - simpleUserInfoMap.get(NOW_INFO).forEach(employee -> { - if (employee.getPoliticsStatus() != null && employee.getPoliticsStatus().getId() != null) { - politicsStatusIds.add(employee.getPoliticsStatus().getId()); - empIdPoliticsStatusMap.put(Objects.isNull(employee.getUser()) ? null : employee.getUser().getId(), employee.getPoliticsStatus().getId()); - politicsStatusMap.put(employee.getPoliticsStatus().getId(), employee.getPoliticsStatus().getName()); - } - }); - simpleUserInfoMap.get(LAST_INFO).forEach(employee -> { - if (employee.getPoliticsStatus() != null && employee.getPoliticsStatus().getId() != null) { - lastEmpIdPoliticsStatusMap.put(Objects.isNull(employee.getUser()) ? null : employee.getUser().getId(), employee.getPoliticsStatus().getId()); - politicsStatusMap.put(employee.getPoliticsStatus().getId(), employee.getPoliticsStatus().getName()); - } - }); - simpleUserInfoMap.get(SAME_INFO).forEach(employee -> { - if (employee.getPoliticsStatus() != null && employee.getPoliticsStatus().getId() != null) { - sameEmpIdPoliticsStatusMap.put(Objects.isNull(employee.getUser()) ? null : employee.getUser().getId(), employee.getPoliticsStatus().getId()); - politicsStatusMap.put(employee.getPoliticsStatus().getId(), employee.getPoliticsStatus().getName()); - } - }); - - politicsStatusIds.forEach(k -> { - List salaryAcctEmployees = data.getList().stream().filter(po -> Objects.equals(empIdPoliticsStatusMap.get(po.getEmployeeId()), k)).collect(Collectors.toList()); - List lastSalaryAcctEmployees = data.getLastList().stream().filter(po -> Objects.equals(lastEmpIdPoliticsStatusMap.get(po.getEmployeeId()), k)).collect(Collectors.toList()); - List sameSalaryAcctEmployees = data.getSameList().stream().filter(po -> Objects.equals(sameEmpIdPoliticsStatusMap.get(po.getEmployeeId()), k)).collect(Collectors.toList()); - Map temp = new HashMap<>(); - temp.put(DM, politicsStatusMap.get(k)); - temp.putAll(SalaryStatisticsReportBO.calculateItem(salaryAcctEmployees, lastSalaryAcctEmployees, sameSalaryAcctEmployees, salaryAcctResultValueMap, data.getSalaryStatisticsItemList())); - records.add(temp); - }); - - List noGroupingList = data.getList().stream().filter(po -> empIdPoliticsStatusMap.get(po.getEmployeeId()) == null).collect(Collectors.toList()); - List lastNoGroupingList = data.getLastList().stream().filter(po -> lastEmpIdPoliticsStatusMap.get(po.getEmployeeId()) == null).collect(Collectors.toList()); - List sameNoGroupingList = data.getSameList().stream().filter(po -> sameEmpIdPoliticsStatusMap.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); - } - - result.setList(records); - return result; - } - - private PageInfo> buildAgeRecords(SalaryStatisticsReportDataDTO data, Map> salaryAcctResultValueMap) { - PageInfo> result = new PageInfo<>(); - List> records = new ArrayList<>(); - Map> simpleUserInfoMap = getSimpleUserInfoList(data); - if (simpleUserInfoMap.isEmpty()) { - return result; - } - - Set ageSet = new HashSet<>(); - - Map empIdAgeMap = new HashMap<>(); - Map lastEmpIdAgeMap = new HashMap<>(); - Map sameEmpIdAgeMap = new HashMap<>(); - simpleUserInfoMap.get(NOW_INFO).forEach(employee -> { - if (employee.getAge() != null) { - ageSet.add(employee.getAge()); - empIdAgeMap.put(Objects.isNull(employee.getUser()) ? null : employee.getUser().getId(), employee.getAge()); - } - }); - simpleUserInfoMap.get(LAST_INFO).forEach(employee -> { - if (employee.getAge() != null) { - lastEmpIdAgeMap.put(Objects.isNull(employee.getUser()) ? null : employee.getUser().getId(), employee.getAge()); - } - }); - simpleUserInfoMap.get(SAME_INFO).forEach(employee -> { - if (employee.getAge() != null) { - sameEmpIdAgeMap.put(Objects.isNull(employee.getUser()) ? null : employee.getUser().getId(), employee.getAge()); - } - }); - - List ages = Lists.newArrayList(ageSet); - ages = ages.stream().sorted().collect(Collectors.toList()); - - ages.forEach(k -> { - List salaryAcctEmployees = data.getList().stream().filter(po -> Objects.equals(empIdAgeMap.get(po.getEmployeeId()), k)).collect(Collectors.toList()); - List lastSalaryAcctEmployees = data.getLastList().stream().filter(po -> Objects.equals(lastEmpIdAgeMap.get(po.getEmployeeId()), k)).collect(Collectors.toList()); - List sameSalaryAcctEmployees = data.getSameList().stream().filter(po -> Objects.equals(sameEmpIdAgeMap.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); - }); - - List noGroupingList = data.getList().stream().filter(po -> empIdAgeMap.get(po.getEmployeeId()) == null).collect(Collectors.toList()); - List lastNoGroupingList = data.getLastList().stream().filter(po -> lastEmpIdAgeMap.get(po.getEmployeeId()) == null).collect(Collectors.toList()); - List sameNoGroupingList = data.getSameList().stream().filter(po -> lastEmpIdAgeMap.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); - } - - result.setList(records); - return result; - } - - private PageInfo> buildWorkYearRecords(SalaryStatisticsReportDataDTO data, Map> salaryAcctResultValueMap) { - PageInfo> result = new PageInfo<>(); - List> records = new ArrayList<>(); - Map> simpleUserInfoMap = getSimpleUserInfoList(data); - if (simpleUserInfoMap.isEmpty()) { - return result; - } - - Set workYearSet = new HashSet<>(); - - Map empIdWorkYearMap = new HashMap<>(); - Map lastEmpIdWorkYearMap = new HashMap<>(); - Map sameEmpIdWorkYearMap = new HashMap<>(); - simpleUserInfoMap.get(NOW_INFO).forEach(employee -> { - if (employee.getWorkYear() != null) { - workYearSet.add(employee.getWorkYear()); - empIdWorkYearMap.put(Objects.isNull(employee.getUser()) ? null : employee.getUser().getId(), employee.getWorkYear()); - } - }); - simpleUserInfoMap.get(LAST_INFO).forEach(employee -> { - if (employee.getWorkYear() != null) { - lastEmpIdWorkYearMap.put(Objects.isNull(employee.getUser()) ? null : employee.getUser().getId(), employee.getWorkYear()); - } - }); - simpleUserInfoMap.get(SAME_INFO).forEach(employee -> { - if (employee.getWorkYear() != null) { - sameEmpIdWorkYearMap.put(Objects.isNull(employee.getUser()) ? null : employee.getUser().getId(), employee.getWorkYear()); - } - }); - List workYears = Lists.newArrayList(workYearSet); - workYears = workYears.stream().sorted().collect(Collectors.toList()); - - workYears.forEach(k -> { - List salaryAcctEmployees = data.getList().stream().filter(po -> Objects.equals(empIdWorkYearMap.get(po.getEmployeeId()), k)).collect(Collectors.toList()); - List lastSalaryAcctEmployees = data.getLastList().stream().filter(po -> Objects.equals(lastEmpIdWorkYearMap.get(po.getEmployeeId()), k)).collect(Collectors.toList()); - List sameSalaryAcctEmployees = data.getSameList().stream().filter(po -> Objects.equals(sameEmpIdWorkYearMap.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); - }); - - List noGroupingList = data.getList().stream().filter(po -> empIdWorkYearMap.get(po.getEmployeeId()) == null).collect(Collectors.toList()); - List lastNoGroupingList = data.getLastList().stream().filter(po -> lastEmpIdWorkYearMap.get(po.getEmployeeId()) == null).collect(Collectors.toList()); - List sameNoGroupingList = data.getSameList().stream().filter(po -> lastEmpIdWorkYearMap.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); - } - - result.setList(records); - return result; - } - - private PageInfo> buildCompanyYearRecords(SalaryStatisticsReportDataDTO data, Map> salaryAcctResultValueMap) { - 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 (StringUtils.isNotEmpty(employee.getCompanyYear())) { - companyYearSet.add(employee.getCompanyYear()); - empIdCompanyYearMap.put(Objects.isNull(employee.getUser()) ? null : employee.getUser().getId(), employee.getCompanyYear()); - } - }); - simpleUserInfoMap.get(LAST_INFO).forEach(employee -> { - if (StringUtils.isNotEmpty(employee.getCompanyYear())) { - lastEmpIdCompanyYearMap.put(Objects.isNull(employee.getUser()) ? null : employee.getUser().getId(), employee.getCompanyYear()); - } - }); - simpleUserInfoMap.get(SAME_INFO).forEach(employee -> { - if (StringUtils.isNotEmpty(employee.getCompanyYear())) { - sameEmpIdCompanyYearMap.put(Objects.isNull(employee.getUser()) ? null : employee.getUser().getId(), employee.getCompanyYear()); - } - }); - - List companyYears = Lists.newArrayList(companyYearSet); - companyYears = companyYears.stream().sorted().collect(Collectors.toList()); - - companyYears.forEach(k -> { - 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); - }); - - 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); - } - - result.setList(records); - return result; - } - - private PageInfo> buildRationGroupSpacing4NoItemRecords(SalaryStatisticsDimensionPO dimension, SalaryStatisticsReportDataDTO data, Map> salaryAcctResultValueMap) { - PageInfo> result = new PageInfo<>(); - List> records = new ArrayList<>(); - - // 分组设置 - List groups = JsonUtil.parseList(dimension.getSetting(), SalaryStatisticsDimensionSaveParam.Setting4RationGroupSpacing.class); - - - result.setList(records); - return result; - } - - private PageInfo> buildRationGroupSpacing4Records(SalaryStatisticsDimensionPO dimension, SalaryStatisticsReportDataDTO data, Map> salaryAcctResultValueMap) { - PageInfo> result = new PageInfo<>(); - List> records = new ArrayList<>(); - - // 分组设置 - List groups = JsonUtil.parseList(dimension.getSetting(), SalaryStatisticsDimensionSaveParam.Setting4RationGroupSpacing.class); - - Map empIdYearMap = new HashMap<>(); - Map lastEmpIdYearMap = new HashMap<>(); - Map sameEmpIdYearMap = new HashMap<>(); - - String groupBelong; - if (StringUtils.isEmpty(dimension.getDimCode())) { - groupBelong = SalaryStatisticsReportBO.G_NO_ITEM; - } else if (dimension.getDimCode().equals(SalaryStatisticsDimensionConstant.DM_AGE) || dimension.getDimCode().equals(SalaryStatisticsDimensionConstant.DM_WORK_YEAR) || dimension.getDimCode().equals(SalaryStatisticsDimensionConstant.DM_COMPANY_YEAR)) { - groupBelong = SalaryStatisticsReportBO.G_YEAR; - // 年份数据 - handle4GroupYear(dimension, empIdYearMap, lastEmpIdYearMap, sameEmpIdYearMap, data); - } else { - groupBelong = SalaryStatisticsReportBO.G_ITEM; - } - groups.forEach(k -> { - List salaryAcctEmployees = SalaryStatisticsReportBO.listAcctEmpByRationGroupSpacing(k, groupBelong, dimension.getDimCode(), data.getList(), empIdYearMap, salaryAcctResultValueMap, data.getSalaryStatisticsItemList()); - List lastSalaryAcctEmployees = SalaryStatisticsReportBO.listAcctEmpByRationGroupSpacing(k, groupBelong, dimension.getDimCode(), data.getLastList(), lastEmpIdYearMap, salaryAcctResultValueMap, data.getSalaryStatisticsItemList()); - List sameSalaryAcctEmployees = SalaryStatisticsReportBO.listAcctEmpByRationGroupSpacing(k, groupBelong, dimension.getDimCode(), data.getSameList(), sameEmpIdYearMap, salaryAcctResultValueMap, data.getSalaryStatisticsItemList()); - Map temp = new HashMap<>(); - temp.put(DM, k.getStartValue() + "-" + k.getEndValue()); - temp.putAll(SalaryStatisticsReportBO.calculateItem(salaryAcctEmployees, lastSalaryAcctEmployees, sameSalaryAcctEmployees, salaryAcctResultValueMap, data.getSalaryStatisticsItemList())); - records.add(temp); - }); - - result.setList(records); - return result; - } - - private void handle4GroupYear(SalaryStatisticsDimensionPO dimension, Map empIdYearMap, Map lastEmpIdYearMap, Map sameEmpIdYearMap, SalaryStatisticsReportDataDTO data) { - Map> simpleUserInfoMap = getSimpleUserInfoList(data); - if (simpleUserInfoMap.isEmpty()) { - return; - } - simpleUserInfoMap.get(NOW_INFO).forEach(employee -> { - if (dimension.getDimCode().equals(SalaryStatisticsDimensionConstant.DM_AGE) && employee.getAge() != null) { - empIdYearMap.put(Objects.isNull(employee.getUser()) ? null : employee.getUser().getId(), employee.getAge().toString()); - } else if (dimension.getDimCode().equals(SalaryStatisticsDimensionConstant.DM_WORK_YEAR) && employee.getWorkYear() != null) { - empIdYearMap.put(Objects.isNull(employee.getUser()) ? null : employee.getUser().getId(), employee.getWorkYear().toString()); - } else if (dimension.getDimCode().equals(SalaryStatisticsDimensionConstant.DM_COMPANY_YEAR) && StringUtils.isNotEmpty(employee.getCompanyYear())) { - empIdYearMap.put(Objects.isNull(employee.getUser()) ? null : employee.getUser().getId(), employee.getCompanyYear()); - } - }); - simpleUserInfoMap.get(LAST_INFO).forEach(employee -> { - if (dimension.getDimCode().equals(SalaryStatisticsDimensionConstant.DM_AGE) && employee.getAge() != null) { - lastEmpIdYearMap.put(Objects.isNull(employee.getUser()) ? null : employee.getUser().getId(), employee.getAge().toString()); - } else if (dimension.getDimCode().equals(SalaryStatisticsDimensionConstant.DM_WORK_YEAR) && employee.getWorkYear() != null) { - lastEmpIdYearMap.put(Objects.isNull(employee.getUser()) ? null : employee.getUser().getId(), employee.getWorkYear().toString()); - } else if (dimension.getDimCode().equals(SalaryStatisticsDimensionConstant.DM_COMPANY_YEAR) && StringUtils.isNotEmpty(employee.getCompanyYear())) { - lastEmpIdYearMap.put(Objects.isNull(employee.getUser()) ? null : employee.getUser().getId(), employee.getCompanyYear()); - } - }); - simpleUserInfoMap.get(SAME_INFO).forEach(employee -> { - if (dimension.getDimCode().equals(SalaryStatisticsDimensionConstant.DM_AGE) && employee.getAge() != null) { - sameEmpIdYearMap.put(Objects.isNull(employee.getUser()) ? null : employee.getUser().getId(), employee.getAge().toString()); - } else if (dimension.getDimCode().equals(SalaryStatisticsDimensionConstant.DM_WORK_YEAR) && employee.getWorkYear() != null) { - sameEmpIdYearMap.put(Objects.isNull(employee.getUser()) ? null : employee.getUser().getId(), employee.getWorkYear().toString()); - } else if (dimension.getDimCode().equals(SalaryStatisticsDimensionConstant.DM_COMPANY_YEAR) && StringUtils.isNotEmpty(employee.getCompanyYear())) { - sameEmpIdYearMap.put(Objects.isNull(employee.getUser()) ? null : employee.getUser().getId(), employee.getCompanyYear()); - } - }); - } - - private PageInfo> buildRationGroupIndividual4Records(SalaryStatisticsDimensionPO dimension, SalaryStatisticsReportDataDTO data, Map> salaryAcctResultValueMap) { - PageInfo> result = new PageInfo<>(); - List> records = new ArrayList<>(); - - // 分组设置 - List groups = JsonUtil.parseList(dimension.getSetting(), SalaryStatisticsDimensionSaveParam.Setting4RationGroupIndividual.class); - Map empIdYearMap = new HashMap<>(); - Map lastEmpIdYearMap = new HashMap<>(); - Map sameEmpIdYearMap = new HashMap<>(); - - String groupBelong; - if (StringUtils.isEmpty(dimension.getDimCode())) { - groupBelong = SalaryStatisticsReportBO.G_NO_ITEM; - } else if (dimension.getDimCode().equals(SalaryStatisticsDimensionConstant.DM_AGE) || dimension.getDimCode().equals(SalaryStatisticsDimensionConstant.DM_WORK_YEAR) || dimension.getDimCode().equals(SalaryStatisticsDimensionConstant.DM_COMPANY_YEAR)) { - groupBelong = SalaryStatisticsReportBO.G_YEAR; - - // 年份数据 +// private Map> getSimpleUserInfoList(SalaryStatisticsReportDataDTO data) { +// List employeeIds = data.getList().stream().map(SalaryAcctEmployeePO::getEmployeeId).distinct().collect(Collectors.toList()); +// List lastEmployeeIds = data.getLastList().stream().map(SalaryAcctEmployeePO::getEmployeeId).distinct().collect(Collectors.toList()); +// List sameEmployeeIds = data.getSameList().stream().map(SalaryAcctEmployeePO::getEmployeeId).distinct().collect(Collectors.toList()); +// +// List simpleUserInfoList; +// List lastSimpleUserInfoList; +// List sameSimpleUserInfoList; +// Map> map = Maps.newHashMap(); +// try { +// simpleUserInfoList = CollectionUtils.isEmpty(employeeIds) ? Lists.newArrayList() : remoteUserInfoService.querySimpleUserInfoByUserIds(employeeIds, data.getTenantKey()); +// lastSimpleUserInfoList = CollectionUtils.isEmpty(lastEmployeeIds) ? Lists.newArrayList() : remoteUserInfoService.querySimpleUserInfoByUserIds(lastEmployeeIds, data.getTenantKey()); +// sameSimpleUserInfoList = CollectionUtils.isEmpty(sameEmployeeIds) ? Lists.newArrayList() : remoteUserInfoService.querySimpleUserInfoByUserIds(sameEmployeeIds, data.getTenantKey()); +// } catch (Exception e) { +// log.info("获取员工个人信息失败: {}", e.getMessage()); +// return map; +// } +// map.put(NOW_INFO, simpleUserInfoList); +// map.put(LAST_INFO, lastSimpleUserInfoList); +// map.put(SAME_INFO, sameSimpleUserInfoList); +// return map; +// } +// +// private PageInfo> buildEducationRecords(SalaryStatisticsReportDataDTO data, Map> salaryAcctResultValueMap) { +// PageInfo> result = new PageInfo<>(); +// List> records = new ArrayList<>(); +// Map> simpleUserInfoMap = getSimpleUserInfoList(data); +// if (simpleUserInfoMap.isEmpty()) { +// return result; +// } +// +// Set educationIds = new HashSet<>(); +// Map educationMap = Maps.newHashMap(); +// +// Map empIdEducationMap = new HashMap<>(); +// Map lastEmpIdEducationMap = new HashMap<>(); +// Map sameEmpIdEducationMap = new HashMap<>(); +// simpleUserInfoMap.get(NOW_INFO).forEach(employee -> { +// if (employee.getEducation() != null && employee.getEducation().getId() != null) { +// educationIds.add(employee.getEducation().getId()); +// empIdEducationMap.put(Objects.isNull(employee.getUser()) ? null : employee.getUser().getId(), employee.getEducation().getId()); +// educationMap.put(employee.getEducation().getId(), employee.getEducation().getName()); +// } +// }); +// simpleUserInfoMap.get(LAST_INFO).forEach(employee -> { +// if (employee.getEducation() != null && employee.getEducation().getId() != null) { +// lastEmpIdEducationMap.put(Objects.isNull(employee.getUser()) ? null : employee.getUser().getId(), employee.getEducation().getId()); +// educationMap.put(employee.getEducation().getId(), employee.getEducation().getName()); +// } +// }); +// simpleUserInfoMap.get(SAME_INFO).forEach(employee -> { +// if (employee.getEducation() != null && employee.getEducation().getId() != null) { +// sameEmpIdEducationMap.put(Objects.isNull(employee.getUser()) ? null : employee.getUser().getId(), employee.getEducation().getId()); +// educationMap.put(employee.getEducation().getId(), employee.getEducation().getName()); +// } +// }); +// +// educationIds.forEach(k -> { +// List salaryAcctEmployees = data.getList().stream().filter(po -> Objects.equals(empIdEducationMap.get(po.getEmployeeId()), k)).collect(Collectors.toList()); +// List lastSalaryAcctEmployees = data.getLastList().stream().filter(po -> Objects.equals(lastEmpIdEducationMap.get(po.getEmployeeId()), k)).collect(Collectors.toList()); +// List sameSalaryAcctEmployees = data.getSameList().stream().filter(po -> Objects.equals(sameEmpIdEducationMap.get(po.getEmployeeId()), k)).collect(Collectors.toList()); +// Map temp = new HashMap<>(); +// temp.put(DM, educationMap.get(k)); +// temp.putAll(SalaryStatisticsReportBO.calculateItem(salaryAcctEmployees, lastSalaryAcctEmployees, sameSalaryAcctEmployees, salaryAcctResultValueMap, data.getSalaryStatisticsItemList())); +// records.add(temp); +// }); +// +// List noGroupingList = data.getList().stream().filter(po -> empIdEducationMap.get(po.getEmployeeId()) == null).collect(Collectors.toList()); +// List lastNoGroupingList = data.getLastList().stream().filter(po -> lastEmpIdEducationMap.get(po.getEmployeeId()) == null).collect(Collectors.toList()); +// List sameNoGroupingList = data.getSameList().stream().filter(po -> sameEmpIdEducationMap.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); +// } +// +// result.setList(records); +// return result; +// } +// +// private PageInfo> buildDegreeRecords(SalaryStatisticsReportDataDTO data, Map> salaryAcctResultValueMap) { +// PageInfo> result = new PageInfo<>(); +// List> records = new ArrayList<>(); +// Map> simpleUserInfoMap = getSimpleUserInfoList(data); +// if (simpleUserInfoMap.isEmpty()) { +// return result; +// } +// +// Set degreeIds = new HashSet<>(); +// Map degreeMap = Maps.newHashMap(); +// +// Map empIdDegreeMap = new HashMap<>(); +// Map lastEmpIdDegreeMap = new HashMap<>(); +// Map sameEmpIdDegreeMap = new HashMap<>(); +// simpleUserInfoMap.get(NOW_INFO).forEach(employee -> { +// if (employee.getDegree() != null && employee.getDegree().getId() != null) { +// degreeIds.add(employee.getDegree().getId()); +// empIdDegreeMap.put(Objects.isNull(employee.getUser()) ? null : employee.getUser().getId(), employee.getDegree().getId()); +// degreeMap.put(employee.getDegree().getId(), employee.getDegree().getName()); +// } +// }); +// simpleUserInfoMap.get(LAST_INFO).forEach(employee -> { +// if (employee.getDegree() != null && employee.getDegree().getId() != null) { +// lastEmpIdDegreeMap.put(Objects.isNull(employee.getUser()) ? null : employee.getUser().getId(), employee.getDegree().getId()); +// degreeMap.put(employee.getDegree().getId(), employee.getDegree().getName()); +// } +// }); +// simpleUserInfoMap.get(SAME_INFO).forEach(employee -> { +// if (employee.getDegree() != null && employee.getDegree().getId() != null) { +// sameEmpIdDegreeMap.put(Objects.isNull(employee.getUser()) ? null : employee.getUser().getId(), employee.getDegree().getId()); +// degreeMap.put(employee.getDegree().getId(), employee.getDegree().getName()); +// } +// }); +// +// degreeIds.forEach(k -> { +// List salaryAcctEmployees = data.getList().stream().filter(po -> Objects.equals(empIdDegreeMap.get(po.getEmployeeId()), k)).collect(Collectors.toList()); +// List lastSalaryAcctEmployees = data.getLastList().stream().filter(po -> Objects.equals(lastEmpIdDegreeMap.get(po.getEmployeeId()), k)).collect(Collectors.toList()); +// List sameSalaryAcctEmployees = data.getSameList().stream().filter(po -> Objects.equals(sameEmpIdDegreeMap.get(po.getEmployeeId()), k)).collect(Collectors.toList()); +// Map temp = new HashMap<>(); +// temp.put(DM, degreeMap.get(k)); +// temp.putAll(SalaryStatisticsReportBO.calculateItem(salaryAcctEmployees, lastSalaryAcctEmployees, sameSalaryAcctEmployees, salaryAcctResultValueMap, data.getSalaryStatisticsItemList())); +// records.add(temp); +// }); +// +// List noGroupingList = data.getList().stream().filter(po -> empIdDegreeMap.get(po.getEmployeeId()) == null).collect(Collectors.toList()); +// List lastNoGroupingList = data.getLastList().stream().filter(po -> lastEmpIdDegreeMap.get(po.getEmployeeId()) == null).collect(Collectors.toList()); +// List sameNoGroupingList = data.getSameList().stream().filter(po -> sameEmpIdDegreeMap.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); +// } +// +// result.setList(records); +// return result; +// } +// +// private PageInfo> buildNationRecords(SalaryStatisticsReportDataDTO data, Map> salaryAcctResultValueMap) { +// PageInfo> result = new PageInfo<>(); +// List> records = new ArrayList<>(); +// Map> simpleUserInfoMap = getSimpleUserInfoList(data); +// if (simpleUserInfoMap.isEmpty()) { +// return result; +// } +// +// Set nationIds = new HashSet<>(); +// Map nationMap = Maps.newHashMap(); +// +// Map empIdNationMap = new HashMap<>(); +// Map lastEmpIdNationMap = new HashMap<>(); +// Map sameEmpIdNationMap = new HashMap<>(); +// simpleUserInfoMap.get(NOW_INFO).forEach(employee -> { +// if (employee.getNation() != null && employee.getNation().getId() != null) { +// nationIds.add(employee.getNation().getId()); +// empIdNationMap.put(Objects.isNull(employee.getUser()) ? null : employee.getUser().getId(), employee.getNation().getId()); +// nationMap.put(employee.getNation().getId(), employee.getNation().getName()); +// } +// }); +// simpleUserInfoMap.get(LAST_INFO).forEach(employee -> { +// if (employee.getNation() != null && employee.getNation().getId() != null) { +// lastEmpIdNationMap.put(Objects.isNull(employee.getUser()) ? null : employee.getUser().getId(), employee.getNation().getId()); +// nationMap.put(employee.getNation().getId(), employee.getNation().getName()); +// } +// }); +// simpleUserInfoMap.get(SAME_INFO).forEach(employee -> { +// if (employee.getNation() != null && employee.getNation().getId() != null) { +// sameEmpIdNationMap.put(Objects.isNull(employee.getUser()) ? null : employee.getUser().getId(), employee.getNation().getId()); +// nationMap.put(employee.getNation().getId(), employee.getNation().getName()); +// } +// }); +// +// nationIds.forEach(k -> { +// List salaryAcctEmployees = data.getList().stream().filter(po -> Objects.equals(empIdNationMap.get(po.getEmployeeId()), k)).collect(Collectors.toList()); +// List lastSalaryAcctEmployees = data.getLastList().stream().filter(po -> Objects.equals(lastEmpIdNationMap.get(po.getEmployeeId()), k)).collect(Collectors.toList()); +// List sameSalaryAcctEmployees = data.getSameList().stream().filter(po -> Objects.equals(sameEmpIdNationMap.get(po.getEmployeeId()), k)).collect(Collectors.toList()); +// Map temp = new HashMap<>(); +// temp.put(DM, nationMap.get(k)); +// temp.putAll(SalaryStatisticsReportBO.calculateItem(salaryAcctEmployees, lastSalaryAcctEmployees, sameSalaryAcctEmployees, salaryAcctResultValueMap, data.getSalaryStatisticsItemList())); +// records.add(temp); +// }); +// +// List noGroupingList = data.getList().stream().filter(po -> empIdNationMap.get(po.getEmployeeId()) == null).collect(Collectors.toList()); +// List lastNoGroupingList = data.getLastList().stream().filter(po -> lastEmpIdNationMap.get(po.getEmployeeId()) == null).collect(Collectors.toList()); +// List sameNoGroupingList = data.getSameList().stream().filter(po -> sameEmpIdNationMap.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); +// } +// +// result.setList(records); +// return result; +// } +// +// private PageInfo> buildHouseholdTypeRecords(SalaryStatisticsReportDataDTO data, Map> salaryAcctResultValueMap) { +// PageInfo> result = new PageInfo<>(); +// List> records = new ArrayList<>(); +// Map> simpleUserInfoMap = getSimpleUserInfoList(data); +// if (simpleUserInfoMap.isEmpty()) { +// return result; +// } +// +// Set householdTypeIds = new HashSet<>(); +// Map householdTypeMap = Maps.newHashMap(); +// +// Map empIdHouseholdTypeMap = new HashMap<>(); +// Map lastEmpIdHouseholdTypeMap = new HashMap<>(); +// Map sameEmpIdHouseholdTypeMap = new HashMap<>(); +// simpleUserInfoMap.get(NOW_INFO).forEach(employee -> { +// if (employee.getHouseholdType() != null && employee.getHouseholdType().getId() != null) { +// householdTypeIds.add(employee.getHouseholdType().getId()); +// empIdHouseholdTypeMap.put(Objects.isNull(employee.getUser()) ? null : employee.getUser().getId(), employee.getHouseholdType().getId()); +// householdTypeMap.put(employee.getHouseholdType().getId(), employee.getHouseholdType().getName()); +// } +// }); +// simpleUserInfoMap.get(LAST_INFO).forEach(employee -> { +// if (employee.getHouseholdType() != null && employee.getHouseholdType().getId() != null) { +// lastEmpIdHouseholdTypeMap.put(Objects.isNull(employee.getUser()) ? null : employee.getUser().getId(), employee.getHouseholdType().getId()); +// householdTypeMap.put(employee.getHouseholdType().getId(), employee.getHouseholdType().getName()); +// } +// }); +// simpleUserInfoMap.get(SAME_INFO).forEach(employee -> { +// if (employee.getHouseholdType() != null && employee.getHouseholdType().getId() != null) { +// sameEmpIdHouseholdTypeMap.put(Objects.isNull(employee.getUser()) ? null : employee.getUser().getId(), employee.getHouseholdType().getId()); +// householdTypeMap.put(employee.getHouseholdType().getId(), employee.getHouseholdType().getName()); +// } +// }); +// +// householdTypeIds.forEach(k -> { +// List salaryAcctEmployees = data.getList().stream().filter(po -> Objects.equals(empIdHouseholdTypeMap.get(po.getEmployeeId()), k)).collect(Collectors.toList()); +// List lastSalaryAcctEmployees = data.getLastList().stream().filter(po -> Objects.equals(lastEmpIdHouseholdTypeMap.get(po.getEmployeeId()), k)).collect(Collectors.toList()); +// List sameSalaryAcctEmployees = data.getSameList().stream().filter(po -> Objects.equals(sameEmpIdHouseholdTypeMap.get(po.getEmployeeId()), k)).collect(Collectors.toList()); +// Map temp = new HashMap<>(); +// temp.put(DM, householdTypeMap.get(k)); +// temp.putAll(SalaryStatisticsReportBO.calculateItem(salaryAcctEmployees, lastSalaryAcctEmployees, sameSalaryAcctEmployees, salaryAcctResultValueMap, data.getSalaryStatisticsItemList())); +// records.add(temp); +// }); +// +// List noGroupingList = data.getList().stream().filter(po -> empIdHouseholdTypeMap.get(po.getEmployeeId()) == null).collect(Collectors.toList()); +// List lastNoGroupingList = data.getLastList().stream().filter(po -> lastEmpIdHouseholdTypeMap.get(po.getEmployeeId()) == null).collect(Collectors.toList()); +// List sameNoGroupingList = data.getSameList().stream().filter(po -> sameEmpIdHouseholdTypeMap.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); +// } +// +// result.setList(records); +// return result; +// } +// +// private PageInfo> buildPoliticsStatusRecords(SalaryStatisticsReportDataDTO data, Map> salaryAcctResultValueMap) { +// PageInfo> result = new PageInfo<>(); +// List> records = new ArrayList<>(); +// Map> simpleUserInfoMap = getSimpleUserInfoList(data); +// if (simpleUserInfoMap.isEmpty()) { +// return result; +// } +// +// Set politicsStatusIds = new HashSet<>(); +// Map politicsStatusMap = Maps.newHashMap(); +// +// Map empIdPoliticsStatusMap = new HashMap<>(); +// Map lastEmpIdPoliticsStatusMap = new HashMap<>(); +// Map sameEmpIdPoliticsStatusMap = new HashMap<>(); +// simpleUserInfoMap.get(NOW_INFO).forEach(employee -> { +// if (employee.getPoliticsStatus() != null && employee.getPoliticsStatus().getId() != null) { +// politicsStatusIds.add(employee.getPoliticsStatus().getId()); +// empIdPoliticsStatusMap.put(Objects.isNull(employee.getUser()) ? null : employee.getUser().getId(), employee.getPoliticsStatus().getId()); +// politicsStatusMap.put(employee.getPoliticsStatus().getId(), employee.getPoliticsStatus().getName()); +// } +// }); +// simpleUserInfoMap.get(LAST_INFO).forEach(employee -> { +// if (employee.getPoliticsStatus() != null && employee.getPoliticsStatus().getId() != null) { +// lastEmpIdPoliticsStatusMap.put(Objects.isNull(employee.getUser()) ? null : employee.getUser().getId(), employee.getPoliticsStatus().getId()); +// politicsStatusMap.put(employee.getPoliticsStatus().getId(), employee.getPoliticsStatus().getName()); +// } +// }); +// simpleUserInfoMap.get(SAME_INFO).forEach(employee -> { +// if (employee.getPoliticsStatus() != null && employee.getPoliticsStatus().getId() != null) { +// sameEmpIdPoliticsStatusMap.put(Objects.isNull(employee.getUser()) ? null : employee.getUser().getId(), employee.getPoliticsStatus().getId()); +// politicsStatusMap.put(employee.getPoliticsStatus().getId(), employee.getPoliticsStatus().getName()); +// } +// }); +// +// politicsStatusIds.forEach(k -> { +// List salaryAcctEmployees = data.getList().stream().filter(po -> Objects.equals(empIdPoliticsStatusMap.get(po.getEmployeeId()), k)).collect(Collectors.toList()); +// List lastSalaryAcctEmployees = data.getLastList().stream().filter(po -> Objects.equals(lastEmpIdPoliticsStatusMap.get(po.getEmployeeId()), k)).collect(Collectors.toList()); +// List sameSalaryAcctEmployees = data.getSameList().stream().filter(po -> Objects.equals(sameEmpIdPoliticsStatusMap.get(po.getEmployeeId()), k)).collect(Collectors.toList()); +// Map temp = new HashMap<>(); +// temp.put(DM, politicsStatusMap.get(k)); +// temp.putAll(SalaryStatisticsReportBO.calculateItem(salaryAcctEmployees, lastSalaryAcctEmployees, sameSalaryAcctEmployees, salaryAcctResultValueMap, data.getSalaryStatisticsItemList())); +// records.add(temp); +// }); +// +// List noGroupingList = data.getList().stream().filter(po -> empIdPoliticsStatusMap.get(po.getEmployeeId()) == null).collect(Collectors.toList()); +// List lastNoGroupingList = data.getLastList().stream().filter(po -> lastEmpIdPoliticsStatusMap.get(po.getEmployeeId()) == null).collect(Collectors.toList()); +// List sameNoGroupingList = data.getSameList().stream().filter(po -> sameEmpIdPoliticsStatusMap.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); +// } +// +// result.setList(records); +// return result; +// } +// +// private PageInfo> buildAgeRecords(SalaryStatisticsReportDataDTO data, Map> salaryAcctResultValueMap) { +// PageInfo> result = new PageInfo<>(); +// List> records = new ArrayList<>(); +// Map> simpleUserInfoMap = getSimpleUserInfoList(data); +// if (simpleUserInfoMap.isEmpty()) { +// return result; +// } +// +// Set ageSet = new HashSet<>(); +// +// Map empIdAgeMap = new HashMap<>(); +// Map lastEmpIdAgeMap = new HashMap<>(); +// Map sameEmpIdAgeMap = new HashMap<>(); +// simpleUserInfoMap.get(NOW_INFO).forEach(employee -> { +// if (employee.getAge() != null) { +// ageSet.add(employee.getAge()); +// empIdAgeMap.put(Objects.isNull(employee.getUser()) ? null : employee.getUser().getId(), employee.getAge()); +// } +// }); +// simpleUserInfoMap.get(LAST_INFO).forEach(employee -> { +// if (employee.getAge() != null) { +// lastEmpIdAgeMap.put(Objects.isNull(employee.getUser()) ? null : employee.getUser().getId(), employee.getAge()); +// } +// }); +// simpleUserInfoMap.get(SAME_INFO).forEach(employee -> { +// if (employee.getAge() != null) { +// sameEmpIdAgeMap.put(Objects.isNull(employee.getUser()) ? null : employee.getUser().getId(), employee.getAge()); +// } +// }); +// +// List ages = Lists.newArrayList(ageSet); +// ages = ages.stream().sorted().collect(Collectors.toList()); +// +// ages.forEach(k -> { +// List salaryAcctEmployees = data.getList().stream().filter(po -> Objects.equals(empIdAgeMap.get(po.getEmployeeId()), k)).collect(Collectors.toList()); +// List lastSalaryAcctEmployees = data.getLastList().stream().filter(po -> Objects.equals(lastEmpIdAgeMap.get(po.getEmployeeId()), k)).collect(Collectors.toList()); +// List sameSalaryAcctEmployees = data.getSameList().stream().filter(po -> Objects.equals(sameEmpIdAgeMap.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); +// }); +// +// List noGroupingList = data.getList().stream().filter(po -> empIdAgeMap.get(po.getEmployeeId()) == null).collect(Collectors.toList()); +// List lastNoGroupingList = data.getLastList().stream().filter(po -> lastEmpIdAgeMap.get(po.getEmployeeId()) == null).collect(Collectors.toList()); +// List sameNoGroupingList = data.getSameList().stream().filter(po -> lastEmpIdAgeMap.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); +// } +// +// result.setList(records); +// return result; +// } +// +// private PageInfo> buildWorkYearRecords(SalaryStatisticsReportDataDTO data, Map> salaryAcctResultValueMap) { +// PageInfo> result = new PageInfo<>(); +// List> records = new ArrayList<>(); +// Map> simpleUserInfoMap = getSimpleUserInfoList(data); +// if (simpleUserInfoMap.isEmpty()) { +// return result; +// } +// +// Set workYearSet = new HashSet<>(); +// +// Map empIdWorkYearMap = new HashMap<>(); +// Map lastEmpIdWorkYearMap = new HashMap<>(); +// Map sameEmpIdWorkYearMap = new HashMap<>(); +// simpleUserInfoMap.get(NOW_INFO).forEach(employee -> { +// if (employee.getWorkYear() != null) { +// workYearSet.add(employee.getWorkYear()); +// empIdWorkYearMap.put(Objects.isNull(employee.getUser()) ? null : employee.getUser().getId(), employee.getWorkYear()); +// } +// }); +// simpleUserInfoMap.get(LAST_INFO).forEach(employee -> { +// if (employee.getWorkYear() != null) { +// lastEmpIdWorkYearMap.put(Objects.isNull(employee.getUser()) ? null : employee.getUser().getId(), employee.getWorkYear()); +// } +// }); +// simpleUserInfoMap.get(SAME_INFO).forEach(employee -> { +// if (employee.getWorkYear() != null) { +// sameEmpIdWorkYearMap.put(Objects.isNull(employee.getUser()) ? null : employee.getUser().getId(), employee.getWorkYear()); +// } +// }); +// List workYears = Lists.newArrayList(workYearSet); +// workYears = workYears.stream().sorted().collect(Collectors.toList()); +// +// workYears.forEach(k -> { +// List salaryAcctEmployees = data.getList().stream().filter(po -> Objects.equals(empIdWorkYearMap.get(po.getEmployeeId()), k)).collect(Collectors.toList()); +// List lastSalaryAcctEmployees = data.getLastList().stream().filter(po -> Objects.equals(lastEmpIdWorkYearMap.get(po.getEmployeeId()), k)).collect(Collectors.toList()); +// List sameSalaryAcctEmployees = data.getSameList().stream().filter(po -> Objects.equals(sameEmpIdWorkYearMap.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); +// }); +// +// List noGroupingList = data.getList().stream().filter(po -> empIdWorkYearMap.get(po.getEmployeeId()) == null).collect(Collectors.toList()); +// List lastNoGroupingList = data.getLastList().stream().filter(po -> lastEmpIdWorkYearMap.get(po.getEmployeeId()) == null).collect(Collectors.toList()); +// List sameNoGroupingList = data.getSameList().stream().filter(po -> lastEmpIdWorkYearMap.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); +// } +// +// result.setList(records); +// return result; +// } +// +// private PageInfo> buildCompanyYearRecords(SalaryStatisticsReportDataDTO data, Map> salaryAcctResultValueMap) { +// 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 (StringUtils.isNotEmpty(employee.getCompanyYear())) { +// companyYearSet.add(employee.getCompanyYear()); +// empIdCompanyYearMap.put(Objects.isNull(employee.getUser()) ? null : employee.getUser().getId(), employee.getCompanyYear()); +// } +// }); +// simpleUserInfoMap.get(LAST_INFO).forEach(employee -> { +// if (StringUtils.isNotEmpty(employee.getCompanyYear())) { +// lastEmpIdCompanyYearMap.put(Objects.isNull(employee.getUser()) ? null : employee.getUser().getId(), employee.getCompanyYear()); +// } +// }); +// simpleUserInfoMap.get(SAME_INFO).forEach(employee -> { +// if (StringUtils.isNotEmpty(employee.getCompanyYear())) { +// sameEmpIdCompanyYearMap.put(Objects.isNull(employee.getUser()) ? null : employee.getUser().getId(), employee.getCompanyYear()); +// } +// }); +// +// List companyYears = Lists.newArrayList(companyYearSet); +// companyYears = companyYears.stream().sorted().collect(Collectors.toList()); +// +// companyYears.forEach(k -> { +// 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); +// }); +// +// 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); +// } +// +// result.setList(records); +// return result; +// } +// +// private PageInfo> buildRationGroupSpacing4NoItemRecords(SalaryStatisticsDimensionPO dimension, SalaryStatisticsReportDataDTO data, Map> salaryAcctResultValueMap) { +// PageInfo> result = new PageInfo<>(); +// List> records = new ArrayList<>(); +// +// // 分组设置 +// List groups = JsonUtil.parseList(dimension.getSetting(), SalaryStatisticsDimensionSaveParam.Setting4RationGroupSpacing.class); +// +// +// result.setList(records); +// return result; +// } +// +// private PageInfo> buildRationGroupSpacing4Records(SalaryStatisticsDimensionPO dimension, SalaryStatisticsReportDataDTO data, Map> salaryAcctResultValueMap) { +// PageInfo> result = new PageInfo<>(); +// List> records = new ArrayList<>(); +// +// // 分组设置 +// List groups = JsonUtil.parseList(dimension.getSetting(), SalaryStatisticsDimensionSaveParam.Setting4RationGroupSpacing.class); +// +// Map empIdYearMap = new HashMap<>(); +// Map lastEmpIdYearMap = new HashMap<>(); +// Map sameEmpIdYearMap = new HashMap<>(); +// +// String groupBelong; +// if (StringUtils.isEmpty(dimension.getDimCode())) { +// groupBelong = SalaryStatisticsReportBO.G_NO_ITEM; +// } else if (dimension.getDimCode().equals(SalaryStatisticsDimensionConstant.DM_AGE) || dimension.getDimCode().equals(SalaryStatisticsDimensionConstant.DM_WORK_YEAR) || dimension.getDimCode().equals(SalaryStatisticsDimensionConstant.DM_COMPANY_YEAR)) { +// groupBelong = SalaryStatisticsReportBO.G_YEAR; +// // 年份数据 // handle4GroupYear(dimension, empIdYearMap, lastEmpIdYearMap, sameEmpIdYearMap, data); - } else { - groupBelong = SalaryStatisticsReportBO.G_ITEM; - } - - groups.forEach(k -> { - List salaryAcctEmployees = SalaryStatisticsReportBO.listAcctEmpByRationGroupIndividual(k, groupBelong, dimension.getDimCode(), data.getList(), empIdYearMap, salaryAcctResultValueMap, data.getSalaryStatisticsItemList()); - List lastSalaryAcctEmployees = SalaryStatisticsReportBO.listAcctEmpByRationGroupIndividual(k, groupBelong, dimension.getDimCode(), data.getLastList(), lastEmpIdYearMap, salaryAcctResultValueMap, data.getSalaryStatisticsItemList()); - List sameSalaryAcctEmployees = SalaryStatisticsReportBO.listAcctEmpByRationGroupIndividual(k, groupBelong, dimension.getDimCode(), data.getSameList(), sameEmpIdYearMap, salaryAcctResultValueMap, data.getSalaryStatisticsItemList()); - Map temp = new HashMap<>(); - temp.put(DM, k.getValue()); - temp.putAll(SalaryStatisticsReportBO.calculateItem(salaryAcctEmployees, lastSalaryAcctEmployees, sameSalaryAcctEmployees, salaryAcctResultValueMap, data.getSalaryStatisticsItemList())); - records.add(temp); - }); - - result.setList(records); - return result; - } +// } else { +// groupBelong = SalaryStatisticsReportBO.G_ITEM; +// } +// groups.forEach(k -> { +// List salaryAcctEmployees = SalaryStatisticsReportBO.listAcctEmpByRationGroupSpacing(k, groupBelong, dimension.getDimCode(), data.getList(), empIdYearMap, salaryAcctResultValueMap, data.getSalaryStatisticsItemList()); +// List lastSalaryAcctEmployees = SalaryStatisticsReportBO.listAcctEmpByRationGroupSpacing(k, groupBelong, dimension.getDimCode(), data.getLastList(), lastEmpIdYearMap, salaryAcctResultValueMap, data.getSalaryStatisticsItemList()); +// List sameSalaryAcctEmployees = SalaryStatisticsReportBO.listAcctEmpByRationGroupSpacing(k, groupBelong, dimension.getDimCode(), data.getSameList(), sameEmpIdYearMap, salaryAcctResultValueMap, data.getSalaryStatisticsItemList()); +// Map temp = new HashMap<>(); +// temp.put(DM, k.getStartValue() + "-" + k.getEndValue()); +// temp.putAll(SalaryStatisticsReportBO.calculateItem(salaryAcctEmployees, lastSalaryAcctEmployees, sameSalaryAcctEmployees, salaryAcctResultValueMap, data.getSalaryStatisticsItemList())); +// records.add(temp); +// }); +// +// result.setList(records); +// return result; +// } +// +// private void handle4GroupYear(SalaryStatisticsDimensionPO dimension, Map empIdYearMap, Map lastEmpIdYearMap, Map sameEmpIdYearMap, SalaryStatisticsReportDataDTO data) { +// Map> simpleUserInfoMap = getSimpleUserInfoList(data); +// if (simpleUserInfoMap.isEmpty()) { +// return; +// } +// simpleUserInfoMap.get(NOW_INFO).forEach(employee -> { +// if (dimension.getDimCode().equals(SalaryStatisticsDimensionConstant.DM_AGE) && employee.getAge() != null) { +// empIdYearMap.put(Objects.isNull(employee.getUser()) ? null : employee.getUser().getId(), employee.getAge().toString()); +// } else if (dimension.getDimCode().equals(SalaryStatisticsDimensionConstant.DM_WORK_YEAR) && employee.getWorkYear() != null) { +// empIdYearMap.put(Objects.isNull(employee.getUser()) ? null : employee.getUser().getId(), employee.getWorkYear().toString()); +// } else if (dimension.getDimCode().equals(SalaryStatisticsDimensionConstant.DM_COMPANY_YEAR) && StringUtils.isNotEmpty(employee.getCompanyYear())) { +// empIdYearMap.put(Objects.isNull(employee.getUser()) ? null : employee.getUser().getId(), employee.getCompanyYear()); +// } +// }); +// simpleUserInfoMap.get(LAST_INFO).forEach(employee -> { +// if (dimension.getDimCode().equals(SalaryStatisticsDimensionConstant.DM_AGE) && employee.getAge() != null) { +// lastEmpIdYearMap.put(Objects.isNull(employee.getUser()) ? null : employee.getUser().getId(), employee.getAge().toString()); +// } else if (dimension.getDimCode().equals(SalaryStatisticsDimensionConstant.DM_WORK_YEAR) && employee.getWorkYear() != null) { +// lastEmpIdYearMap.put(Objects.isNull(employee.getUser()) ? null : employee.getUser().getId(), employee.getWorkYear().toString()); +// } else if (dimension.getDimCode().equals(SalaryStatisticsDimensionConstant.DM_COMPANY_YEAR) && StringUtils.isNotEmpty(employee.getCompanyYear())) { +// lastEmpIdYearMap.put(Objects.isNull(employee.getUser()) ? null : employee.getUser().getId(), employee.getCompanyYear()); +// } +// }); +// simpleUserInfoMap.get(SAME_INFO).forEach(employee -> { +// if (dimension.getDimCode().equals(SalaryStatisticsDimensionConstant.DM_AGE) && employee.getAge() != null) { +// sameEmpIdYearMap.put(Objects.isNull(employee.getUser()) ? null : employee.getUser().getId(), employee.getAge().toString()); +// } else if (dimension.getDimCode().equals(SalaryStatisticsDimensionConstant.DM_WORK_YEAR) && employee.getWorkYear() != null) { +// sameEmpIdYearMap.put(Objects.isNull(employee.getUser()) ? null : employee.getUser().getId(), employee.getWorkYear().toString()); +// } else if (dimension.getDimCode().equals(SalaryStatisticsDimensionConstant.DM_COMPANY_YEAR) && StringUtils.isNotEmpty(employee.getCompanyYear())) { +// sameEmpIdYearMap.put(Objects.isNull(employee.getUser()) ? null : employee.getUser().getId(), employee.getCompanyYear()); +// } +// }); +// } +// +// private PageInfo> buildRationGroupIndividual4Records(SalaryStatisticsDimensionPO dimension, SalaryStatisticsReportDataDTO data, Map> salaryAcctResultValueMap) { +// PageInfo> result = new PageInfo<>(); +// List> records = new ArrayList<>(); +// +// // 分组设置 +// List groups = JsonUtil.parseList(dimension.getSetting(), SalaryStatisticsDimensionSaveParam.Setting4RationGroupIndividual.class); +// Map empIdYearMap = new HashMap<>(); +// Map lastEmpIdYearMap = new HashMap<>(); +// Map sameEmpIdYearMap = new HashMap<>(); +// +// String groupBelong; +// if (StringUtils.isEmpty(dimension.getDimCode())) { +// groupBelong = SalaryStatisticsReportBO.G_NO_ITEM; +// } else if (dimension.getDimCode().equals(SalaryStatisticsDimensionConstant.DM_AGE) || dimension.getDimCode().equals(SalaryStatisticsDimensionConstant.DM_WORK_YEAR) || dimension.getDimCode().equals(SalaryStatisticsDimensionConstant.DM_COMPANY_YEAR)) { +// groupBelong = SalaryStatisticsReportBO.G_YEAR; +// +// // 年份数据 +//// handle4GroupYear(dimension, empIdYearMap, lastEmpIdYearMap, sameEmpIdYearMap, data); +// } else { +// groupBelong = SalaryStatisticsReportBO.G_ITEM; +// } +// +// groups.forEach(k -> { +// List salaryAcctEmployees = SalaryStatisticsReportBO.listAcctEmpByRationGroupIndividual(k, groupBelong, dimension.getDimCode(), data.getList(), empIdYearMap, salaryAcctResultValueMap, data.getSalaryStatisticsItemList()); +// List lastSalaryAcctEmployees = SalaryStatisticsReportBO.listAcctEmpByRationGroupIndividual(k, groupBelong, dimension.getDimCode(), data.getLastList(), lastEmpIdYearMap, salaryAcctResultValueMap, data.getSalaryStatisticsItemList()); +// List sameSalaryAcctEmployees = SalaryStatisticsReportBO.listAcctEmpByRationGroupIndividual(k, groupBelong, dimension.getDimCode(), data.getSameList(), sameEmpIdYearMap, salaryAcctResultValueMap, data.getSalaryStatisticsItemList()); +// Map temp = new HashMap<>(); +// temp.put(DM, k.getValue()); +// temp.putAll(SalaryStatisticsReportBO.calculateItem(salaryAcctEmployees, lastSalaryAcctEmployees, sameSalaryAcctEmployees, salaryAcctResultValueMap, data.getSalaryStatisticsItemList())); +// records.add(temp); +// }); +// +// result.setList(records); +// return result; +// } } diff --git a/src/com/engine/salary/report/service/impl/SubTableExportServiceImpl.java b/src/com/engine/salary/report/service/impl/SubTableExportServiceImpl.java index 1399f8eaa..446881b88 100644 --- a/src/com/engine/salary/report/service/impl/SubTableExportServiceImpl.java +++ b/src/com/engine/salary/report/service/impl/SubTableExportServiceImpl.java @@ -1,5 +1,6 @@ package com.engine.salary.report.service.impl; +import com.engine.core.impl.Service; import com.engine.salary.report.service.SubTableExportService; /** @@ -8,7 +9,7 @@ import com.engine.salary.report.service.SubTableExportService; * @CreateDate: 2022/11/9 * @Version: v1.0 */ -public class SubTableExportServiceImpl implements SubTableExportService { +public class SubTableExportServiceImpl extends Service implements SubTableExportService { // private Logger logger = LoggerFactory.getLogger(this.getClass()); // diff --git a/src/com/engine/salary/report/wrapper/SalaryStatisticsReportWrapper.java b/src/com/engine/salary/report/wrapper/SalaryStatisticsReportWrapper.java index f26271fdb..44d33738c 100644 --- a/src/com/engine/salary/report/wrapper/SalaryStatisticsReportWrapper.java +++ b/src/com/engine/salary/report/wrapper/SalaryStatisticsReportWrapper.java @@ -1,6 +1,7 @@ package com.engine.salary.report.wrapper; import com.cloudstore.eccom.pc.table.WeaTableColumn; +import com.engine.common.util.ServiceUtil; import com.engine.core.impl.Service; import com.engine.salary.exception.SalaryRunTimeException; import com.engine.salary.report.entity.bo.SalaryStatisticsReportBO; @@ -15,6 +16,10 @@ import com.engine.salary.report.service.SalaryStatisticsDimensionService; import com.engine.salary.report.service.SalaryStatisticsItemService; import com.engine.salary.report.service.SalaryStatisticsReportService; import com.engine.salary.report.service.SubTableExportService; +import com.engine.salary.report.service.impl.SalaryStatisticsDimensionServiceImpl; +import com.engine.salary.report.service.impl.SalaryStatisticsItemServiceImpl; +import com.engine.salary.report.service.impl.SalaryStatisticsReportServiceImpl; +import com.engine.salary.report.service.impl.SubTableExportServiceImpl; import com.engine.salary.util.JsonUtil; import com.engine.salary.util.SalaryEntityUtil; import com.engine.salary.util.SalaryI18nUtil; @@ -22,6 +27,7 @@ import com.engine.salary.util.page.PageInfo; import com.google.common.collect.Maps; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Component; +import weaver.hrm.User; import java.util.*; import java.util.stream.Collectors; @@ -36,14 +42,21 @@ public class SalaryStatisticsReportWrapper extends Service { private static final String conditionId = "salaryStatisticsReportSearchCondition"; + private SalaryStatisticsReportService getSalaryStatisticsReportService(User user) { + return ServiceUtil.getService(SalaryStatisticsReportServiceImpl.class, user); + } - private SalaryStatisticsReportService salaryStatisticsReportService; + private SalaryStatisticsItemService getSalaryStatisticsItemService(User user) { + return ServiceUtil.getService(SalaryStatisticsItemServiceImpl.class, user); + } - private SalaryStatisticsItemService salaryStatisticsItemService; - - private SalaryStatisticsDimensionService salaryStatisticsDimensionService; - - private SubTableExportService subTableExportService; + private SalaryStatisticsDimensionService getSalaryStatisticsDimensionService(User user) { + return ServiceUtil.getService(SalaryStatisticsDimensionServiceImpl.class, user); + } + + private SubTableExportService getSubTableExportService(User user) { + return ServiceUtil.getService(SubTableExportServiceImpl.class, user); + } /** * 报表列表 @@ -53,13 +66,13 @@ public class SalaryStatisticsReportWrapper extends Service { */ public List> list(SalaryStatisticsReportQueryParam queryParam) { // 初始化 - salaryStatisticsDimensionService.init((long)user.getUID()); + getSalaryStatisticsDimensionService(user).init((long)user.getUID()); - List reportList = salaryStatisticsReportService.list(); + List reportList = getSalaryStatisticsReportService(user).list(); if (StringUtils.isNotEmpty(queryParam.getReportName())) { reportList = reportList.stream().filter(rp -> rp.getReportName().contains(queryParam.getReportName())).collect(Collectors.toList()); } - List salaryStatisticsDimensionList = this.salaryStatisticsDimensionService.listAll(); + List salaryStatisticsDimensionList = this.getSalaryStatisticsDimensionService(user).listAll(); Map salaryStatisticsDimensionMap = SalaryEntityUtil.convert2Map(salaryStatisticsDimensionList, k -> k.getId().toString(), SalaryStatisticsDimensionPO::getDimName); List> result = new ArrayList<>(); reportList.forEach(po -> { @@ -84,11 +97,11 @@ public class SalaryStatisticsReportWrapper extends Service { */ public SalaryStatisticsReportPO getFrom(Long id) { - List salaryStatisticsDimensions = salaryStatisticsDimensionService.listAll(); + List salaryStatisticsDimensions = getSalaryStatisticsDimensionService(user).listAll(); String placeholder = SalaryI18nUtil.getI18nLabel(85987, "请输入"); - SalaryStatisticsReportPO po = this.salaryStatisticsReportService.getById(id); + SalaryStatisticsReportPO po = this.getSalaryStatisticsReportService(user).getById(id); if (po == null) { throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(161845, "薪酬统计报表不存在")); } @@ -103,7 +116,7 @@ public class SalaryStatisticsReportWrapper extends Service { * @return */ public String save(SalaryStatisticsReportSaveParam saveParam) { - return salaryStatisticsReportService.save(saveParam); + return getSalaryStatisticsReportService(user).save(saveParam); } /** @@ -114,12 +127,12 @@ public class SalaryStatisticsReportWrapper extends Service { * @return */ public Map delete(Collection ids) { - return salaryStatisticsReportService.delete(ids); + return getSalaryStatisticsReportService(user).delete(ids); } public String saveSearchCondition(SalaryStatisticsSearchConditionSaveParam param) { - return this.salaryStatisticsReportService.saveSearchCondition(param); + return this.getSalaryStatisticsReportService(user).saveSearchCondition(param); } /** @@ -133,21 +146,21 @@ public class SalaryStatisticsReportWrapper extends Service { if (param.getId() == null || param.getDimensionId() == null) { throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(84026, "参数错误")); } - SalaryStatisticsDimensionPO dimension = salaryStatisticsDimensionService.getById(param.getDimensionId()); + SalaryStatisticsDimensionPO dimension = getSalaryStatisticsDimensionService(user).getById(param.getDimensionId()); if (dimension == null) { throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(161300, "统计维度不存在")); } // weaTable对象 Map weaTable= new HashMap<>(); // 查询报表配置 - SalaryStatisticsReportPO po = this.salaryStatisticsReportService.getById(param.getId()); + SalaryStatisticsReportPO po = this.getSalaryStatisticsReportService(user).getById(param.getId()); if (po == null) { throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(161845, "薪酬统计报表不存在")); } // 查询自定义统计项目 - List salaryStatisticsItemList = this.salaryStatisticsItemService.listByStatisticsReportId(po.getId()); + List salaryStatisticsItemList = this.getSalaryStatisticsItemService(user).listByStatisticsReportId(po.getId()); // 列表data - PageInfo> page = this.salaryStatisticsReportService.buildReportRecords(dimension, param, po, salaryStatisticsItemList); + PageInfo> page = this.getSalaryStatisticsReportService(user).buildReportRecords(dimension, param, po, salaryStatisticsItemList); // 组装合计 Map countResultMap = SalaryStatisticsReportBO.buildTotal(page, salaryStatisticsItemList,(long)user.getUID()); @@ -176,18 +189,18 @@ public class SalaryStatisticsReportWrapper extends Service { // throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(84026, "参数错误")); // } // -// SalaryStatisticsReportPO po = this.salaryStatisticsReportService.getById(param.getId()); +// SalaryStatisticsReportPO po = this.getSalaryStatisticsReportService(user).getById(param.getId()); // if (po == null) { // throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(161845, "薪酬统计报表不存在")); // } -// SalaryStatisticsDimensionPO dimension = salaryStatisticsDimensionService.getById(param.getDimensionId()); +// SalaryStatisticsDimensionPO dimension = getSalaryStatisticsDimensionService(user).getById(param.getDimensionId()); // if (dimension == null) { // throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(161300, "统计维度不存在")); // } // // 查询自定义统计项目 -// List salaryStatisticsItemList = this.salaryStatisticsItemService.listByStatisticsReportId(po.getId()); +// List salaryStatisticsItemList = this.getSalaryStatisticsItemService(user).listByStatisticsReportId(po.getId()); // // 列表data -// Page> page = this.salaryStatisticsReportService.buildReportRecords(dimension, param, po, salaryStatisticsItemList); +// Page> page = this.getSalaryStatisticsReportService(user).buildReportRecords(dimension, param, po, salaryStatisticsItemList); // // 组装合计 // Map countResultMap = SalaryStatisticsReportBO.buildTotal(page, salaryStatisticsItemList); // if (CollectionUtils.isNotEmpty(page.getRecords()) && MapUtils.isNotEmpty(countResultMap)) { @@ -202,7 +215,7 @@ public class SalaryStatisticsReportWrapper extends Service { // // 组装导出参数 // ExportCommonParam exportParam = SalaryStatisticsReportBO.buildExportParam(dimension.getDimName(), weaTableColumns, records); // exportParam.setSheetName(SalaryI18nUtil.getI18nLabel(179263, "薪酬统计报表") + "-" + exportParam.getDimensionName()); -// return subTableExportService.exportCommon(exportParam, UserContext.getCurrentUser(), TenantContext.get()); +// return getSubTableExportService(user).exportCommon(exportParam, UserContext.getCurrentUser(), TenantContext.get()); return null; } } diff --git a/src/com/engine/salary/service/SalaryEmployeeService.java b/src/com/engine/salary/service/SalaryEmployeeService.java index eb7d56277..7e4f1915c 100644 --- a/src/com/engine/salary/service/SalaryEmployeeService.java +++ b/src/com/engine/salary/service/SalaryEmployeeService.java @@ -46,6 +46,8 @@ public interface SalaryEmployeeService { */ List getEmployeeByIdsAll(List ids); + List listByIds(List ids); + /** * 获取人员信息 * @param employeeId diff --git a/src/com/engine/salary/service/impl/SalaryEmployeeServiceImpl.java b/src/com/engine/salary/service/impl/SalaryEmployeeServiceImpl.java index aa3db586b..3c9988c52 100644 --- a/src/com/engine/salary/service/impl/SalaryEmployeeServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalaryEmployeeServiceImpl.java @@ -100,6 +100,11 @@ public class SalaryEmployeeServiceImpl extends Service implements SalaryEmployee return employBiz.getEmployeeByIdsAll(ids); } + @Override + public List listByIds(List ids) { + return employBiz.getEmployeeByIdsAll(ids); + } + @Override public DataCollectionEmployee getEmployeeById(Long employeeId) { return employBiz.getEmployeeById(employeeId);