数据透视功能

This commit is contained in:
Harryxzy 2023-06-07 15:43:23 +08:00
parent 466412a444
commit 4617005e1f
10 changed files with 541 additions and 131 deletions

View File

@ -0,0 +1,36 @@
package com.engine.salary.entity.salaryBill.param;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
/**
* @author Harryxzy
* @date 2023/06/06 15:22
* @description 我的工资单薪资项目明细查询
*/
@Builder
@Data
@AllArgsConstructor
@NoArgsConstructor
public class SalaryBillItemDetailQueryParam {
/**
* 薪资核算记录id
*/
private Long salaryAcctId;
/**
* 员工id
*/
private List<Long> employeeId;
/**
* 薪资项目id
*/
private Long salaryItemId;
}

View File

@ -44,4 +44,11 @@ public class SalaryStatisticsReportDataDTO {
//租户key")
private String tenantKey;
//维度值
private String dimensionValue;
//根据dimensionValue获取到的本期数据
private List<SalaryAcctEmployeePO> listByDimensionValue;
}

View File

@ -0,0 +1,83 @@
package com.engine.salary.report.entity.param;
import com.engine.salary.common.BaseQueryParam;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
import java.util.List;
/**
* 薪酬统计数据透视查询参数
* <p>Copyright: Copyright (c) 2023</p>
* <p>Company: 泛微软件</p>
*
* @author Harryxzy
* @version 1.0
**/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class SalaryStatisticsDataPerspectiveQueryParam extends BaseQueryParam {
//报表id
private Long id;
//统计维度
private Long dimensionId;
//统计维度值
private String dimensionValue;
@JsonIgnore
//薪资所属月-开始月
private String salaryStartMonth;
@JsonIgnore
// 薪资所属月-终止月
private String salaryEndMonth;
@JsonIgnore
//个税扣缴义务人配置
private List<Long> taxAgent;
@JsonIgnore
//收入所得项目配置
private List<Integer> incomeCategory;
@JsonIgnore
//分部配置
private List<Long> subCompany;
@JsonIgnore
//部门配置
private List<Long> depart;
@JsonIgnore
//职级配置
private List<Long> grade;
@JsonIgnore
// 岗位配置
private List<Long> position;
@JsonIgnore
//人员状态配置
private List<String> status;
@JsonIgnore
//人员
private List<Long> employee;
@JsonIgnore
// 入职日期
private List<Date> hiredate;
@JsonIgnore
// 离职日期
private List<Date> leavedate;
}

View File

@ -1,5 +1,6 @@
package com.engine.salary.report.service;
import com.engine.salary.report.entity.param.SalaryStatisticsDataPerspectiveQueryParam;
import com.engine.salary.report.entity.param.SalaryStatisticsReportDataQueryParam;
import com.engine.salary.report.entity.param.SalaryStatisticsReportSaveParam;
import com.engine.salary.report.entity.param.SalaryStatisticsSearchConditionSaveParam;
@ -79,4 +80,15 @@ public interface SalaryStatisticsReportService {
* @return
*/
PageInfo<Map<String, Object>> buildReportRecords(SalaryStatisticsDimensionPO dimension, SalaryStatisticsReportDataQueryParam param, SalaryStatisticsReportPO salaryStatisticsReport, List<SalaryStatisticsItemPO> salaryStatisticsItemList);
/**
* 构建数据透视记录
*
* @param param
* @param reportPO 报表po
* @param dimension 维度po
* @param salaryStatisticsItemPOS 自定义统计项目List
* @return
*/
List<Map<String, Object>> buildDataPerspectiveRecords(SalaryStatisticsDataPerspectiveQueryParam param, SalaryStatisticsReportPO reportPO, SalaryStatisticsDimensionPO dimension, List<SalaryStatisticsItemPO> salaryStatisticsItemPOS);
}

View File

