From 45ef9e340f9bb4b98fd88a758343470dfe125cb3 Mon Sep 17 00:00:00 2001 From: whyclxw <810412026@qq.com> Date: 星期三, 07 五月 2025 17:12:48 +0800 Subject: [PATCH] 苏州地铁推送修改 --- src/main/java/com/whyc/mapper/DevalarmDataMapper.java | 2 + src/main/java/com/whyc/service/BattInfService.java | 30 ++++++++++++++ src/main/java/com/whyc/webSocket/ScreenForSZ2Socket.java | 8 +++ src/main/java/com/whyc/mapper/BattInfMapper.java | 2 + src/main/resources/mapper/DevalarmDataMapper.xml | 5 ++ src/main/resources/mapper/BattInfMapper.xml | 14 +++++++ 6 files changed, 59 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/whyc/mapper/BattInfMapper.java b/src/main/java/com/whyc/mapper/BattInfMapper.java index 9cdf6d1..223c72b 100644 --- a/src/main/java/com/whyc/mapper/BattInfMapper.java +++ b/src/main/java/com/whyc/mapper/BattInfMapper.java @@ -137,4 +137,6 @@ List<Battinf> getInfInStation(String stationId); //1缁熻鏈烘埧涓暟锛岃澶囦釜鏁帮紝鐢垫睜缁勪釜鏁�(鑻忓窞鍦伴搧) List<Battinf> getAllInfInSz2(Integer userId); + //鏌ヨbattinf琛ㄤ腑鎵�鏈夋満鎴夸俊鎭� + List<Battinf> getAllStationInSz2(Integer userId); } diff --git a/src/main/java/com/whyc/mapper/DevalarmDataMapper.java b/src/main/java/com/whyc/mapper/DevalarmDataMapper.java index e8ed9c8..036d447 100644 --- a/src/main/java/com/whyc/mapper/DevalarmDataMapper.java +++ b/src/main/java/com/whyc/mapper/DevalarmDataMapper.java @@ -45,4 +45,6 @@ List<DevalarmData> getListByStationIds(List<String> stationIdList); List<DevalarmData> getLevelListByUserId(int userId); + //鍒ゆ柇鏈烘埧涓嬬殑璁惧鍛婅鏄惁閮藉瓨鍦ㄩ�氳鍛婅 119020 + int judgeCommErr(@Param("stationId") String stationId,@Param("almType") int almType); } diff --git a/src/main/java/com/whyc/service/BattInfService.java b/src/main/java/com/whyc/service/BattInfService.java index 2c68e5f..06fc017 100644 --- a/src/main/java/com/whyc/service/BattInfService.java +++ b/src/main/java/com/whyc/service/BattInfService.java @@ -59,6 +59,9 @@ @Autowired(required = false) private BaoJiGroupBattGroupMapper bjBattMapper; + @Autowired(required = false) + private DevalarmDataMapper devAlmMapper; + public int searchMaxBattgroupId_zj() { Integer id = battInfMapper.getMaxBattGroupId_zj(); if (id == null) { @@ -989,7 +992,7 @@ int devNum=0; int battNum=0; try { - //鏌ヨbattinf琛ㄤ腑鎵�鏈夋満鎴夸俊鎭� + //鏌ヨbattinf琛ㄤ腑鎵�鏈夌數姹犵粍淇℃伅 List<Battinf> list=battInfMapper.getAllInfInSz2(userId); Map<String, List<Battinf>> ListMap = list.stream().collect(Collectors.groupingBy(Battinf::getStationName9)); for (String stationName9 : ListMap.keySet()) { @@ -1019,4 +1022,29 @@ } } + //4.涓棿鍦板浘 + public Response getAllStationInSz2(Integer userId) { + Map<String,Object> map=new HashMap<>(); + try { + //鏌ヨbattinf琛ㄤ腑鎵�鏈夋満鎴夸俊鎭� + List<Battinf> list=battInfMapper.getAllStationInSz2(userId); + Map<String, List<Battinf>> ListMap = list.stream().collect(Collectors.groupingBy(Battinf::getStationName9)); + for (String stationName9 : ListMap.keySet()) { + List<Battinf> name9List=ListMap.get(stationName9); + for (Battinf binf:name9List) { + //鍒ゆ柇鏈烘埧涓嬬殑璁惧鍛婅鏄惁閮藉瓨鍦ㄩ�氳鍛婅 119020 + int flag=devAlmMapper.judgeCommErr(binf.getStationId(),119020); + if(flag>0){ + binf.setNote("0"); + }else{ + binf.setNote("1"); + } + } + map.put(stationName9,name9List); + } + return new Response<>().setII(1,true,map,""); + } catch (Exception e) { + return new Response<>().set(1,false,""); + } + } } diff --git a/src/main/java/com/whyc/webSocket/ScreenForSZ2Socket.java b/src/main/java/com/whyc/webSocket/ScreenForSZ2Socket.java index 59dc4c3..e3ab15e 100644 --- a/src/main/java/com/whyc/webSocket/ScreenForSZ2Socket.java +++ b/src/main/java/com/whyc/webSocket/ScreenForSZ2Socket.java @@ -89,7 +89,7 @@ public Map<String, Object> getStatic(Integer userId) throws InterruptedException { Map<String, Object> res = new HashMap<>(); ThreadPoolExecutor poolExecutor = ThreadPoolExecutorFactory.getPoolExecutor(); - CountDownLatch latch = new CountDownLatch(3); + CountDownLatch latch = new CountDownLatch(4); poolExecutor.execute(()->{ //1缁熻鏈烘埧涓暟锛岃澶囦釜鏁帮紝鐢垫睜缁勪釜鏁� Response<Map> res_inf = battInfService.getAllInfInSz2(userId); @@ -108,6 +108,12 @@ res.put("res_battState", res_battState); latch.countDown(); }); + poolExecutor.execute(()->{ + //4.涓棿鍦板浘 + Response<Map> res_station = battInfService.getAllStationInSz2(userId); + res.put("res_station", res_station); + latch.countDown(); + }); latch.await(10, TimeUnit.MINUTES); return res; diff --git a/src/main/resources/mapper/BattInfMapper.xml b/src/main/resources/mapper/BattInfMapper.xml index 5d36881..ec5ed5a 100644 --- a/src/main/resources/mapper/BattInfMapper.xml +++ b/src/main/resources/mapper/BattInfMapper.xml @@ -774,4 +774,18 @@ and db_user.tb_user_inf.uid = db_user.tb_user_battgroup_baojigroup_usr.uid and db_user.tb_user_inf.uid = #{userId}) </select> + <select id="getAllStationInSz2" resultType="com.whyc.pojo.Battinf"> + select distinct stationId, stationName1,stationName2,stationName3,stationName5,stationName9 from db_battinf.tb_battinf + where StationId in (select distinct db_battinf.tb_battinf.StationId + from db_battinf.tb_battinf, + db_user.tb_user_battgroup_baojigroup_battgroup, + db_user.tb_user_battgroup_baojigroup_usr, + db_user.tb_user_inf + where db_user.tb_user_battgroup_baojigroup_battgroup.BattGroupId = + db_battinf.tb_battinf.BattGroupId + and db_user.tb_user_battgroup_baojigroup_usr.baoji_group_id = + db_user.tb_user_battgroup_baojigroup_battgroup.baoji_group_id + and db_user.tb_user_inf.uid = db_user.tb_user_battgroup_baojigroup_usr.uid + and db_user.tb_user_inf.uid = #{userId}) + </select> </mapper> \ No newline at end of file diff --git a/src/main/resources/mapper/DevalarmDataMapper.xml b/src/main/resources/mapper/DevalarmDataMapper.xml index 267973a..a456a3c 100644 --- a/src/main/resources/mapper/DevalarmDataMapper.xml +++ b/src/main/resources/mapper/DevalarmDataMapper.xml @@ -392,4 +392,9 @@ and db_user.tb_user_inf.uid=db_user.tb_user_battgroup_baojigroup_usr.uid and db_user.tb_user_inf.uid=#{userId} ) </select> + <select id="judgeCommErr" resultType="java.lang.Integer"> + select count(*) from db_alarm.tb_devalarm_data ,db_battinf.tb_battinf + WHERE tb_devalarm_data.dev_id=tb_battinf.FBSDeviceId + and alm_type=#{almType} and tb_battinf.stationid=#{stationId} + </select> </mapper> \ No newline at end of file -- Gitblit v1.9.1