From b1996cd1823d1fbd5c80f2f6d8f33db33a1bde18 Mon Sep 17 00:00:00 2001
From: whyclxw <810412026@qq.com>
Date: 星期二, 27 五月 2025 16:55:44 +0800
Subject: [PATCH] 实时监控页面推送top头部修改

---
 src/main/java/com/whyc/webSocket/RealTimeSocket.java |   23 ++++++++++++++++-------
 1 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/src/main/java/com/whyc/webSocket/RealTimeSocket.java b/src/main/java/com/whyc/webSocket/RealTimeSocket.java
index 35d0898..9e7576f 100644
--- a/src/main/java/com/whyc/webSocket/RealTimeSocket.java
+++ b/src/main/java/com/whyc/webSocket/RealTimeSocket.java
@@ -8,6 +8,7 @@
 import com.whyc.pojo.db_ram_db.BattRtstate;
 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_user.User;
 import com.whyc.service.*;
 import com.whyc.util.ActionUtil;
@@ -43,6 +44,8 @@
     //鏀剧數璁板綍
     private static BatttestdataInfService batttestdataInfService;
 
+    //鐢垫睜缁勪俊鎭�
+    private static BattInfService battInfService;
 
 
     private volatile boolean runFlag = true;
@@ -86,6 +89,11 @@
     @Autowired
     public void setBatttestdataInfService(BatttestdataInfService batttestdataInfService) {
         RealTimeSocket.batttestdataInfService = batttestdataInfService;
+    }
+
+    @Autowired
+    public void seBattInfService(BattInfService battInfService) {
+        RealTimeSocket.battInfService = battInfService;
     }
 
 
@@ -167,14 +175,11 @@
                     //鍓╀綑瀹归噺鍜屽墿浣欐椂闂磋绠�
                     Float restCap = batttestdataInfService.getLastTestDataRestCap(realDto.getBattgroupId());
                     topDto.setRestCap(restCap);
-                    /*Integer restTime= BattCapFactory.getTheoryTime(deviceState.getDevCaptestCurr(), battRtstate.getBattGroupCap(), battRtstate.getBattGroupCapStd());
-                    topDto.setRestTime(restTime);*/
+                    BattInf binf=battInfService.getBinfByBattgroupId(realDto.getBattgroupId());
+                    Float restTime= BattCapFactory.getTheoryTime(deviceState.getDevCaptestCurr(), restCap, binf.getMoncapstd());
+                    topDto.setRestTime(restTime);
                 }
-                //瀹炴椂鑾峰彇鐢垫簮淇℃伅
-                PwrdevAcdcdata pwrdevAcdcdata = pwrdevAcdcdataService.getPwrRealInfo(realDto.getPowerId());
-                if (pwrdevAcdcdata != null) {
-                    //topDto.setPwrState(pwrdevAcdcdata.getPwrState());
-                }
+
                 //鑾峰彇涓�绾ф湭澶勭悊瀹炴椂鍛婅鏁�
                 Integer battALmNum = battalarmDataService.getBattAlmNum(realDto.getBattgroupId());
                 topDto.setBattALmNum(battALmNum);
@@ -185,6 +190,10 @@
                 Integer pwrALmNum = pwrdevAlarmService.getPwrAlmNum(realDto.getPowerId());
                 topDto.setPwrALmNum(pwrALmNum);
 
+                //瀹炴椂鑾峰彇鐢垫簮淇℃伅(鏄惁瀛樺湪鐢垫簮鍛婅淇℃伅)
+                //PwrdevAcdcdata pwrdevAcdcdata = pwrdevAcdcdataService.getPwrRealInfo(realDto.getPowerId());
+                topDto.setPwrState((pwrALmNum > 0 ? 1 : 0));
+
                 Integer allALmNum = battALmNum + devALmNum + pwrALmNum;
                 topDto.setAllALmNum(allALmNum);
                 topDto.setSystemState((allALmNum > 0 ? 1 : 0));

--
Gitblit v1.9.1