From 813b1e0a24b1d7ba70b3929d4e7f90d99c2241a2 Mon Sep 17 00:00:00 2001 From: whycxzp <glperry@163.com> Date: 星期六, 09 三月 2024 11:35:51 +0800 Subject: [PATCH] 南网昆明首页接口 --- src/main/java/com/whyc/webSocket/ScreenForNWKMSocket.java | 23 ++++++++++++++++++----- 1 files changed, 18 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/whyc/webSocket/ScreenForNWKMSocket.java b/src/main/java/com/whyc/webSocket/ScreenForNWKMSocket.java index 1bf2ee8..9acf323 100644 --- a/src/main/java/com/whyc/webSocket/ScreenForNWKMSocket.java +++ b/src/main/java/com/whyc/webSocket/ScreenForNWKMSocket.java @@ -94,10 +94,10 @@ @OnOpen public void onOpen(Session session, EndpointConfig config){ this.session = session; - HttpSession httpSession = (HttpSession) config.getUserProperties().get("httpSession"); - UserInf user = (UserInf) httpSession.getAttribute("user"); - final int userId = user.getUId().intValue(); - //final int userId = 1001; + //HttpSession httpSession = (HttpSession) config.getUserProperties().get("httpSession"); + //UserInf user = (UserInf) httpSession.getAttribute("user"); + //final int userId = user.getUId().intValue(); + final int userId = 1001; Thread thread = new Thread() { @Override public void run() { @@ -105,7 +105,7 @@ Map<String, Object> res = new HashMap<>(); while (!currentThread().isInterrupted()) { ThreadPoolExecutor poolExecutor = ThreadPoolExecutorFactory.getPoolExecutor(); - CountDownLatch latch = new CountDownLatch(9); + CountDownLatch latch = new CountDownLatch(10); poolExecutor.execute(()->{ //1.缁熻:鐢垫睜缁熻 鍒嗕负鍝佺墝鍜屾爣绉扮數鍘� Response res_battGroupInfo = new Response(); @@ -222,6 +222,19 @@ res.put("devAlarmNum", res_devAlarmNum); latch.countDown(); }); + poolExecutor.execute(()->{ + //9-2.缁熻:鍛婅缁熻 绾у埆缁熻 + Response res_alarmLevel = new Response(); + Map<String, Integer> devAlarmNumMap = new HashMap<>(); + try { + Response alarmsCountByLevel = battAlarmDataService.getByLevel(userId); + res_alarmLevel.setII(1,true,alarmsCountByLevel,null); + }catch (Exception e){ + res_alarmLevel.set(1,false,"鍙戠敓寮傚父:"+e.getCause()); + } + res.put("alarmsLevel", res_alarmLevel); + latch.countDown(); + }); latch.await(10, TimeUnit.MINUTES); session.getBasicRemote().sendObject(new Response().set(1, res)); -- Gitblit v1.9.1