Browse Source

统计调整

lipenghui 2 weeks ago
parent
commit
47b115d690

+ 40 - 2
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/stat/IotStaticController.java

@@ -813,8 +813,28 @@ public class IotStaticController {
             fillData.add(v);
         });
 
+        iotDeviceRunLogPageReqVO.setPointName("累计注水量");
+        List<IotDeviceRunLogRespVO> waterDOs = iotDeviceRunLogMapper.selectListByCreateTimeAndDeptList(iotDeviceRunLogPageReqVO);
+        List<Map<String, Object>> waters = waterDOs
+                .stream().map(e -> {
+                    Map<String, Object> abc = new HashMap<>();
+                    abc.put("id", e.getId());
+                    abc.put("createTime", e.getCreateTime());
+                    abc.put("total", e.getTotalRunTime());
+                    abc.put("today", e.getFillContent());
+                    return abc;
+                }).collect(Collectors.toList());
+        LinkedHashMap<String, Long> waterMap = sumTotalByDate(waters, 7,"total");
+        LinkedList<Object> waterXAxis = new LinkedList<>();
+        LinkedList<Object> waterData = new LinkedList<>();
+        waterMap.forEach( (k,v)->{
+            waterXAxis.add(k);
+            waterData.add(v);
+        });
+
         ImmutableMap<String, Serializable> fillResult = ImmutableMap.of("name", "累计注气量", "data", fillData);
-        return success(ImmutableMap.of("xAxis", xAxis, "series", ImmutableList.of(fillResult)));
+        ImmutableMap<String, Serializable> waterResult = ImmutableMap.of("name", "累计注水量", "data", waterData);
+        return success(ImmutableMap.of("xAxis", xAxis, "series", ImmutableList.of(fillResult,waterResult)));
 
     }
     @GetMapping("/rh/zql/today/{dept}")
@@ -849,8 +869,26 @@ public class IotStaticController {
             fillData.add(v);
         });
 
+        iotDeviceRunLogPageReqVO.setPointName("当日注水量");
+        List<Map<String, Object>> waters = iotDeviceRunLogMapper.selectListByCreateTimeAndDeptList(iotDeviceRunLogPageReqVO).stream().map(e -> {
+            Map<String, Object> abc = new HashMap<>();
+            abc.put("id", e.getId());
+            abc.put("createTime", e.getCreateTime());
+            abc.put("total", e.getTotalRunTime());
+            abc.put("today", e.getFillContent());
+            return abc;
+        }).collect(Collectors.toList());
+        LinkedHashMap<String, Long> waterMap = sumTotalByDate(waters, 7,"today");
+        LinkedList<Object> waterxAxis = new LinkedList<>();
+        LinkedList<Object> waterData = new LinkedList<>();
+        waterMap.forEach( (k,v)->{
+            waterxAxis.add(k);
+            waterData.add(v);
+        });
+
         ImmutableMap<String, Serializable> fillResult = ImmutableMap.of("name", "当日注气量", "data", fillData);
-        return success(ImmutableMap.of("xAxis", xAxis, "series", ImmutableList.of(fillResult)));
+        ImmutableMap<String, Serializable> waterResult = ImmutableMap.of("name", "当日注水量", "data", waterData);
+        return success(ImmutableMap.of("xAxis", xAxis, "series", ImmutableList.of(fillResult, waterResult)));
 
     }
 }