From e787bc5515949320b1d3c6e521b9fee6b72c1d04 Mon Sep 17 00:00:00 2001 From: whyclxw <810412026@qq.com> Date: 星期三, 28 五月 2025 13:32:50 +0800 Subject: [PATCH] 实时监控页面推送top头部修改 --- src/main/java/com/whyc/service/StationInfService.java | 8 ++++ src/main/java/com/whyc/webSocket/RealTimeSocket.java | 41 +++++++++++++++++++- src/main/java/com/whyc/service/PowerInfService.java | 9 ++++ src/main/java/com/whyc/mapper/BattInfMapper.java | 1 src/main/java/com/whyc/dto/Real/TopDto.java | 18 +++++++++ 5 files changed, 75 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/whyc/dto/Real/TopDto.java b/src/main/java/com/whyc/dto/Real/TopDto.java index 51b961e..558f932 100644 --- a/src/main/java/com/whyc/dto/Real/TopDto.java +++ b/src/main/java/com/whyc/dto/Real/TopDto.java @@ -22,6 +22,15 @@ private Float restCap; //棰勪及鍓╀綑瀹归噺 private Float restTime; //棰勪及鍓╀綑缁埅鏃堕棿 private String recordtime; //鏇存柊鏃堕棿 + private String stationName; + private String provice; + private String city; + private String county; + private String fullName; + private String powerName; + private String devName; + private String battGroupName; + public TopDto() { this.systemState = 0; @@ -33,6 +42,7 @@ this.battALmNum = 0; this.devALmNum = 0; this.pwrALmNum = 0; + this.allALmNum = 0; this.captestGroupvol = 0.0f; this.captestCurr = 0.0f; this.captestTimelong = 0; @@ -41,5 +51,13 @@ this.restTime = 0.0f; this.allALmNum = 0; this.recordtime = "1972-01-01 00:00:00"; + this.stationName = ""; + this.provice = ""; + this.city = ""; + this.county = ""; + this.fullName = ""; + this.powerName = ""; + this.devName = ""; + this.battGroupName = ""; } } \ No newline at end of file diff --git a/src/main/java/com/whyc/mapper/BattInfMapper.java b/src/main/java/com/whyc/mapper/BattInfMapper.java index cb81c69..f38de0f 100644 --- a/src/main/java/com/whyc/mapper/BattInfMapper.java +++ b/src/main/java/com/whyc/mapper/BattInfMapper.java @@ -30,4 +30,5 @@ //鑾峰彇鏍囩О鍐呴樆(涓嬫媺) List<Float> getMonResByUid(@Param("uid") Integer uid); + } \ No newline at end of file diff --git a/src/main/java/com/whyc/service/PowerInfService.java b/src/main/java/com/whyc/service/PowerInfService.java index 321d3ff..05cbad6 100644 --- a/src/main/java/com/whyc/service/PowerInfService.java +++ b/src/main/java/com/whyc/service/PowerInfService.java @@ -10,6 +10,7 @@ import com.whyc.mapper.BaojigroupUsrMapper; import com.whyc.mapper.PowerInfMapper; import com.whyc.mapper.StationInfMapper; +import com.whyc.pojo.db_station.BattInf; import com.whyc.pojo.db_station.PowerInf; import com.whyc.pojo.db_station.StationInf; import com.whyc.pojo.db_user.BaojigroupPower; @@ -131,4 +132,12 @@ List<String> list=mapper.getProtocolByUid(uid); return new Response().setII(1,list.size()>0,list,"鑾峰彇鐢垫簮鍗忚(涓嬫媺)"); } + //鑾峰彇鐢垫簮淇℃伅 + public PowerInf getPowerInfById(Integer powerId) { + QueryWrapper wrapper=new QueryWrapper(); + wrapper.eq("power_id",powerId); + wrapper.last("limit 1"); + PowerInf pinf=mapper.selectOne(wrapper); + return pinf; + } } \ No newline at end of file diff --git a/src/main/java/com/whyc/service/StationInfService.java b/src/main/java/com/whyc/service/StationInfService.java index 4ff5732..0f58f61 100644 --- a/src/main/java/com/whyc/service/StationInfService.java +++ b/src/main/java/com/whyc/service/StationInfService.java @@ -63,4 +63,12 @@ PageInfo<StationInf> pageInfo=new PageInfo<>(list); return new Response().setII(1,list.size()>0,pageInfo,"绔欑偣淇℃伅缁熻"); } + //鑾峰彇鏈烘埧淇℃伅 + public StationInf getStationInfById(Integer stationId) { + QueryWrapper wrapper=new QueryWrapper(); + wrapper.eq("station_id",stationId); + wrapper.last("limit 1"); + StationInf sinf=mapper.selectOne(wrapper); + return sinf; + } } \ No newline at end of file diff --git a/src/main/java/com/whyc/webSocket/RealTimeSocket.java b/src/main/java/com/whyc/webSocket/RealTimeSocket.java index 03d4d39..ac98303 100644 --- a/src/main/java/com/whyc/webSocket/RealTimeSocket.java +++ b/src/main/java/com/whyc/webSocket/RealTimeSocket.java @@ -9,6 +9,8 @@ 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_station.PowerInf; +import com.whyc.pojo.db_station.StationInf; import com.whyc.pojo.db_user.User; import com.whyc.service.*; import com.whyc.util.ActionUtil; @@ -47,6 +49,12 @@ //鐢垫睜缁勪俊鎭� private static BattInfService battInfService; + + //鏈烘埧淇℃伅 + private static StationInfService stationInfService; + + //鐢垫簮淇℃伅 + private static PowerInfService powerInfService; private volatile boolean runFlag = true; @@ -93,8 +101,18 @@ } @Autowired - public void seBattInfService(BattInfService battInfService) { + public void setBattInfService(BattInfService battInfService) { RealTimeSocket.battInfService = battInfService; + } + + @Autowired + public void setStationInfService(StationInfService stationInfService) { + RealTimeSocket.stationInfService = stationInfService; + } + + @Autowired + public void setPowerInfService(PowerInfService powerInfService) { + RealTimeSocket.powerInfService = powerInfService; } @@ -165,6 +183,26 @@ topDto.setOnlineVol(battRtstate.getOnlineVol()); topDto.setRecordtime(ThreadLocalUtil.format(battRtstate.getRecDatetime(),1)); } + //瀹炴椂鑾峰彇鐢垫睜缁勪俊鎭� + BattInf binf=battInfService.getBinfByBattgroupId(realDto.getBattgroupId()); + if(binf!=null){ + topDto.setBattGroupName(binf.getBattgroupName()); + topDto.setDevName(binf.getDevName()); + } + //鑾峰彇鏈烘埧淇℃伅 + StationInf stationInf = stationInfService.getStationInfById(binf.getStationId()); + if(stationInf!=null){ + topDto.setStationName(stationInf.getStationName()); + topDto.setProvice(stationInf.getProvice()); + topDto.setCity(stationInf.getCity()); + topDto.setCounty(stationInf.getCountry()); + topDto.setFullName(stationInf.getFullName()); + } + //鑾峰彇鐢垫簮淇℃伅 + PowerInf powerInf = powerInfService.getPowerInfById(binf.getPowerId()); + if(powerInf!=null){ + topDto.setPowerName(powerInf.getPowerName()); + } //瀹炴椂鑾峰彇璁惧淇℃伅 DeviceState deviceState = deviceStateService.getDevRealInfo(realDto.getDevId()); if (deviceState != null) { @@ -177,7 +215,6 @@ //鍓╀綑瀹归噺鍜屽墿浣欐椂闂磋绠� Float restCap = batttestdataInfService.getLastTestDataRestCap(realDto.getBattgroupId()); topDto.setRestCap(restCap); - BattInf binf=battInfService.getBinfByBattgroupId(realDto.getBattgroupId()); //瀹炴椂缁勭鐢垫祦锛屽墿浣欏閲忥紝鏍囩О瀹归噺 if(battRtstate!=null){ Float restTime= BattCapFactory.getTheoryTime(battRtstate.getGroupCurr(), restCap, binf.getMoncapstd()); -- Gitblit v1.9.1