From e787bc5515949320b1d3c6e521b9fee6b72c1d04 Mon Sep 17 00:00:00 2001
From: whyclxw <810412026@qq.com>
Date: 星期三, 28 五月 2025 13:32:50 +0800
Subject: [PATCH] 实时监控页面推送top头部修改

---
 src/main/java/com/whyc/webSocket/RealTimeSocket.java |   41 +++++++++++++++++++++++++++++++++++++++--
 1 files changed, 39 insertions(+), 2 deletions(-)

diff --git a/src/main/java/com/whyc/webSocket/RealTimeSocket.java b/src/main/java/com/whyc/webSocket/RealTimeSocket.java
index 03d4d39..ac98303 100644
--- a/src/main/java/com/whyc/webSocket/RealTimeSocket.java
+++ b/src/main/java/com/whyc/webSocket/RealTimeSocket.java
@@ -9,6 +9,8 @@
 import com.whyc.pojo.db_ram_db.DeviceState;
 import com.whyc.pojo.db_ram_db.PwrdevAcdcdata;
 import com.whyc.pojo.db_station.BattInf;
+import com.whyc.pojo.db_station.PowerInf;
+import com.whyc.pojo.db_station.StationInf;
 import com.whyc.pojo.db_user.User;
 import com.whyc.service.*;
 import com.whyc.util.ActionUtil;
@@ -47,6 +49,12 @@
 
     //鐢垫睜缁勪俊鎭�
     private static BattInfService battInfService;
+
+    //鏈烘埧淇℃伅
+    private static StationInfService stationInfService;
+
+    //鐢垫簮淇℃伅
+    private static PowerInfService powerInfService;
 
 
     private volatile boolean runFlag = true;
@@ -93,8 +101,18 @@
     }
 
     @Autowired
-    public void seBattInfService(BattInfService battInfService) {
+    public void setBattInfService(BattInfService battInfService) {
         RealTimeSocket.battInfService = battInfService;
+    }
+
+    @Autowired
+    public void setStationInfService(StationInfService stationInfService) {
+        RealTimeSocket.stationInfService = stationInfService;
+    }
+
+    @Autowired
+    public void setPowerInfService(PowerInfService powerInfService) {
+        RealTimeSocket.powerInfService = powerInfService;
     }
 
 
@@ -165,6 +183,26 @@
                 topDto.setOnlineVol(battRtstate.getOnlineVol());
                 topDto.setRecordtime(ThreadLocalUtil.format(battRtstate.getRecDatetime(),1));
             }
+            //瀹炴椂鑾峰彇鐢垫睜缁勪俊鎭�
+            BattInf binf=battInfService.getBinfByBattgroupId(realDto.getBattgroupId());
+            if(binf!=null){
+                topDto.setBattGroupName(binf.getBattgroupName());
+                topDto.setDevName(binf.getDevName());
+            }
+            //鑾峰彇鏈烘埧淇℃伅
+            StationInf stationInf = stationInfService.getStationInfById(binf.getStationId());
+            if(stationInf!=null){
+                topDto.setStationName(stationInf.getStationName());
+                topDto.setProvice(stationInf.getProvice());
+                topDto.setCity(stationInf.getCity());
+                topDto.setCounty(stationInf.getCountry());
+                topDto.setFullName(stationInf.getFullName());
+            }
+            //鑾峰彇鐢垫簮淇℃伅
+            PowerInf powerInf = powerInfService.getPowerInfById(binf.getPowerId());
+            if(powerInf!=null){
+                topDto.setPowerName(powerInf.getPowerName());
+            }
             //瀹炴椂鑾峰彇璁惧淇℃伅
             DeviceState deviceState = deviceStateService.getDevRealInfo(realDto.getDevId());
             if (deviceState != null) {
@@ -177,7 +215,6 @@
                     //鍓╀綑瀹归噺鍜屽墿浣欐椂闂磋绠�
                     Float restCap = batttestdataInfService.getLastTestDataRestCap(realDto.getBattgroupId());
                     topDto.setRestCap(restCap);
-                    BattInf binf=battInfService.getBinfByBattgroupId(realDto.getBattgroupId());
                     //瀹炴椂缁勭鐢垫祦锛屽墿浣欏閲忥紝鏍囩О瀹归噺
                     if(battRtstate!=null){
                         Float restTime= BattCapFactory.getTheoryTime(battRtstate.getGroupCurr(), restCap, binf.getMoncapstd());

--
Gitblit v1.9.1