@ -6,17 +6,17 @@ 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.SalaryAcctRecordPO;
import com.engine.salary.entity.salaryacct.po.SalaryAcctResultPO;
import com.engine.salary.entity.salarysob.po.SalarySobPO;
import com.engine.salary.entity.taxagent.po.TaxAgentPO;
import com.engine.salary.exception.SalaryRunTimeException;
import com.engine.salary.mapper.report.SalaryStatisticsReportMapper;
import com.engine.salary.report.common.constant.SalaryConstant;
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;
import com.engine.salary.report.entity.param.*;
import com.engine.salary.report.entity.po.SalaryStatisticsDimensionPO;
import com.engine.salary.report.entity.po.SalaryStatisticsItemPO;
import com.engine.salary.report.entity.po.SalaryStatisticsReportPO;
@ -24,14 +24,8 @@ import com.engine.salary.report.enums.SalaryStatisticsDimensionTypeEnum;
import com.engine.salary.report.service.SalaryStatisticsItemService;
import com.engine.salary.report.service.SalaryStatisticsReportService;
import com.engine.salary.report.util.ReportTimeUtil;
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.service.impl.TaxAgentServiceImpl;
import com.engine.salary.service.*;
import com.engine.salary.service.impl.*;
import com.engine.salary.util.*;
import com.engine.salary.util.db.MapperProxyFactory;
import com.engine.salary.util.page.PageInfo;
@ -92,6 +86,14 @@ public class SalaryStatisticsReportServiceImpl extends Service implements Salary
return ServiceUtil.getService(SalaryEmployeeServiceImpl.class, user);
}
private SalarySobService getSalarySobService(User user) {
return ServiceUtil.getService(SalarySobServiceImpl.class, user);
}
private SalaryAcctRecordService getSalaryAcctRecordService(User user) {
return ServiceUtil.getService(SalaryAcctRecordServiceImpl.class, user);
}
// private ExtEmployeeService extEmployeeService;
// @Autowired
// private HrmCommonEmployeeService hrmCommonEmployeeService;
@ -368,6 +370,86 @@ public class SalaryStatisticsReportServiceImpl extends Service implements Salary
return calculateReportRecordsByDimension(dimension, param, salaryStatisticsReportData, map);
}
@Override
public List<Map<String, Object>> buildDataPerspectiveRecords(SalaryStatisticsDataPerspectiveQueryParam param, SalaryStatisticsReportPO reportPO, SalaryStatisticsDimensionPO dimension, List<SalaryStatisticsItemPO> salaryStatisticsItemPOS) {
// 获取报表统计薪资项目
List<Long> salaryItemIds = salaryStatisticsItemPOS.stream().filter(item -> StringUtils.isNotBlank(item.getItemValue())).map(p -> p.getItemValue().split(","))
.flatMap(Arrays::stream).map(Long::valueOf).collect(Collectors.toList());
// 参数转换
param.setSalaryStartMonth(SalaryDateUtil.getFormatYearMonth(reportPO.getSalaryStartMonth()));
param.setSalaryEndMonth(SalaryDateUtil.getFormatYearMonth(reportPO.getSalaryEndMonth()));
String key = "id";
param.setTaxAgent(((List<Map>) JSON.parseArray(reportPO.getTaxAgentSetting(), Map.class)).stream().map(m -> Long.valueOf(m.get(key).toString())).collect(Collectors.toList()));
param.setSubCompany(((List<Map>) JSON.parseArray(reportPO.getSubCompanySetting(), Map.class)).stream().map(m -> Long.valueOf(m.get(key).toString())).collect(Collectors.toList()));
param.setDepart(((List<Map>) JSON.parseArray(reportPO.getDepartSetting(), Map.class)).stream().map(m -> Long.valueOf(m.get(key).toString())).collect(Collectors.toList()));
param.setEmployee(((List<Map>) JSON.parseArray(reportPO.getEmployeeSetting(), Map.class)).stream().map(m -> Long.valueOf(m.get(key).toString())).collect(Collectors.toList()));
param.setHiredate(JSON.parseArray(reportPO.getHiredateSetting(), Date.class));
SalaryStatisticsReportDataQueryParam queryParam = new SalaryStatisticsReportDataQueryParam();
com.mzlion.core.utils.BeanUtils.copyProperties(param,queryParam);
// 获取本期报表分权后的核算人员
List<SalaryAcctEmployeePO> salaryAcctEmployeeList = getSalaryAcctEmployeeService(user).listBySalaryStatisticsReportParam(queryParam);
List<Long> salaryAcctEmployeeIds = salaryAcctEmployeeList.stream().map(SalaryAcctEmployeePO::getId).collect(Collectors.toList());
// 获取核算结果
List<SalaryAcctResultPO> salaryAcctResultValues = getSalaryAcctResultService(user).listByAcctEmployeeIdsAndSalaryItemIds(salaryAcctEmployeeIds, salaryItemIds);
// 设置dimensionValue为维度值
SalaryStatisticsReportDataDTO salaryStatisticsReportData = SalaryStatisticsReportDataDTO.builder()
.list(salaryAcctEmployeeList)
.lastList(Collections.emptyList())
.sameList(Collections.emptyList())
.salaryStatisticsItemList(salaryStatisticsItemPOS)
.employeeId((long) user.getUID())
.tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY)
.dimensionValue(param.getDimensionValue())
.build();
Map<Long, List<SalaryAcctResultPO>> salaryAcctEmpResultMap = SalaryEntityUtil.group2Map(salaryAcctResultValues, SalaryAcctResultPO::getSalaryAcctEmpId);
Map<Long, Map<String, String>> map = new HashMap<>();
salaryAcctEmpResultMap.forEach((k, v) -> {
Map<String, String> collect = v.stream().collect(Collectors.toMap(p -> Util.null2String(p.getSalaryItemId()), p -> Util.null2o(p.getResultValue()), (key1, key2) -> key2));
map.put(k, collect);
});
// 获取根据维度值过滤出的本次核算人员信息
calculateReportRecordsByDimension(dimension, SalaryStatisticsReportDataQueryParam.builder().build(), salaryStatisticsReportData, map);
List<SalaryAcctEmployeePO> listByDimensionValue = salaryStatisticsReportData.getListByDimensionValue();
// 构建核算结果数据
return buildResultRecords(listByDimensionValue, map);
}
/**
* 获取根据维度值过滤出的本次核算人员信息
* @param listByDimensionValue 根据维度筛选后的薪资核算人员
* @param map 薪资核算结果
*/
private List<Map<String, Object>> buildResultRecords(List<SalaryAcctEmployeePO> listByDimensionValue, Map<Long, Map<String, String>> map) {
List<TaxAgentPO> taxAgentList = getTaxAgentService(user).listAll();
Map<Long, String> taxAgentMap = SalaryEntityUtil.convert2Map(taxAgentList, TaxAgentPO::getId, TaxAgentPO::getName);
List<SalarySobPO> salarySobPOS = getSalarySobService(user).listAll();
Map<Long, String> SalarySobMap = SalaryEntityUtil.convert2Map(salarySobPOS, SalarySobPO::getId, SalarySobPO::getName);
List<SalaryAcctRecordPO> salaryAcctRecordPOS = getSalaryAcctRecordService(user).listAll();
Map<Long, Integer> salaryAcctRecordMap = SalaryEntityUtil.convert2Map(salaryAcctRecordPOS, SalaryAcctRecordPO::getId, SalaryAcctRecordPO::getAcctTimes);
List<Map<String, Object>> resultList = Lists.newArrayList();
Map<String, Object> resultMap;
for (SalaryAcctEmployeePO se : listByDimensionValue) {
resultMap = Maps.newHashMap();
Map<String, String> resultValueMap = Optional.ofNullable(map.get(se.getId())).orElse(Maps.newHashMap());
Map<String, Object> finalMap = resultMap;
resultValueMap.forEach((k, v) -> {
finalMap.put(k + SalaryConstant.DYNAMIC_SUFFIX, v);
});
resultMap.put("id", se.getId().toString());
resultMap.put("salaryMonth", SalaryDateUtil.getFormatYearMonth(se.getSalaryMonth()));
resultMap.put("taxAgent", taxAgentMap.get(se.getTaxAgentId()));
resultMap.put("salarySob",SalarySobMap.get(se.getSalarySobId()));
resultMap.put("acctTimes", salaryAcctRecordMap.get(se.getSalaryAcctRecordId()));
resultList.add(resultMap);
}
return resultList;
}
private PageInfo<Map<String, Object>> calculateReportRecordsByDimension(SalaryStatisticsDimensionPO dimension, SalaryStatisticsReportDataQueryParam param, SalaryStatisticsReportDataDTO data, Map<Long, Map<String, String>> salaryAcctResultValueMap) {
// 定性
if (SalaryStatisticsDimensionTypeEnum.QUALITATIVE.getValue().equals(dimension.getDimType())) {
@ -442,11 +524,16 @@ public class SalaryStatisticsReportServiceImpl extends Service implements Salary
Map<Date, List<SalaryAcctEmployeePO>> lastListMap = data.getLastList().stream().collect(Collectors.groupingBy(SalaryAcctEmployeePO::getSalaryMonth));
Map<Date, List<SalaryAcctEmployeePO>> sameListMap = data.getSameList().stream().collect(Collectors.groupingBy(SalaryAcctEmployeePO::getSalaryMonth));
List<Date> salaryMonthList = listMap.keySet().stream().sorted().collect(Collectors.toList());
String dimensionValue = data.getDimensionValue();
salaryMonthList.forEach(k -> {
Map<String, Object> temp = new HashMap<>();
temp.put(DM, SalaryDateUtil.getFormatYearMonth(k));
temp.putAll(SalaryStatisticsReportBO.calculateItem(listMap.get(k), lastListMap.get(ReportTimeUtil.getLastYearMonth(k)), sameListMap.get(ReportTimeUtil.getSameYearMonth(k)), salaryAcctResultValueMap, data.getSalaryStatisticsItemList()));
records.add(temp);
if(dimensionValue == null ){
Map<String, Object> temp = new HashMap<>();
temp.put(DM, SalaryDateUtil.getFormatYearMonth(k));
temp.putAll(SalaryStatisticsReportBO.calculateItem(listMap.get(k), lastListMap.get(ReportTimeUtil.getLastYearMonth(k)), sameListMap.get(ReportTimeUtil.getSameYearMonth(k)), salaryAcctResultValueMap, data.getSalaryStatisticsItemList()));
records.add(temp);
}else if( StringUtils.equals(dimensionValue,SalaryDateUtil.getFormatYearMonth(k)) ){
data.setListByDimensionValue(listMap.get(k));
}
});
result.setList(records);
return result;
@ -462,12 +549,16 @@ public class SalaryStatisticsReportServiceImpl extends Service implements Salary
List<TaxAgentPO> taxAgentList = getTaxAgentService(user).listAll();
Map<Long, String> taxAgentMap = SalaryEntityUtil.convert2Map(taxAgentList, TaxAgentPO::getId, TaxAgentPO::getName);
String dimensionValue = data.getDimensionValue();
listMap.forEach((k, v) -> {
Map<String, Object> temp = new HashMap<>();
temp.put(DM, taxAgentMap.get(k));
temp.putAll(SalaryStatisticsReportBO.calculateItem(v, lastListMap.get(k), sameListMap.get(k), salaryAcctResultValueMap, data.getSalaryStatisticsItemList()));
records.add(temp);
if(dimensionValue == null ){
Map<String, Object> temp = new HashMap<>();
temp.put(DM, taxAgentMap.get(k));
temp.putAll(SalaryStatisticsReportBO.calculateItem(v, lastListMap.get(k), sameListMap.get(k), salaryAcctResultValueMap, data.getSalaryStatisticsItemList()));
records.add(temp);
}else if(StringUtils.equals(dimensionValue, taxAgentMap.get(k))){
data.setListByDimensionValue(v);
}
});
result.setList(records);
@ -530,24 +621,35 @@ public class SalaryStatisticsReportServiceImpl extends Service implements Salary
sameEmpIdSubComMap.put(k, v.getSubcompanyid());
});
String dimensionValue = data.getDimensionValue();
subComIds.forEach(subComId -> {
List<SalaryAcctEmployeePO> subComEmployeePOS = data.getList().stream().filter(po -> Objects.equals(empIdSubComMap.get(po.getEmployeeId()), subComId)).collect(Collectors.toList());
List<SalaryAcctEmployeePO> lastSubComEmployeePOS = data.getLastList().stream().filter(po -> Objects.equals(lastEmpIdSubComMap.get(po.getEmployeeId()), subComId)).collect(Collectors.toList());
List<SalaryAcctEmployeePO> sameSubComEmployeePOS = data.getSameList().stream().filter(po -> Objects.equals(sameEmpIdSubComMap.get(po.getEmployeeId()), subComId)).collect(Collectors.toList());
Map<String, Object> temp = new HashMap<>();
temp.put(DM, subComIdNameMap.get(subComId));
temp.putAll(SalaryStatisticsReportBO.calculateItem(subComEmployeePOS, lastSubComEmployeePOS, sameSubComEmployeePOS, salaryAcctResultValueMap, data.getSalaryStatisticsItemList()));
records.add(temp);
if(dimensionValue == null ){
List<SalaryAcctEmployeePO> subComEmployeePOS = data.getList().stream().filter(po -> Objects.equals(empIdSubComMap.get(po.getEmployeeId()), subComId)).collect(Collectors.toList());
List<SalaryAcctEmployeePO> lastSubComEmployeePOS = data.getLastList().stream().filter(po -> Objects.equals(lastEmpIdSubComMap.get(po.getEmployeeId()), subComId)).collect(Collectors.toList());
List<SalaryAcctEmployeePO> sameSubComEmployeePOS = data.getSameList().stream().filter(po -> Objects.equals(sameEmpIdSubComMap.get(po.getEmployeeId()), subComId)).collect(Collectors.toList());
Map<String, Object> temp = new HashMap<>();
temp.put(DM, subComIdNameMap.get(subComId));
temp.putAll(SalaryStatisticsReportBO.calculateItem(subComEmployeePOS, lastSubComEmployeePOS, sameSubComEmployeePOS, salaryAcctResultValueMap, data.getSalaryStatisticsItemList()));
records.add(temp);
}else if( StringUtils.equals(dimensionValue, subComIdNameMap.get(subComId)) ){
List<SalaryAcctEmployeePO> subComEmployeePOS = data.getList().stream().filter(po -> Objects.equals(empIdSubComMap.get(po.getEmployeeId()), subComId)).collect(Collectors.toList());
data.setListByDimensionValue(subComEmployeePOS);
}
});
List<SalaryAcctEmployeePO> noGroupingList = data.getList().stream().filter(po -> empIdSubComMap.get(po.getEmployeeId()) == null).collect(Collectors.toList());
List<SalaryAcctEmployeePO> lastNoGroupingList = data.getLastList().stream().filter(po -> lastEmpIdSubComMap.get(po.getEmployeeId()) == null).collect(Collectors.toList());
List<SalaryAcctEmployeePO> sameNoGroupingList = data.getSameList().stream().filter(po -> sameEmpIdSubComMap.get(po.getEmployeeId()) == null).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(noGroupingList)) {
Map<String, Object> noGrouping = new HashMap<>();
noGrouping.put(DM, SalaryI18nUtil.getI18nLabel(153462, "无分组"));
noGrouping.putAll(SalaryStatisticsReportBO.calculateItem(noGroupingList, lastNoGroupingList, sameNoGroupingList, salaryAcctResultValueMap, data.getSalaryStatisticsItemList()));
records.add(noGrouping);
if(dimensionValue == null){
List<SalaryAcctEmployeePO> noGroupingList = data.getList().stream().filter(po -> empIdSubComMap.get(po.getEmployeeId()) == null).collect(Collectors.toList());
List<SalaryAcctEmployeePO> lastNoGroupingList = data.getLastList().stream().filter(po -> lastEmpIdSubComMap.get(po.getEmployeeId()) == null).collect(Collectors.toList());
List<SalaryAcctEmployeePO> sameNoGroupingList = data.getSameList().stream().filter(po -> sameEmpIdSubComMap.get(po.getEmployeeId()) == null).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(noGroupingList)) {
Map<String, Object> noGrouping = new HashMap<>();
noGrouping.put(DM, SalaryI18nUtil.getI18nLabel(153462, "无分组"));
noGrouping.putAll(SalaryStatisticsReportBO.calculateItem(noGroupingList, lastNoGroupingList, sameNoGroupingList, salaryAcctResultValueMap, data.getSalaryStatisticsItemList()));
records.add(noGrouping);
}
}else if( StringUtils.equals(dimensionValue, "无分组") ){
List<SalaryAcctEmployeePO> noGroupingList = data.getList().stream().filter(po -> empIdSubComMap.get(po.getEmployeeId()) == null).collect(Collectors.toList());
data.setListByDimensionValue(noGroupingList);
}
result.setList(records);
@ -588,24 +690,35 @@ public class SalaryStatisticsReportServiceImpl extends Service implements Salary
}
});
String dimensionValue = data.getDimensionValue();
departIds.forEach(departId -> {
List<SalaryAcctEmployeePO> departEmployeePOS = data.getList().stream().filter(po -> Objects.equals(empIdDepartIdMap.get(po.getEmployeeId()), departId)).collect(Collectors.toList());
List<SalaryAcctEmployeePO> lastDepartEmployeePOS = data.getLastList().stream().filter(po -> Objects.equals(lastEmpIdDepartIdMap.get(po.getEmployeeId()), departId)).collect(Collectors.toList());
List<SalaryAcctEmployeePO> sameDepartEmployeePOS = data.getSameList().stream().filter(po -> Objects.equals(sameEmpIdDepartIdMap.get(po.getEmployeeId()), departId)).collect(Collectors.toList());
Map<String, Object> temp = new HashMap<>();
temp.put(DM, departIdNameMap.get(departId));
temp.putAll(SalaryStatisticsReportBO.calculateItem(departEmployeePOS, lastDepartEmployeePOS, sameDepartEmployeePOS, salaryAcctResultValueMap, data.getSalaryStatisticsItemList()));
records.add(temp);
if(dimensionValue == null ){
List<SalaryAcctEmployeePO> departEmployeePOS = data.getList().stream().filter(po -> Objects.equals(empIdDepartIdMap.get(po.getEmployeeId()), departId)).collect(Collectors.toList());
List<SalaryAcctEmployeePO> lastDepartEmployeePOS = data.getLastList().stream().filter(po -> Objects.equals(lastEmpIdDepartIdMap.get(po.getEmployeeId()), departId)).collect(Collectors.toList());
List<SalaryAcctEmployeePO> sameDepartEmployeePOS = data.getSameList().stream().filter(po -> Objects.equals(sameEmpIdDepartIdMap.get(po.getEmployeeId()), departId)).collect(Collectors.toList());
Map<String, Object> temp = new HashMap<>();
temp.put(DM, departIdNameMap.get(departId));
temp.putAll(SalaryStatisticsReportBO.calculateItem(departEmployeePOS, lastDepartEmployeePOS, sameDepartEmployeePOS, salaryAcctResultValueMap, data.getSalaryStatisticsItemList()));
records.add(temp);
}else if( StringUtils.equals(dimensionValue, departIdNameMap.get(departId)) ){
List<SalaryAcctEmployeePO> departEmployeePOS = data.getList().stream().filter(po -> Objects.equals(empIdDepartIdMap.get(po.getEmployeeId()), departId)).collect(Collectors.toList());
data.setListByDimensionValue(departEmployeePOS);
}
});
List<SalaryAcctEmployeePO> noGroupingList = data.getList().stream().filter(po -> empIdDepartIdMap.get(po.getEmployeeId()) == null).collect(Collectors.toList());
List<SalaryAcctEmployeePO> lastNoGroupingList = data.getLastList().stream().filter(po -> lastEmpIdDepartIdMap.get(po.getEmployeeId()) == null).collect(Collectors.toList());
List<SalaryAcctEmployeePO> sameNoGroupingList = data.getSameList().stream().filter(po -> lastEmpIdDepartIdMap.get(po.getEmployeeId()) == null).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(noGroupingList)) {
Map<String, Object> noGrouping = new HashMap<>();
noGrouping.put(DM, SalaryI18nUtil.getI18nLabel(153462, "无分组"));
noGrouping.putAll(SalaryStatisticsReportBO.calculateItem(noGroupingList, lastNoGroupingList, sameNoGroupingList, salaryAcctResultValueMap, data.getSalaryStatisticsItemList()));
records.add(noGrouping);
if(dimensionValue == null ){
List<SalaryAcctEmployeePO> noGroupingList = data.getList().stream().filter(po -> empIdDepartIdMap.get(po.getEmployeeId()) == null).collect(Collectors.toList());
List<SalaryAcctEmployeePO> lastNoGroupingList = data.getLastList().stream().filter(po -> lastEmpIdDepartIdMap.get(po.getEmployeeId()) == null).collect(Collectors.toList());
List<SalaryAcctEmployeePO> sameNoGroupingList = data.getSameList().stream().filter(po -> lastEmpIdDepartIdMap.get(po.getEmployeeId()) == null).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(noGroupingList)) {
Map<String, Object> noGrouping = new HashMap<>();
noGrouping.put(DM, SalaryI18nUtil.getI18nLabel(153462, "无分组"));
noGrouping.putAll(SalaryStatisticsReportBO.calculateItem(noGroupingList, lastNoGroupingList, sameNoGroupingList, salaryAcctResultValueMap, data.getSalaryStatisticsItemList()));
records.add(noGrouping);
}
}else if( StringUtils.equals(dimensionValue, "无分组") ){
List<SalaryAcctEmployeePO> noGroupingList = data.getList().stream().filter(po -> empIdDepartIdMap.get(po.getEmployeeId()) == null).collect(Collectors.toList());
data.setListByDimensionValue(noGroupingList);
}
result.setList(records);
@ -819,12 +932,17 @@ public class SalaryStatisticsReportServiceImpl extends Service implements Salary
// List<ExtEmployeePO> extEmployees = extEmployeeService.listByIdsWithDeleted(accountDetailPOList.stream().filter(e -> EmployeeTypeEnum.EXT_EMPLOYEE.getValue().equals(e.getEmployeeType())).map(SalaryAcctEmployeePO::getEmployeeId).distinct().collect(Collectors.toList()), data.getTenantKey());
// Map<Long, String> employeeExtByIdMap = SalaryEntityUtil.convert2Map(extEmployees, ExtEmployeePO::getId, ExtEmployeePO::getUsername);
String dimensionValue = data.getDimensionValue();
employeeListMap.forEach((k, v) -> {
Map<String, Object> temp = new HashMap<>();
if(dimensionValue == null ){
Map<String, Object> temp = new HashMap<>();
// temp.put(DM, Objects.nonNull(employeeByIdMap.get(k)) ? employeeByIdMap.get(k) : employeeExtByIdMap.get(k));
temp.put(DM, employeeByIdMap.get(k));
temp.putAll(SalaryStatisticsReportBO.calculateItem(v, lastEmployeeListMap.get(k), sameEmployeeListMap.get(k), salaryAcctResultValueMap, data.getSalaryStatisticsItemList()));
records.add(temp);
temp.put(DM, employeeByIdMap.get(k));
temp.putAll(SalaryStatisticsReportBO.calculateItem(v, lastEmployeeListMap.get(k), sameEmployeeListMap.get(k), salaryAcctResultValueMap, data.getSalaryStatisticsItemList()));
records.add(temp);
}else if( StringUtils.equals(dimensionValue, employeeByIdMap.get(k)) ){
data.setListByDimensionValue(v);
}
});
PageInfo<Map<String, Object>> result = new PageInfo<>();
@ -841,14 +959,20 @@ public class SalaryStatisticsReportServiceImpl extends Service implements Salary
List<String> quarters = quarterSet.stream().sorted().collect(Collectors.toList());
Collections.reverse(quarters);
String dimensionValue = data.getDimensionValue();
quarters.forEach(k -> {
List<SalaryAcctEmployeePO> listYear = data.getList().stream().filter(sa -> Objects.equals(k, ReportTimeUtil.getQuarter(SalaryDateUtil.getFormatYearMonth(sa.getSalaryMonth())))).collect(Collectors.toList());
List<SalaryAcctEmployeePO> lastListYear = data.getLastList().stream().filter(sa -> Objects.equals(k, ReportTimeUtil.getQuarter(ReportTimeUtil.getPlusYearMonth(SalaryDateUtil.getFormatYearMonth(sa.getSalaryMonth()), 3)))).collect(Collectors.toList());
List<SalaryAcctEmployeePO> sameListYear = data.getSameList().stream().filter(sa -> Objects.equals(k, ReportTimeUtil.getQuarter(ReportTimeUtil.getPlusYearMonth(SalaryDateUtil.getFormatYearMonth(sa.getSalaryMonth()), 12)))).collect(Collectors.toList());
Map<String, Object> temp = new HashMap<>();
temp.put(DM, k);
temp.putAll(SalaryStatisticsReportBO.calculateItem(listYear, lastListYear, sameListYear, salaryAcctResultValueMap, data.getSalaryStatisticsItemList()));
records.add(temp);
if(dimensionValue == null ){
List<SalaryAcctEmployeePO> listYear = data.getList().stream().filter(sa -> Objects.equals(k, ReportTimeUtil.getQuarter(SalaryDateUtil.getFormatYearMonth(sa.getSalaryMonth())))).collect(Collectors.toList());
List<SalaryAcctEmployeePO> lastListYear = data.getLastList().stream().filter(sa -> Objects.equals(k, ReportTimeUtil.getQuarter(ReportTimeUtil.getPlusYearMonth(SalaryDateUtil.getFormatYearMonth(sa.getSalaryMonth()), 3)))).collect(Collectors.toList());
List<SalaryAcctEmployeePO> sameListYear = data.getSameList().stream().filter(sa -> Objects.equals(k, ReportTimeUtil.getQuarter(ReportTimeUtil.getPlusYearMonth(SalaryDateUtil.getFormatYearMonth(sa.getSalaryMonth()), 12)))).collect(Collectors.toList());
Map<String, Object> temp = new HashMap<>();
temp.put(DM, k);
temp.putAll(SalaryStatisticsReportBO.calculateItem(listYear, lastListYear, sameListYear, salaryAcctResultValueMap, data.getSalaryStatisticsItemList()));
records.add(temp);
}else if(StringUtils.equals(dimensionValue, k)){
List<SalaryAcctEmployeePO> listYear = data.getList().stream().filter(sa -> Objects.equals(k, ReportTimeUtil.getQuarter(SalaryDateUtil.getFormatYearMonth(sa.getSalaryMonth())))).collect(Collectors.toList());
data.setListByDimensionValue(listYear);
}
});
result.setList(records);
@ -864,14 +988,20 @@ public class SalaryStatisticsReportServiceImpl extends Service implements Salary
List<String> halfYears = halfYearSet.stream().sorted().collect(Collectors.toList());
Collections.reverse(halfYears);
String dimensionValue = data.getDimensionValue();
halfYears.forEach(k -> {
List<SalaryAcctEmployeePO> listHalfYear = data.getList().stream().filter(sa -> Objects.equals(k, ReportTimeUtil.getHalfYear(SalaryDateUtil.getFormatYearMonth(sa.getSalaryMonth())))).collect(Collectors.toList());
List<SalaryAcctEmployeePO> lastListHalfYear = data.getLastList().stream().filter(sa -> Objects.equals(k, ReportTimeUtil.getHalfYear(ReportTimeUtil.getPlusYearMonth(SalaryDateUtil.getFormatYearMonth(sa.getSalaryMonth()), 6)))).collect(Collectors.toList());
List<SalaryAcctEmployeePO> sameListHalfYear = data.getSameList().stream().filter(sa -> Objects.equals(k, ReportTimeUtil.getHalfYear(ReportTimeUtil.getPlusYearMonth(SalaryDateUtil.getFormatYearMonth(sa.getSalaryMonth()), 12)))).collect(Collectors.toList());
Map<String, Object> temp = new HashMap<>();
temp.put(DM, k);
temp.putAll(SalaryStatisticsReportBO.calculateItem(listHalfYear, lastListHalfYear, sameListHalfYear, salaryAcctResultValueMap, data.getSalaryStatisticsItemList()));
records.add(temp);
if(dimensionValue == null){
List<SalaryAcctEmployeePO> listHalfYear = data.getList().stream().filter(sa -> Objects.equals(k, ReportTimeUtil.getHalfYear(SalaryDateUtil.getFormatYearMonth(sa.getSalaryMonth())))).collect(Collectors.toList());
List<SalaryAcctEmployeePO> lastListHalfYear = data.getLastList().stream().filter(sa -> Objects.equals(k, ReportTimeUtil.getHalfYear(ReportTimeUtil.getPlusYearMonth(SalaryDateUtil.getFormatYearMonth(sa.getSalaryMonth()), 6)))).collect(Collectors.toList());
List<SalaryAcctEmployeePO> sameListHalfYear = data.getSameList().stream().filter(sa -> Objects.equals(k, ReportTimeUtil.getHalfYear(ReportTimeUtil.getPlusYearMonth(SalaryDateUtil.getFormatYearMonth(sa.getSalaryMonth()), 12)))).collect(Collectors.toList());
Map<String, Object> temp = new HashMap<>();
temp.put(DM, k);
temp.putAll(SalaryStatisticsReportBO.calculateItem(listHalfYear, lastListHalfYear, sameListHalfYear, salaryAcctResultValueMap, data.getSalaryStatisticsItemList()));
records.add(temp);
}else if(StringUtils.equals(dimensionValue, k)){
List<SalaryAcctEmployeePO> listHalfYear = data.getList().stream().filter(sa -> Objects.equals(k, ReportTimeUtil.getHalfYear(SalaryDateUtil.getFormatYearMonth(sa.getSalaryMonth())))).collect(Collectors.toList());
data.setListByDimensionValue(listHalfYear);
}
});
result.setList(records);
@ -887,14 +1017,20 @@ public class SalaryStatisticsReportServiceImpl extends Service implements Salary
List<String> years = yearSet.stream().sorted().collect(Collectors.toList());
Collections.reverse(years);
String dimensionValue = data.getDimensionValue();
years.forEach(k -> {
List<SalaryAcctEmployeePO> listYear = data.getList().stream().filter(sa -> Objects.equals(k, ReportTimeUtil.getYear(SalaryDateUtil.getFormatYearMonth(sa.getSalaryMonth())))).collect(Collectors.toList());
List<SalaryAcctEmployeePO> lastListYear = data.getLastList().stream().filter(sa -> Objects.equals(ReportTimeUtil.getLastYear(k), ReportTimeUtil.getYear(SalaryDateUtil.getFormatYearMonth(sa.getSalaryMonth())))).collect(Collectors.toList());
List<SalaryAcctEmployeePO> sameListYear = data.getSameList().stream().filter(sa -> Objects.equals(ReportTimeUtil.getLastYear(k), ReportTimeUtil.getYear(SalaryDateUtil.getFormatYearMonth(sa.getSalaryMonth())))).collect(Collectors.toList());
Map<String, Object> temp = new HashMap<>();
temp.put(DM, k);
temp.putAll(SalaryStatisticsReportBO.calculateItem(listYear, lastListYear, sameListYear, salaryAcctResultValueMap, data.getSalaryStatisticsItemList()));
records.add(temp);
if(dimensionValue == null ){
List<SalaryAcctEmployeePO> listYear = data.getList().stream().filter(sa -> Objects.equals(k, ReportTimeUtil.getYear(SalaryDateUtil.getFormatYearMonth(sa.getSalaryMonth())))).collect(Collectors.toList());
List<SalaryAcctEmployeePO> lastListYear = data.getLastList().stream().filter(sa -> Objects.equals(ReportTimeUtil.getLastYear(k), ReportTimeUtil.getYear(SalaryDateUtil.getFormatYearMonth(sa.getSalaryMonth())))).collect(Collectors.toList());
List<SalaryAcctEmployeePO> sameListYear = data.getSameList().stream().filter(sa -> Objects.equals(ReportTimeUtil.getLastYear(k), ReportTimeUtil.getYear(SalaryDateUtil.getFormatYearMonth(sa.getSalaryMonth())))).collect(Collectors.toList());
Map<String, Object> temp = new HashMap<>();
temp.put(DM, k);
temp.putAll(SalaryStatisticsReportBO.calculateItem(listYear, lastListYear, sameListYear, salaryAcctResultValueMap, data.getSalaryStatisticsItemList()));
records.add(temp);
}else if( StringUtils.equals(dimensionValue, k) ){
List<SalaryAcctEmployeePO> listYear = data.getList().stream().filter(sa -> Objects.equals(k, ReportTimeUtil.getYear(SalaryDateUtil.getFormatYearMonth(sa.getSalaryMonth())))).collect(Collectors.toList());
data.setListByDimensionValue(listYear);
}
});
result.setList(records);
@ -1537,24 +1673,35 @@ public class SalaryStatisticsReportServiceImpl extends Service implements Salary
List<Double> workYears = Lists.newArrayList(workYearSet);
workYears = workYears.stream().sorted().collect(Collectors.toList());
String dimensionValue = data.getDimensionValue();
workYears.forEach(k -> {
List<SalaryAcctEmployeePO> salaryAcctEmployees = data.getList().stream().filter(po -> Objects.equals(empIdWorkYearMap.get(po.getEmployeeId()), k)).collect(Collectors.toList());
List<SalaryAcctEmployeePO> lastSalaryAcctEmployees = data.getLastList().stream().filter(po -> Objects.equals(lastEmpIdWorkYearMap.get(po.getEmployeeId()), k)).collect(Collectors.toList());
List<SalaryAcctEmployeePO> sameSalaryAcctEmployees = data.getSameList().stream().filter(po -> Objects.equals(sameEmpIdWorkYearMap.get(po.getEmployeeId()), k)).collect(Collectors.toList());
Map<String, Object> temp = new HashMap<>();
temp.put(DM, k);
temp.putAll(SalaryStatisticsReportBO.calculateItem(salaryAcctEmployees, lastSalaryAcctEmployees, sameSalaryAcctEmployees, salaryAcctResultValueMap, data.getSalaryStatisticsItemList()));
records.add(temp);
if(dimensionValue == null ){
List<SalaryAcctEmployeePO> salaryAcctEmployees = data.getList().stream().filter(po -> Objects.equals(empIdWorkYearMap.get(po.getEmployeeId()), k)).collect(Collectors.toList());
List<SalaryAcctEmployeePO> lastSalaryAcctEmployees = data.getLastList().stream().filter(po -> Objects.equals(lastEmpIdWorkYearMap.get(po.getEmployeeId()), k)).collect(Collectors.toList());
List<SalaryAcctEmployeePO> sameSalaryAcctEmployees = data.getSameList().stream().filter(po -> Objects.equals(sameEmpIdWorkYearMap.get(po.getEmployeeId()), k)).collect(Collectors.toList());
Map<String, Object> temp = new HashMap<>();
temp.put(DM, k);
temp.putAll(SalaryStatisticsReportBO.calculateItem(salaryAcctEmployees, lastSalaryAcctEmployees, sameSalaryAcctEmployees, salaryAcctResultValueMap, data.getSalaryStatisticsItemList()));
records.add(temp);
}else if( Double.compare(Double.valueOf(dimensionValue), k) == 0 ){
List<SalaryAcctEmployeePO> salaryAcctEmployees = data.getList().stream().filter(po -> Objects.equals(empIdWorkYearMap.get(po.getEmployeeId()), k)).collect(Collectors.toList());
data.setListByDimensionValue(salaryAcctEmployees);
}
});
List<SalaryAcctEmployeePO> noGroupingList = data.getList().stream().filter(po -> empIdWorkYearMap.get(po.getEmployeeId()) == null).collect(Collectors.toList());
List<SalaryAcctEmployeePO> lastNoGroupingList = data.getLastList().stream().filter(po -> lastEmpIdWorkYearMap.get(po.getEmployeeId()) == null).collect(Collectors.toList());
List<SalaryAcctEmployeePO> sameNoGroupingList = data.getSameList().stream().filter(po -> lastEmpIdWorkYearMap.get(po.getEmployeeId()) == null).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(noGroupingList)) {
Map<String, Object> noGrouping = new HashMap<>();
noGrouping.put(DM, SalaryI18nUtil.getI18nLabel(153462, "无分组"));
noGrouping.putAll(SalaryStatisticsReportBO.calculateItem(noGroupingList, lastNoGroupingList, sameNoGroupingList, salaryAcctResultValueMap, data.getSalaryStatisticsItemList()));
records.add(noGrouping);
if(dimensionValue == null ){
List<SalaryAcctEmployeePO> noGroupingList = data.getList().stream().filter(po -> empIdWorkYearMap.get(po.getEmployeeId()) == null).collect(Collectors.toList());
List<SalaryAcctEmployeePO> lastNoGroupingList = data.getLastList().stream().filter(po -> lastEmpIdWorkYearMap.get(po.getEmployeeId()) == null).collect(Collectors.toList());
List<SalaryAcctEmployeePO> sameNoGroupingList = data.getSameList().stream().filter(po -> lastEmpIdWorkYearMap.get(po.getEmployeeId()) == null).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(noGroupingList)) {
Map<String, Object> noGrouping = new HashMap<>();
noGrouping.put(DM, SalaryI18nUtil.getI18nLabel(153462, "无分组"));
noGrouping.putAll(SalaryStatisticsReportBO.calculateItem(noGroupingList, lastNoGroupingList, sameNoGroupingList, salaryAcctResultValueMap, data.getSalaryStatisticsItemList()));
records.add(noGrouping);
}
}else if( StringUtils.equals(dimensionValue, "无分组") ){
List<SalaryAcctEmployeePO> noGroupingList = data.getList().stream().filter(po -> empIdWorkYearMap.get(po.getEmployeeId()) == null).collect(Collectors.toList());
data.setListByDimensionValue(noGroupingList);
}
result.setList(records);
@ -1594,24 +1741,35 @@ public class SalaryStatisticsReportServiceImpl extends Service implements Salary
List<String> companyYears = Lists.newArrayList(companyYearSet);
companyYears = companyYears.stream().sorted().collect(Collectors.toList());
String dimensionValue = data.getDimensionValue();
companyYears.forEach(k -> {
List<SalaryAcctEmployeePO> salaryAcctEmployees = data.getList().stream().filter(po -> Objects.equals(empIdCompanyYearMap.get(po.getEmployeeId()), k)).collect(Collectors.toList());
List<SalaryAcctEmployeePO> lastSalaryAcctEmployees = data.getLastList().stream().filter(po -> Objects.equals(lastEmpIdCompanyYearMap.get(po.getEmployeeId()), k)).collect(Collectors.toList());
List<SalaryAcctEmployeePO> sameSalaryAcctEmployees = data.getSameList().stream().filter(po -> Objects.equals(sameEmpIdCompanyYearMap.get(po.getEmployeeId()), k)).collect(Collectors.toList());
Map<String, Object> temp = new HashMap<>();
temp.put(DM, k);
temp.putAll(SalaryStatisticsReportBO.calculateItem(salaryAcctEmployees, lastSalaryAcctEmployees, sameSalaryAcctEmployees, salaryAcctResultValueMap, data.getSalaryStatisticsItemList()));
records.add(temp);
if(dimensionValue == null ){
List<SalaryAcctEmployeePO> salaryAcctEmployees = data.getList().stream().filter(po -> Objects.equals(empIdCompanyYearMap.get(po.getEmployeeId()), k)).collect(Collectors.toList());
List<SalaryAcctEmployeePO> lastSalaryAcctEmployees = data.getLastList().stream().filter(po -> Objects.equals(lastEmpIdCompanyYearMap.get(po.getEmployeeId()), k)).collect(Collectors.toList());
List<SalaryAcctEmployeePO> sameSalaryAcctEmployees = data.getSameList().stream().filter(po -> Objects.equals(sameEmpIdCompanyYearMap.get(po.getEmployeeId()), k)).collect(Collectors.toList());
Map<String, Object> temp = new HashMap<>();
temp.put(DM, k);
temp.putAll(SalaryStatisticsReportBO.calculateItem(salaryAcctEmployees, lastSalaryAcctEmployees, sameSalaryAcctEmployees, salaryAcctResultValueMap, data.getSalaryStatisticsItemList()));
records.add(temp);
}else if( StringUtils.equals(dimensionValue, k) ){
List<SalaryAcctEmployeePO> salaryAcctEmployees = data.getList().stream().filter(po -> Objects.equals(empIdCompanyYearMap.get(po.getEmployeeId()), k)).collect(Collectors.toList());
data.setListByDimensionValue(salaryAcctEmployees);
}
});
List<SalaryAcctEmployeePO> noGroupingList = data.getList().stream().filter(po -> empIdCompanyYearMap.get(po.getEmployeeId()) == null).collect(Collectors.toList());
List<SalaryAcctEmployeePO> lastNoGroupingList = data.getLastList().stream().filter(po -> lastEmpIdCompanyYearMap.get(po.getEmployeeId()) == null).collect(Collectors.toList());
List<SalaryAcctEmployeePO> sameNoGroupingList = data.getSameList().stream().filter(po -> sameEmpIdCompanyYearMap.get(po.getEmployeeId()) == null).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(noGroupingList)) {
Map<String, Object> noGrouping = new HashMap<>();
noGrouping.put(DM, SalaryI18nUtil.getI18nLabel(153462, "无分组"));
noGrouping.putAll(SalaryStatisticsReportBO.calculateItem(noGroupingList, lastNoGroupingList, sameNoGroupingList, salaryAcctResultValueMap, data.getSalaryStatisticsItemList()));
records.add(noGrouping);
if(dimensionValue == null ){
List<SalaryAcctEmployeePO> noGroupingList = data.getList().stream().filter(po -> empIdCompanyYearMap.get(po.getEmployeeId()) == null).collect(Collectors.toList());
List<SalaryAcctEmployeePO> lastNoGroupingList = data.getLastList().stream().filter(po -> lastEmpIdCompanyYearMap.get(po.getEmployeeId()) == null).collect(Collectors.toList());
List<SalaryAcctEmployeePO> sameNoGroupingList = data.getSameList().stream().filter(po -> sameEmpIdCompanyYearMap.get(po.getEmployeeId()) == null).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(noGroupingList)) {
Map<String, Object> noGrouping = new HashMap<>();
noGrouping.put(DM, SalaryI18nUtil.getI18nLabel(153462, "无分组"));
noGrouping.putAll(SalaryStatisticsReportBO.calculateItem(noGroupingList, lastNoGroupingList, sameNoGroupingList, salaryAcctResultValueMap, data.getSalaryStatisticsItemList()));
records.add(noGrouping);
}
}else if( StringUtils.equals(dimensionValue, "无分组")){
List<SalaryAcctEmployeePO> noGroupingList = data.getList().stream().filter(po -> empIdCompanyYearMap.get(po.getEmployeeId()) == null).collect(Collectors.toList());
data.setListByDimensionValue(noGroupingList);
}
result.setList(records);
@ -1651,14 +1809,20 @@ public class SalaryStatisticsReportServiceImpl extends Service implements Salary
} else {
groupBelong = SalaryStatisticsReportBO.G_ITEM;
}
String dimensionValue = data.getDimensionValue();
groups.forEach(k -> {
List<SalaryAcctEmployeePO> salaryAcctEmployees = SalaryStatisticsReportBO.listAcctEmpByRationGroupSpacing(k, groupBelong, dimension.getDimCode(), data.getList(), empIdYearMap, salaryAcctResultValueMap, data.getSalaryStatisticsItemList());
List<SalaryAcctEmployeePO> lastSalaryAcctEmployees = SalaryStatisticsReportBO.listAcctEmpByRationGroupSpacing(k, groupBelong, dimension.getDimCode(), data.getLastList(), lastEmpIdYearMap, salaryAcctResultValueMap, data.getSalaryStatisticsItemList());
List<SalaryAcctEmployeePO> sameSalaryAcctEmployees = SalaryStatisticsReportBO.listAcctEmpByRationGroupSpacing(k, groupBelong, dimension.getDimCode(), data.getSameList(), sameEmpIdYearMap, salaryAcctResultValueMap, data.getSalaryStatisticsItemList());
Map<String, Object> temp = new HashMap<>();
temp.put(DM, k.getStartValue() + "-" + k.getEndValue());
temp.putAll(SalaryStatisticsReportBO.calculateItem(salaryAcctEmployees, lastSalaryAcctEmployees, sameSalaryAcctEmployees, salaryAcctResultValueMap, data.getSalaryStatisticsItemList()));
records.add(temp);
if(dimensionValue == null ){
List<SalaryAcctEmployeePO> salaryAcctEmployees = SalaryStatisticsReportBO.listAcctEmpByRationGroupSpacing(k, groupBelong, dimension.getDimCode(), data.getList(), empIdYearMap, salaryAcctResultValueMap, data.getSalaryStatisticsItemList());
List<SalaryAcctEmployeePO> lastSalaryAcctEmployees = SalaryStatisticsReportBO.listAcctEmpByRationGroupSpacing(k, groupBelong, dimension.getDimCode(), data.getLastList(), lastEmpIdYearMap, salaryAcctResultValueMap, data.getSalaryStatisticsItemList());
List<SalaryAcctEmployeePO> sameSalaryAcctEmployees = SalaryStatisticsReportBO.listAcctEmpByRationGroupSpacing(k, groupBelong, dimension.getDimCode(), data.getSameList(), sameEmpIdYearMap, salaryAcctResultValueMap, data.getSalaryStatisticsItemList());
Map<String, Object> temp = new HashMap<>();
temp.put(DM, k.getStartValue() + "-" + k.getEndValue());
temp.putAll(SalaryStatisticsReportBO.calculateItem(salaryAcctEmployees, lastSalaryAcctEmployees, sameSalaryAcctEmployees, salaryAcctResultValueMap, data.getSalaryStatisticsItemList()));
records.add(temp);
}else if( StringUtils.equals(dimensionValue, k.getStartValue() + "-" + k.getEndValue()) ){
List<SalaryAcctEmployeePO> salaryAcctEmployees = SalaryStatisticsReportBO.listAcctEmpByRationGroupSpacing(k, groupBelong, dimension.getDimCode(), data.getList(), empIdYearMap, salaryAcctResultValueMap, data.getSalaryStatisticsItemList());
data.setListByDimensionValue(salaryAcctEmployees);
}
});
result.setList(records);
@ -1726,14 +1890,20 @@ public class SalaryStatisticsReportServiceImpl extends Service implements Salary
groupBelong = SalaryStatisticsReportBO.G_ITEM;
}
String dimensionValue = data.getDimensionValue();
groups.forEach(k -> {
List<SalaryAcctEmployeePO> salaryAcctEmployees = SalaryStatisticsReportBO.listAcctEmpByRationGroupIndividual(k, groupBelong, dimension.getDimCode(), data.getList(), empIdYearMap, salaryAcctResultValueMap, data.getSalaryStatisticsItemList());
List<SalaryAcctEmployeePO> lastSalaryAcctEmployees = SalaryStatisticsReportBO.listAcctEmpByRationGroupIndividual(k, groupBelong, dimension.getDimCode(), data.getLastList(), lastEmpIdYearMap, salaryAcctResultValueMap, data.getSalaryStatisticsItemList());
List<SalaryAcctEmployeePO> sameSalaryAcctEmployees = SalaryStatisticsReportBO.listAcctEmpByRationGroupIndividual(k, groupBelong, dimension.getDimCode(), data.getSameList(), sameEmpIdYearMap, salaryAcctResultValueMap, data.getSalaryStatisticsItemList());
Map<String, Object> temp = new HashMap<>();
temp.put(DM, k.getValue());
temp.putAll(SalaryStatisticsReportBO.calculateItem(salaryAcctEmployees, lastSalaryAcctEmployees, sameSalaryAcctEmployees, salaryAcctResultValueMap, data.getSalaryStatisticsItemList()));
records.add(temp);
if(dimensionValue == null ){
List<SalaryAcctEmployeePO> salaryAcctEmployees = SalaryStatisticsReportBO.listAcctEmpByRationGroupIndividual(k, groupBelong, dimension.getDimCode(), data.getList(), empIdYearMap, salaryAcctResultValueMap, data.getSalaryStatisticsItemList());
List<SalaryAcctEmployeePO> lastSalaryAcctEmployees = SalaryStatisticsReportBO.listAcctEmpByRationGroupIndividual(k, groupBelong, dimension.getDimCode(), data.getLastList(), lastEmpIdYearMap, salaryAcctResultValueMap, data.getSalaryStatisticsItemList());
List<SalaryAcctEmployeePO> sameSalaryAcctEmployees = SalaryStatisticsReportBO.listAcctEmpByRationGroupIndividual(k, groupBelong, dimension.getDimCode(), data.getSameList(), sameEmpIdYearMap, salaryAcctResultValueMap, data.getSalaryStatisticsItemList());
Map<String, Object> temp = new HashMap<>();
temp.put(DM, k.getValue());
temp.putAll(SalaryStatisticsReportBO.calculateItem(salaryAcctEmployees, lastSalaryAcctEmployees, sameSalaryAcctEmployees, salaryAcctResultValueMap, data.getSalaryStatisticsItemList()));
records.add(temp);
}else if( StringUtils.equals(dimensionValue, k.getValue()) ){
List<SalaryAcctEmployeePO> salaryAcctEmployees = SalaryStatisticsReportBO.listAcctEmpByRationGroupIndividual(k, groupBelong, dimension.getDimCode(), data.getList(), empIdYearMap, salaryAcctResultValueMap, data.getSalaryStatisticsItemList());
data.setListByDimensionValue(salaryAcctEmployees);
}
});
result.setList(records);

