From 6ad6f8e23de1532dba3d46d8fe6a15bd792d3637 Mon Sep 17 00:00:00 2001
From: lxw <810412026@qq.com>
Date: 星期一, 27 三月 2023 16:34:35 +0800
Subject: [PATCH] 管理员首页

---
 src/main/java/com/whyc/webSocket/HomeAdminSocket.java |   22 ++++++++++++++--------
 1 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/src/main/java/com/whyc/webSocket/HomeAdminSocket.java b/src/main/java/com/whyc/webSocket/HomeAdminSocket.java
index 3d7a0ed..c2aabf6 100644
--- a/src/main/java/com/whyc/webSocket/HomeAdminSocket.java
+++ b/src/main/java/com/whyc/webSocket/HomeAdminSocket.java
@@ -4,11 +4,9 @@
 import com.whyc.dto.Response;
 import com.whyc.pojo.Battinf;
 import com.whyc.pojo.PowerInf;
+import com.whyc.pojo.StationInf;
 import com.whyc.pojo.UserInf;
-import com.whyc.service.BadBattMonService;
-import com.whyc.service.BattInfService;
-import com.whyc.service.BatttestdataInfService;
-import com.whyc.service.PowerInfService;
+import com.whyc.service.*;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
@@ -40,6 +38,8 @@
 
     private static BattInfService battInfService;
 
+    private static StationInfService stationInfService;
+
     private static BadBattMonService badBattMonService;
 
 
@@ -65,6 +65,11 @@
     @Autowired
     public void setBatttestdataInfService(BatttestdataInfService batttestdataInfService) {
         HomeAdminSocket.batttestdataInfService = batttestdataInfService;
+    }
+
+    @Autowired
+    public void setStationInfService(StationInfService stationInfService) {
+        HomeAdminSocket.stationInfService = stationInfService;
     }
 
     @OnOpen
@@ -237,13 +242,14 @@
         //绔欑偣淇℃伅
         Response resStationAnalysis = new Response();
         try {
-            List<Battinf> battinfList = battInfService.getSateAnalysis(userId);
-            Map<Integer, List<Battinf>> nodeStationMap = battinfList.stream().collect(Collectors.groupingBy(Battinf::getNodeStation));
-            Map<String, List<Battinf>> stationTypeMap = battinfList.stream().collect(Collectors.groupingBy(Battinf::getStationType));
+            //List<Battinf> battinfList = battInfService.getSateAnalysis(userId);
+            List<StationInf> sinfList = stationInfService.getSateAnalysis(userId);
+            Map<Integer, List<StationInf>> nodeStationMap = sinfList.stream().collect(Collectors.groupingBy(StationInf::getNodeStation));
+            Map<String, List<StationInf>> stationTypeMap = sinfList.stream().collect(Collectors.groupingBy(StationInf::getStationType));
             Map<Integer, Object> nodeMap = new HashMap<>();
             Map<String, Object> stationMap = new HashMap<>();
             Map<String, Object> battGroupInfoMap = new HashMap<>();
-            int battSize = battinfList.size();
+            int battSize = sinfList.size();
             for (Integer node : nodeStationMap.keySet()) {
                 nodeMap.put(node, nodeStationMap.get(node).size());
             }

--
Gitblit v1.9.1