| | |
| | | return map; |
| | | } |
| | | for (VoIntake intake : intakes) { |
| | | intake.setIsOnLine(getRtuStatus(intake.getRtuAddr())); |
| | | Boolean isOnLine = getOnlineStatus(intake.getRtuAddr()); |
| | | intake.setIsOnLine(isOnLine); |
| | | Boolean isOpen = getOpenCloseStatus(intake.getRtuAddr()); |
| | | intake.setIsOpen(isOpen); |
| | | } |
| | | voGroupIntakes.setIntakes(intakes); |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取rtu在线情况 |
| | | * @param rtuAdd |
| | | * @return |
| | | */ |
| | | public Boolean getRtuStatus(String rtuAdd) { |
| | | public Boolean getOnlineStatus(String rtuAdd) { |
| | | Command com = new Command(); |
| | | com.id = Command.defaultId; |
| | | com.code = CodeLocal.onLinePart; |
| | |
| | | } |
| | | } |
| | | |
| | | public Boolean getOpenCloseStatus(String rtuAdd) { |
| | | Command com = new Command(); |
| | | com.id = Command.defaultId; |
| | | com.code = CodeLocal.oneRtuStates; |
| | | com.type = CommandType.innerCommand; |
| | | com.setRtuAddr(rtuAdd); |
| | | com.setParam(rtuAdd); |
| | | JSONObject response = (JSONObject) JSON.toJSON(sendCom2Mw(com)); |
| | | |
| | | if (response == null || !response.getString("code").equals("0001") || response.getJSONObject("content").getJSONObject("attachment") == null) { |
| | | return false; |
| | | } |
| | | |
| | | if(response.getJSONObject("content").getJSONObject("attachment").get("valveOpenTrueCloseFalse").equals("true")) { |
| | | return true; |
| | | } |
| | | else { |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 发送命令 |
| | | * |