View File

@ -1,10 +1,7 @@
package com.engine.salary.report.web;
import com.engine.common.util.ServiceUtil;
import com.engine.salary.report.entity.param.SalaryStatisticsReportDataQueryParam;
import com.engine.salary.report.entity.param.SalaryStatisticsReportQueryParam;
import com.engine.salary.report.entity.param.SalaryStatisticsReportSaveParam;
import com.engine.salary.report.entity.param.SalaryStatisticsSearchConditionSaveParam;
import com.engine.salary.report.entity.param.*;
import com.engine.salary.report.wrapper.SalaryStatisticsReportWrapper;
import com.engine.salary.util.ResponseResult;
import io.swagger.v3.oas.annotations.parameters.RequestBody;
@ -177,4 +174,17 @@ public class SalaryStatisticsReportController {
throw e;
}
}
/**
* 获取报表的透视数据信息
*
* @return
*/
@GET
@Path("/getDataPerspective")
@Produces(MediaType.APPLICATION_OCTET_STREAM)
public String getDataPerspective(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalaryStatisticsDataPerspectiveQueryParam param) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<SalaryStatisticsDataPerspectiveQueryParam, Map<String, Object>>(user).run(getSalaryStatisticsReportWrapper(user)::getDataPerspective, param);
}
}

