报表支持文本
This commit is contained in:
parent
7fa3c31aac
commit
22a946d9ad
|
|
@ -45,7 +45,7 @@ public class SalaryStatisticsReportBO {
|
|||
public static final String MAX = "max";
|
||||
public static final String MIN = "min";
|
||||
public static final String MEDIAN = "median";
|
||||
public static final String LATEST = "latest";
|
||||
public static final String LATEST = "last";
|
||||
|
||||
public static final String ZERO = "0";
|
||||
public static final String ONE = "1";
|
||||
|
|
@ -496,7 +496,7 @@ public class SalaryStatisticsReportBO {
|
|||
if (medianRule == null || medianRule.getTotalValue() != 1) {
|
||||
return;
|
||||
}
|
||||
String latestValue = "";
|
||||
String lastValue = "";
|
||||
// 本期
|
||||
if (medianRule.getTotalValue() == 1) {
|
||||
List<String> decimalList = Lists.newArrayList();
|
||||
|
|
@ -511,8 +511,8 @@ public class SalaryStatisticsReportBO {
|
|||
}
|
||||
}
|
||||
// 本期最近值
|
||||
latestValue = latest(decimalList);
|
||||
nowAndRatio(result, item, medianRule, LATEST, latestValue);
|
||||
lastValue = last(decimalList);
|
||||
nowAndRatio(result, item, medianRule, LATEST, lastValue);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -658,7 +658,7 @@ public class SalaryStatisticsReportBO {
|
|||
* @param list
|
||||
* @return
|
||||
*/
|
||||
public static String latest(List<String> list) {
|
||||
public static String last(List<String> list) {
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
return "";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,23 @@
|
|||
package com.engine.salary.report.entity.dto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 薪酬统计报表自定义统计字符项目规则
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class SalaryStatisticsItemStringRuleDTO {
|
||||
|
||||
|
||||
/**
|
||||
* 是否显示
|
||||
*/
|
||||
private Integer display;
|
||||
|
||||
}
|
||||
|
|
@ -20,38 +20,39 @@ import java.util.List;
|
|||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
//"薪酬统计报表自定义统计项目保存参数")
|
||||
public class SalaryStatisticsItemSaveParam {
|
||||
//统计项目id")
|
||||
//统计项目id
|
||||
private Long id;
|
||||
|
||||
// 报表id")
|
||||
// 报表id
|
||||
private Long statReportId;
|
||||
|
||||
//统计项目")
|
||||
//统计项目
|
||||
private List<String> itemValue;
|
||||
|
||||
//统计项名称")
|
||||
//统计项名称
|
||||
private String itemName;
|
||||
|
||||
//计数规则")
|
||||
//计数规则
|
||||
private SalaryStatisticsItemRuleDTO countRule;
|
||||
|
||||
//求和规则")
|
||||
//求和规则
|
||||
private SalaryStatisticsItemRuleDTO sumRule;
|
||||
|
||||
//平均值规则")
|
||||
//平均值规则
|
||||
private SalaryStatisticsItemRuleDTO avgRule;
|
||||
|
||||
//最大值规则")
|
||||
//最大值规则
|
||||
private SalaryStatisticsItemRuleDTO maxRule;
|
||||
|
||||
//最小值规则")
|
||||
//最小值规则
|
||||
private SalaryStatisticsItemRuleDTO minRule;
|
||||
|
||||
//中位数规则")
|
||||
//中位数规则
|
||||
private SalaryStatisticsItemRuleDTO medianRule;
|
||||
|
||||
private SalaryStatisticsItemRuleDTO lastRule;
|
||||
|
||||
//统计单位")
|
||||
//统计单位
|
||||
private Integer unitType;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -127,7 +127,25 @@ public class SalaryStatisticsItemPO implements Serializable {
|
|||
private String medianRule;
|
||||
|
||||
|
||||
// private String medianRule;
|
||||
/**
|
||||
* 最近值
|
||||
*/
|
||||
private String lastRule;
|
||||
|
||||
/**
|
||||
* 最早值
|
||||
*/
|
||||
private String oldRule;
|
||||
|
||||
/**
|
||||
* 出现最多
|
||||
*/
|
||||
private String frequentRule;
|
||||
|
||||
/**
|
||||
* 按时间平铺
|
||||
*/
|
||||
private String tileRule;
|
||||
|
||||
//顺序")
|
||||
private Integer indexValue;
|
||||
|
|
|
|||
|
|
@ -167,67 +167,29 @@ public class SalaryStatisticsItemWrapper extends Service {
|
|||
}
|
||||
}
|
||||
weaTable.put("data", result);
|
||||
}else {
|
||||
} else {
|
||||
List<WeaTableColumn> list = new ArrayList<>();
|
||||
WeaTableColumn ruleName = new WeaTableColumn("20%", SalaryI18nUtil.getI18nLabel(157532, "统计规则"), "ruleName");
|
||||
WeaTableColumn ratio = new WeaTableColumn("10%", SalaryI18nUtil.getI18nLabel(162990, "占比"), "ratio");
|
||||
WeaTableColumn m2m = new WeaTableColumn("10%", SalaryI18nUtil.getI18nLabel(157533, "环比"), "m2m");
|
||||
WeaTableColumn m2mLimit = new WeaTableColumn("25%", SalaryI18nUtil.getI18nLabel(157536, "环比增幅正常区间设置"), "m2mLimit");
|
||||
WeaTableColumn y2y = new WeaTableColumn("10%", SalaryI18nUtil.getI18nLabel(162991, "同比"), "y2y");
|
||||
WeaTableColumn y2yLimit = new WeaTableColumn("25%", SalaryI18nUtil.getI18nLabel(162992, "同比增幅正常区间设置"), "y2yLimit");
|
||||
WeaTableColumn ruleName = new WeaTableColumn("20%", SalaryI18nUtil.getI18nLabel(157532, "字符取值规则"), "ruleName");
|
||||
list.add(ruleName);
|
||||
list.add(ratio);
|
||||
list.add(m2m);
|
||||
list.add(m2mLimit);
|
||||
list.add(y2y);
|
||||
list.add(y2yLimit);
|
||||
weaTable.put("columns", list);
|
||||
|
||||
List<Map<String, Object>> result = new ArrayList<>();
|
||||
List<String> ruleList = Arrays.asList("count", "sum", "avg", "max", "min", "median");
|
||||
List<String> ruleList = Arrays.asList("count", "last");
|
||||
List<String> ruleNameList = Arrays.asList(
|
||||
SalaryI18nUtil.getI18nLabel(157268, "计数"),
|
||||
SalaryI18nUtil.getI18nLabel(157266, "求和"),
|
||||
SalaryI18nUtil.getI18nLabel(100132, "平均值"),
|
||||
SalaryI18nUtil.getI18nLabel(163001, "最大值"),
|
||||
SalaryI18nUtil.getI18nLabel(163002, "最小值"),
|
||||
SalaryI18nUtil.getI18nLabel(163003, "中位数"));
|
||||
SalaryI18nUtil.getI18nLabel(157266, "最近值"));
|
||||
if (salaryStatisticsItem == null) {
|
||||
for (int i = 0; i < ruleList.size(); i++) {
|
||||
Map<String, Object> rule = new HashMap<>();
|
||||
rule.put("id", ruleList.get(i));
|
||||
rule.put("ruleName", ruleNameList.get(i));
|
||||
rule.put("totalValue", 0);
|
||||
rule.put("ratioValue", 0);
|
||||
rule.put("m2mValue", 0);
|
||||
rule.put("m2mUpperLimit", "");
|
||||
rule.put("m2mLowerLimit", "");
|
||||
rule.put("y2yValue", 0);
|
||||
rule.put("y2yUpperLimit", "");
|
||||
rule.put("y2yLowerLimit", "");
|
||||
result.add(rule);
|
||||
}
|
||||
} else {
|
||||
for (int i = 0; i < ruleList.size(); i++) {
|
||||
Map<String, Object> rule = new HashMap<>();
|
||||
switch (ruleList.get(i)) {
|
||||
case "count":
|
||||
rule = JSON.parseObject(salaryStatisticsItem.getCountRule(), new HashMap<String, String>().getClass());
|
||||
break;
|
||||
case "sum":
|
||||
rule = JSON.parseObject(salaryStatisticsItem.getSumRule(), new HashMap<String, String>().getClass());
|
||||
break;
|
||||
case "avg":
|
||||
rule = JSON.parseObject(salaryStatisticsItem.getAvgRule(), new HashMap<String, String>().getClass());
|
||||
break;
|
||||
case "max":
|
||||
rule = JSON.parseObject(salaryStatisticsItem.getMaxRule(), new HashMap<String, String>().getClass());
|
||||
break;
|
||||
case "min":
|
||||
rule = JSON.parseObject(salaryStatisticsItem.getMinRule(), new HashMap<String, String>().getClass());
|
||||
break;
|
||||
case "median":
|
||||
rule = JSON.parseObject(salaryStatisticsItem.getMedianRule(), new HashMap<String, String>().getClass());
|
||||
case "last":
|
||||
rule = JSON.parseObject(salaryStatisticsItem.getLatestRule(), new HashMap<String, String>().getClass());
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
@ -237,14 +199,6 @@ public class SalaryStatisticsItemWrapper extends Service {
|
|||
}
|
||||
rule.put("id", ruleList.get(i));
|
||||
rule.put("ruleName", ruleNameList.get(i));
|
||||
rule.put("totalValue", Optional.ofNullable(rule.get("totalValue")).orElse(0));
|
||||
rule.put("ratioValue", Optional.ofNullable(rule.get("ratioValue")).orElse(0));
|
||||
rule.put("m2mValue", Optional.ofNullable(rule.get("m2mValue")).orElse(0));
|
||||
rule.put("m2mUpperLimit", Optional.ofNullable(rule.get("m2mUpperLimit")).orElse(""));
|
||||
rule.put("m2mLowerLimit", Optional.ofNullable(rule.get("m2mLowerLimit")).orElse(""));
|
||||
rule.put("y2yValue", Optional.ofNullable(rule.get("y2yValue")).orElse(0));
|
||||
rule.put("y2yUpperLimit", Optional.ofNullable(rule.get("y2yUpperLimit")).orElse(""));
|
||||
rule.put("y2yLowerLimit", Optional.ofNullable(rule.get("y2yLowerLimit")).orElse(""));
|
||||
result.add(rule);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue