liurunyu
2024-12-05 267e622c876bea09b61af34fc93cd08b022aa423
pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/monitor/MonitorSv.java
@@ -5,6 +5,7 @@
import com.alibaba.fastjson2.JSONObject;
import com.dy.common.mw.protocol.Command;
import com.dy.common.mw.protocol.CommandBackParam;
import com.dy.common.mw.protocol.rtuState.RtuStatus;
import com.dy.common.webUtil.BaseResponse;
import com.dy.common.webUtil.QueryResultVo;
import com.dy.pipIrrGlobal.daoPr.PrIntakeMapper;
@@ -56,6 +57,39 @@
    }
    /**
     * 查询RTU在通信中间件中的支行状态
     * @param rtuAddr
     * @return
     */
    public RtuStatus rtuStatus(String rtuAddr){
        //向通信中间件发关命令,查询部分RTU在线情况
        RtuStatus rtuStatus = null ;
        Command com = this.createInnerCommand(CodeLocal.oneRtuStates);
        com.setParam(rtuAddr) ;
        String rqUrl = this.get2MwRequestUrl(this.env, ContextComSend) ;
        BaseResponse res = sendPostRequest2Mw(restTemplate, rqUrl, com) ;
        if(res != null){
            if(res.isSuccess()){
                Command reCom = JSON.parseObject(res.getContent() == null ? null : JSON.toJSONString(res.getContent()), Command.class) ;
                CommandBackParam bakParam = JSON.parseObject((reCom== null || reCom.param == null) ? null : JSON.toJSONString(reCom.param), CommandBackParam.class) ;
                if(bakParam != null){
                    if(bakParam.getSuccess().booleanValue()){
                        //通信中间件成功返回命令结果
                        rtuStatus = JSON.parseObject(JSON.toJSONString(reCom.getAttachment()), RtuStatus.class);
                    }
                }else{
                    log.error("通信中间件返回内部命令结果中不包含CommandBackParam类型参数");
                }
            }else{
                log.error("通信中间件返回内部命令执行失败" + (res.getMsg() == null? "" : ("," + res.getMsg()))) ;
            }
        }else{
            log.error("通信中间件返回内部命令结果为null");
        }
        return rtuStatus ;
    }
    /**
     * 查询取水口,不限制在线与离线状态
     * @param vo
     * @return