| | |
| | | * @param rtuAddr |
| | | * @return |
| | | */ |
| | | public RtuStatus rtuStatus(String rtuAddr){ |
| | | public RtuStatus rtuStatus(String rtuAddr) throws Exception{ |
| | | //向通信中间件发关命令,查询部分RTU在线情况 |
| | | RtuStatus rtuStatus = null ; |
| | | Command com = this.createInnerCommand(CodeLocal.oneRtuStates); |
| | |
| | | if(bakParam != null){ |
| | | if(bakParam.getSuccess().booleanValue()){ |
| | | //通信中间件成功返回命令结果 |
| | | rtuStatus = JSON.parseObject(JSON.toJSONString(reCom.getAttachment()), RtuStatus.class); |
| | | if(reCom.getAttachment() != null){ |
| | | rtuStatus = JSON.parseObject(JSON.toJSONString(reCom.getAttachment()), RtuStatus.class); |
| | | }else{ |
| | | throw new Exception("通信中间件未掌握该RTU的状态,可能该RTU未上线") ; |
| | | } |
| | | } |
| | | }else{ |
| | | log.error("通信中间件返回内部命令结果中不包含CommandBackParam类型参数"); |
| | | throw new Exception("通信中间件执行命令出错") ; |
| | | } |
| | | }else{ |
| | | log.error("通信中间件返回内部命令执行失败" + (res.getMsg() == null? "" : ("," + res.getMsg()))) ; |
| | | throw new Exception("通信中间件执行命令出错" + (res.getMsg() == null? "" : ("," + res.getMsg()))) ; |
| | | } |
| | | }else{ |
| | | log.error("通信中间件返回内部命令结果为null"); |
| | | throw new Exception("通信中间件执行命令出错,返回内部命令结果为null") ; |
| | | } |
| | | return rtuStatus ; |
| | | } |