From 7d885c1d4c86f40927af50e6e7bfa13aac0c2180 Mon Sep 17 00:00:00 2001
From: liurunyu <lry9898@163.com>
Date: 星期四, 21 十二月 2023 21:47:15 +0800
Subject: [PATCH] 1、common模块优化代码,Command命令中增加RTU命令结果返回webRul; 2、通信中间件增加了接收http下发RTU命令和内部命令的Controler; 3、RTU模拟器和控制器增加了上报完数据是否关闭TCP连接的控制。

---
 pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/Command.java |   30 ++++++++++++++++++++++++------
 1 files changed, 24 insertions(+), 6 deletions(-)

diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/Command.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/Command.java
index 2449b3b..933e980 100644
--- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/Command.java
+++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/Command.java
@@ -3,6 +3,7 @@
 import java.io.Serializable;
 
 import com.alibaba.fastjson2.JSON ;
+import com.alibaba.fastjson2.JSONObject;
 
 public class Command implements Serializable{
 
@@ -24,7 +25,7 @@
 	public String id; 
 	
 	/**
-	 * 姘磋〃鍗忚鍚嶇О锛岃繖涓彲浠ヤ负绌猴紝鍥犱负姘磋〃涓婅鏁版嵁瑙f瀽鍑哄崗璁悕绉帮紝鐒跺悗绯荤粺鎶婂崗璁悕绉颁繚瀛樺湪姘磋〃鏁版嵁璁板綍涓紝浠庢鍗忚鍚嶇О灏变笉鍐嶇┖浜�
+	 * RTU鍗忚鍚嶇О锛岃繖涓彲浠ヤ负绌猴紝鍥犱负RTU涓婅鏁版嵁瑙f瀽鍑哄崗璁悕绉帮紝鐒跺悗绯荤粺鎶婂崗璁悕绉颁繚瀛樺湪RTU鏁版嵁璁板綍涓紝浠庢鍗忚鍚嶇О灏变笉鍐嶇┖浜�
 	 */
 	public String protocol;
 	
@@ -50,6 +51,11 @@
 	public Boolean noRtMwDealRes ;
 
 	/**
+	 * rtu杩斿洖鍛戒护缁撴灉 鍙戝悜鐩殑鍦皐eb URL
+	 */
+	public String rtuResultSendWebUrl ;
+
+	/**
 	 * 鍏蜂綋鍙傛暟鏁版嵁
 	 */
 	public Object param ;
@@ -63,9 +69,9 @@
 		String s = "鍛戒护id=" + id + "\n" ;
 		s += (protocol == null ? "" : ("鍗忚=" + protocol + "\n"));
 		s += (rtuAddr == null ? "" : ("Rtu鍦板潃=" + rtuAddr + "\n"));
-		s += "鍛戒护绫诲瀷=" + (type.equals(CommandType.innerCommand)?"鍐呴儴鍛戒护":"缁堢鍛戒护") + "\n" ;
+		s += "鍛戒护绫诲瀷=" + (type.equals(CommandType.innerCommand)?"鍐呴儴鍛戒护":"RTU鍛戒护") + "\n" ;
 		s += (code == null ? "" : ("鍔熻兘鐮�=" + code + "\n")) ;
-		s += "杩斿洖涓棿浠跺鍛戒护澶勭悊缁撴灉=" + (noRtMwDealRes == null?"杩斿洖":(noRtMwDealRes?"涓嶈繑鍥�":"杩斿洖") + "\n") ;
+		s += "鏄惁杩斿洖涓棿浠跺鍛戒护澶勭悊缁撴灉=" + (noRtMwDealRes == null?"鏄�":(noRtMwDealRes?"鏄�":"鍚�") + "\n") ;
 		if(param != null){
 			s += "鍙傛暟:" + param  ;
 		}
@@ -82,7 +88,8 @@
 	@SuppressWarnings("unused")
 	public String toJson()throws Exception{
 		try{
-			return JSON.toJSONString(this) ;
+			String json = JSON.toJSONString(this) ;
+			return json ;
 		}catch(Exception e){
 			throw new Exception(e.getMessage() , e ) ;
 		}
@@ -96,7 +103,10 @@
 	@SuppressWarnings("unused")
 	public static Command jsonToObject(String json)throws Exception{
 		try{
-			return JSON.parseObject(json, Command.class) ;
+			JSONObject jsonObject = JSON.parseObject(json);
+			Command command = jsonObject.to(Command.class) ;
+			//command.param = jsonObject.getObject("param", class);
+			return command ;
 		}catch(Exception e){
 			throw new Exception(e.getMessage() , e ) ;
 		}
@@ -167,7 +177,15 @@
 		this.rtuAddr = rtuAddr;
 		return this ;
 	}
-	
+
+	public String getRtuResultSendWebUrl() {
+		return rtuResultSendWebUrl;
+	}
+
+	public void setRtuResultSendWebUrl(String rtuResultSendWebUrl) {
+		this.rtuResultSendWebUrl = rtuResultSendWebUrl;
+	}
+
 	public String getProtocol() {
 		return protocol;
 	}

--
Gitblit v1.8.0