whyclxw
5 天以前 35030ce30b625cec394adee29b89d0b07352763a
src/main/java/com/whyc/webSocket/RealTimeSocket.java
@@ -1,7 +1,9 @@
package com.whyc.webSocket;
import com.whyc.config.WebSocketConfig;
import com.whyc.constant.BattStateEnum;
import com.whyc.constant.DevStateEnum;
import com.whyc.constant.FailReasonEnum;
import com.whyc.constant.StopReasonEnum;
import com.whyc.dto.Real.SticRealRtdataDto;
import com.whyc.dto.Real.TopDto;
@@ -203,6 +205,7 @@
            BattRtstate battRtstate = battRtstateService.getBattRealInfo(realDto.getBattgroupId());
            if (battRtstate != null) {
                topDto.setBattState(battRtstate.getBattState());
                topDto.setBattStateName(BattStateEnum.getValue(battRtstate.getBattState()));
                topDto.setVbusVol(battRtstate.getVbusVol());
                topDto.setOnlineVol(battRtstate.getOnlineVol());
                topDto.setRecordtime(ThreadLocalUtil.format(battRtstate.getRecDatetime(),1));
@@ -231,6 +234,7 @@
            DeviceState deviceState = deviceStateService.getDevRealInfo(realDto.getDevId());
            if (deviceState != null) {
                topDto.setDevState(deviceState.getDevWorkstate());
                topDto.setDevStateName(DevStateEnum.getValue(deviceState.getDevWorkstate()));
                if (deviceState.getDevWorkstate() == DevStateEnum.DEVSTATE_2.getStateId()) {//核容放电
                    topDto.setCaptestGroupvol(deviceState.getDevCaptestGroupvol());
                    topDto.setCaptestCurr(deviceState.getDevCaptestCurr());
@@ -257,12 +261,19 @@
                topDto.setPwrALmNum(pwrALmNum);
                //实时获取电源信息(是否存在电源告警信息)
                //PwrdevAcdcdata pwrdevAcdcdata = pwrdevAcdcdataService.getPwrRealInfo(realDto.getPowerId());
                topDto.setPwrState((pwrALmNum > 0 ? 1 : 0));
                PwrdevAcdcdata pwrdevAcdcdata = pwrdevAcdcdataService.getPwrRealInfo(realDto.getPowerId());
                topDto.setPwrState(pwrdevAcdcdata.getIsJunCharge());
                //查看当前是否存在交流停电告警(is_jun_charge   电源是否均充[1-均充 0-浮充],若当前电源存在交流停电告警则显示停电其他按照状态展示。)
                int stopFalg=pwrdevAlarmService.judge3100014(realDto.getPowerId());
                if(stopFalg==1){
                    topDto.setPwrStateName("停电");
                }else{
                    topDto.setPwrStateName((pwrdevAcdcdata.getIsJunCharge()==1 ? "均充" : "浮充"));
                }
                Integer allALmNum = battALmNum + devALmNum + pwrALmNum;
                topDto.setAllALmNum(allALmNum);
                topDto.setSystemState((allALmNum > 0 ? 1 : 0));
                topDto.setSystemStateName((allALmNum > 0 ? "系统异常" : "系统正常"));
            }
            return new Response().setII(1, true, topDto, "实时页面头部数据推送");
        } catch (Exception e) {
@@ -291,7 +302,7 @@
    private Response getManagePage(RealTimeDto realDto) {
        Map<String, Object> map=new HashMap<>();
        try {
            StationInf sinf=stationInfService.getStationInfById(realDto.getStaitonId());
            StationInf sinf=stationInfService.getStationInfById(realDto.getStationId());
            map.put("sinf",sinf);
            PowerInf pinf=powerInfService.getPowerInfById(realDto.getPowerId());
            map.put("pinf",pinf);
@@ -439,6 +450,9 @@
            //实时获取电源信息
            PwrdevAcdcdata pwrdevAcdcdata = pwrdevAcdcdataService.getPwrRealInfo(realDto.getPowerId());
            map.put("pwrdevAcdcdata",pwrdevAcdcdata!=null?pwrdevAcdcdata:"");
            //电源对象(整流器使用情况)
            PowerInf powerInf = powerInfService.getPowerInfById(realDto.getPowerId());
            map.put("powerInf",powerInf!=null?powerInf:"");
            map.put("pageType",realDto.getPageType());
            return new Response().setII(1,true,map,"电源界面信息推送");
        }catch (Exception e){
@@ -454,6 +468,7 @@
            BattRtstate battRtstate = battRtstateService.getBattRealInfo(realDto.getBattgroupId());
            if(battRtstate!=null){
                battRtstate.setLastCaptestStopTypeReason(StopReasonEnum.getValue(battRtstate.getLastCaptestStopType()));
                battRtstate.setControlFailTypeReason(FailReasonEnum.getValue(battRtstate.getControlFailType()));
            }
            map.put("battRtstate",battRtstate!=null?battRtstate:"");
            //实时获取设备信息