whyclxw
2025-05-28 e787bc5515949320b1d3c6e521b9fee6b72c1d04
实时监控页面推送top头部修改
5个文件已修改
77 ■■■■■ 已修改文件
src/main/java/com/whyc/dto/Real/TopDto.java 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/mapper/BattInfMapper.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/service/PowerInfService.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/service/StationInfService.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/webSocket/RealTimeSocket.java 41 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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 = "";
    }
}
src/main/java/com/whyc/mapper/BattInfMapper.java
@@ -30,4 +30,5 @@
    //获取标称内阻(下拉)
    List<Float> getMonResByUid(@Param("uid") Integer uid);
}
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;
    }
}
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;
    }
}
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());