Merge branch 'feature/报表维度' into release/2.10.1.2401.01
This commit is contained in:
commit
1e12138ca1
|
|
@ -1,5 +1,6 @@
|
|||
package com.engine.salary.report.entity.bo;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.cloudstore.eccom.pc.table.WeaTableColumn;
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
|
|
@ -932,6 +933,16 @@ public class SalaryStatisticsReportBO {
|
|||
return sumDecimal;
|
||||
}
|
||||
|
||||
private static String handle4GroupValue(String dimCode, SalaryAcctEmployeePO sa, Map<Long, Map<String, String>> salaryAcctResultValueMap, SalaryStatisticsItemPO item) {
|
||||
if (salaryAcctResultValueMap.get(sa.getId()) != null) {
|
||||
String value = salaryAcctResultValueMap.get(sa.getId()).get(dimCode);
|
||||
if (StringUtils.isNotBlank(value)) {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* 定量-单项式分组list分割
|
||||
*
|
||||
|
|
@ -960,6 +971,22 @@ public class SalaryStatisticsReportBO {
|
|||
return list.stream().filter(i -> ids.contains(i.getId())).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public static List<SalaryAcctEmployeePO> listAcctEmpByRationGroupIndividual(String groupIndividual, String dimCode, List<SalaryAcctEmployeePO> list, Map<Long, String> yearMap, Map<Long, Map<String, String>> salaryAcctResultValueMap, List<SalaryStatisticsItemPO> salaryStatisticsItemList) {
|
||||
Set<Long> ids = Sets.newHashSet();
|
||||
|
||||
for (SalaryAcctEmployeePO sa : list) {
|
||||
salaryStatisticsItemList.forEach(item -> {
|
||||
String value = handle4GroupValue(dimCode, sa, salaryAcctResultValueMap, item);
|
||||
|
||||
if (StrUtil.equals(groupIndividual, value)) {
|
||||
ids.add(sa.getId());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return list.stream().filter(i -> ids.contains(i.getId())).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public static Map<String, Boolean> checkLoad(List<SalaryStatisticsItemPO> salaryStatisticsItemList) {
|
||||
boolean isNow = false;
|
||||
boolean isLast = false;
|
||||
|
|
|
|||
|
|
@ -12,22 +12,22 @@ import java.util.Date;
|
|||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@ToString
|
||||
//hrsa_salary_statistics_item")
|
||||
//薪酬报表统计子表自定义统计项")
|
||||
//hrsa_salary_statistics_item
|
||||
//薪酬报表统计子表自定义统计项
|
||||
public class SalaryStatisticsItemPO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 5335849418826222822L;
|
||||
|
||||
//主键id")
|
||||
//主键id
|
||||
private Long id;
|
||||
|
||||
//统计报表id")
|
||||
//统计报表id
|
||||
private Long statReportId;
|
||||
|
||||
//统计项名称")
|
||||
//统计项名称
|
||||
private String itemName;
|
||||
|
||||
//统计项集合")
|
||||
//统计项集合
|
||||
private String itemValue;
|
||||
|
||||
/**
|
||||
|
|
@ -43,7 +43,7 @@ public class SalaryStatisticsItemPO implements Serializable {
|
|||
* }
|
||||
* jsonToString
|
||||
*/
|
||||
//计数规则")
|
||||
//计数规则
|
||||
private String countRule;
|
||||
|
||||
/**
|
||||
|
|
@ -59,7 +59,7 @@ public class SalaryStatisticsItemPO implements Serializable {
|
|||
* }
|
||||
* jsonToString
|
||||
*/
|
||||
//求和规则")
|
||||
//求和规则
|
||||
private String sumRule;
|
||||
|
||||
/**
|
||||
|
|
@ -75,7 +75,7 @@ public class SalaryStatisticsItemPO implements Serializable {
|
|||
* }
|
||||
* jsonToString
|
||||
*/
|
||||
//平均值规则")
|
||||
//平均值规则
|
||||
private String avgRule;
|
||||
|
||||
/**
|
||||
|
|
@ -91,7 +91,7 @@ public class SalaryStatisticsItemPO implements Serializable {
|
|||
* }
|
||||
* jsonToString
|
||||
*/
|
||||
//最大值规则")
|
||||
//最大值规则
|
||||
private String maxRule;
|
||||
|
||||
/**
|
||||
|
|
@ -107,7 +107,7 @@ public class SalaryStatisticsItemPO implements Serializable {
|
|||
* }
|
||||
* jsonToString
|
||||
*/
|
||||
//最小值规则")
|
||||
//最小值规则
|
||||
private String minRule;
|
||||
|
||||
/**
|
||||
|
|
@ -123,7 +123,7 @@ public class SalaryStatisticsItemPO implements Serializable {
|
|||
* }
|
||||
* jsonToString
|
||||
*/
|
||||
//中位数规则")
|
||||
//中位数规则
|
||||
private String medianRule;
|
||||
|
||||
|
||||
|
|
@ -161,7 +161,7 @@ public class SalaryStatisticsItemPO implements Serializable {
|
|||
*/
|
||||
private String tileRule;
|
||||
|
||||
//顺序")
|
||||
//顺序
|
||||
private Integer indexValue;
|
||||
|
||||
/**
|
||||
|
|
@ -169,22 +169,22 @@ public class SalaryStatisticsItemPO implements Serializable {
|
|||
*
|
||||
* @see UnitTypeEnum
|
||||
*/
|
||||
//统计单位")
|
||||
//统计单位
|
||||
private Integer unitType;
|
||||
|
||||
//创建时间")
|
||||
//创建时间
|
||||
private Date createTime;
|
||||
|
||||
//更新时间")
|
||||
//更新时间
|
||||
private Date updateTime;
|
||||
|
||||
//创建人")
|
||||
//创建人
|
||||
private Long creator;
|
||||
|
||||
//是否删除")
|
||||
//是否删除
|
||||
private Integer deleteType;
|
||||
|
||||
//租户key")
|
||||
//租户key
|
||||
private String tenantKey;
|
||||
|
||||
private Collection<Long> ids;
|
||||
|
|
|
|||
|
|
@ -31,13 +31,13 @@ import com.engine.salary.report.util.ReportTimeUtil;
|
|||
import com.engine.salary.service.*;
|
||||
import com.engine.salary.service.impl.*;
|
||||
import com.engine.salary.util.*;
|
||||
import com.engine.salary.util.db.IdGenerator;
|
||||
import com.engine.salary.util.db.MapperProxyFactory;
|
||||
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 com.google.common.collect.Sets;
|
||||
import com.engine.salary.util.db.IdGenerator;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.math.NumberUtils;
|
||||
|
|
@ -398,7 +398,7 @@ public class SalaryStatisticsReportServiceImpl extends Service implements Salary
|
|||
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<String, String> collect = v.stream().collect(Collectors.toMap(p -> Util.null2String(p.getSalaryItemId()), SalaryAcctResultPO::getResultValue, (key1, key2) -> key2));
|
||||
map.put(k, collect);
|
||||
});
|
||||
|
||||
|
|
@ -444,7 +444,7 @@ public class SalaryStatisticsReportServiceImpl extends Service implements Salary
|
|||
List<Long> finalSalaryAcctEmpIds = getSalaryAcctResultService(user).listAcctEmpIdByAcctEmpId(salaryAcctEmployeeIds);
|
||||
Map<Long, List<SalaryAcctResultPO>> salaryAcctEmpResultMap = SalaryEntityUtil.group2Map(salaryAcctResultValues, SalaryAcctResultPO::getSalaryAcctEmpId);
|
||||
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<String, String> collect = v.stream().collect(Collectors.toMap(p -> Util.null2String(p.getSalaryItemId()), SalaryAcctResultPO::getResultValue, (key1, key2) -> key2));
|
||||
resultMap.put(k, collect);
|
||||
});
|
||||
salaryAcctEmployeeIds.stream().forEach(id -> {
|
||||
|
|
@ -472,7 +472,7 @@ public class SalaryStatisticsReportServiceImpl extends Service implements Salary
|
|||
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<String, String> collect = v.stream().collect(Collectors.toMap(p -> Util.null2String(p.getSalaryItemId()), p -> Util.null2String(p.getResultValue()), (key1, key2) -> key2));
|
||||
map.put(k, collect);
|
||||
});
|
||||
|
||||
|
|
@ -495,12 +495,11 @@ public class SalaryStatisticsReportServiceImpl extends Service implements Salary
|
|||
String salaryReportConditions = getSalaryCacheService(user).get(SalaryCacheKey.SALARY_REPORT_CONDITIONS + id);
|
||||
if (StringUtils.isNotBlank(salaryReportConditions)) {
|
||||
Arrays.asList(salaryReportConditions.split(",")).forEach(paramMd5 -> {
|
||||
if (StringUtils.isNotBlank(paramMd5)) {
|
||||
//条件对应的结果
|
||||
getSalaryCacheService(user).remove(SalaryCacheKey.SALARY_REPORT_DATA + id + "_" + paramMd5);
|
||||
}
|
||||
}
|
||||
);
|
||||
if (StringUtils.isNotBlank(paramMd5)) {
|
||||
//条件对应的结果
|
||||
getSalaryCacheService(user).remove(SalaryCacheKey.SALARY_REPORT_DATA + id + "_" + paramMd5);
|
||||
}
|
||||
});
|
||||
getSalaryCacheService(user).remove(SalaryCacheKey.SALARY_REPORT_CONDITIONS + id);
|
||||
}
|
||||
}
|
||||
|
|
@ -523,14 +522,13 @@ public class SalaryStatisticsReportServiceImpl extends Service implements Salary
|
|||
List c = new ArrayList<>();
|
||||
if (StringUtils.isNotBlank(salaryReportConditions)) {
|
||||
Arrays.asList(salaryReportConditions.split(",")).forEach(paramMd5 -> {
|
||||
if (StringUtils.isNotBlank(paramMd5)) {
|
||||
Map<String, Object> data = getSalaryCacheService(user).get(SalaryCacheKey.SALARY_REPORT_DATA + paramMd5);
|
||||
Map kv = new HashMap<>();
|
||||
kv.put(paramMd5, data);
|
||||
c.add(kv);
|
||||
}
|
||||
}
|
||||
);
|
||||
if (StringUtils.isNotBlank(paramMd5)) {
|
||||
Map<String, Object> data = getSalaryCacheService(user).get(SalaryCacheKey.SALARY_REPORT_DATA + paramMd5);
|
||||
Map kv = new HashMap<>();
|
||||
kv.put(paramMd5, data);
|
||||
c.add(kv);
|
||||
}
|
||||
});
|
||||
report.add(c);
|
||||
}
|
||||
}
|
||||
|
|
@ -639,7 +637,7 @@ public class SalaryStatisticsReportServiceImpl extends Service implements Salary
|
|||
case SalaryStatisticsDimensionConstant.DM_COMPANY_YEAR:
|
||||
return buildCompanyYearRecords(data, salaryAcctResultValueMap);
|
||||
default:
|
||||
return new PageInfo<>();
|
||||
return buildSalaryItemRecords(dimension, data, salaryAcctResultValueMap);
|
||||
}
|
||||
// 定量-组距式分组
|
||||
} else if (SalaryStatisticsDimensionTypeEnum.RATION_GROUP_SPACING.getValue().equals(dimension.getDimType())) {
|
||||
|
|
@ -1063,9 +1061,7 @@ public class SalaryStatisticsReportServiceImpl extends Service implements Salary
|
|||
Map<Long, List<SalaryAcctEmployeePO>> sameEmployeeListMap = data.getSameList().stream().collect(Collectors.groupingBy(SalaryAcctEmployeePO::getEmployeeId));
|
||||
|
||||
List<Long> empIds = accountDetailPOList.stream().map(SalaryAcctEmployeePO::getEmployeeId).distinct().collect(Collectors.toList());
|
||||
Map<Long, DataCollectionEmployee> employeeByIdMap = getSalaryEmployeeService(user).getEmployeeByIdsAll(empIds)
|
||||
.stream()
|
||||
.collect(Collectors.toMap(DataCollectionEmployee::getEmployeeId, o -> o));
|
||||
Map<Long, DataCollectionEmployee> employeeByIdMap = getSalaryEmployeeService(user).getEmployeeByIdsAll(empIds).stream().collect(Collectors.toMap(DataCollectionEmployee::getEmployeeId, o -> o));
|
||||
|
||||
//人员维度扩展属性
|
||||
EmployeeInfoExpandDTO employeeInfoExpandDTO = getSalaryStatisticsDimensionService(user).getExpandFieldSettings("dim_employee");
|
||||
|
|
@ -1083,11 +1079,9 @@ public class SalaryStatisticsReportServiceImpl extends Service implements Salary
|
|||
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).getUsername());
|
||||
fieldSettings.forEach(
|
||||
fieldSetting -> {
|
||||
temp.put(fieldSetting.getField(), expandEmployeeMap.getOrDefault(k, new HashMap<>()).get(fieldSetting.getField()));
|
||||
}
|
||||
);
|
||||
fieldSettings.forEach(fieldSetting -> {
|
||||
temp.put(fieldSetting.getField(), expandEmployeeMap.getOrDefault(k, new HashMap<>()).get(fieldSetting.getField()));
|
||||
});
|
||||
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).getUsername())) {
|
||||
|
|
@ -1926,6 +1920,41 @@ public class SalaryStatisticsReportServiceImpl extends Service implements Salary
|
|||
return result;
|
||||
}
|
||||
|
||||
private PageInfo<Map<String, Object>> buildSalaryItemRecords(SalaryStatisticsDimensionPO dimension, SalaryStatisticsReportDataDTO data, Map<Long, Map<String, String>> salaryAcctResultValueMap) {
|
||||
|
||||
//查询薪资项目存在的种类(维度)
|
||||
Set<String> dimensionSet = new HashSet<>();
|
||||
for (Long k : salaryAcctResultValueMap.keySet()) {
|
||||
Map<String, String> map = salaryAcctResultValueMap.get(k);
|
||||
dimensionSet.add(map.getOrDefault(dimension.getDimCode(), ""));
|
||||
}
|
||||
|
||||
PageInfo<Map<String, Object>> result = new PageInfo<>();
|
||||
List<Map<String, Object>> records = new ArrayList<>();
|
||||
|
||||
Map<Long, String> empIdYearMap = new HashMap<>();
|
||||
Map<Long, String> lastEmpIdYearMap = new HashMap<>();
|
||||
Map<Long, String> sameEmpIdYearMap = new HashMap<>();
|
||||
|
||||
String dimensionValue = data.getDimensionValue();
|
||||
dimensionSet.stream().sorted((a,b)->b.length()-a.length()).forEach(k -> {
|
||||
if (dimensionValue == null) {
|
||||
List<SalaryAcctEmployeePO> salaryAcctEmployees = SalaryStatisticsReportBO.listAcctEmpByRationGroupIndividual(k, dimension.getDimCode(), data.getList(), empIdYearMap, salaryAcctResultValueMap, data.getSalaryStatisticsItemList());
|
||||
List<SalaryAcctEmployeePO> lastSalaryAcctEmployees = SalaryStatisticsReportBO.listAcctEmpByRationGroupIndividual(k, dimension.getDimCode(), data.getLastList(), lastEmpIdYearMap, salaryAcctResultValueMap, data.getSalaryStatisticsItemList());
|
||||
List<SalaryAcctEmployeePO> sameSalaryAcctEmployees = SalaryStatisticsReportBO.listAcctEmpByRationGroupIndividual(k, dimension.getDimCode(), data.getSameList(), sameEmpIdYearMap, salaryAcctResultValueMap, data.getSalaryStatisticsItemList());
|
||||
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 = SalaryStatisticsReportBO.listAcctEmpByRationGroupIndividual(k, dimension.getDimCode(), data.getList(), empIdYearMap, salaryAcctResultValueMap, data.getSalaryStatisticsItemList());
|
||||
data.setListByDimensionValue(salaryAcctEmployees);
|
||||
}
|
||||
});
|
||||
result.setList(records);
|
||||
return result;
|
||||
}
|
||||
|
||||
// private PageInfo<Map<String, Object>> buildRationGroupSpacing4NoItemRecords(SalaryStatisticsDimensionPO dimension, SalaryStatisticsReportDataDTO data, Map<Long, Map<String, String>> salaryAcctResultValueMap) {
|
||||
// PageInfo<Map<String, Object>> result = new PageInfo<>();
|
||||
// List<Map<String, Object>> records = new ArrayList<>();
|
||||
|
|
|
|||
|
|
@ -114,6 +114,7 @@ public class SalaryStatisticsDimensionWrapper extends Service {
|
|||
* @return
|
||||
*/
|
||||
public SalaryStatisticsDimensionFormDTO getFrom(Long id) {
|
||||
List<SalaryItemPO> salaryItemList = salaryItemService(user).listAll();
|
||||
|
||||
List<WeaFormOption> statsDimOptions = Lists.newArrayList();
|
||||
// statsDimOptions.add(new WeaFormOption(SalaryStatisticsDimensionConstant.DM_SEX, SalaryI18nUtil.getI18nLabel(98622, "性别")));
|
||||
|
|
@ -129,12 +130,12 @@ public class SalaryStatisticsDimensionWrapper extends Service {
|
|||
// statsDimOptions.add(new WeaFormOption(SalaryStatisticsDimensionConstant.DM_AGE, SalaryI18nUtil.getI18nLabel(174001, "年龄")));
|
||||
statsDimOptions.add(new WeaFormOption(SalaryStatisticsDimensionConstant.DM_WORK_YEAR, SalaryI18nUtil.getI18nLabel(174000, "工龄")));
|
||||
statsDimOptions.add(new WeaFormOption(SalaryStatisticsDimensionConstant.DM_COMPANY_YEAR, SalaryI18nUtil.getI18nLabel(174003, "司龄")));
|
||||
statsDimOptions.addAll(salaryItemList.stream().map(item -> new WeaFormOption(item.getId().toString(), item.getName())).collect(Collectors.toList()));
|
||||
|
||||
List<WeaFormOption> groupDimOptions = Lists.newArrayList();
|
||||
// groupDimOptions.add(new WeaFormOption(SalaryStatisticsDimensionConstant.DM_AGE, SalaryI18nUtil.getI18nLabel(174001, "年龄")));
|
||||
groupDimOptions.add(new WeaFormOption(SalaryStatisticsDimensionConstant.DM_WORK_YEAR, SalaryI18nUtil.getI18nLabel(174000, "工龄")));
|
||||
groupDimOptions.add(new WeaFormOption(SalaryStatisticsDimensionConstant.DM_COMPANY_YEAR, SalaryI18nUtil.getI18nLabel(174003, "司龄")));
|
||||
List<SalaryItemPO> salaryItemList = salaryItemService(user).listAll();
|
||||
groupDimOptions.addAll(salaryItemList.stream()
|
||||
.filter(item -> SalaryDataTypeEnum.NUMBER.getValue().equals(item.getDataType()))
|
||||
.map(item -> new WeaFormOption(item.getId().toString(), item.getName())).collect(Collectors.toList()));
|
||||
|
|
|
|||
Loading…
Reference in New Issue