View File

@ -1,16 +1,21 @@
package com.engine.salary.report.wrapper;
import com.alibaba.fastjson.JSONArray;
import com.cloudstore.eccom.constant.WeaBoolAttr;
import com.cloudstore.eccom.pc.table.WeaTableColumn;
import com.cloudstore.eccom.result.WeaResultMsg;
import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.salary.component.SalaryWeaTable;
import com.engine.salary.component.WeaFormOption;
import com.engine.salary.component.WeaTableColumnGroup;
import com.engine.salary.entity.salaryarchive.dto.SalaryArchiveListDTO;
import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
import com.engine.salary.exception.SalaryRunTimeException;
import com.engine.salary.report.common.constant.SalaryConstant;
import com.engine.salary.report.entity.bo.SalaryStatisticsReportBO;
import com.engine.salary.report.entity.param.SalaryStatisticsReportDataQueryParam;
import com.engine.salary.report.entity.param.SalaryStatisticsReportQueryParam;
import com.engine.salary.report.entity.param.SalaryStatisticsReportSaveParam;
import com.engine.salary.report.entity.param.SalaryStatisticsSearchConditionSaveParam;
import com.engine.salary.report.entity.dto.SalaryStatisticsEmployeeDetailResultDTO;
import com.engine.salary.report.entity.param.*;
import com.engine.salary.report.entity.po.SalaryStatisticsDimensionPO;
import com.engine.salary.report.entity.po.SalaryStatisticsItemPO;
import com.engine.salary.report.entity.po.SalaryStatisticsReportPO;
@ -22,9 +27,16 @@ import com.engine.salary.report.service.impl.SalaryStatisticsDimensionServiceImp
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.service.SalaryAcctEmployeeService;
import com.engine.salary.service.SalaryAcctResultService;
import com.engine.salary.service.SalaryItemService;
import com.engine.salary.service.impl.SalaryAcctEmployeeServiceImpl;
import com.engine.salary.service.impl.SalaryAcctResultServiceImpl;
import com.engine.salary.service.impl.SalaryItemServiceImpl;
import com.engine.salary.util.*;
import com.engine.salary.util.excel.ExcelUtilPlus;
import com.engine.salary.util.page.PageInfo;
import com.engine.salary.util.page.SalaryPageUtil;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import org.apache.commons.collections4.CollectionUtils;
@ -64,6 +76,18 @@ public class SalaryStatisticsReportWrapper extends Service {
return ServiceUtil.getService(SubTableExportServiceImpl.class, user);
}
private SalaryAcctEmployeeService getSalaryAcctEmployeeService(User user) {
return ServiceUtil.getService(SalaryAcctEmployeeServiceImpl.class, user);
}
private SalaryAcctResultService getSalaryAcctResultService(User user) {
return (SalaryAcctResultService) ServiceUtil.getService(SalaryAcctResultServiceImpl.class, user);
}
private SalaryItemService getSalaryItemService(User user) {
return (SalaryItemService) ServiceUtil.getService(SalaryItemServiceImpl.class, user);
}
/**
* 报表列表
*
@ -299,4 +323,60 @@ public class SalaryStatisticsReportWrapper extends Service {
return map;
}
/**
* 获取报表透视数据
* @param param
* @return
*/
public Map<String, Object> getDataPerspective(SalaryStatisticsDataPerspectiveQueryParam param) {
if (param.getId() == null || param.getDimensionId() == null) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(84026, "参数错误"));
}
SalaryStatisticsReportPO po = this.getSalaryStatisticsReportService(user).getById(param.getId());
if (po == null) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(161845, "薪酬统计报表不存在"));
}
SalaryStatisticsDimensionPO dimension = getSalaryStatisticsDimensionService(user).getById(param.getDimensionId());
if (dimension == null) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(161300, "统计维度不存在"));
}
// 查询自定义统计项目中所有薪资项目id
List<SalaryStatisticsItemPO> salaryStatisticsItemPOS = getSalaryStatisticsItemService(user).listByStatisticsReportId(param.getId());
List<Long> salaryItemIds = salaryStatisticsItemPOS.stream().filter(item -> StringUtils.isNotBlank(item.getItemValue())).map(p -> p.getItemValue().split(","))
.flatMap(Arrays::stream).map(Long::valueOf).collect(Collectors.toList());
List<Map<String, Object>> records = getSalaryStatisticsReportService(user).buildDataPerspectiveRecords(param, po, dimension, salaryStatisticsItemPOS);
PageInfo<Map<String, Object>> pageInfo = SalaryPageUtil.buildPage(param.getCurrent(), param.getPageSize(), records);
List<SalaryItemPO> itemList = getSalaryItemService(user).listByIds(salaryItemIds);
// 列表columns
List<WeaTableColumn> weaTableColumns = buildDataPerspectiveTableColumns(itemList);
SalaryWeaTable<SalaryArchiveListDTO> table = new SalaryWeaTable<SalaryArchiveListDTO>(user, SalaryStatisticsEmployeeDetailResultDTO.class);
table.setColumns(weaTableColumns);
WeaResultMsg result = new WeaResultMsg(false);
result.putAll(table.makeDataResult());
result.success();
// 结果
Map<String, Object> resultMap = Maps.newHashMap();
resultMap.put("dataKey", result.getResultMap());
resultMap.put("pageInfo", pageInfo);
return resultMap;
}
private List<WeaTableColumn> buildDataPerspectiveTableColumns(List<SalaryItemPO> salaryItems) {
// 表格表头
List<WeaTableColumn> columns = new ArrayList<>();
columns.add(new WeaTableColumn("100px", SalaryI18nUtil.getI18nLabel(87614, "薪资所属月"), "salaryMonth"));
columns.add(new WeaTableColumn("100px", SalaryI18nUtil.getI18nLabel(86184, "个税扣缴义务人"), "taxAgent"));
columns.add(new WeaTableColumn("100px", SalaryI18nUtil.getI18nLabel(86184, "账套"), "salarySob"));
columns.add(new WeaTableColumn("100px", SalaryI18nUtil.getI18nLabel(86184, "次数"), "acctTimes").setDisplay(WeaBoolAttr.FALSE));
salaryItems.forEach(item -> {
columns.add(new WeaTableColumn("100px", item.getName(), item.getId() + SalaryConstant.DYNAMIC_SUFFIX));
});
return columns;
}
}

