From e29b2f68e2062688c2d40209ba434e3e7932b92e Mon Sep 17 00:00:00 2001
From: liurunyu <lry9898@163.com>
Date: 星期一, 02 十二月 2024 16:09:03 +0800
Subject: [PATCH] 修改升级数据中的CRC16验证算法,注意其是大端模块,与其他部分不一样

---
 pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/monitor/MonitorSv.java |   25 ++++++++++++-------------
 1 files changed, 12 insertions(+), 13 deletions(-)

diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/monitor/MonitorSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/monitor/MonitorSv.java
index a59a207..803cf39 100644
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/monitor/MonitorSv.java
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/monitor/MonitorSv.java
@@ -5,12 +5,11 @@
 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.p206V1_0_0.downVos.Com99Vo;
 import com.dy.common.webUtil.BaseResponse;
 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;
@@ -30,7 +29,7 @@
  */
 @Slf4j
 @Service
-public class MonitorSv extends ToRtuMwCom {
+public class MonitorSv extends Web2RtuMw {
 
     @Autowired
     private PrIntakeMapper prIntakeMapper;
@@ -77,16 +76,16 @@
             //鍚戦�氫俊涓棿浠跺彂鍏冲懡浠わ紝鏌ヨ閮ㄥ垎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 = sendPostRequest2Mw(restTemplate, rqUrl, com) ;
             if(res != null){
                 if(res.isSuccess()){
-                    Command reCom = JSON.parseObject(res.getContent() == null ? null : ((JSONObject)res.getContent()).toJSONString(), Command.class) ;
-                    CommandBackParam bakParam = JSON.parseObject((reCom== null || reCom.param == null) ? null : ((JSONObject)reCom.param).toJSONString(), CommandBackParam.class) ;
+                    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()){
                             //閫氫俊涓棿浠舵垚鍔熻繑鍥炲懡浠ょ粨鏋�
-                            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()));
@@ -115,16 +114,16 @@
     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 = sendPostRequest2Mw(restTemplate, rqUrl, com) ;
         if(res != null){
             if(res.isSuccess()){
-                Command reCom = JSON.parseObject(res.getContent() == null ? null : ((JSONObject)res.getContent()).toJSONString(), Command.class) ;
-                CommandBackParam bakParam = JSON.parseObject((reCom== null || reCom.param == null) ? null : ((JSONObject)reCom.param).toJSONString(), CommandBackParam.class) ;
+                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()){
                         //閫氫俊涓棿浠舵垚鍔熻繑鍥炲懡浠ょ粨鏋�
-                        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();

--
Gitblit v1.8.0