From 8910275656c9bf398832dc14957a03684a593e96 Mon Sep 17 00:00:00 2001
From: zhubaomin <zhubaomin>
Date: 星期五, 30 八月 2024 15:16:58 +0800
Subject: [PATCH] 2024-08-30 朱宝民 修改配置文件bug
---
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/Command.java | 103 +++++++++++++++------------------------------------
1 files changed, 30 insertions(+), 73 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 674046b..ed3cd69 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{
@@ -10,6 +11,12 @@
static {
serialVersionUID = 201211292156L;
}
+
+ /**
+ * 褰撳懡浠ょ粨鏋滆繑鍥炵殑缃戝潃鏄鍊兼椂锛屽拷鐣ユ墽琛岋紝渚嬪涓棿浠朵富鍔ㄤ笅鍙戠殑鍛戒护锛屽氨涓嶇敤杩斿洖鍛戒护缁撴灉
+ */
+ public static final String ignoreRtuResultSendWebUrl = "http://0.0.0.0" ;
+
/**
* 榛樿鍛戒护ID
@@ -24,7 +31,7 @@
public String id;
/**
- * 姘磋〃鍗忚鍚嶇О锛岃繖涓彲浠ヤ负绌猴紝鍥犱负姘磋〃涓婅鏁版嵁瑙f瀽鍑哄崗璁悕绉帮紝鐒跺悗绯荤粺鎶婂崗璁悕绉颁繚瀛樺湪姘磋〃鏁版嵁璁板綍涓紝浠庢鍗忚鍚嶇О灏变笉鍐嶇┖浜�
+ * RTU鍗忚鍚嶇О锛岃繖涓彲浠ヤ负绌猴紝鍥犱负RTU涓婅鏁版嵁瑙f瀽鍑哄崗璁悕绉帮紝鐒跺悗绯荤粺鎶婂崗璁悕绉颁繚瀛樺湪RTU鏁版嵁璁板綍涓紝浠庢鍗忚鍚嶇О灏变笉鍐嶇┖浜�
*/
public String protocol;
@@ -32,25 +39,7 @@
* RTU 鍦板潃
*/
public String rtuAddr ;
-
- /**
- * 姘磋〃鍙�
- * 搴旂敤鐢典俊骞冲彴鏃舵湁鏁�
- */
- public String meterNo ;
-
- /**
- * 鐢典俊骞冲彴涓婄殑浜у搧ID锛屽綋涓嶅湪鐢典俊骞冲彴涓婅繍琛屾椂锛屼负null
- * 搴旂敤鐢典俊骞冲彴鏃舵湁鏁�
- */
- public Integer productId ;
-
- /**
- * 鐢典俊骞冲彴涓婄殑璁惧ID锛屽綋涓嶅湪鐢典俊骞冲彴涓婅繍琛屾椂锛屼负null
- * 搴旂敤鐢典俊骞冲彴鏃舵湁鏁�
- */
- public String deviceId ;
-
+
/**
* 鍛戒护绫诲瀷:Rtu鍛戒护銆侀拡瀵圭洃鎺т腑闂翠欢鐨勫懡浠�
* 鐢眂om.dy.common.mw.protocol.CommandType绫诲畾涔�
@@ -61,11 +50,11 @@
* 鍔熻兘鐮�
*/
public String code ;
-
+
/**
- * 涓嶈繑鍥炰腑闂翠欢瀵瑰懡浠ゅ鐞嗙粨鏋滐紙true锛氫笉杩斿洖澶勭悊缁撴灉锛宖alse鎴杗ull锛氳繑鍥炲鐞嗙粨鏋滐級
+ * rtu杩斿洖鍛戒护缁撴灉 鍙戝悜鐩殑鍦皐eb URL
*/
- public Boolean noRtMwDealRes ;
+ public String rtuResultSendWebUrl ;
/**
* 鍏蜂綋鍙傛暟鏁版嵁
@@ -80,17 +69,10 @@
public String toString(){
String s = "鍛戒护id=" + id + "\n" ;
s += (protocol == null ? "" : ("鍗忚=" + protocol + "\n"));
- s += (rtuAddr == null ? "" : ("IMEI鍙�=" + rtuAddr + "\n"));
- s += (meterNo == null ? "" : ("姘磋〃鍙�=" + meterNo + "\n"));
- if(productId != null){
- s += "鐢典俊骞冲彴浜у搧ID=" + productId + "\n" ;
- }
- if(deviceId != null && !deviceId.trim().equals("")){
- s += "鐢典俊骞冲彴璁惧ID=" + deviceId + "\n" ;
- }
- s += "鍛戒护绫诲瀷=" + (type.equals(CommandType.innerCommand)?"鍐呴儴鍛戒护":"缁堢鍛戒护") + "\n" ;
+ s += (rtuAddr == null ? "" : ("Rtu鍦板潃=" + rtuAddr + "\n"));
+ s += "鍛戒护绫诲瀷=" + (type.equals(CommandType.innerCommand)?"鍐呴儴鍛戒护":"RTU鍛戒护") + "\n" ;
s += (code == null ? "" : ("鍔熻兘鐮�=" + code + "\n")) ;
- s += "杩斿洖涓棿浠跺鍛戒护澶勭悊缁撴灉=" + (noRtMwDealRes == null?"杩斿洖":(noRtMwDealRes?"涓嶈繑鍥�":"杩斿洖") + "\n") ;
+ s += (rtuResultSendWebUrl == null ? "" : ("鍥炶皟缃戝潃=" + rtuResultSendWebUrl + "\n"));
if(param != null){
s += "鍙傛暟:" + param ;
}
@@ -107,7 +89,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 ) ;
}
@@ -121,7 +104,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 ) ;
}
@@ -177,17 +163,6 @@
return this ;
}
- /*
- public static void main(String[] args){
- String json = "{\"attachment\":null,\"code\":\"03\",\"deviceId\":\"d8c9601f214747d98d47a4736e5\",\"id\":\"999999999\",\"meterNo\":\"23040600377\",\"productId\":16873252,\"param\":\"0002\",\"protocol\":\"HAC_NBhV2_5\",\"rtuAddr\":\"863318060168996\",\"type\":\"outerCommand\"}" ;
- try {
- Command com = jsonToObject(json) ;
- System.out.println(com.param);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- */
public String getId() {
return id;
@@ -203,30 +178,20 @@
this.rtuAddr = rtuAddr;
return this ;
}
-
+
+ public String getRtuResultSendWebUrl() {
+ return rtuResultSendWebUrl;
+ }
+
+ public void setRtuResultSendWebUrl(String rtuResultSendWebUrl) {
+ this.rtuResultSendWebUrl = rtuResultSendWebUrl;
+ }
+
public String getProtocol() {
return protocol;
}
public void setProtocol(String protocol) {
this.protocol = protocol;
- }
- public String getMeterNo() {
- return meterNo;
- }
- public void setMeterNo(String meterNo) {
- this.meterNo = meterNo;
- }
- public Integer getProductId() {
- return productId;
- }
- public void setProductId(Integer productId) {
- this.productId = productId;
- }
- public String getDeviceId() {
- return deviceId;
- }
- public void setDeviceId(String deviceId) {
- this.deviceId = deviceId;
}
public String getType() {
return type;
@@ -241,14 +206,6 @@
public Command setCode(String code) {
this.code = code;
return this ;
- }
- @SuppressWarnings("unused")
- public Boolean getNoRtMwDealRes() {
- return noRtMwDealRes;
- }
- @SuppressWarnings("unused")
- public void setNoRtMwDealRes(Boolean noRtMwDealRes) {
- this.noRtMwDealRes = noRtMwDealRes;
}
public Object getParam() {
return param;
--
Gitblit v1.8.0