From e50d8c30b43dd30daa77da27101ce21d8ef2fcef Mon Sep 17 00:00:00 2001 From: whycxzp <glperry@163.com> Date: 星期一, 17 三月 2025 17:20:10 +0800 Subject: [PATCH] 锂电设备相关代码更新 --- src/main/java/com/whyc/webSocket/DevLithiumStatisticSocket.java | 34 +++++++++++++++++----------------- 1 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/main/java/com/whyc/webSocket/DevStaticSocket.java b/src/main/java/com/whyc/webSocket/DevLithiumStatisticSocket.java similarity index 70% rename from src/main/java/com/whyc/webSocket/DevStaticSocket.java rename to src/main/java/com/whyc/webSocket/DevLithiumStatisticSocket.java index 9f3f632..295a58d 100644 --- a/src/main/java/com/whyc/webSocket/DevStaticSocket.java +++ b/src/main/java/com/whyc/webSocket/DevLithiumStatisticSocket.java @@ -5,7 +5,7 @@ import com.whyc.factory.ThreadPoolExecutorFactory; import com.whyc.pojo.db_user.UserInf; import com.whyc.service.BattTestDataInfService; -import com.whyc.service.DevInfService; +import com.whyc.service.DevLithiumInfService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -23,28 +23,28 @@ * 宸︿晶鍒楄〃 */ @Component -@ServerEndpoint(value = "/staticSocket",encoders = WebSocketEncoder.class,configurator = WebSocketConfig.class) -public class DevStaticSocket{ +@ServerEndpoint(value = "/devLithiumStatistic",encoders = WebSocketEncoder.class,configurator = WebSocketConfig.class) +public class DevLithiumStatisticSocket { private Session session; private Thread thread; - private static DevInfService dinfService; + private static DevLithiumInfService devLithiumInfService; - private static BattTestDataInfService tinfService; + private static BattTestDataInfService battTestDataInfService; private HttpSession httpSession; @Autowired - public void setDevInfService(DevInfService dinfService) { - DevStaticSocket.dinfService = dinfService; + public void setDevLithiumInfService(DevLithiumInfService devLithiumInfService) { + DevLithiumStatisticSocket.devLithiumInfService = devLithiumInfService; } @Autowired - public void setBatttestdataInfService(BattTestDataInfService tinfService) { - DevStaticSocket.tinfService = tinfService; + public void setBattTestDataInfService(BattTestDataInfService battTestDataInfService) { + DevLithiumStatisticSocket.battTestDataInfService = battTestDataInfService; } @@ -59,7 +59,7 @@ public void run() { try { while (!currentThread().isInterrupted()) { - Response res = getDevStatic(userId); + Response res = getStatistics(userId); session.getBasicRemote().sendObject(res); sleep(4000); } @@ -72,27 +72,27 @@ this.thread = thread; } //鑾峰彇缁熻淇℃伅 - private Response getDevStatic(int userId) { + private Response getStatistics(int userId) { Map<String,Object> map=new HashMap<>(); try { ThreadPoolExecutor poolExecutor = ThreadPoolExecutorFactory.getPoolExecutor(); CountDownLatch latch = new CountDownLatch(3); //鍏呮斁鐢典竴浣撴満娴嬭瘯缁熻/閿傜數鍧囪 浠祴璇曠粺璁� poolExecutor.execute(() -> { - Map<String,Object> devTinfMap=tinfService.getDevTinfByYearMonth(userId); - map.put("devTinf",devTinfMap); + Map<String,Object> lithiumTestInfMap = battTestDataInfService.getDevTinfByYearMonth(userId); + map.put("lithiumTestInf",lithiumTestInfMap); latch.countDown(); }); //璁惧鍒嗙被鎬绘暟缁熻/璁惧鐘舵�佺粺璁�/鍦板浘淇℃伅 poolExecutor.execute(() -> { - Map<String,Object> devSaticMap=dinfService.getDevStaticByType(userId); - map.put("devSatic",devSaticMap); + Map<String,Object> devSaticMap=devLithiumInfService.getDevStaticByType(userId); + map.put("devLithiumStatistics",devSaticMap); latch.countDown(); }); //杩戜竴鍛ㄧ數姹犳祴璇曡秼鍔跨粺璁�(浠庡綋鍓嶆椂闂村紑濮�) poolExecutor.execute(() -> { - Map<String,Object> devTestByWeekMap=tinfService.getDevTinfByWeek(userId); - map.put("devTestByWeek",devTestByWeekMap); + Map<String,Object> devTestByWeekMap=battTestDataInfService.getDevTinfByWeek(userId); + map.put("devLithiumTestByWeek",devTestByWeekMap); latch.countDown(); }); latch.await(10, TimeUnit.MINUTES); -- Gitblit v1.9.1