|
@@ -271,20 +271,22 @@ public class StockWaterServiceImpl extends ServiceImpl<StockWaterMapper, StockWa
|
|
|
|
|
|
|
|
|
|
|
|
- Collection<Map<String, Object>> values = list.stream().collect(Collectors.toMap(
|
|
|
- item -> item.get("supplierId").toString(),
|
|
|
- item -> {
|
|
|
- Map<String, Object> map = new HashMap<>();
|
|
|
- map.put("supplierId", item.get("supplierId"));
|
|
|
- map.put("supplierName", item.get("supplierName"));
|
|
|
- map.put("money", ((BigDecimal) item.get("money")).setScale(2, RoundingMode.HALF_UP));
|
|
|
- return map;
|
|
|
- },
|
|
|
- (v1, v2) -> {
|
|
|
- v1.put("money", ((BigDecimal) v1.get("money")).add((BigDecimal) v2.get("money")));
|
|
|
- return v1;
|
|
|
- }
|
|
|
- )).values();
|
|
|
+ List<Map<String, Object>> values = list.stream().collect(Collectors.toMap(
|
|
|
+ item -> item.get("supplierId").toString(),
|
|
|
+ item -> {
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ map.put("supplierId", item.get("supplierId"));
|
|
|
+ map.put("supplierName", item.get("supplierName"));
|
|
|
+ map.put("money", ((BigDecimal) item.get("money")).setScale(2, RoundingMode.HALF_UP));
|
|
|
+ return map;
|
|
|
+ },
|
|
|
+ (v1, v2) -> {
|
|
|
+ v1.put("money", ((BigDecimal) v1.get("money")).add((BigDecimal) v2.get("money")));
|
|
|
+ return v1;
|
|
|
+ }
|
|
|
+ )).values().stream()
|
|
|
+ .sorted(Comparator.comparing((Map<String, Object> v) -> ((BigDecimal) v.get("money"))).reversed())
|
|
|
+ .collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
0 全部公司统计
|
|
@@ -294,24 +296,26 @@ public class StockWaterServiceImpl extends ServiceImpl<StockWaterMapper, StockWa
|
|
|
4 5~20万
|
|
|
5 5万以下
|
|
|
*/
|
|
|
- Map<String, List<Map<String, Object>>> map = values.stream().collect(Collectors.groupingBy(item -> {
|
|
|
- BigDecimal money = (BigDecimal) item.get("money");
|
|
|
- if (money.compareTo(new BigDecimal("50000")) < 0) {
|
|
|
- return "5";
|
|
|
- }
|
|
|
- if (money.compareTo(new BigDecimal("100000")) > 0) {
|
|
|
- return "4";
|
|
|
- }
|
|
|
- if (money.compareTo(new BigDecimal("200000")) > 0) {
|
|
|
- return "3";
|
|
|
- }
|
|
|
- if (money.compareTo(new BigDecimal("500000")) > 0) {
|
|
|
- return "4";
|
|
|
- }
|
|
|
- return "5";
|
|
|
- }));
|
|
|
+ Map<String, List<Map<String, Object>>> map = values.stream()
|
|
|
+
|
|
|
+ .collect(Collectors.groupingBy(item -> {
|
|
|
+ BigDecimal money = (BigDecimal) item.get("money");
|
|
|
+ if (money.compareTo(new BigDecimal("50000")) < 0) {
|
|
|
+ return "5";
|
|
|
+ }
|
|
|
+ if (money.compareTo(new BigDecimal("100000")) < 0) {
|
|
|
+ return "4";
|
|
|
+ }
|
|
|
+ if (money.compareTo(new BigDecimal("200000")) < 0) {
|
|
|
+ return "3";
|
|
|
+ }
|
|
|
+ if (money.compareTo(new BigDecimal("500000")) < 0) {
|
|
|
+ return "2";
|
|
|
+ }
|
|
|
+ return "1";
|
|
|
+ }));
|
|
|
|
|
|
- map.put("0", new ArrayList<>(values));
|
|
|
+ map.put("0", values);
|
|
|
map.putIfAbsent("1", new ArrayList<>());
|
|
|
map.putIfAbsent("2", new ArrayList<>());
|
|
|
map.putIfAbsent("3", new ArrayList<>());
|