From 60eefffd2a9a32d870d554a3790bd68c5546cdf3 Mon Sep 17 00:00:00 2001
From: whyclxw <810412026@qq.com>
Date: 星期四, 16 一月 2025 11:03:27 +0800
Subject: [PATCH] 首页统计

---
 src/main/java/com/whyc/webSocket/HomeSocket.java |   54 +++++++++++++++---------------------------------------
 1 files changed, 15 insertions(+), 39 deletions(-)

diff --git a/src/main/java/com/whyc/webSocket/HomeSocket.java b/src/main/java/com/whyc/webSocket/HomeSocket.java
index e1d08e7..fa098aa 100644
--- a/src/main/java/com/whyc/webSocket/HomeSocket.java
+++ b/src/main/java/com/whyc/webSocket/HomeSocket.java
@@ -36,26 +36,16 @@
 
     private HttpSession httpSession;
 
-    private static LockCtlLogService ctlLogService;
 
     private static AreaInfService ainfService;
 
-    private static LockInfService lockInfService;
 
-    @Autowired
-    public void setLockCtlLogService(LockCtlLogService ctlLogService) {
-        HomeSocket.ctlLogService = ctlLogService;
-    }
 
     @Autowired
     public void setAreaInfServicee(AreaInfService ainfService) {
         HomeSocket.ainfService = ainfService;
     }
 
-    @Autowired
-    public void setLockInfService(LockInfService lockInfService) {
-        HomeSocket.lockInfService = lockInfService;
-    }
 
     @OnOpen
     public void onOpen(Session session, EndpointConfig config) {
@@ -65,7 +55,7 @@
 
     @OnMessage
     public void onMessage(Session session, String message){
-       UserInf user = (UserInf) this.httpSession.getAttribute("user");
+        UserInf user = (UserInf) this.httpSession.getAttribute("user");
         final int userId = user.getUid();
         final int urole = user.getUrole();
         Thread thread = new Thread() {
@@ -75,11 +65,11 @@
                     Map<String, Object> res = new HashMap<>();
                     while (!currentThread().isInterrupted()) {
                         ThreadPoolExecutor poolExecutor = ThreadPoolExecutorFactory.getPoolExecutor();
-                        CountDownLatch latch = new CountDownLatch(7);
-                        //鍒嗙粍缁熻鍓�10寮�閿佹鏁�
+                        CountDownLatch latch = new CountDownLatch(5);
                         poolExecutor.execute(() -> {
-                            Response resGroupCtlCount = ainfService.getGroupCtlCount(userId,urole);
-                            res.put("resGroupCtlCount", resGroupCtlCount);
+                            //閿佺殑宸ヤ綔鐘舵��
+                            Response resLockState = ainfService.getLockState(userId,urole);
+                            res.put("resLockState", resLockState);
                             latch.countDown();
                         });
                         poolExecutor.execute(() -> {
@@ -89,39 +79,25 @@
                             latch.countDown();
                         });
                         poolExecutor.execute(() -> {
-                            //绔欑偣淇℃伅
-                            Response resStationAnalysis = new Response();
-
-                            res.put("resStationAnalysis", resStationAnalysis);
+                            //lock鐨勪娇鐢ㄩ娆�
+                            Response resReport = ainfService.getReport(userId,urole);
+                            res.put("resReport", resReport);
                             latch.countDown();
                         });
                         poolExecutor.execute(() -> {
-                            //涓嶅悓鍝佺墝鍚屼竴鏃堕棿鍝佽川鍜屽悓鍝佺墝鍚屾椂闂村搧璐�
-                            Response resProductQuaAnalysis = new Response();
-                            res.put("resProductQuaAnalysis", resProductQuaAnalysis);
+                            //瀹炴椂寮�閿佷俊鎭�(澶辫触)
+                            Response resErrorCtlLog =  ainfService.getErrorCtlog(userId,urole);
+                            res.put("resErrorCtlLog", resErrorCtlLog);
                             latch.countDown();
                         });
                         poolExecutor.execute(() -> {
-                            //鐢垫睜淇℃伅
-                            Response res_battGroupInfo = new Response();
-                            res.put("battGroupInfo", res_battGroupInfo);
-                            latch.countDown();
-                        });
-                        poolExecutor.execute(() -> {
-                            //鐢垫簮淇℃伅
-                            Response resPwrdevInfAnalysis = new Response();
-
-                            res.put("resPwrdevInfAnalysis", resPwrdevInfAnalysis);
-                            latch.countDown();
-                        });
-                        poolExecutor.execute(() -> {
-                            //娴嬭瘯淇℃伅
-                            Response resTestdataInfAnalysis = new Response();
-                            res.put("resTestdataInfAnalysis", resTestdataInfAnalysis);
+                            //瀹炴椂寮�閿佷俊鎭�(鍏ㄩ儴)
+                            Response resAllCtlLog = ainfService.getAllCtlLog(userId,urole);
+                            res.put("resAllCtlLog", resAllCtlLog);
                             latch.countDown();
                         });
                         latch.await(10, TimeUnit.MINUTES);
-                        session.getBasicRemote().sendObject(new Response().set(1, res));
+                        session.getBasicRemote().sendObject(res);
                         sleep(5000);
                     }
                 } catch (Exception e) {

--
Gitblit v1.9.1