rev:向飞书推送图片:增加排序、占比
This commit is contained in:
@@ -277,6 +277,13 @@ public class AutoSendSalesIvt {
|
|||||||
resultList.add(resultJson);
|
resultList.add(resultJson);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 根据合计倒序排序
|
||||||
|
resultList = resultList.stream()
|
||||||
|
.sorted(Comparator.comparing(row -> row.getDoubleValue("day_sum")))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
Collections.reverse(resultList);
|
||||||
|
|
||||||
// 插入小计
|
// 插入小计
|
||||||
JSONObject jsonMin = new JSONObject();
|
JSONObject jsonMin = new JSONObject();
|
||||||
jsonMin.put("sales_man", "小计");
|
jsonMin.put("sales_man", "小计");
|
||||||
@@ -342,6 +349,29 @@ public class AutoSendSalesIvt {
|
|||||||
|
|
||||||
resultListAll.add(jsonSum);
|
resultListAll.add(jsonSum);
|
||||||
|
|
||||||
|
// 计算占比
|
||||||
|
JSONObject jsonPro = new JSONObject();
|
||||||
|
jsonPro.put("sales_man", "占比");
|
||||||
|
|
||||||
|
double day1_pro = NumberUtil.mul(NumberUtil.div(jsonSum.getDoubleValue("day1"), jsonSum.getDoubleValue("day_sum")), 100);
|
||||||
|
jsonPro.put("day1", NumberUtil.round(day1_pro, 2) + "%");
|
||||||
|
|
||||||
|
double day2_pro = NumberUtil.mul(NumberUtil.div(jsonSum.getDoubleValue("day2"), jsonSum.getDoubleValue("day_sum")), 100);
|
||||||
|
jsonPro.put("day2", NumberUtil.round(day2_pro, 2) + "%");
|
||||||
|
|
||||||
|
double day3_pro = NumberUtil.mul(NumberUtil.div(jsonSum.getDoubleValue("day3"), jsonSum.getDoubleValue("day_sum")), 100);
|
||||||
|
jsonPro.put("day3", NumberUtil.round(day3_pro, 2) + "%");
|
||||||
|
|
||||||
|
double day4_pro = NumberUtil.mul(NumberUtil.div(jsonSum.getDoubleValue("day4"), jsonSum.getDoubleValue("day_sum")), 100);
|
||||||
|
jsonPro.put("day4", NumberUtil.round(day4_pro, 2) + "%");
|
||||||
|
|
||||||
|
double day5_pro = NumberUtil.mul(NumberUtil.div(jsonSum.getDoubleValue("day5"), jsonSum.getDoubleValue("day_sum")), 100);
|
||||||
|
jsonPro.put("day5", NumberUtil.round(day5_pro, 2) + "%");
|
||||||
|
|
||||||
|
jsonPro.put("day_sum", "100%");
|
||||||
|
resultListAll.add(jsonPro);
|
||||||
|
|
||||||
|
|
||||||
JSONObject result = new JSONObject();
|
JSONObject result = new JSONObject();
|
||||||
result.put("data", resultListAll);
|
result.put("data", resultListAll);
|
||||||
resultSize.add(resultListAll.size()+1);
|
resultSize.add(resultListAll.size()+1);
|
||||||
|
|||||||
Reference in New Issue
Block a user