| | |
| | | import com.dy.common.webUtil.QueryResultVo; |
| | | import com.dy.pipIrrGlobal.daoPr.PrIntakeMapper; |
| | | import com.dy.pipIrrGlobal.rtuMw.CodeLocal; |
| | | import com.dy.pipIrrGlobal.rtuMw.ToRtuMwCom; |
| | | import com.dy.pipIrrGlobal.rtuMw.Web2RtuMw; |
| | | import com.dy.pipIrrGlobal.voPr.VoOnLineIntake; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.dubbo.common.utils.PojoUtils; |
| | |
| | | */ |
| | | @Slf4j |
| | | @Service |
| | | public class MonitorSv extends ToRtuMwCom { |
| | | public class MonitorSv extends Web2RtuMw { |
| | | |
| | | @Autowired |
| | | private PrIntakeMapper prIntakeMapper; |
| | |
| | | //向通信中间件发关命令,查询部分RTU在线情况 |
| | | Command com = this.createInnerCommand(CodeLocal.onLinePart); |
| | | com.setParam(rtuAddrs) ; |
| | | String comSendUrl = this.getToMwUrl(this.env) ; |
| | | BaseResponse res = sendCom2Mw(restTemplate, comSendUrl, com) ; |
| | | String rqUrl = this.get2MwRequestUrl(this.env, ContextComSend) ; |
| | | BaseResponse res = sendRequest2Mw(restTemplate, rqUrl, com) ; |
| | | if(res != null){ |
| | | if(res.isSuccess()){ |
| | | Command reCom = JSON.parseObject(res.getContent() == null ? null : JSON.toJSONString(res.getContent()), Command.class) ; |
| | |
| | | if(bakParam != null){ |
| | | if(bakParam.getSuccess().booleanValue()){ |
| | | //通信中间件成功返回命令结果 |
| | | HashMap<String, Boolean> onLineMap = JSON.parseObject(((JSONObject)reCom.getAttachment()).toJSONString(), HashMap.class); |
| | | HashMap<String, Boolean> onLineMap = JSON.parseObject(JSON.toJSONString(reCom.getAttachment()), HashMap.class); |
| | | for(VoOnLineIntake rVo : rsVo.obj){ |
| | | if(onLineMap.containsKey(rVo.getRtuAddr())) { |
| | | rVo.setIsOnLine(onLineMap.get(rVo.getRtuAddr())); |
| | |
| | | private QueryResultVo<List<VoOnLineIntake>> selectIntakesOnOrOffLine(QueryVo vo) { |
| | | //向通信中间件发关命令,查询部分RTU在线情况 |
| | | Command com = this.createInnerCommand(CodeLocal.onLineAll); |
| | | String comSendUrl = this.getToMwUrl(this.env) ; |
| | | BaseResponse res = sendCom2Mw(restTemplate, comSendUrl, com) ; |
| | | String rqUrl = this.get2MwRequestUrl(this.env, ContextComSend) ; |
| | | BaseResponse res = sendRequest2Mw(restTemplate, rqUrl, com) ; |
| | | if(res != null){ |
| | | if(res.isSuccess()){ |
| | | Command reCom = JSON.parseObject(res.getContent() == null ? null : JSON.toJSONString(res.getContent()), Command.class) ; |
| | |
| | | if(bakParam != null){ |
| | | if(bakParam.getSuccess().booleanValue()){ |
| | | //通信中间件成功返回命令结果 |
| | | HashMap<String, Boolean> onLineMap = JSON.parseObject(((JSONObject)reCom.getAttachment()).toJSONString(), HashMap.class); |
| | | HashMap<String, Boolean> onLineMap = JSON.parseObject(JSON.toJSONString(reCom.getAttachment()), HashMap.class); |
| | | JSONArray jsonArray = new JSONArray(); |
| | | for (Map.Entry<String, Boolean> entry : onLineMap.entrySet()) { |
| | | JSONObject jsonObject = new JSONObject(); |