View File

@ -14,7 +14,6 @@ import com.engine.salary.util.page.PageInfo;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* 薪资核算结果
@ -198,5 +197,5 @@ public interface SalaryAcctResultService {
* @author Harryxzy
* @date 2022/12/26 22:24
*/
List<SalaryAcctResultPO> listByAcctEmployeeIdsAndSalaryItemIds(Set<Long> salaryAcctEmpIds, Set<Long> excelSalaryItemIds);
List<SalaryAcctResultPO> listByAcctEmployeeIdsAndSalaryItemIds(Collection<Long> salaryAcctEmpIds, Collection<Long> salaryItemIds);
}

View File

@ -961,7 +961,7 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
}
@Override
public List<SalaryAcctResultPO> listByAcctEmployeeIdsAndSalaryItemIds(Set<Long> salaryAcctEmployeeIds, Set<Long> salaryItemIds) {
public List<SalaryAcctResultPO> listByAcctEmployeeIdsAndSalaryItemIds(Collection<Long> salaryAcctEmployeeIds, Collection<Long> salaryItemIds) {
SalaryAcctResultPO build = SalaryAcctResultPO.builder().salaryAcctEmpIds(salaryAcctEmployeeIds).salaryItemIds(salaryItemIds).build();
List<SalaryAcctResultPO> list = getSalaryAcctResultMapper().listSome(build);
// 数据解密

View File

@ -544,5 +544,18 @@ public class SalaryBillController {
}
/******** 工资单发放 end ***********************************************************************************************/
// /**
// *
// *
// * @param
// * @return
// */
// @GET
// @Path("/mySalaryBillItemDetail")
// @Produces(MediaType.APPLICATION_JSON)
// public String mySalaryBillItemDetail(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody) {
//
// }
}