From 60bd6a383b3f7c0d4922517974da9525a0166b68 Mon Sep 17 00:00:00 2001
From: liurunyu <lry9898@163.com>
Date: 星期四, 07 十二月 2023 10:45:36 +0800
Subject: [PATCH] 文件误删除后,本地重新找回后提交
---
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/AnnotationScan.java | 6
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/DataCd83CloseVo.java | 61 +
pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/java/com/dy/testServer/forRmi/RmiRequestedCallback.java | 36
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/parse/Cd_84_Up.java | 149 +++
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/DataCd71Vo.java | 21
pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/java/com/dy/testServer/forRmi/ResStartVo.java | 63 +
pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/tasks/RtuUpTask.java | 6
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/DataCd02Vo.java | 20
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/support/SupportUnit.java | 42
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/parse/Cd_71_Up.java | 65 +
pipIrr-platform/文档/编码设计.docx | 0
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/CodeV1_0_1.java | 33
pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/forTcp/MidResultActionToRtu.java | 2
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/support/SupportUnitConfigVo.java | 6
pipIrr-platform/文档/Maven 打包插件 maven-jar-plugin.docx | 0
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/MidResultFromRtu.java | 5
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/parse/Cd_83_Up.java | 253 ++++++
pipIrr-platform/文档/Maven打包.docx | 0
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/channel/tcp/TcpIoSessionAttrIdIsRtuAddr.java | 2
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/parse/Cd_02_Up.java | 89 ++
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/ParseParamsForDownV1_0_1.java | 40 +
pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/ServerProperties.java | 8
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/DriverParserDataCallback.java | 16
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/MidResultError.java | 6
pipIrr-platform/文档/Maven的maven-compiler-plugin插件.docx | 0
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/OnLine.java | 6
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/DataCd84Vo.java | 33
pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/tasks/ToRtuConstantTask.java | 48
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/Data.java | 13
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/DriverV1_0_1.java | 1
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/PrefixedDataAvailableHandleImp.java | 14
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/Command.java | 47 -
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/DataAlarmVo.java | 28
pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/tasks/RtuDownTask.java | 11
pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/java/com/dy/testServer/AdapterImp_RmiUnit.java | 26
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/ParseParamsForUpV1_0_1.java | 39 +
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/ProtocolCache.java | 91 ++
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/Driver.java | 14
pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/java/com/dy/testServer/forRmi/ResRegisterVo.java | 46 +
pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/forTcp/TcpDownCommandObj.java | 4
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/MidResultToRtu.java | 5
pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/Server.java | 7
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/DataCd83OpenVo.java | 46 +
pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/rtuData/TreeParse.java | 6
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/DataStateVo.java | 24
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/parse/Cd_C0_Up.java | 224 +++++
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/ByteUtil.java | 446 ++++++-----
pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/forTcp/TcpDownCommandCache.java | 129 +++
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/OnLineHandle.java | 4
pipIrr-platform/文档/Git操作.txt | 2
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/OnLineV1_0_1.java | 39 +
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/ProtocolUnit.java | 6
52 files changed, 1,908 insertions(+), 380 deletions(-)
diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/channel/tcp/TcpIoSessionAttrIdIsRtuAddr.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/channel/tcp/TcpIoSessionAttrIdIsRtuAddr.java
index 3bd48c5..0d3eb64 100644
--- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/channel/tcp/TcpIoSessionAttrIdIsRtuAddr.java
+++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/channel/tcp/TcpIoSessionAttrIdIsRtuAddr.java
@@ -7,5 +7,5 @@
*/
public class TcpIoSessionAttrIdIsRtuAddr {
- public static final String sessionArrIdKey = "key_rtuAddr" ; //杩欎釜key瀛樺偍鐨勬槸IMEI鍙�
+ public static final String sessionArrIdKey = "key_rtuAddr" ; //杩欎釜key瀛樺偍鐨勬槸Rtu鍦板潃
}
diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/AnnotationScan.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/AnnotationScan.java
index f4ec4cb..2b3aa3a 100644
--- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/AnnotationScan.java
+++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/AnnotationScan.java
@@ -65,9 +65,9 @@
int onLineDataMinLength;
int headMinLength ;
- HashMap<String, AnnotationDriverVo> driverMap = ProtocolCach.getDriverMap() ;
- HashMap<String, AnnotationPrefixedDataAvailableVo> prefixedDataAvailableMap = ProtocolCach.getPrefixedDataAvailableMap() ;
- HashMap<String, AnnotationOnLineVo> onLineMap = ProtocolCach.getOnLineMap() ;
+ HashMap<String, AnnotationDriverVo> driverMap = ProtocolCache.getDriverMap() ;
+ HashMap<String, AnnotationPrefixedDataAvailableVo> prefixedDataAvailableMap = ProtocolCache.getPrefixedDataAvailableMap() ;
+ HashMap<String, AnnotationOnLineVo> onLineMap = ProtocolCache.getOnLineMap() ;
for(String cName : classNames){
String className = cName.substring(0, cName.lastIndexOf('.')) ;
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 39bd450..2449b3b 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
@@ -32,25 +32,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绫诲畾涔�
@@ -80,14 +62,7 @@
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 += (rtuAddr == null ? "" : ("Rtu鍦板潃=" + rtuAddr + "\n"));
s += "鍛戒护绫诲瀷=" + (type.equals(CommandType.innerCommand)?"鍐呴儴鍛戒护":"缁堢鍛戒护") + "\n" ;
s += (code == null ? "" : ("鍔熻兘鐮�=" + code + "\n")) ;
s += "杩斿洖涓棿浠跺鍛戒护澶勭悊缁撴灉=" + (noRtMwDealRes == null?"杩斿洖":(noRtMwDealRes?"涓嶈繑鍥�":"杩斿洖") + "\n") ;
@@ -198,24 +173,6 @@
}
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;
diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/Data.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/Data.java
index 3df78c2..68bc9f8 100644
--- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/Data.java
+++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/Data.java
@@ -6,7 +6,6 @@
/**
* 鏁版嵁鏍�
- * @author Administrator
*
*/
public class Data implements java.io.Serializable{
@@ -15,7 +14,6 @@
private String commandId ;//鍛戒护ID锛屽彲鑳戒负null
private String rtuAddr ;//缁堢鍦板潃
- private String meterNo ;//姘磋〃鍙�
private String protocol ;//鏁版嵁鎵�瀵瑰簲鐨勫崗璁悕绉�
private String code ;//鏁版嵁鎵�瀵瑰簲鐨勫姛鑳界爜:
private Object subData ;//瀵瑰簲鍚勪釜鍔熻兘鐮佺殑鍏蜂綋鏁版嵁
@@ -24,8 +22,7 @@
public String toString() {
StringBuilder sb = new StringBuilder() ;
sb.append("涓婅鎶ユ枃(鍗佸叚杩涘埗): ").append((hex == null?"":hex)).append("\n") ; //
- sb.append("IMEI鍙� : ").append((rtuAddr==null?"":rtuAddr)).append("\n") ;
- sb.append("姘磋〃鍙� : ").append((meterNo==null?"":meterNo)).append("\n") ;
+ sb.append("Rtu鍦板潃 : ").append((rtuAddr==null?"":rtuAddr)).append("\n") ;
if(commandId != null){
sb.append("鍛戒护ID : ").append(commandId).append("\n") ; //鍛戒护ID
}
@@ -85,13 +82,7 @@
public void setRtuAddr(String rtuAddr) {
this.rtuAddr = rtuAddr;
}
-
- public String getMeterNo() {
- return meterNo;
- }
- public void setMeterNo(String meterNo) {
- this.meterNo = meterNo;
- }
+
public String getCode() {
return code;
}
diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/Driver.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/Driver.java
index 4b607f3..a541bc8 100644
--- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/Driver.java
+++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/Driver.java
@@ -142,7 +142,7 @@
return codeParse ;
}
/**
- * 瑙f瀽涓婅鏁版嵁
+ * 瑙f瀽RTU涓婅鏁版嵁
* @param isLowPower 鏄惁鍦ㄤ綆鍔熻�楃幆澧冧笅杩愯
* @param rtuAddr 鎺у埗鍣ㄥ湴鍧�
* @param upBuffer 瀛楄妭鏁扮粍
@@ -151,18 +151,6 @@
* @return MidResult[]
*/
public abstract MidResult[] parseData(Boolean isLowPower, String rtuAddr, byte[] upBuffer, String upHex, DriverParserDataCallback callback, Object... params) ;
- /**
- * 瑙f瀽鐢典俊骞冲彴涓婅鏁版嵁
- * @param isLowPower 鏄惁鍦ㄤ綆鍔熻�楃幆澧冧笅杩愯
- * @param rtuAddr 鎺у埗鍣ㄥ湴鍧�
- * @param productId 鐢典俊骞冲彴浜у搧ID锛屽綋涓嶅湪鐢典俊骞冲彴涓繍琛屾椂锛屼负null
- * @param deviceId 鐢典俊骞冲彴璁惧ID锛屽綋涓嶅湪鐢典俊骞冲彴涓繍琛屾椂锛屼负null
- * @param upBuffer 瀛楄妭鏁扮粍
- * @param upHex 瀛楄妭鏁扮粍16杩涘埗褰㈠紡
- * @param callback 鍥炶皟
- * @return MidResult[]
- */
- public abstract MidResult[] parseData(Boolean isLowPower, String rtuAddr, Integer productId, String deviceId, byte[] upBuffer, String upHex, DriverParserDataCallback callback, Object... params) ;
/**
* 鏋勯�犱笅琛屾暟鎹紙鍛戒护锛�
diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/DriverParserDataCallback.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/DriverParserDataCallback.java
index 5ca3e20..30f219a 100644
--- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/DriverParserDataCallback.java
+++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/DriverParserDataCallback.java
@@ -4,23 +4,19 @@
/**
* 瑙f瀽涓婅鏁版嵁鍚庡洖璋�
- * @param rtuAddr 涓婅鏁版嵁鍗忚澶翠腑鐨処MEI鍙�
- * @param meterNo 涓婅鏁版嵁鍗忚澶翠腑鐨勬按琛ㄥ彿
+ * @param rtuAddr 涓婅鏁版嵁鍗忚澶翠腑RtuAddr
* @param code 涓婅鏁版嵁 鍔熻兘鐮�
* @param upHex 涓婅鏁版嵁
* @param reportOrResponse_trueOrFalse 涓婅鏁版嵁鏄富鍔ㄤ笂鎶ヨ繕鏄懡浠ょ粨鏋�
* @param parseFail 涓婅鏁版嵁瑙f瀽鏄惁澶辫触
- * @param rtuAddrInData 涓婅鏁版嵁涓湪鍗忚鏁版嵁涓殑IMEI鍙凤紝
- * @param meterNoInData 涓婅鏁版嵁涓湪鍗忚鏁版嵁涓殑姘磋〃鍙凤紝
- * 鈥滀慨鏀筊TU缁堢绠$悊閰嶇疆鍙傛暟鈥濆懡浠ょ殑杩斿洖鏁版嵁锛屽叾鍗忚澶翠腑鐨処MEI鍙蜂笌鏁版嵁涓殑IMEI鍙蜂笉涓�鏍凤紝
- * 濡傛灉RTU涓嶈兘鍏抽棴缃戠粶锛岄偅涔坰essionCach涓殑IMEI鍙锋�绘槸鐢ㄤ慨鏀瑰墠鐨処MEI鍙凤紝浣垮緱浠ュ悗涓婅鏁版嵁鐨勪笉鑳芥壘鍒扮紦瀛樹腑鐨凷ession
+ * @param rtuAddrInData 涓婅鏁版嵁涓湪鍗忚鏁版嵁涓殑Rtu鍦板潃锛�
+ * 鈥滀慨鏀筊TU缁堢绠$悊閰嶇疆鍙傛暟鈥濆懡浠ょ殑杩斿洖鏁版嵁锛屽叾鍗忚澶翠腑鐨凴tu鍦板潃涓庢暟鎹腑鐨凴tu鍦板潃涓嶄竴鏍凤紝
+ * 濡傛灉RTU涓嶈兘鍏抽棴缃戠粶锛岄偅涔坰essionCach涓殑Rtu鍦板潃鎬绘槸鐢ㄤ慨鏀瑰墠鐨凴tu鍦板潃锛屼娇寰椾互鍚庝笂琛屾暟鎹殑涓嶈兘鎵惧埌缂撳瓨涓殑Session
*/
void callback(String rtuAddr,
- String meterNo,
- String code,
+ String code,
String upHex,
Boolean reportOrResponse_trueOrFalse,
boolean parseFail,
- String rtuAddrInData,
- String meterNoInData) ;
+ String rtuAddrInData) ;
}
diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/MidResultError.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/MidResultError.java
index 0a71d84..bdbb7a0 100644
--- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/MidResultError.java
+++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/MidResultError.java
@@ -11,15 +11,13 @@
}
public String protocolName ;//鍗忚鍚嶇О
- public String rtuAddr ;//IMEI鍙凤紝娉ㄦ剰rtuAddr鍙兘涓簄ull
- public String meterNo ;//姘磋〃鍙凤紝娉ㄦ剰meterNo鍙兘涓簄ull
+ public String rtuAddr ;//Rtu鍦板潃锛屾敞鎰弐tuAddr鍙兘涓簄ull
public String message ;//鍑洪敊娑堟伅
public Exception e ;//寮傚父
- public MidResultError(String protocolName, String rtuAddr, String meterNo, String message, Exception e){
+ public MidResultError(String protocolName, String rtuAddr, String message, Exception e){
this.protocolName = protocolName ;
this.rtuAddr = rtuAddr ;
- this.meterNo = meterNo ;
this.message = message ;
this.e = e ;
}
diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/MidResultFromRtu.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/MidResultFromRtu.java
index 50562ef..4813115 100644
--- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/MidResultFromRtu.java
+++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/MidResultFromRtu.java
@@ -13,10 +13,7 @@
public String commandId ;//鍙戦�佸懡浠ょ殑ID锛屽鏋滄槸鍛戒护缁撴灉锛屽苟涓斿尮閰嶄簡涓嬪彂鍛戒护锛屾鍊间笉涓虹┖
public String protocolName ;//鍗忚鍚嶇О
- public String rtuAddr ;//IMEI鍙�
- public String meterNo ;//姘磋〃鍙�
- public Integer productId ;//鐢典俊骞冲彴浜у搧ID锛屽綋涓嶅湪鐢典俊骞冲彴杩愯鏃讹紝涓簄ull
- public String deviceId ;//鐢典俊骞冲彴璁惧ID锛屽綋涓嶅湪鐢典俊骞冲彴杩愯鏃讹紝涓簄ull
+ public String rtuAddr ;//Rtu鍦板潃
public String upCode ;//涓婅鏁版嵁涓殑鍔熻兘鐮�
public String upHex ;//涓婅鏁版嵁鍗佸叚杩涘埗褰㈠紡
public byte[] upBuffer ;//涓婅鏁版嵁瀛楄妭鏁扮粍
diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/MidResultToRtu.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/MidResultToRtu.java
index 4c58abe..087aa53 100644
--- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/MidResultToRtu.java
+++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/MidResultToRtu.java
@@ -11,10 +11,7 @@
}
public String protocolName ;//鍗忚鍚嶇О
- public String rtuAddr ;//IMEI鍙�(鐢典俊骞冲彴IMEI)
- public String meterNo ;//姘磋〃鍙�
- public Integer productId ;//鐢典俊骞冲彴浜у搧ID
- public String deviceId ;//鐢典俊骞冲彴璁惧ID
+ public String rtuAddr ;//Rtu鍦板潃
public String commandId ;//鍛戒护ID锛屽彂璧峰懡浠ょ殑瀹㈡埛绔�(web绔�)鐢熸垚锛屼互鍖归厤鍛戒护缁撴灉
public String downCode ;//涓嬭鍛戒护鍔熻兘鐮�;
public byte[] downBuffer ;//涓嬭鍛戒护鏁版嵁
diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/OnLine.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/OnLine.java
index f8b693b..746e926 100644
--- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/OnLine.java
+++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/OnLine.java
@@ -16,19 +16,17 @@
class OnLineResult{
public int result ;//鍒嗘瀽缁撴灉
public String protocolName ;//鍗忚鍚嶇О
- public String rtuAddr ;//IMEI鍙�
- public String meterNo ;//姘磋〃鍙�
+ public String rtuAddr ;//Rtu鍦板潃
public byte[] remoteData;//闇�瑕佸悜Rtu鍥炲啓鐨勬暟鎹�
public OnLineResult(){
result = OnLineAction_fail ;
rtuAddr = null ;
- meterNo = null ;
remoteData = null ;
}
}
int OnLineAction_fail = 0; //鍒嗘瀽涓婄嚎鏁版嵁澶辫触锛屽鎻愪緵鐨勬暟鎹负null绛夊師鍥�
- int OnLineAction_success = 1; //鍒嗘瀽涓婄嚎鏁版嵁鎴愬姛锛屽苟鑳藉緱鍒癐MEI鍙�
+ int OnLineAction_success = 1; //鍒嗘瀽涓婄嚎鏁版嵁鎴愬姛锛屽苟鑳藉緱鍒癛tu鍦板潃
int OnLineAction_success_noMe = 2; //鍒嗘瀽涓婄嚎鏁版嵁鎴愬姛锛岃瘑鍒嚭涓嶆槸鏈崗璁暟鎹�
int OnLineAction_success_response = 3; //鍒嗘瀽涓婄嚎鏁版嵁鎴愬姛锛屽苟闇�瑕佸悜Rtu鍥炲啓鏁版嵁
diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/OnLineHandle.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/OnLineHandle.java
index 825588f..a95c192 100644
--- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/OnLineHandle.java
+++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/OnLineHandle.java
@@ -6,13 +6,13 @@
public class OnLineHandle {
/**
- * 瑙f瀽涓婄嚎鏁版嵁锛屽緱鍒癐MEI鍙�
+ * 瑙f瀽涓婄嚎鏁版嵁锛屽緱鍒癛tuAddr
* @param bs 瀛楄妭鏁扮粍
* @return OnLine.OnLineResult
*/
public OnLine.OnLineResult parse(byte[] bs)throws Exception{
OnLine.OnLineResult rs = null ;
- HashMap<String, AnnotationOnLineVo> onLineMap = ProtocolCach.getOnLineMap() ;
+ HashMap<String, AnnotationOnLineVo> onLineMap = ProtocolCache.getOnLineMap() ;
Collection<AnnotationOnLineVo> set = onLineMap.values() ;
if(set.size() == 0){
throw new Exception("澶勭悊涓婄嚎鏃讹紝寰楀埌鐨勫崗璁泦鍚堜负绌恒��") ;
diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/PrefixedDataAvailableHandleImp.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/PrefixedDataAvailableHandleImp.java
index 56d32fc..30864ee 100644
--- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/PrefixedDataAvailableHandleImp.java
+++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/PrefixedDataAvailableHandleImp.java
@@ -30,18 +30,18 @@
try{
PrefixedDataAvailableStatus pds = null ;
- HashMap<String, AnnotationPrefixedDataAvailableVo> prefixedDataAvailableMap = ProtocolCach.getPrefixedDataAvailableMap() ;
+ HashMap<String, AnnotationPrefixedDataAvailableVo> prefixedDataAvailableMap = ProtocolCache.getPrefixedDataAvailableMap() ;
Collection<AnnotationPrefixedDataAvailableVo> set = prefixedDataAvailableMap.values() ;
if(set.size() == 0){
throw new Exception("涓婄嚎鏁版嵁瀹屾暣鎬ф鏌ユ椂锛屽緱鍒扮殑鍗忚瀹屾暣鎬ф鏌ョ被闆嗗悎涓虹┖銆�") ;
}
- int prority = ProtocolConstant.firstPriority ;
+ int priority = ProtocolConstant.firstPriority ;
while(true){
- Object[] objs = this.getClassObjAndAnnotationVo(prority, set) ;
+ Object[] objs = this.getClassObjAndAnnotationVo(priority, set) ;
PrefixedDataAvailable pda = (PrefixedDataAvailable)objs[0] ;
- if(pda == null && prority == ProtocolConstant.firstPriority){
- throw new Exception("涓婄嚎鏁版嵁瀹屾暣鎬ф鏌ユ椂锛屾湭寰楀埌浼樺厛绾т负" + prority + "涓婄嚎鏁版嵁瀹屾暣鎬ф鏌ョ被锛�") ;
+ if(pda == null && priority == ProtocolConstant.firstPriority){
+ throw new Exception("涓婄嚎鏁版嵁瀹屾暣鎬ф鏌ユ椂锛屾湭寰楀埌浼樺厛绾т负" + priority + "涓婄嚎鏁版嵁瀹屾暣鎬ф鏌ョ被锛�") ;
}else if(pda == null){
//璇存槑涓婄嚎鏁版嵁瀹屾暣鎬ф鏌ョ被闆嗗悎宸茬粡閬嶅巻瀹屼簡銆�
break ;
@@ -53,7 +53,7 @@
if(pds == null){
//璇存槑涓嶆槸瀵瑰簲鐨勫崗璁暟鎹紝闇�瑕佸彟澶栫殑鍗忚鏉ュ鐞嗕笂绾�
//寰幆缁х画
- prority++ ;
+ priority++ ;
}else{
//鍋滄寰幆锛岃繑鍥炵粨鏋�
break ;
@@ -90,7 +90,7 @@
try{
PrefixedDataAvailableStatus pds = null ;
- HashMap<String, AnnotationPrefixedDataAvailableVo> prefixedDataAvailableMap = ProtocolCach.getPrefixedDataAvailableMap() ;
+ HashMap<String, AnnotationPrefixedDataAvailableVo> prefixedDataAvailableMap = ProtocolCache.getPrefixedDataAvailableMap() ;
Collection<AnnotationPrefixedDataAvailableVo> set = prefixedDataAvailableMap.values() ;
if(set.size() == 0){
throw new Exception("涓婄嚎鏁版嵁瀹屾暣鎬ф鏌ユ椂锛屽緱鍒扮殑鍗忚闆嗗悎涓虹┖銆�") ;
diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/ProtocolCache.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/ProtocolCache.java
new file mode 100644
index 0000000..c076537
--- /dev/null
+++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/ProtocolCache.java
@@ -0,0 +1,91 @@
+package com.dy.common.mw.protocol;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class ProtocolCache {
+
+ //鏈郴缁熶腑锛孌river鍦ㄥ崟绾跨▼涓繍琛岋紝鎵�浠ュ彧鐢ㄤ竴涓疄渚�
+ private static final HashMap<String, Driver> drivers = new HashMap<>() ;
+ //娉ㄨВ涓庡鐞嗙被鐨勬槧灏�
+ private static final HashMap<String, AnnotationDriverVo> driverMap = new HashMap<>() ;
+ private static final HashMap<String, AnnotationPrefixedDataAvailableVo> prefixedDataAvailableMap = new HashMap<>() ;
+ private static final HashMap<String, AnnotationOnLineVo> onLineMap = new HashMap<>() ;
+
+
+ /**
+ * 鍦ㄥ崟绾跨▼鐜涓繍琛�
+ * 閫氳繃鍗忚椹卞姩鐨勭被鍚嶏紝寰楀埌绫诲崟渚�
+ * @param protocolName 鍗忚鍚嶇О
+ * @return 椹卞姩
+ * @throws Exception 寮傚父
+ */
+ public static Driver getDriver(String protocolName) throws Exception{
+ Driver dri = drivers.get(protocolName);
+ if(dri == null){
+ AnnotationDriverVo vo = driverMap.get(protocolName) ;
+ if(vo != null && vo.clazz != null){
+ dri = (Driver)vo.clazz.getDeclaredConstructor().newInstance();
+ //dri = (Driver)vo.clazz.newInstance() ;
+ drivers.put(protocolName, dri) ;
+ }
+ }
+ return dri ;
+ }
+
+ /**
+ * 寰楀埌椹卞姩鐨勬暟閲忥紝鍗充腑闂翠欢鏀寔鐨勫崗璁暟閲�
+ * @return 椹卞姩鎬绘暟
+ */
+ public static int driverCount(){
+ if(drivers.size() == 0){
+ return 0 ;
+ }else{
+ return drivers.size() ;
+ }
+ }
+
+ /**
+ * 寰楀埌绗竴涓┍鍔�
+ * @return 椹卞姩
+ */
+ public static Driver getFirstDriver(){
+ Driver dri = null ;
+ if(drivers.size() > 0){
+ Map.Entry<String, Driver> ent = drivers.entrySet().iterator().next() ;
+ dri = ent.getValue();
+ }
+ return dri ;
+ }
+
+ /**
+ * 寰楀埌鎵�鏈夊崗璁悕绉�
+ * @return 鍗忚鍚嶇О闆嗗悎
+ */
+ @SuppressWarnings("unused")
+ public static List<String> getProtocolList() {
+ return new ArrayList<>(driverMap.keySet()) ;
+ }
+
+ protected static HashMap<String, AnnotationDriverVo> getDriverMap() {
+ return driverMap;
+ }
+ protected static HashMap<String, AnnotationPrefixedDataAvailableVo> getPrefixedDataAvailableMap() {
+ return prefixedDataAvailableMap;
+ }
+ protected static HashMap<String, AnnotationOnLineVo> getOnLineMap() {
+ return onLineMap;
+ }
+
+ /*
+ public static void main(String[] args){
+ HashMap<String, Integer> mp = new HashMap<>() ;
+ mp.put("a1", 1) ;
+ mp.put("a2", 2) ;
+ List<String> list = new ArrayList<>(mp.keySet()) ;
+ System.out.println(list);
+ }
+ */
+}
\ No newline at end of file
diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/ProtocolUnit.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/ProtocolUnit.java
index 71dea2a..0e280fb 100644
--- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/ProtocolUnit.java
+++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/ProtocolUnit.java
@@ -44,7 +44,7 @@
AnnotationScan.getIntance() ;
//鍚勪釜鍗忚椹卞姩绫绘壂鎻忚嚜宸辩殑鍔熻兘鐮佹敞瑙�
- HashMap<String, AnnotationDriverVo> drivers = ProtocolCach.getDriverMap() ;
+ HashMap<String, AnnotationDriverVo> drivers = ProtocolCache.getDriverMap() ;
Collection<String> colDrivers = drivers.keySet() ;
StringBuilder totalProtocols = new StringBuilder() ;
for(String protocolName : colDrivers){
@@ -52,7 +52,7 @@
totalProtocols.append("锛�") ;
}
totalProtocols.append(protocolName) ;
- Driver dri = ProtocolCach.getDriver(protocolName) ;
+ Driver dri = ProtocolCache.getDriver(protocolName) ;
if(dri != null){
dri.scanAnnotationCode();
}
@@ -70,7 +70,7 @@
*/
@SuppressWarnings("unused")
public boolean isOnlyOneProtocol(){
- HashMap<String, AnnotationDriverVo> drivers = ProtocolCach.getDriverMap() ;
+ HashMap<String, AnnotationDriverVo> drivers = ProtocolCache.getDriverMap() ;
return drivers.size() == 1 ;
}
diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/CodeV1_0_1.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/CodeV1_0_1.java
new file mode 100644
index 0000000..0c2fd16
--- /dev/null
+++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/CodeV1_0_1.java
@@ -0,0 +1,33 @@
+package com.dy.common.mw.protocol.p206V1_0_0;
+
+public class CodeV1_0_1 {
+ //鍔熻兘鐮佷负瀛楃涓诧紝鍗佸叚杩涘埗鏁版嵁
+ public static final String cd_02 = "02" ;//閬ユ祴绔欓摼璺娴�
+ public static final String cd_C0 = "C0" ;//閬ユ祴绔欒嚜鎶ュ疄鏃舵暟鎹�
+ public static final String cd_83 = "83" ;//閬ユ祴绔欏紑鍏抽榾鑷姤
+ public static final String cd_84 = "84" ;//寮�闃�宸ヤ綔鎶�
+ public static final String cd_71 = "71" ;//鏌ヨ闃�闂ㄧ姸鎬�
+
+ public static String getCodeName(String code) {
+ String name = (code.equals(cd_02) ? "閾捐矾妫�娴�" :
+ (code.equals(cd_C0) ? "鑷姤瀹炴椂鏁版嵁" :
+ (code.equals(cd_83) ? "寮�鍏抽榾鑷姤" :
+ (code.equals(cd_84) ? "寮�闃�宸ヤ綔鎶�" :
+ (code.equals(cd_71) ? "鏌ヨ闃�闂ㄧ姸鎬�" :
+ ""))))) ;
+ return name ;
+ }
+
+ /**
+ * 鏄惁涓烘湁鏁堝姛鑳界爜
+ * @param code 鍔熻兘鐮�
+ * @return 鏈夋晥true锛屾棤鏁坒alse
+ */
+ public static boolean isValid(String code){
+ String name = getCodeName(code) ;
+ if(name != null && !name.equals("")){
+ return true ;
+ }
+ return false ;
+ }
+}
diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/DataAlarmVo.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/DataAlarmVo.java
new file mode 100644
index 0000000..3accdc0
--- /dev/null
+++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/DataAlarmVo.java
@@ -0,0 +1,28 @@
+package com.dy.common.mw.protocol.p206V1_0_0;
+
+import lombok.Data;
+
+@Data
+public class DataAlarmVo {
+ public Byte batteryVolt ;// 钃勭數姹犵數鍘�
+ public Byte loss ;//婕忔崯
+ public Byte meter ;//浠〃
+ public Byte valve ;//闃�闂�
+
+ public String toString(){
+ StringBuilder str = new StringBuilder() ;
+ str.append(" 鎶ヨ:\n");
+ str.append(" 钃勭數姹犵數鍘嬶細");
+ str.append(batteryVolt==null?"":(batteryVolt==1?"鎶ヨ":"姝e父"));
+ str.append("\n");
+ str.append(" 婕忔崯锛�");
+ str.append(loss==null?"":(loss==1?"鎶ヨ":"姝e父"));
+ str.append("\n");
+ str.append(" 浠〃锛�");
+ str.append(meter==null?"":(meter==1?"鎶ヨ":"姝e父"));
+ str.append("\n");
+ str.append(" 闃�闂細");
+ str.append(valve==null?"":(valve==1?"鎶ヨ":"姝e父"));
+ return str.toString() ;
+ }
+}
diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/DataCd02Vo.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/DataCd02Vo.java
new file mode 100644
index 0000000..edd5ccd
--- /dev/null
+++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/DataCd02Vo.java
@@ -0,0 +1,20 @@
+package com.dy.common.mw.protocol.p206V1_0_0;
+
+import lombok.Data;
+
+//閾捐矾妫�娴�
+@Data
+public class DataCd02Vo {
+
+ public String status ;//F0 鐧诲綍锛孎1 閫�鍑虹櫥褰曪紝F2 鍦ㄧ嚎淇濇寔
+
+ public String toString(){
+ StringBuffer sb = new StringBuffer() ;
+ sb.append(" 閾捐矾妫�娴� : \n") ;
+ sb.append(" 璇锋眰鐘舵�� : ") ;
+ sb.append(status == null?"":(status.equals("F0")?"鐧诲綍":(status.equals("F1")?"閫�鍑虹櫥褰�":(status.equals("F2")?"鍦ㄧ嚎淇濇寔":status)))) ;
+ sb.append("\n") ;
+ return sb.toString() ;
+ }
+
+}
diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/DataCd71Vo.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/DataCd71Vo.java
new file mode 100644
index 0000000..405a121
--- /dev/null
+++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/DataCd71Vo.java
@@ -0,0 +1,21 @@
+package com.dy.common.mw.protocol.p206V1_0_0;
+
+import lombok.Data;
+
+@Data
+public class DataCd71Vo {
+
+ public Byte state ;//闃�闂ㄧ姸鎬佺爜锛�0锛氶榾闂ㄥ叧闂姸鎬侊紱1锛氶榾闂ㄦ墦寮�鐘舵�侊級
+ public String stateName ;
+
+ public String toString(){
+ StringBuilder sb = new StringBuilder() ;
+ sb.append(" 鏌ヨ璁惧闃�闂ㄧ姸鎬佸簲绛�:\n");
+ sb.append(" 闃�闂ㄧ姸鎬侊細");
+ sb.append(state==null?"":state);
+ sb.append(stateName==null?"":("(" + stateName + ")"));
+ sb.append("\n");
+
+ return sb.toString() ;
+ }
+}
diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/DataCd83CloseVo.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/DataCd83CloseVo.java
new file mode 100644
index 0000000..5d93ebd
--- /dev/null
+++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/DataCd83CloseVo.java
@@ -0,0 +1,61 @@
+package com.dy.common.mw.protocol.p206V1_0_0;
+
+import lombok.Data;
+
+@Data
+public class DataCd83CloseVo {
+ // 寮�鍏抽榾绫诲瀷锛�
+ // 1銆佸埛鍗″紑闃�锛�2鍒峰崱鍏抽榾锛�3銆佷腑蹇冪珯寮�闃�锛�4銆佷腑蹇冪珯鍏抽榾锛�5銆佹瑺璐瑰叧闃�锛�
+ // 6銆佹祦閲忚鏁呴殰鍏抽榾锛�7銆佺揣鎬ュ叧闃�锛�8銆佺敤鎴疯繙绋嬪紑闃�锛�9銆佺敤鎴疯繙绋嬪叧闃�锛�
+ public Byte type ;
+ public Double totalAmount; //绱娴侀噺锛�5瀛楄妭BCD鐮侊紝鍙栧�艰寖鍥�0~9999999999锛屽崟浣嶄负m3銆�
+ public String clientNum ;//鍐滄埛缂栧彿
+ public String icAddr ;//ic鍗″湴鍧�
+ public Double remainMoney ;//鍓╀綑閲戦锛氱敤鎴蜂綑棰�4瀛楄妭BCD鐮侊紝鍙栧�艰寖鍥�0.00~999999.99锛屽崟浣嶄负鍏�
+ public String openDt ;//鐢ㄦ按鎴风敤姘村紑濮嬫椂闂达細6瀛楄妭BCD鐮侊紝椤哄簭鏄勾鏈堟棩鏃跺垎绉掞紝鍏朵腑鍏厓骞�=2000+骞淬��
+ public String closeDt ;//鐢ㄦ按鎴风敤姘寸粨鏉熸椂闂达細6瀛楄妭BCD鐮侊紝椤哄簭鏄勾鏈堟棩鏃跺垎绉掞紝鍏朵腑鍏厓骞�=2000+骞淬��
+ public Double thisAmount ;//鐢ㄦ按鎴锋湰娆$敤姘撮噺锛氱疮璁℃祦閲�5瀛楄妭BCD鐮侊紝鍙栧�艰寖鍥�0~9999999999锛屽崟浣嶄负m3銆�
+ public Double thisMoney ;//鐢ㄦ按鎴锋湰娆℃秷璐归噾棰濓細鐢ㄦ埛浣欓4瀛楄妭BCD鐮侊紝鍙栧�艰寖鍥�0.00~999999.99锛屽崟浣嶄负鍏冦��
+ public Integer thisTime ;//鐢ㄦ按鎴锋湰娆$敤姘存椂闀匡細鐢ㄦ按鏃堕暱2瀛楄妭BCD鐮侊紝鍙栧�艰寖鍥�0~9999锛屽崟浣嶄负鍒嗛挓銆�
+ public String rtuDt ;//鎺у埗鍣ㄦ椂閽�
+
+ public String toString(){
+ StringBuilder sb = new StringBuilder() ;
+ sb.append(" 缁堢鍏抽榾鑷姤:\n");
+ sb.append(" 鍏抽榾绫诲瀷锛�");
+ sb.append(CommonV1_0_1.openCloseValveType(type)) ;
+ sb.append("\n");
+ sb.append(" 绱娴侀噺锛�");
+ sb.append(totalAmount==null?"":totalAmount);
+ sb.append("\n");
+ sb.append(" 鍐滄埛缂栧彿锛�");
+ sb.append(clientNum);
+ sb.append("\n");
+ sb.append(" ic鍗″湴鍧�锛�");
+ sb.append(icAddr);
+ sb.append("\n");
+ sb.append(" 鍓╀綑閲戦锛堝厓锛夛細");
+ sb.append(remainMoney ==null?"": remainMoney);
+ sb.append("\n");
+ sb.append(" 寮�闃�鏃堕棿锛�");
+ sb.append(openDt);
+ sb.append("\n");
+ sb.append(" 鍏抽榾鏃堕棿锛�");
+ sb.append(closeDt);
+ sb.append("\n");
+ sb.append(" 鏈鐢ㄦ按閲忥細");
+ sb.append(thisAmount==null?"":thisAmount);
+ sb.append("\n");
+ sb.append(" 鏈鑺辫垂閲戦锛堝厓锛夛細");
+ sb.append(thisMoney==null?"":thisMoney);
+ sb.append("\n");
+ sb.append(" 鏈鐢ㄦ按鏃堕暱锛堝垎閽燂級锛�");
+ sb.append(thisTime==null?"":thisTime);
+ sb.append("\n");
+ sb.append(" 鎺у埗鍣ㄦ椂閽燂細");
+ sb.append(rtuDt==null?"":rtuDt);
+ sb.append("\n");
+
+ return sb.toString() ;
+ }
+}
diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/DataCd83OpenVo.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/DataCd83OpenVo.java
new file mode 100644
index 0000000..6b8da04
--- /dev/null
+++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/DataCd83OpenVo.java
@@ -0,0 +1,46 @@
+package com.dy.common.mw.protocol.p206V1_0_0;
+
+
+import lombok.Data;
+
+@Data
+public class DataCd83OpenVo {
+ // 寮�鍏抽榾绫诲瀷锛�
+ // 1銆佸埛鍗″紑闃�锛�2鍒峰崱鍏抽榾锛�3銆佷腑蹇冪珯寮�闃�锛�4銆佷腑蹇冪珯鍏抽榾锛�5銆佹瑺璐瑰叧闃�锛�
+ // 6銆佹祦閲忚鏁呴殰鍏抽榾锛�7銆佺揣鎬ュ叧闃�锛�8銆佺敤鎴疯繙绋嬪紑闃�锛�9銆佺敤鎴疯繙绋嬪叧闃�锛�
+ public Byte type ;
+ public Double totalAmount; //绱娴侀噺锛�5瀛楄妭BCD鐮侊紝鍙栧�艰寖鍥�0~9999999999锛屽崟浣嶄负m3銆�
+ public String clientNum ;//鍐滄埛缂栧彿
+ public String icAddr ;//ic鍗″湴鍧�
+ public Double remainMoney;//鍓╀綑閲戦锛氱敤鎴蜂綑棰�4瀛楄妭BCD鐮侊紝鍙栧�艰寖鍥�0.00~999999.99锛屽崟浣嶄负鍏�
+ public String openDt ;//鐢ㄦ按鎴峰紑闃�鏃堕棿锛�6瀛楄妭BCD鐮侊紝椤哄簭鏄勾鏈堟棩鏃跺垎绉掞紝鍏朵腑鍏厓骞�=2000+骞淬��
+ public String rtuDt ;//鎺у埗鍣ㄦ椂閽�
+
+ public String toString(){
+ StringBuilder sb = new StringBuilder() ;
+ sb.append(" 缁堢寮�闃�鑷姤:\n");
+ sb.append(" 寮�闃�绫诲瀷锛�");
+ sb.append(CommonV1_0_1.openCloseValveType(type)) ;
+ sb.append("\n");
+ sb.append(" 绱娴侀噺锛�");
+ sb.append(totalAmount==null?"":totalAmount);
+ sb.append("\n");
+ sb.append(" 鍐滄埛缂栧彿锛�");
+ sb.append(clientNum);
+ sb.append("\n");
+ sb.append(" ic鍗″湴鍧�锛�");
+ sb.append(icAddr);
+ sb.append("\n");
+ sb.append(" 鍓╀綑閲戦锛堝厓锛夛細");
+ sb.append(remainMoney ==null?"": remainMoney);
+ sb.append("\n");
+ sb.append(" 寮�闃�鏃堕棿锛�");
+ sb.append(openDt);
+ sb.append("\n");
+ sb.append(" 鎺у埗鍣ㄦ椂閽燂細");
+ sb.append(rtuDt==null?"":rtuDt);
+ sb.append("\n");
+
+ return sb.toString() ;
+ }
+}
diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/DataCd84Vo.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/DataCd84Vo.java
new file mode 100644
index 0000000..789350f
--- /dev/null
+++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/DataCd84Vo.java
@@ -0,0 +1,33 @@
+package com.dy.common.mw.protocol.p206V1_0_0;
+
+import lombok.Data;
+
+@Data
+public class DataCd84Vo {
+ public String clientNum ;//鍐滄埛缂栧彿
+ public Double remainMoney ;//鍓╀綑閲戦锛氱敤鎴蜂綑棰�4瀛楄妭BCD鐮侊紝鍙栧�艰寖鍥�0.00~999999.99锛屽崟浣嶄负鍏�
+ public Double totalAmount; //绱娴侀噺锛�5瀛楄妭BCD鐮侊紝鍙栧�艰寖鍥�0~9999999999锛屽崟浣嶄负m3銆�
+ public Double instantAmount; //鐬椂娴侀噺锛�5瀛楄妭BCD鐮侊紝鍙栧�艰寖鍥�0~9999999.999锛屽崟浣嶄负m3/h銆�
+ public String rtuDt ;//鎺у埗鍣ㄦ椂閽�
+
+ public String toString(){
+ StringBuilder sb = new StringBuilder() ;
+ sb.append(" 缁堢寮�闃�宸ヤ綔鎶�:\n");
+ sb.append(" 鍐滄埛缂栧彿锛�");
+ sb.append(clientNum);
+ sb.append("\n");
+ sb.append(" 鍓╀綑閲戦锛堝厓锛夛細");
+ sb.append(remainMoney==null?"":remainMoney);
+ sb.append("\n");
+ sb.append(" 绱娴侀噺锛�");
+ sb.append(totalAmount==null?"":totalAmount);
+ sb.append("\n");
+ sb.append(" 鐬椂娴侀噺锛�");
+ sb.append(instantAmount==null?"":instantAmount);
+ sb.append("\n");
+ sb.append(" 鎺у埗鍣ㄦ椂閽燂細");
+ sb.append(rtuDt==null?"":rtuDt);
+ sb.append("\n");
+ return sb.toString() ;
+ }
+}
diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/DataStateVo.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/DataStateVo.java
new file mode 100644
index 0000000..08bfef9
--- /dev/null
+++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/DataStateVo.java
@@ -0,0 +1,24 @@
+package com.dy.common.mw.protocol.p206V1_0_0;
+
+import lombok.Data;
+
+@Data
+public class DataStateVo {
+ public Byte idCard ;// 钃勭數姹犵數鍘�
+ public Byte work;//宸ヤ綔鐘舵��
+ public Byte valve ;//闃�闂�
+
+ public String toString(){
+ StringBuilder str = new StringBuilder() ;
+ str.append(" 鐘舵��:\n");
+ str.append(" IC 鍗″姛鑳斤細");
+ str.append(idCard==null?"":(idCard==1?"鏈夋晥":"鏃犳晥"));
+ str.append("\n");
+ str.append(" 宸ヤ綔鐘舵�侊細");
+ str.append(work ==null?"":(work==1?"鍚姩":"鍋滄"));
+ str.append("\n");
+ str.append(" 闃�闂細");
+ str.append(valve==null?"":(valve==1?"鎵撳紑":"鍏抽棴"));
+ return str.toString() ;
+ }
+}
diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/DriverV1_0_1.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/DriverV1_0_1.java
index 38aac6a..ea3fefd 100644
--- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/DriverV1_0_1.java
+++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/DriverV1_0_1.java
@@ -106,6 +106,7 @@
callback.callback(rtuAddr, upCode, upHex, reportOrResponse_trueOrFalse, isFail, rtuAddrInData);
}
}
+
/**
* 鏋勯�犱笅琛屾暟鎹紙鍛戒护锛�
* @param isLowPower 鏄惁鍦ㄤ綆鍔熻�楃幆澧冧笅杩愯
diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/OnLineV1_0_1.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/OnLineV1_0_1.java
new file mode 100644
index 0000000..69d63a1
--- /dev/null
+++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/OnLineV1_0_1.java
@@ -0,0 +1,39 @@
+package com.dy.common.mw.protocol.p206V1_0_0;
+
+import com.dy.common.mw.protocol.AnnotationOnLine;
+import com.dy.common.mw.protocol.OnLine;
+
+@AnnotationOnLine(
+ protocolName = ProtocolConstantV206V1_0_0.protocolName,
+ priority = ProtocolConstantV206V1_0_0.priority)
+@SuppressWarnings("unused")
+public class OnLineV1_0_1 implements OnLine{
+
+ /**
+ * 瀵逛笂绾挎暟鎹繘琛屽垎鏋�
+ * @param upBuf 涓婅鏁版嵁
+ * @return
+ */
+ @Override
+ public OnLineResult parse(byte[] upBuf)throws Exception {
+ OnLineResult olr = new OnLineResult() ;
+ CommonV1_0_1 cp = new CommonV1_0_1() ;
+ Boolean flag = cp.isThisProtocolHead(upBuf) ;
+ if(flag == null){
+ //鍑洪敊
+ olr.result = OnLine.OnLineAction_fail ;
+ olr.rtuAddr = null ;
+ }else if(!flag.booleanValue()){
+ //涓嶆槸鏈崗璁暟鎹�
+ olr.result = OnLine.OnLineAction_success_noMe ;
+ olr.rtuAddr = null ;
+ }else{
+ //鏄湰鍗忚鏁版嵁
+ olr.result = OnLine.OnLineAction_success ;
+ olr.rtuAddr = cp.parseRtuAddr(upBuf) ;
+ olr.protocolName = ProtocolConstantV206V1_0_0.protocolName ;
+ }
+ return olr;
+ }
+
+}
diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/ParseParamsForDownV1_0_1.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/ParseParamsForDownV1_0_1.java
new file mode 100644
index 0000000..a0f2caa
--- /dev/null
+++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/ParseParamsForDownV1_0_1.java
@@ -0,0 +1,40 @@
+package com.dy.common.mw.protocol.p206V1_0_0;
+
+import com.dy.common.mw.protocol.CodeParseParams;
+
+public class ParseParamsForDownV1_0_1 implements CodeParseParams{
+
+ public String protocolName ;
+ public String rtuAddr ;//鎺у埗鍣ㄥ湴鍧�
+ public String commandId ;
+ public String commandCode ;
+ public Object param ;
+ public Object attachment ;
+
+ public ParseParamsForDownV1_0_1(){}
+
+ public void clear(){
+ this.protocolName = null ;
+ this.rtuAddr = null ;
+ this.commandId = null ;
+ this.commandCode = null ;
+ this.param = null ;
+ this.attachment = null ;
+ }
+
+ public void setValue(
+ String protocolName,
+ String rtuAddr,
+ String commandId,
+ String commandCode,
+ Object param,
+ Object attachment ){
+ this.protocolName = protocolName ;
+ this.rtuAddr = rtuAddr ;
+ this.commandId = commandId ;
+ this.commandCode = commandCode ;
+ this.param = param ;
+ this.attachment = attachment ;
+ }
+
+}
diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/ParseParamsForUpV1_0_1.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/ParseParamsForUpV1_0_1.java
new file mode 100644
index 0000000..58d58c9
--- /dev/null
+++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/ParseParamsForUpV1_0_1.java
@@ -0,0 +1,39 @@
+package com.dy.common.mw.protocol.p206V1_0_0;
+
+import com.dy.common.mw.protocol.CodeParseParams;
+import com.dy.common.mw.protocol.Data;
+
+public class ParseParamsForUpV1_0_1 implements CodeParseParams{
+
+ public String protocolName ;//鍗忚鍚嶇О
+ public String rtuAddr ;//鎺у埗鍣ㄥ潃
+ public String upCode ;//涓婅鎶ユ枃鏁版嵁涓殑鍔熻兘鐮�
+ public String upHex ;//琛屾姤鏂囨暟鎹崄鍏繘鍒跺舰寮�
+ public byte[] upBuffer ;//琛屾姤鏂囨暟鎹瓧鑺傛暟缁�
+ public Data data ;//瑙f瀽鍚庣殑鏁版嵁
+
+ public ParseParamsForUpV1_0_1(){}
+
+ public void clear(){
+ this.protocolName = null ;
+ this.rtuAddr = null ;
+ this.upCode = null ;
+ this.upHex = null ;
+ this.upBuffer = null ;
+ this.data = null ;
+ }
+
+ public void setValue(String protocolName,
+ String rtuAddr,
+ String upCode,
+ String upHex,
+ byte[] upBuffer,
+ Data data){
+ this.protocolName = protocolName ;
+ this.rtuAddr = rtuAddr ;
+ this.upCode = upCode ;
+ this.upHex = upHex ;
+ this.upBuffer = upBuffer ;
+ this.data = data ;
+ }
+}
diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/parse/Cd_02_Up.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/parse/Cd_02_Up.java
new file mode 100644
index 0000000..dd96f44
--- /dev/null
+++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/parse/Cd_02_Up.java
@@ -0,0 +1,89 @@
+package com.dy.common.mw.protocol.p206V1_0_0.parse;
+
+
+import com.dy.common.mw.protocol.*;
+import com.dy.common.util.ByteUtil;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+
+import com.dy.common.mw.protocol.p206V1_0_0.*;
+
+@AnnotationCodeUp(ifAny={
+ CodeV1_0_1.cd_02
+})
+@SuppressWarnings("unused")
+public class Cd_02_Up implements CodeParse{
+
+ private static final Logger log = LogManager.getLogger(Cd_02_Up.class);
+
+ /**
+ * 鍒嗘瀽涓婅鏁版嵁
+ */
+ @Override
+ public MidResult[] parse(Boolean isLowPower, CodeParseParams params, CodeParseCallback callback)throws Exception {
+ ParseParamsForUpV1_0_1 para = (ParseParamsForUpV1_0_1)params ;
+ int bsLen = new CommonV1_0_1().parseDataLen(para.upBuffer) ;
+ if(bsLen > 0){
+ this.doParse(para.upBuffer,
+ bsLen,
+ para.upCode,
+ para.data) ;
+ }
+ log.info("鍒嗘瀽涓婅鏁版嵁<" + CodeV1_0_1.getCodeName(para.upCode) + " RTU鍦板潃=" + para.rtuAddr + ">:\n" + para.data.toString());
+
+ MidResultFromRtu midRs = new MidResultFromRtu() ;
+ midRs.protocolName = para.protocolName ;//鍗忚鍚嶇О
+ midRs.rtuAddr = para.rtuAddr ;//Rtu鍦板潃
+ midRs.upCode = para.upCode ;//涓婅鏁版嵁涓殑鍔熻兘鐮�
+ midRs.upHex = para.upHex ;//涓婅鏁版嵁鍗佸叚杩涘埗褰㈠紡
+ midRs.upBuffer = para.upBuffer ;//涓婅鏁版嵁瀛楄妭鏁扮粍
+ midRs.data = para.data ;//瑙f瀽鍚庣殑鏁版嵁
+
+ midRs.reportOrResponse_trueOrFalse = true ;//涓诲姩涓婃姤
+
+ String confirmComCode = para.upCode ;
+ ParseParamsForDownV1_0_1 downCpParams = new ParseParamsForDownV1_0_1() ;
+ downCpParams.setValue(
+ ProtocolConstantV206V1_0_0.protocolName,
+ para.rtuAddr,
+ Command.defaultId,
+ confirmComCode,
+ null,
+ null);
+ //鏋勯�犲簲绛�
+ byte[] data = new Cd_02_Down().doParse(downCpParams) ;
+
+ MidResultToRtu confirmCommand = new MidResultToRtu() ;
+ confirmCommand.protocolName = para.protocolName ;//鍗忚鍚嶇О
+ confirmCommand.rtuAddr = para.rtuAddr ;//Rtu鍦板潃
+ confirmCommand.commandId = Command.defaultId ;//鍛戒护ID锛屽彂璧峰懡浠ょ殑瀹㈡埛绔�(web绔�)鐢熸垚锛屼互鍖归厤鍛戒护缁撴灉
+ confirmCommand.downCode = confirmComCode ;//涓嬭鍛戒护鍔熻兘鐮�;
+ confirmCommand.downBuffer = data ;//涓嬭鍛戒护鏁版嵁
+ confirmCommand.downBufHex = ByteUtil.bytes2Hex(data, true) ;//涓嬭鍛戒护鏁版嵁鍗佸叚杩涘埗褰㈠紡
+ confirmCommand.hasResponse = false ;//鏄惁鏈夊簲绛�
+ confirmCommand.maxSendTimes = 1 ;//鍛戒护鏈�澶у彂閫佹鏁�(褰撴敹涓嶅埌搴旂瓟鏃讹紝灏嗛噸鍙�2娆�)锛屽鏋滀笉璁剧疆锛屽懡浠ょ紦瀛樺櫒杩涜琛ュ厖璁剧疆
+ confirmCommand.isCachForOffLine = false ;//RTU涓嶅湪绾匡紝鍛戒护鏄惁缂撳瓨
+
+ confirmCommand.isSendFirst = true ;//纭鍛戒护锛屼紭鍏堝彂閫�
+ if(isLowPower != null && isLowPower.booleanValue()){
+ //浣庡姛鑰楁椂锛屽敖蹇彂閫�
+ confirmCommand.isQuickSend = true ;
+ }
+ callback.callback(midRs.reportOrResponse_trueOrFalse);
+ return new MidResult[]{midRs, confirmCommand} ;
+ }
+ /**
+ * 鎵ц鍒嗘瀽
+ * @param bs 瀛楄妭鏁扮粍
+ * @param bsLen 瀛楄妭闀垮害锛堟�诲寘闀匡紝鍖呮嫭鍖呭ご鍜屽寘灏撅級
+ * @param dataCode 鍔熻兘鐮�
+ * @param data 鏁版嵁
+ * @throws Exception 寮傚父
+ */
+ protected void doParse(byte[] bs, int bsLen, String dataCode, Data data) throws Exception {
+ DataV1_0_1 dV1 = (DataV1_0_1)data.getSubData() ;
+ DataCd02Vo cdData = new DataCd02Vo() ;
+ dV1.dataCd02Vo = cdData ;
+ cdData.status = ByteUtil.bytes2Hex(bs, false, ProtocolConstantV206V1_0_0.dataIndex, 1) ;
+ }
+}
diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/parse/Cd_71_Up.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/parse/Cd_71_Up.java
new file mode 100644
index 0000000..69e36a4
--- /dev/null
+++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/parse/Cd_71_Up.java
@@ -0,0 +1,65 @@
+package com.dy.common.mw.protocol.p206V1_0_0.parse;
+
+import com.dy.common.mw.protocol.*;
+import com.dy.common.mw.protocol.p206V1_0_0.*;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+
+@AnnotationCodeUp(ifAny={
+ CodeV1_0_1.cd_71
+})
+@SuppressWarnings("unused")
+public class Cd_71_Up implements CodeParse {
+
+ private static final Logger log = LogManager.getLogger(Cd_71_Up.class);
+
+ /**
+ * 鍒嗘瀽涓婅鏁版嵁
+ */
+ @Override
+ public MidResult[] parse(Boolean isLowPower, CodeParseParams params, CodeParseCallback callback)throws Exception {
+ ParseParamsForUpV1_0_1 para = (ParseParamsForUpV1_0_1)params ;
+ int bsLen = new CommonV1_0_1().parseDataLen(para.upBuffer) ;
+ if(bsLen > 0){
+ this.doParse(para.upBuffer,
+ bsLen,
+ para.upCode,
+ para.data) ;
+ }
+ log.info("鍒嗘瀽涓婅鏁版嵁<" + CodeV1_0_1.getCodeName(para.upCode) + " RTU鍦板潃=" + para.rtuAddr + ">:\n" + para.data.toString());
+
+ MidResultFromRtu midRs = new MidResultFromRtu() ;
+ midRs.protocolName = para.protocolName ;//鍗忚鍚嶇О
+ midRs.rtuAddr = para.rtuAddr ;//Rtu鍦板潃
+ midRs.upCode = para.upCode ;//涓婅鏁版嵁涓殑鍔熻兘鐮�
+ midRs.upHex = para.upHex ;//涓婅鏁版嵁鍗佸叚杩涘埗褰㈠紡
+ midRs.upBuffer = para.upBuffer ;//涓婅鏁版嵁瀛楄妭鏁扮粍
+ midRs.data = para.data ;//瑙f瀽鍚庣殑鏁版嵁
+
+ midRs.reportOrResponse_trueOrFalse = false ;//涓诲姩涓婃姤
+
+ callback.callback(midRs.reportOrResponse_trueOrFalse);
+ return new MidResult[]{midRs} ;
+ }
+ /**
+ * 鎵ц鍒嗘瀽
+ * @param bs 瀛楄妭鏁扮粍
+ * @param bsLen 瀛楄妭闀垮害锛堟�诲寘闀匡紝鍖呮嫭鍖呭ご鍜屽寘灏撅級
+ * @param dataCode 鍔熻兘鐮�
+ * @param data 鏁版嵁
+ * @throws Exception 寮傚父
+ */
+ protected void doParse(byte[] bs, int bsLen, String dataCode, Data data) throws Exception {
+ DataV1_0_1 dV1 = (DataV1_0_1)data.getSubData() ;
+ DataCd71Vo cdData = new DataCd71Vo() ;
+ dV1.dataCd71Vo = cdData ;
+ cdData.state = bs[ProtocolConstantV206V1_0_0.dataIndex] ;
+ if(cdData.state == 0){
+ cdData.stateName = "闃�闂ㄥ叧闂�" ;
+ }else if(cdData.state == 1){
+ cdData.stateName = "闃�闂ㄦ墦寮�" ;
+ }else{
+ cdData.stateName = "鏈煡" ;
+ }
+ }
+}
diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/parse/Cd_83_Up.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/parse/Cd_83_Up.java
new file mode 100644
index 0000000..15ff9f1
--- /dev/null
+++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/parse/Cd_83_Up.java
@@ -0,0 +1,253 @@
+package com.dy.common.mw.protocol.p206V1_0_0.parse;
+
+import com.dy.common.mw.protocol.*;
+import com.dy.common.mw.protocol.p206V1_0_0.*;
+import com.dy.common.mw.protocol.p206V1_0_0.parse.global.GlParse;
+import com.dy.common.util.ByteUtil;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+
+@AnnotationCodeUp(ifAny={
+ CodeV1_0_1.cd_83
+})
+@SuppressWarnings("unused")
+public class Cd_83_Up implements CodeParse {
+
+ private static final Logger log = LogManager.getLogger(Cd_83_Up.class);
+
+ /**
+ * 鍒嗘瀽涓婅鏁版嵁
+ */
+ @Override
+ public MidResult[] parse(Boolean isLowPower, CodeParseParams params, CodeParseCallback callback)throws Exception {
+ ParseParamsForUpV1_0_1 para = (ParseParamsForUpV1_0_1)params ;
+ int bsLen = new CommonV1_0_1().parseDataLen(para.upBuffer) ;
+ if(bsLen > 0){
+ this.doParse(para.upBuffer,
+ bsLen,
+ para.upCode,
+ para.data) ;
+ }
+ log.info("鍒嗘瀽涓婅鏁版嵁<" + CodeV1_0_1.getCodeName(para.upCode) + " RTU鍦板潃=" + para.rtuAddr + ">:\n" + para.data.toString());
+
+ MidResultFromRtu midRs = new MidResultFromRtu() ;
+ midRs.protocolName = para.protocolName ;//鍗忚鍚嶇О
+ midRs.rtuAddr = para.rtuAddr ;//Rtu鍦板潃
+ midRs.upCode = para.upCode ;//涓婅鏁版嵁涓殑鍔熻兘鐮�
+ midRs.upHex = para.upHex ;//涓婅鏁版嵁鍗佸叚杩涘埗褰㈠紡
+ midRs.upBuffer = para.upBuffer ;//涓婅鏁版嵁瀛楄妭鏁扮粍
+ midRs.data = para.data ;//瑙f瀽鍚庣殑鏁版嵁
+
+ midRs.reportOrResponse_trueOrFalse = true ;//涓诲姩涓婃姤
+
+ String confirmComCode = para.upCode ;
+ ParseParamsForDownV1_0_1 downCpParams = new ParseParamsForDownV1_0_1() ;
+ downCpParams.setValue(
+ ProtocolConstantV206V1_0_0.protocolName,
+ para.rtuAddr,
+ Command.defaultId,
+ confirmComCode,
+ null,
+ null);
+ //鏋勯�犲簲绛�
+ byte[] data = new Cd_83_Down().doParse(downCpParams) ;
+
+ MidResultToRtu confirmCommand = new MidResultToRtu() ;
+ confirmCommand.protocolName = para.protocolName ;//鍗忚鍚嶇О
+ confirmCommand.rtuAddr = para.rtuAddr ;//Rtu鍦板潃
+ confirmCommand.commandId = Command.defaultId ;//鍛戒护ID锛屽彂璧峰懡浠ょ殑瀹㈡埛绔�(web绔�)鐢熸垚锛屼互鍖归厤鍛戒护缁撴灉
+ confirmCommand.downCode = confirmComCode ;//涓嬭鍛戒护鍔熻兘鐮�;
+ confirmCommand.downBuffer = data ;//涓嬭鍛戒护鏁版嵁
+ confirmCommand.downBufHex = ByteUtil.bytes2Hex(data, true) ;//涓嬭鍛戒护鏁版嵁鍗佸叚杩涘埗褰㈠紡
+ confirmCommand.hasResponse = false ;//鏄惁鏈夊簲绛�
+ confirmCommand.maxSendTimes = 1 ;//鍛戒护鏈�澶у彂閫佹鏁�(褰撴敹涓嶅埌搴旂瓟鏃讹紝灏嗛噸鍙�2娆�)锛屽鏋滀笉璁剧疆锛屽懡浠ょ紦瀛樺櫒杩涜琛ュ厖璁剧疆
+ confirmCommand.isCachForOffLine = false ;//RTU涓嶅湪绾匡紝鍛戒护鏄惁缂撳瓨
+
+ confirmCommand.isSendFirst = true ;//纭鍛戒护锛屼紭鍏堝彂閫�
+ if(isLowPower != null && isLowPower.booleanValue()){
+ //浣庡姛鑰楁椂锛屽敖蹇彂閫�
+ confirmCommand.isQuickSend = true ;
+ }
+
+ callback.callback(midRs.reportOrResponse_trueOrFalse);
+ return new MidResult[]{midRs, confirmCommand} ;
+ }
+ /**
+ * 鎵ц鍒嗘瀽
+ * @param bs 瀛楄妭鏁扮粍
+ * @param bsLen 瀛楄妭闀垮害锛堟�诲寘闀匡紝鍖呮嫭鍖呭ご鍜屽寘灏撅級
+ * @param dataCode 鍔熻兘鐮�
+ * @param data 鏁版嵁
+ * @throws Exception 寮傚父
+ */
+ protected void doParse(byte[] bs, int bsLen, String dataCode, Data data) throws Exception {
+ short index = ProtocolConstantV206V1_0_0.dataIndex ;
+ byte opType = bs[ProtocolConstantV206V1_0_0.dataIndex];
+ if(opType == 1 || opType == 3 || opType == 8){
+ this.doParseOpen(opType, bs, bsLen, dataCode, data);
+ }else{
+ this.doParseClose(opType, bs, bsLen, dataCode, data);
+ }
+ }
+ private void doParseOpen(byte opType, byte[] bs, int bsLen, String dataCode, Data data) throws Exception {
+ DataV1_0_1 dV1 = (DataV1_0_1)data.getSubData() ;
+ DataCd83OpenVo cdData = new DataCd83OpenVo() ;
+ dV1.dataCd83OpenVo = cdData ;
+
+ cdData.type = opType ;
+
+ short index = ProtocolConstantV206V1_0_0.dataIndex + 1 ;
+ //绱娴侀噺锛�5瀛楄妭BCD鐮侊紝鍙栧�艰寖鍥�0~9999999999锛屽崟浣嶄负m3銆�
+ cdData.totalAmount = 0.0D ;
+ int tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ;
+ index++ ;
+ cdData.totalAmount += tpInt;
+ tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ;
+ index++ ;
+ cdData.totalAmount += tpInt * 100.0 ;
+ tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ;
+ index++ ;
+ cdData.totalAmount += tpInt * 10000.0 ;
+ tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ;
+ index++ ;
+ cdData.totalAmount += tpInt * 1000000.0 ;
+ tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ;
+ index++ ;
+ cdData.totalAmount += tpInt * 100000000.0 ;
+
+ //鐢ㄦ按鎴峰彿鏁版嵁鏍煎紡锛�5瀛楄妭BCD鐮佷綆浣嶅湪鍓嶉珮浣嶅湪鍚庛��
+ cdData.clientNum = ByteUtil.BCD2String_LE(bs, index, index + 4) ;
+ index += 5 ;
+
+ //IC鍗″彿鏍煎紡锛�4瀛楄妭HEX鐮佷綆浣嶅湪鍓嶉珮浣嶅湪鍚庛��
+ cdData.clientNum = ByteUtil.bytesToHex(bs, index, index + 3) ;
+ index += 4 ;
+
+ //鐢ㄦ按鎴蜂綑棰濓細鐢ㄦ埛浣欓4瀛楄妭BCD鐮侊紝鍙栧�艰寖鍥�0.00~999999.99锛屽崟浣嶄负鍏冦��
+ cdData.remainMoney = 0.0D ;
+ tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ;
+ index++ ;
+ cdData.remainMoney += tpInt/100.0 ;
+ tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ;
+ index++ ;
+ cdData.remainMoney += tpInt;
+ tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ;
+ index++ ;
+ cdData.remainMoney += tpInt * 100.0 ;
+ tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ;
+ index++ ;
+ cdData.remainMoney += tpInt * 10000.0 ;
+
+ //鐢ㄦ按鎴风敤姘村紑濮嬫椂闂达細6瀛楄妭BCD鐮侊紝椤哄簭鏄勾鏈堟棩鏃跺垎绉掞紝鍏朵腑鍏厓骞�=2000+骞淬��
+ cdData.openDt = GlParse.parseTp(bs, index) ;
+ index += 6 ;
+
+ //鎺у埗鍣ㄦ椂閽�
+ cdData.rtuDt = GlParse.parseTp(bs, index) ;
+ //index += 6 ;
+ }
+
+ private void doParseClose(byte opType, byte[] bs, int bsLen, String dataCode, Data data) throws Exception {
+ DataV1_0_1 dV1 = (DataV1_0_1)data.getSubData() ;
+ DataCd83CloseVo cdData = new DataCd83CloseVo() ;
+ dV1.dataCd83CloseVo = cdData ;
+
+ cdData.type = opType ;
+
+ short index = ProtocolConstantV206V1_0_0.dataIndex + 1 ;
+ //绱娴侀噺锛�5瀛楄妭BCD鐮侊紝鍙栧�艰寖鍥�0~9999999999锛屽崟浣嶄负m3銆�
+ cdData.totalAmount = 0.0D ;
+ int tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ;
+ index++ ;
+ cdData.totalAmount += tpInt;
+ tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ;
+ index++ ;
+ cdData.totalAmount += tpInt * 100.0 ;
+ tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ;
+ index++ ;
+ cdData.totalAmount += tpInt * 10000.0 ;
+ tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ;
+ index++ ;
+ cdData.totalAmount += tpInt * 1000000.0 ;
+ tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ;
+ index++ ;
+ cdData.totalAmount += tpInt * 100000000.0 ;
+
+ //鐢ㄦ按鎴峰彿鏁版嵁鏍煎紡锛�5瀛楄妭BCD鐮佷綆浣嶅湪鍓嶉珮浣嶅湪鍚庛��
+ cdData.clientNum = ByteUtil.BCD2String_LE(bs, index, index + 4) ;
+ index += 5 ;
+
+ //IC鍗″彿鏍煎紡锛�4瀛楄妭HEX鐮佷綆浣嶅湪鍓嶉珮浣嶅湪鍚庛��
+ cdData.clientNum = ByteUtil.bytesToHex(bs, index, index + 3) ;
+ index += 4 ;
+
+ //鐢ㄦ按鎴蜂綑棰濓細鐢ㄦ埛浣欓4瀛楄妭BCD鐮侊紝鍙栧�艰寖鍥�0.00~999999.99锛屽崟浣嶄负鍏冦��
+ cdData.remainMoney = 0.0D ;
+ tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ;
+ index++ ;
+ cdData.remainMoney += tpInt/100.0 ;
+ tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ;
+ index++ ;
+ cdData.remainMoney += tpInt;
+ tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ;
+ index++ ;
+ cdData.remainMoney += tpInt * 100.0 ;
+ tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ;
+ index++ ;
+ cdData.remainMoney += tpInt * 10000.0 ;
+
+ //鐢ㄦ按鎴风敤姘村紑濮嬫椂闂达細6瀛楄妭BCD鐮侊紝椤哄簭鏄勾鏈堟棩鏃跺垎绉掞紝鍏朵腑鍏厓骞�=2000+骞淬��
+ cdData.openDt = GlParse.parseTp(bs, index) ;
+ index += 6 ;
+
+ //鐢ㄦ按鎴风敤姘寸粨鏉熸椂闂达細6瀛楄妭BCD鐮侊紝椤哄簭鏄勾鏈堟棩鏃跺垎绉掞紝鍏朵腑鍏厓骞�=2000+骞淬��
+ cdData.closeDt = GlParse.parseTp(bs, index) ;
+ index += 6 ;
+
+ //鐢ㄦ按鎴锋湰娆$敤姘撮噺锛氱疮璁℃祦閲�5瀛楄妭BCD鐮侊紝鍙栧�艰寖鍥�0~9999999999锛屽崟浣嶄负m3銆�
+ cdData.thisAmount = 0.0D ;
+ tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ;
+ index++ ;
+ cdData.thisAmount += tpInt/100.0 ;
+ tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ;
+ index++ ;
+ cdData.thisAmount += tpInt ;
+ tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ;
+ index++ ;
+ cdData.thisAmount += tpInt * 100.0 ;
+ tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ;
+ index++ ;
+ cdData.thisAmount += tpInt * 10000.0 ;
+ tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ;
+ index++ ;
+ cdData.thisAmount += tpInt * 1000000.0 ;
+
+ //鐢ㄦ按鎴锋湰娆℃秷璐归噾棰濓細鐢ㄦ埛浣欓4瀛楄妭BCD鐮侊紝鍙栧�艰寖鍥�0.00~999999.99锛屽崟浣嶄负鍏冦��
+ cdData.thisMoney = 0.0D ;
+ tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ;
+ index++ ;
+ cdData.thisMoney += tpInt/100.0 ;
+ tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ;
+ index++ ;
+ cdData.thisMoney += tpInt;
+ tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ;
+ index++ ;
+ cdData.thisMoney += tpInt * 100.0 ;
+ tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ;
+ index++ ;
+ cdData.thisMoney += tpInt * 10000.0 ;
+
+ //鐢ㄦ按鎴锋湰娆$敤姘存椂闀匡細鐢ㄦ按鏃堕暱2瀛楄妭BCD鐮侊紝鍙栧�艰寖鍥�0~9999锛屽崟浣嶄负鍒嗛挓銆�
+ cdData.thisTime = 0 ;
+ tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ;
+ index++ ;
+ cdData.thisTime += tpInt;
+ tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ;
+ index++ ;
+ cdData.thisTime += tpInt * 100 ;
+
+ //鎺у埗鍣ㄦ椂閽�
+ cdData.rtuDt = GlParse.parseTp(bs, index) ;
+ //index += 6 ;
+ }
+}
diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/parse/Cd_84_Up.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/parse/Cd_84_Up.java
new file mode 100644
index 0000000..a14fc36
--- /dev/null
+++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/parse/Cd_84_Up.java
@@ -0,0 +1,149 @@
+package com.dy.common.mw.protocol.p206V1_0_0.parse;
+
+import com.dy.common.mw.protocol.*;
+import com.dy.common.mw.protocol.p206V1_0_0.*;
+import com.dy.common.mw.protocol.p206V1_0_0.parse.global.GlParse;
+import com.dy.common.util.ByteUtil;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+
+@AnnotationCodeUp(ifAny={
+ CodeV1_0_1.cd_84
+})
+@SuppressWarnings("unused")
+public class Cd_84_Up implements CodeParse {
+
+ private static final Logger log = LogManager.getLogger(Cd_84_Up.class);
+
+ /**
+ * 鍒嗘瀽涓婅鏁版嵁
+ */
+ @Override
+ public MidResult[] parse(Boolean isLowPower, CodeParseParams params, CodeParseCallback callback)throws Exception {
+ ParseParamsForUpV1_0_1 para = (ParseParamsForUpV1_0_1)params ;
+ int bsLen = new CommonV1_0_1().parseDataLen(para.upBuffer) ;
+ if(bsLen > 0){
+ this.doParse(para.upBuffer,
+ bsLen,
+ para.upCode,
+ para.data) ;
+ }
+ log.info("鍒嗘瀽涓婅鏁版嵁<" + CodeV1_0_1.getCodeName(para.upCode) + " RTU鍦板潃=" + para.rtuAddr + ">:\n" + para.data.toString());
+
+ MidResultFromRtu midRs = new MidResultFromRtu() ;
+ midRs.protocolName = para.protocolName ;//鍗忚鍚嶇О
+ midRs.rtuAddr = para.rtuAddr ;//Rtu鍦板潃
+ midRs.upCode = para.upCode ;//涓婅鏁版嵁涓殑鍔熻兘鐮�
+ midRs.upHex = para.upHex ;//涓婅鏁版嵁鍗佸叚杩涘埗褰㈠紡
+ midRs.upBuffer = para.upBuffer ;//涓婅鏁版嵁瀛楄妭鏁扮粍
+ midRs.data = para.data ;//瑙f瀽鍚庣殑鏁版嵁
+
+ midRs.reportOrResponse_trueOrFalse = true ;//涓诲姩涓婃姤
+
+ String confirmComCode = para.upCode ;
+ ParseParamsForDownV1_0_1 downCpParams = new ParseParamsForDownV1_0_1() ;
+ downCpParams.setValue(
+ ProtocolConstantV206V1_0_0.protocolName,
+ para.rtuAddr,
+ Command.defaultId,
+ confirmComCode,
+ null,
+ null);
+ //鏋勯�犲簲绛�
+ byte[] data = new Cd_84_Down().doParse(downCpParams) ;
+
+ MidResultToRtu confirmCommand = new MidResultToRtu() ;
+ confirmCommand.protocolName = para.protocolName ;//鍗忚鍚嶇О
+ confirmCommand.rtuAddr = para.rtuAddr ;//Rtu鍦板潃
+ confirmCommand.commandId = Command.defaultId ;//鍛戒护ID锛屽彂璧峰懡浠ょ殑瀹㈡埛绔�(web绔�)鐢熸垚锛屼互鍖归厤鍛戒护缁撴灉
+ confirmCommand.downCode = confirmComCode ;//涓嬭鍛戒护鍔熻兘鐮�;
+ confirmCommand.downBuffer = data ;//涓嬭鍛戒护鏁版嵁
+ confirmCommand.downBufHex = ByteUtil.bytes2Hex(data, true) ;//涓嬭鍛戒护鏁版嵁鍗佸叚杩涘埗褰㈠紡
+ confirmCommand.hasResponse = false ;//鏄惁鏈夊簲绛�
+ confirmCommand.maxSendTimes = 1 ;//鍛戒护鏈�澶у彂閫佹鏁�(褰撴敹涓嶅埌搴旂瓟鏃讹紝灏嗛噸鍙�2娆�)锛屽鏋滀笉璁剧疆锛屽懡浠ょ紦瀛樺櫒杩涜琛ュ厖璁剧疆
+ confirmCommand.isCachForOffLine = false ;//RTU涓嶅湪绾匡紝鍛戒护鏄惁缂撳瓨
+
+ confirmCommand.isSendFirst = true ;//纭鍛戒护锛屼紭鍏堝彂閫�
+ if(isLowPower != null && isLowPower.booleanValue()){
+ //浣庡姛鑰楁椂锛屽敖蹇彂閫�
+ confirmCommand.isQuickSend = true ;
+ }
+
+ callback.callback(midRs.reportOrResponse_trueOrFalse);
+ return new MidResult[]{midRs, confirmCommand} ;
+ }
+ /**
+ * 鎵ц鍒嗘瀽
+ * @param bs 瀛楄妭鏁扮粍
+ * @param bsLen 瀛楄妭闀垮害锛堟�诲寘闀匡紝鍖呮嫭鍖呭ご鍜屽寘灏撅級
+ * @param dataCode 鍔熻兘鐮�
+ * @param data 鏁版嵁
+ * @throws Exception 寮傚父
+ */
+ protected void doParse(byte[] bs, int bsLen, String dataCode, Data data) throws Exception {
+ DataV1_0_1 dV1 = (DataV1_0_1)data.getSubData() ;
+ DataCd84Vo cdData = new DataCd84Vo() ;
+ dV1.dataCd84Vo = cdData ;
+
+ short index = ProtocolConstantV206V1_0_0.dataIndex ;
+ //鐢ㄦ按鎴峰彿鏁版嵁鏍煎紡锛�5瀛楄妭BCD鐮佷綆浣嶅湪鍓嶉珮浣嶅湪鍚庛��
+ cdData.clientNum = ByteUtil.BCD2String_LE(bs, index, index + 4) ;
+ index += 5 ;
+
+ //鐢ㄦ按鎴蜂綑棰濓細鐢ㄦ埛浣欓4瀛楄妭BCD鐮侊紝鍙栧�艰寖鍥�0.00~999999.99锛屽崟浣嶄负鍏冦��
+ cdData.remainMoney = 0.0D ;
+ int tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ;
+ index++ ;
+ cdData.remainMoney += tpInt/100.0 ;
+ tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ;
+ index++ ;
+ cdData.remainMoney += tpInt;
+ tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ;
+ index++ ;
+ cdData.remainMoney += tpInt * 100.0 ;
+ tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ;
+ index++ ;
+ cdData.remainMoney += tpInt * 10000.0 ;
+
+ //绱娴侀噺锛�5瀛楄妭BCD鐮侊紝鍙栧�艰寖鍥�0~9999999999锛屽崟浣嶄负m3銆�
+ cdData.totalAmount = 0.0D ;
+ tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ;
+ index++ ;
+ cdData.totalAmount += tpInt;
+ tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ;
+ index++ ;
+ cdData.totalAmount += tpInt * 100.0 ;
+ tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ;
+ index++ ;
+ cdData.totalAmount += tpInt * 10000.0 ;
+ tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ;
+ index++ ;
+ cdData.totalAmount += tpInt * 1000000.0 ;
+ tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ;
+ index++ ;
+ cdData.totalAmount += tpInt * 100000000.0 ;
+
+ //鐬椂娴侀噺锛�5瀛楄妭BCD鐮侊紝鍙栧�艰寖鍥�0~9999999.999锛屽崟浣嶄负m3/h銆�
+ cdData.instantAmount = 0.0D ;
+ tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ;
+ index++ ;
+ cdData.instantAmount += tpInt/1000.0 ;
+ tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ;
+ index++ ;
+ cdData.instantAmount += tpInt/10.0 ;
+ tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ;
+ index++ ;
+ cdData.instantAmount += tpInt * 10.0 ;
+ tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ;
+ index++ ;
+ cdData.instantAmount += tpInt * 1000.0 ;
+ tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ;
+ index++ ;
+ cdData.instantAmount += tpInt * 100000.0 ;
+
+ //鎺у埗鍣ㄦ椂閽�
+ cdData.rtuDt = GlParse.parseTp(bs, index) ;
+ //index += 6 ;
+ }
+
+}
diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/parse/Cd_C0_Up.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/parse/Cd_C0_Up.java
new file mode 100644
index 0000000..dd61198
--- /dev/null
+++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/parse/Cd_C0_Up.java
@@ -0,0 +1,224 @@
+package com.dy.common.mw.protocol.p206V1_0_0.parse;
+
+import com.dy.common.mw.protocol.*;
+import com.dy.common.mw.protocol.p206V1_0_0.*;
+import com.dy.common.mw.protocol.p206V1_0_0.parse.global.GlParse;
+import com.dy.common.util.ByteUtil;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+
+@AnnotationCodeUp(ifAny={
+ CodeV1_0_1.cd_C0
+})
+@SuppressWarnings("unused")
+public class Cd_C0_Up implements CodeParse {
+
+ private static final Logger log = LogManager.getLogger(Cd_C0_Up.class);
+
+ /**
+ * 鍒嗘瀽涓婅鏁版嵁
+ */
+ @Override
+ public MidResult[] parse(Boolean isLowPower, CodeParseParams params, CodeParseCallback callback)throws Exception {
+ ParseParamsForUpV1_0_1 para = (ParseParamsForUpV1_0_1)params ;
+ int bsLen = new CommonV1_0_1().parseDataLen(para.upBuffer) ;
+ if(bsLen > 0){
+ this.doParse(para.upBuffer,
+ bsLen,
+ para.upCode,
+ para.data) ;
+ }
+ log.info("鍒嗘瀽涓婅鏁版嵁<" + CodeV1_0_1.getCodeName(para.upCode) + " RTU鍦板潃=" + para.rtuAddr + ">:\n" + para.data.toString());
+
+ MidResultFromRtu midRs = new MidResultFromRtu() ;
+ midRs.protocolName = para.protocolName ;//鍗忚鍚嶇О
+ midRs.rtuAddr = para.rtuAddr ;//Rtu鍦板潃
+ midRs.upCode = para.upCode ;//涓婅鏁版嵁涓殑鍔熻兘鐮�
+ midRs.upHex = para.upHex ;//涓婅鏁版嵁鍗佸叚杩涘埗褰㈠紡
+ midRs.upBuffer = para.upBuffer ;//涓婅鏁版嵁瀛楄妭鏁扮粍
+ midRs.data = para.data ;//瑙f瀽鍚庣殑鏁版嵁
+
+ midRs.reportOrResponse_trueOrFalse = true ;//涓诲姩涓婃姤
+
+ String confirmComCode = para.upCode ;
+ ParseParamsForDownV1_0_1 downCpParams = new ParseParamsForDownV1_0_1() ;
+ downCpParams.setValue(
+ ProtocolConstantV206V1_0_0.protocolName,
+ para.rtuAddr,
+ Command.defaultId,
+ confirmComCode,
+ null,
+ null);
+ //鏋勯�犲簲绛�
+ byte[] data = new Cd_02_Down().doParse(downCpParams) ;
+
+ MidResultToRtu confirmCommand = new MidResultToRtu() ;
+ confirmCommand.protocolName = para.protocolName ;//鍗忚鍚嶇О
+ confirmCommand.rtuAddr = para.rtuAddr ;//Rtu鍦板潃
+ confirmCommand.commandId = Command.defaultId ;//鍛戒护ID锛屽彂璧峰懡浠ょ殑瀹㈡埛绔�(web绔�)鐢熸垚锛屼互鍖归厤鍛戒护缁撴灉
+ confirmCommand.downCode = confirmComCode ;//涓嬭鍛戒护鍔熻兘鐮�;
+ confirmCommand.downBuffer = data ;//涓嬭鍛戒护鏁版嵁
+ confirmCommand.downBufHex = ByteUtil.bytes2Hex(data, true) ;//涓嬭鍛戒护鏁版嵁鍗佸叚杩涘埗褰㈠紡
+ confirmCommand.hasResponse = false ;//鏄惁鏈夊簲绛�
+ confirmCommand.maxSendTimes = 1 ;//鍛戒护鏈�澶у彂閫佹鏁�(褰撴敹涓嶅埌搴旂瓟鏃讹紝灏嗛噸鍙�2娆�)锛屽鏋滀笉璁剧疆锛屽懡浠ょ紦瀛樺櫒杩涜琛ュ厖璁剧疆
+ confirmCommand.isCachForOffLine = false ;//RTU涓嶅湪绾匡紝鍛戒护鏄惁缂撳瓨
+
+ confirmCommand.isSendFirst = true ;//纭鍛戒护锛屼紭鍏堝彂閫�
+ if(isLowPower != null && isLowPower.booleanValue()){
+ //浣庡姛鑰楁椂锛屽敖蹇彂閫�
+ confirmCommand.isQuickSend = true ;
+ }
+
+ callback.callback(midRs.reportOrResponse_trueOrFalse);
+ return new MidResult[]{midRs, confirmCommand} ;
+ }
+ /**
+ * 鎵ц鍒嗘瀽
+ * @param bs 瀛楄妭鏁扮粍
+ * @param bsLen 瀛楄妭闀垮害锛堟�诲寘闀匡紝鍖呮嫭鍖呭ご鍜屽寘灏撅級
+ * @param dataCode 鍔熻兘鐮�
+ * @param data 鏁版嵁
+ * @throws Exception 寮傚父
+ */
+ protected void doParse(byte[] bs, int bsLen, String dataCode, Data data) throws Exception {
+ DataV1_0_1 dV1 = (DataV1_0_1)data.getSubData() ;
+ DataCdC0Vo cdData = new DataCdC0Vo() ;
+ dV1.dataCdC0Vo = cdData ;
+
+ boolean hasWaterAmount = false ;//鏄惁鏈夋祦閲忔暟鎹�
+ boolean hasWaterPress = false ;//鏄惁鏈夋按鍘嬫暟鎹�
+ boolean hasEleVolt = false ;//鏄惁鏈夌數鍘嬫暟鎹�
+ boolean hasSignal = false ;//鏄惁鏈変俊鍙峰己搴︽暟鎹�
+ boolean hasAlarmStatus = false ;//鏄惁鏈夋暟鎹�
+
+ short index = ProtocolConstantV206V1_0_0.dataIndex ;
+
+ byte tmpBt1 = bs[index] ;
+ index++ ;
+ if(((tmpBt1 & 4) >> 2) == 1){
+ hasWaterAmount = true ;
+ }
+
+ byte tmpBt2 = bs[index] ;
+ index++ ;
+ if(((tmpBt2 & 0x10) >> 4) == 1){
+ hasAlarmStatus = true ;
+ }
+ if(((tmpBt2 & 0x20) >> 5) == 1){
+ hasWaterPress = true ;
+ }
+ if(((tmpBt2 & 0x40) >> 6) == 1){
+ hasEleVolt = true ;
+ }
+ if(((tmpBt2 & 0x80) >> 7) == 1){
+ hasSignal = true ;
+ }
+
+ if(hasWaterAmount){
+ //鐬椂娴侀噺锛�5瀛楄妭BCD鐮侊紝鍙栧�艰寖鍥�0~9999999.999锛屽崟浣嶄负m3/h銆�
+ cdData.instantAmount = 0.0D ;
+ int tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ;
+ index++ ;
+ cdData.instantAmount += tpInt/1000.0 ;
+ tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ;
+ index++ ;
+ cdData.instantAmount += tpInt/10.0 ;
+ tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ;
+ index++ ;
+ cdData.instantAmount += tpInt * 10.0 ;
+ tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ;
+ index++ ;
+ cdData.instantAmount += tpInt * 1000.0 ;
+ tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ;
+ index++ ;
+ cdData.instantAmount += tpInt * 100000.0 ;
+
+ //绱娴侀噺锛�5瀛楄妭BCD鐮侊紝鍙栧�艰寖鍥�0~9999999999锛屽崟浣嶄负m3銆�
+ cdData.totalAmount = 0.0D ;
+ tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ;
+ index++ ;
+ cdData.totalAmount += tpInt;
+ tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ;
+ index++ ;
+ cdData.totalAmount += tpInt * 100.0 ;
+ tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ;
+ index++ ;
+ cdData.totalAmount += tpInt * 10000.0 ;
+ tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ;
+ index++ ;
+ cdData.totalAmount += tpInt * 1000000.0 ;
+ tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ;
+ index++ ;
+ cdData.totalAmount += tpInt * 100000000.0 ;
+
+ //鎹熷け娴侀噺锛�5瀛楄妭BCD鐮侊紝鍙栧�艰寖鍥�0~9999999999锛屽崟浣嶄负m3銆�
+ cdData.lossAmount = 0.0D ;
+ tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ;
+ index++ ;
+ cdData.lossAmount += tpInt;
+ tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ;
+ index++ ;
+ cdData.lossAmount += tpInt * 100.0 ;
+ tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ;
+ index++ ;
+ cdData.lossAmount += tpInt * 10000.0 ;
+ tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ;
+ index++ ;
+ cdData.lossAmount += tpInt * 1000000.0 ;
+ tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ;
+ index++ ;
+ cdData.lossAmount += tpInt * 100000000.0 ;
+ }
+ if(hasWaterPress){
+ //姘村帇锛�4瀛楄妭BCD鐮侊紝鍙栧�艰寖鍥�0~999999.99锛屽崟浣嶄负KPa銆�
+ cdData.waterPress = 0.0D ;
+ int tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ;
+ index++ ;
+ cdData.waterPress += tpInt/100.0 ;
+ tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ;
+ index++ ;
+ cdData.waterPress += tpInt;
+ tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ;
+ index++ ;
+ cdData.waterPress += tpInt * 100.0 ;
+ tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ;
+ index++ ;
+ cdData.waterPress += tpInt * 10000.0 ;
+ }
+ if(hasEleVolt){
+ //鐢垫睜鐢靛帇锛�4瀛楄妭BCD鐮侊紝鍙栧�艰寖鍥�0~99.99锛屽崟浣嶄负V銆�
+ cdData.batteryVolt = 0.0D ;//钃勭數姹犵數鍘�
+ cdData.sunVolt = 0.0D ;//澶槼鑳界數鍘�
+ int tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ;
+ index++ ;
+ cdData.batteryVolt += tpInt/100.0 ;
+ tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ;
+ index++ ;
+ cdData.batteryVolt += tpInt;
+ //澶槼鑳界數鍘嬶細4瀛楄妭BCD鐮侊紝鍙栧�艰寖鍥�0~99.99锛屽崟浣嶄负V銆�
+ tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ;
+ index++ ;
+ cdData.sunVolt += tpInt/100.0 ;
+ tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ;
+ index++ ;
+ cdData.sunVolt += tpInt;
+ }
+ if(hasSignal){
+ //淇″彿寮哄害锛�1瀛楄妭BCD鐮侊紝鍙栧�艰寖鍥�0~99銆�
+ cdData.signal = 0 ;
+ int tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ;
+ index++ ;
+ cdData.signal += tpInt ;
+ }
+ if(hasAlarmStatus){
+ //鎶ヨ鏁版嵁
+ cdData.alarmVo = GlParse.parseAlarm(bs, index) ;
+ index += 2 ;
+ //鐘舵�佹暟鎹�
+ cdData.stateVo = GlParse.parseState(bs, index) ;
+ index += 2 ;
+ }
+ cdData.rtuDt = GlParse.parseTp(bs, index) ;
+
+ }
+}
diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/support/SupportUnit.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/support/SupportUnit.java
index ea7216e..3757b30 100644
--- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/support/SupportUnit.java
+++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/support/SupportUnit.java
@@ -39,31 +39,36 @@
public void start(UnitStartedCallbackInterface callback) throws Exception {
if(!started){
started = true ;
- if(confVo.enableThreadPool){
- TreadPoolFactory.initThreadPoolShort("鐭换鍔″伐浣滅嚎绋嬫睜",
- this.confVo.short_maxThread,
- this.confVo.short_minThread,
- this.confVo.short_freeTimeout,
+ if(confVo.enableShortThreadPool) {
+ TreadPoolFactory.initThreadPoolShort("鐭换鍔″伐浣滅嚎绋嬫睜",
+ this.confVo.short_maxThread,
+ this.confVo.short_minThread,
+ this.confVo.short_freeTimeout,
this.confVo.short_busyTimeout);
- TreadPoolFactory.initThreadPoolLong("闀夸换鍔″伐浣滅嚎绋嬫睜",
- this.confVo.long_maxThread,
- this.confVo.long_minThread,
- this.confVo.long_freeTimeout,
- this.confVo.long_busyTimeout);
-
- if(this.confVo.showStartInfo){
- System.out.println("绾跨▼姹犳ā鍧楁垚鍔熷惎鍔�");
- }
+ }else{
+ System.out.println("鐭嚎绋嬫睜閰嶇疆涓嶅惎鍔�");
}
- callback.call(null);
+ if(confVo.enableLongThreadPool) {
+ TreadPoolFactory.initThreadPoolLong("闀夸换鍔″伐浣滅嚎绋嬫睜",
+ this.confVo.long_maxThread,
+ this.confVo.long_minThread,
+ this.confVo.long_freeTimeout,
+ this.confVo.long_busyTimeout);
+ }else{
+ System.out.println("闀跨嚎绋嬫睜閰嶇疆涓嶅惎鍔�");
+ }
+ if(this.confVo.showStartInfo){
+ System.out.println("绾跨▼姹犳ā鍧楁垚鍔熷惎鍔�");
+ }
}
+ callback.call(null);
}
@Override
- public void stop(UnitStartedCallbackInterface callback) throws Exception {
+ public void stop(UnitStartedCallbackInterface callback) {
}
-
+ /*
public static void main(String[] args) throws Exception{
SupportUnitConfigVo supVo = new SupportUnitConfigVo() ;
//鐭伐浣滄椂闀跨嚎绋嬫睜锛岀嚎绋嬭礋璐g敤鏃惰緝鐭殑宸ヤ綔浠诲姟
@@ -106,7 +111,6 @@
public void setConfig(SupportUnitConfigVo configVo) {
this.configVo = configVo;
}
-
-
}
+ */
}
diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/support/SupportUnitConfigVo.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/support/SupportUnitConfigVo.java
index 9bf912c..fd6cd57 100644
--- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/support/SupportUnitConfigVo.java
+++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/support/SupportUnitConfigVo.java
@@ -1,8 +1,10 @@
package com.dy.common.mw.support;
public class SupportUnitConfigVo {
-
- public boolean enableThreadPool ;
+
+ public boolean enableShortThreadPool ;
+
+ public boolean enableLongThreadPool ;
//鐭换鍔$嚎绋嬫睜
public int short_maxThread ;
diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/ByteUtil.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/ByteUtil.java
index 7b06e4d..ce00ba0 100644
--- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/ByteUtil.java
+++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/ByteUtil.java
@@ -9,7 +9,7 @@
* 灏嗗瓧鑺傛暟缁勫悎骞跺埌瀛楄妭鏁扮粍涓�
* @param bGroup1 琚悎骞舵暟缁�
* @param bGroup2 鍚堝苟鏁扮粍
- * @return 鍚堝苟鍚庢暟缁�
+ * @return 杩斿洖 鍚堝苟鍚庢暟缁�
*/
public static byte[] bytesMerge(byte[] bGroup1, byte[] bGroup2){
if(bGroup1 == null && bGroup2 == null){
@@ -29,11 +29,11 @@
/**
* 鍒ゆ柇鎵�鏈夊瓧鑺傛槸鍚︿负0xFF
- * @param bs
- * @param index
- * @param len
- * @return
- * @throws Exception
+ * @param bs 瀛楄妭鏁扮粍
+ * @param index 涓嬫爣浣�
+ * @param len 闀垮害
+ * @return 杩斿洖 杩斿洖
+ * @throws Exception 寮傚父
*/
public static boolean bytesIsAll0xFF(byte[] bs, int index, int len)throws Exception {
int count = 0 ;
@@ -42,14 +42,14 @@
count++ ;
}
}
- return count==len?true:false ;
+ return count == len;
}
-
+
/**
* 浜岃繘鍒惰浆鍗佽繘鍒舵暟
* @param str
- * @return
- * @throws Exception
+ * @return 杩斿洖
+ * @throws Exception 寮傚父
*/
public static int binary2Int(String str) throws Exception {
int cnt=0;
@@ -69,13 +69,13 @@
return sum;
}
-
+
/**
* 瀛楄妭杞瓨浜岃繘鍒�
- *
+ *
* @param b byte
- * @throws Exception
- * @return String
+ * @throws Exception 寮傚父
+ * @return 杩斿洖 String
*/
public static String byte2Binary(byte b) throws Exception {
int n = (b + 256) % 256 + 256;
@@ -87,11 +87,11 @@
}
/**
* 瀛楄妭杞瓨8浣嶄簩杩涘埗
- *
+ *
* @param b
* byte
- * @throws Exception
- * @return String
+ * @throws Exception 寮傚父
+ * @return 杩斿洖 String
*/
public static String byte2bit8Binary(byte b) throws Exception {
String s = byte2Binary(b);
@@ -101,13 +101,13 @@
}
return s;
}
-
+
/**
* 瀛楄妭鍙朾it
* @param b
- * @param index
- * @throws Exception
- * @return String
+ * @param b
+ * @throws Exception 寮傚父
+ * @return 杩斿洖 String
*/
public static byte[] getBit(byte b) throws Exception {
byte[] bs = new byte[8] ;
@@ -125,9 +125,9 @@
/**
* 瀛楄妭鍙朾it
* @param b
- * @param index
- * @throws Exception
- * @return String
+ * @param index 涓嬫爣浣�
+ * @throws Exception 寮傚父
+ * @return 杩斿洖 String
*/
public static byte getBit(byte b, byte index) throws Exception {
if(index == 0){
@@ -153,11 +153,11 @@
/**
* 涓�涓瓧鑺傝浆姝f暣鏁�
- *
+ *
* @param b
* byte
- * @throws Exception
- * @return String
+ * @throws Exception 寮傚父
+ * @return 杩斿洖 String
*/
public static Short byte2PlusInt(byte b) throws Exception {
short v = b ;
@@ -167,13 +167,13 @@
return v ;
}
-
+
/**
* 澶х妯″紡銆婃暟鎹綆浣嶅湪鏁扮粍楂樺瓧鑺傘��
* double杞崲byte
- * @param bs byte[]
+ * @param bs 瀛楄妭鏁扮粍 byte[]
* @param value double double绫诲瀷鐨勫弬鏁�
- * @param from int
+ * @param from 寮�濮嬩綅 int
*/
public static void double2Bytes_BE(byte[] bs, double value, int from)throws Exception {
boolean b = isOutOfArrLength(bs.length, (from - 1) + 8);
@@ -188,9 +188,9 @@
/**
* 灏忕妯″紡銆婃暟鎹綆浣嶅湪鏁扮粍浣庡瓧鑺傘��
* double杞崲byte锛屽瓧鑺傞『搴忔槸鍊掔殑
- * @param bs byte[]
+ * @param bs 瀛楄妭鏁扮粍 byte[]
* @param value double double绫诲瀷鐨勫弬鏁�
- * @param from int
+ * @param from 寮�濮嬩綅 int
*/
public static void double2Bytes_LE(byte[] bs, double value, int from)throws Exception {
boolean b = isOutOfArrLength(bs.length, (from - 1) + 8);
@@ -205,8 +205,8 @@
/**
* 澶х妯″紡銆婃暟鎹綆浣嶅湪鏁扮粍楂樺瓧鑺傘��
* byte杞崲double
- * @param bs byte[]
- * @param from int
+ * @param bs 瀛楄妭鏁扮粍 byte[]
+ * @param from 寮�濮嬩綅 int
*/
public static double bytes2Double_BE(byte[] bs, int from) throws Exception {
long l = bytes2Long_BE(bs, from);
@@ -216,8 +216,8 @@
/**
* 灏忕妯″紡銆婃暟鎹綆浣嶅湪鏁扮粍浣庡瓧鑺傘��
* byte杞崲double锛屽瓧鑺傞『搴忔槸鍊掔殑
- * @param bs byte[]
- * @param from int
+ * @param bs 瀛楄妭鏁扮粍 byte[]
+ * @param from 寮�濮嬩綅 int
*/
public static double bytes2Double_LE(byte[] bs, int from) throws Exception {
long l = bytes2Long_LE(bs, from);
@@ -306,7 +306,7 @@
/**
* 灏忕妯″紡銆婃暟鎹綆浣嶅湪鏁扮粍浣庡瓧鑺傘��
- * 杞崲long鍨嬩负byte鏁扮粍
+ * 杞崲long鍨嬩负byte鏁扮粍
* @value bs byte[]
* @value value long
* @value from int
@@ -315,8 +315,8 @@
boolean b = isOutOfArrLength(bs.length, (from - 1) + 8);
if (b) {
for (int i = 0; i < 8; i++) {
- bs[from + i] = Long.valueOf(value & 0xff).byteValue();
- value = value >> 8;
+ bs[from + i] = Long.valueOf(value & 0xff).byteValue();
+ value = value >> 8;
if(value == 0){
break ;
}
@@ -325,12 +325,12 @@
throw new Exception("long2Bytes鏃舵暟缁勮秺鐣�");
}
}
-
+
/**
* 澶х妯″紡銆婃暟鎹綆浣嶅湪鏁扮粍楂樺瓧鑺傘��
* 8浣嶅瓧鑺傛暟缁勮浆鎹负闀挎暣鍨�
- * @param bs byte[]
- * @return
+ * @param bs 瀛楄妭鏁扮粍 byte[]
+ * @return 杩斿洖
*/
public static long bytes2Long_BE(byte[] bs) {
int len = bs.length ;
@@ -347,16 +347,16 @@
l = l | ls[i] ;
}
return l;
- }
+ }
return 0L ;
}
-
+
/**
* 澶х妯″紡銆婃暟鎹綆浣嶅湪鏁扮粍楂樺瓧鑺傘��
* 8浣嶅瓧鑺傛暟缁勮浆鎹负闀挎暣鍨�
- * @param bs byte[]
- * @param from int
- * @return
+ * @param bs 瀛楄妭鏁扮粍 byte[]
+ * @param from 寮�濮嬩綅 int
+ * @return 杩斿洖
*/
public static long bytes2Long_BE(byte[] bs, int from) throws Exception {
boolean b = isOutOfArrLength(bs.length, (from - 1) + 8);
@@ -388,10 +388,10 @@
/**
* 澶х妯″紡銆婃暟鎹綆浣嶅湪鏁扮粍楂樺瓧鑺傘��
* 8浣嶅瓧鑺傛暟缁勮浆鎹负闀挎暣鍨�
- * @param bs byte[]
- * @param from int
+ * @param bs 瀛楄妭鏁扮粍 byte[]
+ * @param from 寮�濮嬩綅 int
* @param end int
- * @return
+ * @return 杩斿洖
*/
public static long bytes2Long_BE(byte[] bs, int from, int end) throws Exception {
boolean b = isOutOfArrLength(bs.length, end);
@@ -414,13 +414,13 @@
}
}
-
-
+
+
/**
* 灏忕妯″紡銆婃暟鎹綆浣嶅湪鏁扮粍浣庡瓧鑺傘��
* 8浣嶅瓧鑺傛暟缁勮浆鎹负闀挎暣鍨�
- * @param bs byte[]
- * @return
+ * @param bs 瀛楄妭鏁扮粍 byte[]
+ * @return 杩斿洖
*/
public static long bytes2Long_LE(byte[] bs) {
int len = bs.length ;
@@ -437,16 +437,16 @@
l = l | ls[i] ;
}
return l;
- }
+ }
return 0L ;
}
/**
* 灏忕妯″紡銆婃暟鎹綆浣嶅湪鏁扮粍浣庡瓧鑺傘��
- * 8浣嶅瓧鑺傛暟缁勮浆鎹负闀挎暣鍨�
- * @param bs byte[]
- * @param from int
- * @return
+ * 8浣嶅瓧鑺傛暟缁勮浆鎹负闀挎暣鍨�
+ * @param bs 瀛楄妭鏁扮粍 byte[]
+ * @param from 寮�濮嬩綅 int
+ * @return 杩斿洖
*/
public static long bytes2Long_LE(byte[] bs, int from) throws Exception {
boolean b = isOutOfArrLength(bs.length, (from - 1) + 8);
@@ -479,10 +479,10 @@
/**
* 灏忕妯″紡銆婃暟鎹綆浣嶅湪鏁扮粍浣庡瓧鑺傘��
* 8浣嶅瓧鑺傛暟缁勮浆鎹负闀挎暣鍨�
- * @param bs byte[]
- * @param from int
+ * @param bs 瀛楄妭鏁扮粍 byte[]
+ * @param from 寮�濮嬩綅 int
* @param end int
- * @return
+ * @return 杩斿洖
*/
public static long bytes2Long_LE(byte[] bs, int from, int end) throws Exception {
boolean b = isOutOfArrLength(bs.length, end);
@@ -551,8 +551,9 @@
/**
* 澶х妯″紡銆婃暟鎹綆浣嶅湪鏁扮粍楂樺瓧鑺傘��
* 4浣嶅瓧鑺傛暟缁勮浆鎹负鏁村瀷
- * @param b
- * @return
+ * @param bs 瀛楄妭鏁扮粍
+ * @param from 寮�濮嬩綅
+ * @return 杩斿洖
*/
public static int bytes2Int_BE(byte[] bs, int from) throws Exception {
boolean b = isOutOfArrLength(bs.length, (from - 1) + 4);
@@ -573,13 +574,13 @@
throw new Exception("byte2Int鏃舵暟缁勮秺鐣�");
}
}
-
+
/**
* 灏忕妯″紡銆婃暟鎹綆浣嶅湪鏁扮粍浣庡瓧鑺傘��
* 4浣嶅瓧鑺傛暟缁勮浆鎹负鏁村瀷锛屽瓧鑺傞『搴忔槸鍊掔殑
- * @param b
- * @return
+ * @param bs 瀛楄妭鏁扮粍 瀛楄妭鏁扮粍
+ * @return 杩斿洖
*/
public static int bytes2Int_LE(byte[] bs, int from) throws Exception {
boolean b = isOutOfArrLength(bs.length, (from - 1) + 4);
@@ -600,7 +601,7 @@
throw new Exception("byte2Int鏃舵暟缁勮秺鐣�");
}
}
-
+
/**
* 澶х妯″紡銆婃暟鎹綆浣嶅湪鏁扮粍楂樺瓧鑺傘��
@@ -674,14 +675,14 @@
/**
* 澶х妯″紡銆婃暟鎹綆浣嶅湪鏁扮粍楂樺瓧鑺傘��
* 2浣嶅瓧鑺傛暟缁勮浆鎹负鐭暣鍨�
- * @param b
- * @return
+ * @param bs 瀛楄妭鏁扮粍 瀛楄妭鏁扮粍
+ * @return 杩斿洖
*/
public static short bytes2Short_BE(byte[] bs, int from) throws Exception {
boolean b = isOutOfArrLength(bs.length, (from - 1) + 2);
if (b) {
int s = 0;
- int s0 = bs[from + 0] ;
+ int s0 = bs[from + 0] ;
int s1 = bs[from + 1] ;
// s1涓嶅彉
@@ -697,14 +698,14 @@
/**
* 灏忕妯″紡銆婃暟鎹綆浣嶅湪鏁扮粍浣庡瓧鑺傘��
* 2浣嶅瓧鑺傛暟缁勮浆鎹负鐭暣鍨嬶紝瀛楄妭椤哄簭鏄�掔殑
- * @param b
- * @return
+ * @param bs 瀛楄妭鏁扮粍 瀛楄妭鏁扮粍
+ * @return 杩斿洖
*/
public static short bytes2Short_LE(byte[] bs, int from) throws Exception {
boolean b = isOutOfArrLength(bs.length, (from - 1) + 2);
if (b) {
int s = 0;
- int s0 = bs[from + 0] ;
+ int s0 = bs[from + 0] ;
int s1 = bs[from + 1] ;
// s0涓嶅彉
@@ -718,11 +719,11 @@
}
/**
* 瀛楃鍒颁竴瀛楄妭杞崲
- *
+ *
* @value bs byte[]
* @value ch char char绫诲瀷鐨勫弬鏁�
* @value index int
- * @return
+ * @return 杩斿洖
*/
public static void char2Bytes(byte[] bs, char ch, int index)throws Exception {
boolean b = isOutOfArrLength(bs.length, index);
@@ -735,10 +736,9 @@
/**
* 涓�瀛楄妭杞崲涓哄瓧绗�
- *
- * @param b
+ * @param bs 瀛楄妭鏁扮粍 瀛楄妭鏁扮粍
* @value index int
- * @return
+ * @return 杩斿洖
*/
public static char bytes2Char(byte[] bs, int index) throws Exception {
boolean b = isOutOfArrLength(bs.length, index);
@@ -751,13 +751,13 @@
/**
* 瀛楃涓插瀷鏁板瓧杞垚byte
- *
+ *
* @param s
- * @return
- * @throws Exception
+ * @return 杩斿洖
+ * @throws Exception 寮傚父
*/
public static byte string2byte(String s) throws Exception {
- int n = 0;
+ int n ;
try {
n = Integer.parseInt(s);
} catch (Exception e) {
@@ -772,7 +772,7 @@
* @value bs byte[]
* @value str String
* @value from int
- * @return
+ * @return 杩斿洖
* @throws java.io.UnsupportedEncodingException
*/
public static int string2Bytes_BE(byte[] bs, String str, int from, int end)throws Exception {
@@ -798,7 +798,7 @@
* @value bs byte[]
* @value str String
* @value from int
- * @return
+ * @return 杩斿洖
* @throws java.io.UnsupportedEncodingException
*/
public static int string2Bytes_LE(byte[] bs, String str, int from, int end)throws Exception {
@@ -824,7 +824,7 @@
* @value bs byte[]
* @value str String
* @value from int
- * @return
+ * @return 杩斿洖
* @throws java.io.UnsupportedEncodingException
*/
public static int string2Bytes_BE(byte[] bs, String str, int from)throws Exception {
@@ -846,7 +846,7 @@
* @value bs byte[]
* @value str String
* @value from int
- * @return
+ * @return 杩斿洖
* @throws java.io.UnsupportedEncodingException
*/
public static int string2Bytes_LE(byte[] bs, String str, int from)throws Exception {
@@ -898,10 +898,10 @@
/**
* 鍒ゆ柇鏁扮粍涓嬫爣鏄惁瓒婄晫
- *
+ *
* @value bsLength 鏁扮粍鎬婚暱搴�
* @value toSite 鏁扮粍鍋忕Щ閲�
- * @return
+ * @return 杩斿洖
*/
private static boolean isOutOfArrLength(int bsLength, int toSite) {
if (bsLength > toSite) {
@@ -911,104 +911,104 @@
}
}
-
+
/**
- * 瀛楄妭鏁扮粍杞崲鎴愬崄鍏繘鍒剁殑瀛楃涓�
- *
- * @param b byte[]
+ * 瀛楄妭鏁扮粍杞崲鎴愬崄鍏繘鍒剁殑瀛楃涓�
+ *
+ * @param src byte[]
* @param hasBlank 16杩涘埗鏄惁鐢ㄧ┖鏍煎垎闅�
- * @return String
+ * @return 杩斿洖 String
*/
- public static String bytes2Hex(byte[] src, boolean hasBlank){
- StringBuilder stringBuilder = new StringBuilder("");
- if (src == null || src.length <= 0) {
- return null;
- }
- for (int i = 0; i < src.length; i++) {
- int v = src[i] & 0xFF;
- String str = Integer.toHexString(v);
- if (str.length() < 2) {
+ public static String bytes2Hex(byte[] src, boolean hasBlank){
+ StringBuilder stringBuilder = new StringBuilder("");
+ if (src == null || src.length <= 0) {
+ return null;
+ }
+ for (int i = 0; i < src.length; i++) {
+ int v = src[i] & 0xFF;
+ String str = Integer.toHexString(v);
+ if (str.length() < 2) {
str = "0" + str;
- }
+ }
if (hasBlank) {
if (i == 0) {
- stringBuilder.append(str);
+ stringBuilder.append(str);
} else {
- stringBuilder.append(" " + str);
+ stringBuilder.append(" " + str);
}
} else {
- stringBuilder.append(str);
+ stringBuilder.append(str);
}
- }
+ }
return stringBuilder.toString().toUpperCase(Locale.US);
- }
+ }
/**
- * 瀛楄妭鏁扮粍杞崲鎴愬崄鍏繘鍒剁殑瀛楃涓�
- *
- * @param b byte[]
+ * 瀛楄妭鏁扮粍杞崲鎴愬崄鍏繘鍒剁殑瀛楃涓�
+ *
+ * @param src byte[]
* @param hasBlank 16杩涘埗鏄惁鐢ㄧ┖鏍煎垎闅�
- * @param from
- * @param len
- * @return String
+ * @param from 寮�濮嬩綅
+ * @param len 闀垮害
+ * @return 杩斿洖 String
*/
- public static String bytes2Hex(byte[] src, boolean hasBlank, int from, int len){
- if (src == null || src.length <= 0 || src.length < from + len) {
- return null;
- }
+ public static String bytes2Hex(byte[] src, boolean hasBlank, int from, int len){
+ if (src == null || src.length <= 0 || src.length < from + len) {
+ return null;
+ }
byte[] bb = new byte[len];
for (int i = 0 ; i < len; i++) {
bb[i] = src[from + i];
}
return bytes2Hex(bb, hasBlank) ;
- }
- /**
+ }
+ /**
* 鍗佸叚杩涘埗杞瓧鑺傛暟缁�
- * @param hexString the hex string
- * @return byte[]
- */
- public static byte[] hex2Bytes(String hex) {
- if (hex == null || hex.equals("")) {
- return null;
- }
- hex = hex.toUpperCase(Locale.ENGLISH);
- int length = hex.length() / 2;
- char[] hexChars = hex.toCharArray();
- byte[] d = new byte[length];
- for (int i = 0; i < length; i++) {
- int pos = i * 2;
- d[i] = (byte) (charToByte(hexChars[pos]) << 4 | charToByte(hexChars[pos + 1]));
- }
- return d;
- }
- /**
+ * @param hex the hex string
+ * @return 杩斿洖 byte[]
+ */
+ public static byte[] hex2Bytes(String hex) {
+ if (hex == null || hex.equals("")) {
+ return null;
+ }
+ hex = hex.toUpperCase(Locale.ENGLISH);
+ int length = hex.length() / 2;
+ char[] hexChars = hex.toCharArray();
+ byte[] d = new byte[length];
+ for (int i = 0; i < length; i++) {
+ int pos = i * 2;
+ d[i] = (byte) (charToByte(hexChars[pos]) << 4 | charToByte(hexChars[pos + 1]));
+ }
+ return d;
+ }
+ /**
* 鍗佸叚杩涘埗杞瓧鑺傛暟缁�
- * @param hexString the hex string
- * @return byte[]
- */
- public static int hex2Bytes(String hex, byte[] bs, int fromIndex) {
- if (hex == null || hex.equals("")) {
- return fromIndex;
- }
- hex = hex.toUpperCase(Locale.ENGLISH);
- int length = hex.length() / 2;
- char[] hexChars = hex.toCharArray();
- byte[] d = new byte[length];
- for (int i = 0; i < length; i++) {
- int pos = i * 2;
- d[i] = (byte) (charToByte(hexChars[pos]) << 4 | charToByte(hexChars[pos + 1]));
+ * @param hex the hex string
+ * @return 杩斿洖 byte[]
+ */
+ public static int hex2Bytes(String hex, byte[] bs, int fromIndex) {
+ if (hex == null || hex.equals("")) {
+ return fromIndex;
+ }
+ hex = hex.toUpperCase(Locale.ENGLISH);
+ int length = hex.length() / 2;
+ char[] hexChars = hex.toCharArray();
+ byte[] d = new byte[length];
+ for (int i = 0; i < length; i++) {
+ int pos = i * 2;
+ d[i] = (byte) (charToByte(hexChars[pos]) << 4 | charToByte(hexChars[pos + 1]));
}
for(int i = 0 ; i < d.length; i++){
bs[fromIndex++] = d[i] ;
}
- return fromIndex ;
- }
+ return fromIndex ;
+ }
private static final char[] HEX_CHAR = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
/**
* 灏哹yte[]杞崲涓�16杩涘埗瀛楃涓�
*
* @param bytes 寰呰浆鎹yte[]
- * @return 杞崲鍚庣殑瀛楃涓�
+ * @return 杩斿洖 杞崲鍚庣殑瀛楃涓�
*/
public static String bytesToHex(byte[] bytes) {
//涓�涓猙yte涓�8浣嶏紝鍙敤涓や釜鍗佸叚杩涘埗浣嶆爣璇�
@@ -1027,12 +1027,40 @@
}
return new String(buf);
}
+ /**
+ * 灏哹yte[]杞崲涓�16杩涘埗瀛楃涓�
+ *
+ * @param bytes 寰呰浆鎹yte[]
+ * @return 杩斿洖 杞崲鍚庣殑瀛楃涓�
+ */
+ public static String bytesToHex(byte[] bytes, int startIndex, int endIndex) {
+ byte[] bs = new byte[endIndex - startIndex + 1] ;
+ byte j = 0 ;
+ for(int i = startIndex; i <= endIndex; i++){
+ bs[j++] = bytes[i] ;
+ }
+ //涓�涓猙yte涓�8浣嶏紝鍙敤涓や釜鍗佸叚杩涘埗浣嶆爣璇�
+ char[] buf = new char[bs.length * 2];
+ int a = 0;
+ int index = 0;
+ for (byte b : bs) { // 浣跨敤闄や笌鍙栦綑杩涜杞崲
+ if (b < 0) {
+ a = 256 + b;
+ } else {
+ a = b;
+ }
+
+ buf[index++] = HEX_CHAR[a / 16];
+ buf[index++] = HEX_CHAR[a % 16];
+ }
+ return new String(buf);
+ }
/**
* 灏�16杩涘埗瀛楃涓茶浆鎹负byte[]
*
* @param str 寰呰浆鎹㈠瓧绗︿覆
- * @return 杞崲鍚庣殑byte[]
+ * @return 杩斿洖 杞崲鍚庣殑byte[]
*/
public static byte[] hexToBytes(String str) {
if (str == null || "".equals(str.trim())) {
@@ -1051,18 +1079,18 @@
/**
* Convert char to byte
* @param c char
- * @return byte
+ * @return 杩斿洖 byte
*/
private static byte charToByte(char c) {
return (byte) "0123456789ABCDEF".indexOf(c);
- }
-
+ }
+
/**
* 澶х妯″紡銆婃暟鎹綆浣嶅湪鏁扮粍楂樺瓧鑺傘��
* 鏁村舰杞垚BCD缂栫爜
- * @param l
- * @return
+ * @param i
+ * @return 杩斿洖
*/
public static byte[] int2BCD_BE(int i)throws Exception {
String str = "" + i;
@@ -1079,8 +1107,8 @@
/**
* 灏忕妯″紡銆婃暟鎹綆浣嶅湪鏁扮粍浣庡瓧鑺傘��
* 鏁村舰杞垚BCD缂栫爜锛屽瓧鑺傞『搴忔槸鍊掔殑
- * @param l
- * @return
+ * @param i
+ * @return 杩斿洖
*/
public static byte[] int2BCD_LE(int i)throws Exception {
String str = "" + i;
@@ -1099,7 +1127,7 @@
* 澶х妯″紡銆婃暟鎹綆浣嶅湪鏁扮粍楂樺瓧鑺傘��
* 闀挎暣褰㈣浆鎴怋CD缂栫爜
* @param l
- * @return
+ * @return 杩斿洖
*/
public static byte[] long2BCD_BE(long l)throws Exception {
String str = "" + l;
@@ -1118,7 +1146,7 @@
* 灏忕妯″紡銆婃暟鎹綆浣嶅湪鏁扮粍浣庡瓧鑺傘��
* 闀挎暣褰㈣浆鎴怋CD缂栫爜锛屽瓧鑺傞『搴忔槸鍊掔殑
* @param l
- * @return
+ * @return 杩斿洖
*/
public static byte[] long2BCD_LE(long l) throws Exception {
String str = "" + l;
@@ -1137,30 +1165,30 @@
* 澶х妯″紡銆婃暟鎹綆浣嶅湪鏁扮粍楂樺瓧鑺傘��
* 瀛楃涓插瀷鏁板瓧杞垚BCD缂栫爜
* @param s
- * @return
- * @throws Exception
+ * @return 杩斿洖
+ * @throws Exception 寮傚父
*/
public static byte[] string2BCD_BE(String s) throws Exception {
- byte[] b = null;
+ byte[] b ;
if (s.length() % 2 == 0) {
b = new byte[s.length() / 2];
} else {
b = new byte[(s.length() / 2) + 1];
}
-
+
encodeBCD_BE(s, b, 0, b.length);
return b ;
}
-
+
/**
* 澶х妯″紡銆婃暟鎹綆浣嶅湪鏁扮粍楂樺瓧鑺傘��
* 瀛楃涓茶浆鎹㈡垚byte鏁扮粍
* @value bs byte[]
* @value str String
* @value fromIndex int
- * @return
- * @throws java.io.Exception
+ * @return 杩斿洖
+ * @throws Exception 寮傚父 寮傚父
*/
public static int string2BCD_BE(byte[] bs, String str, int fromIndex)throws Exception {
byte[] bb = string2BCD_BE(str);
@@ -1179,8 +1207,8 @@
* 灏忕妯″紡銆婃暟鎹綆浣嶅湪鏁扮粍浣庡瓧鑺傘��
* 瀛楃涓插瀷鏁板瓧杞垚BCD缂栫爜锛屽瓧鑺傞『搴忔槸鍊掔殑
* @param s
- * @return
- * @throws Exception
+ * @return 杩斿洖
+ * @throws Exception 寮傚父
*/
public static byte[] string2BCD_LE(String s) throws Exception {
byte[] b = null;
@@ -1193,15 +1221,15 @@
return b;
}
-
+
/**
* 澶х妯″紡銆婃暟鎹綆浣嶅湪鏁扮粍楂樺瓧鑺傘��
* 瀛楃涓茶浆鎹㈡垚byte鏁扮粍
* @value bs byte[]
* @value str String
* @value fromIndex int
- * @return
- * @throws java.io.Exception
+ * @return 杩斿洖
+ * @throws Exception 寮傚父 寮傚父
*/
public static int string2BCD_LE(byte[] bs, String str, int fromIndex)throws Exception {
byte[] bb = string2BCD_LE(str);
@@ -1221,10 +1249,8 @@
* 澶х妯″紡銆婃暟鎹綆浣嶅湪鏁扮粍楂樺瓧鑺傘��
* BCD缂栫爜杞垚鏁村瀷
* @param b
- * @param startIndex
- * @param endIndex
- * @return
- * @throws Exception
+ * @return 杩斿洖
+ * @throws Exception 寮傚父
*/
public static int BCD2Int_BE(byte b) throws Exception {
String str = "";
@@ -1237,10 +1263,8 @@
* 灏忕妯″紡銆婃暟鎹綆浣嶅湪鏁扮粍浣庡瓧鑺傘��
* BCD缂栫爜杞垚鏁村瀷锛屽瓧鑺傞『搴忔槸鍊掔殑
* @param b
- * @param startIndex
- * @param endIndex
- * @return
- * @throws Exception
+ * @return 杩斿洖
+ * @throws Exception 寮傚父
*/
public static int BCD2Int_LE(byte b) throws Exception {
String str = "";
@@ -1255,8 +1279,8 @@
* @param b
* @param startIndex
* @param endIndex
- * @return
- * @throws Exception
+ * @return 杩斿洖
+ * @throws Exception 寮傚父
*/
public static int BCD2Int_BE(byte[] b, int startIndex, int endIndex)throws Exception {
String str = "";
@@ -1271,8 +1295,8 @@
* @param b
* @param startIndex
* @param endIndex
- * @return
- * @throws Exception
+ * @return 杩斿洖
+ * @throws Exception 寮傚父
*/
public static int BCD2Int_LE(byte[] b, int startIndex, int endIndex)throws Exception {
String str = "";
@@ -1287,8 +1311,8 @@
* @param b
* @param startIndex
* @param endIndex
- * @return
- * @throws Exception
+ * @return 杩斿洖
+ * @throws Exception 寮傚父
*/
public static long BCD2Long_BE(byte[] b, int startIndex, int endIndex)throws Exception {
String str = "";
@@ -1304,8 +1328,8 @@
* @param b
* @param startIndex
* @param endIndex
- * @return
- * @throws Exception
+ * @return 杩斿洖
+ * @throws Exception 寮傚父
*/
public static long BCD2Long_LE(byte[] b, int startIndex, int endIndex)throws Exception {
String str = "";
@@ -1320,8 +1344,8 @@
* @param b
* @param startIndex
* @param endIndex
- * @return
- * @throws Exception
+ * @return 杩斿洖
+ * @throws Exception 寮傚父
*/
public static String BCD2String_BE(byte[] b, int startIndex, int endIndex) throws Exception {
return decodeBCD_BE(b, startIndex, endIndex - startIndex + 1);
@@ -1333,8 +1357,8 @@
* @param b
* @param startIndex
* @param endIndex
- * @return
- * @throws Exception
+ * @return 杩斿洖
+ * @throws Exception 寮傚父
*/
public static String BCD2String_LE(byte[] b, int startIndex, int endIndex) throws Exception {
return decodeBCD_LE(b, startIndex, endIndex - startIndex + 1);
@@ -1342,17 +1366,17 @@
/**
* 澶х妯″紡銆婃暟鎹綆浣嶅湪鏁扮粍楂樺瓧鑺傘��
- * 缂栫爜BCD锛屼緥濡�1387缂栫爜鎴� 13 87锛岄『搴忔槸姝g殑
+ * 缂栫爜BCD锛屼緥濡�1387缂栫爜鎴� 13 87锛岄『搴忔槸姝g殑
* @param value
* @param dest
* @param startIndex
- * @param length
+ * @param length 闀垮害
*/
private static void encodeBCD_BE(String value, byte[] dest, int startIndex, int length)throws Exception {
if (value == null || !value.matches("\\d*")) {
throw new Exception("鏁板瓧杞垚BCD缂栫爜鏃跺嚭閿欙紝涓嶆槸鍚堟硶鏁板瓧:" + value, null);
}
-
+
int[] tmpInts = new int[2 * length];
int index = value.length() - 1;
for (int i = tmpInts.length - 1; i >= 0 && index >= 0; i--, index--) {
@@ -1362,20 +1386,20 @@
dest[i] = (byte) (tmpInts[2 * j] * 16 + tmpInts[2 * j + 1]);
}
}
-
+
/**
* 灏忕妯″紡銆婃暟鎹綆浣嶅湪鏁扮粍浣庡瓧鑺傘��
- * 缂栫爜BCD锛屼緥濡�1387缂栫爜鎴� 87 13锛岄『搴忔槸鍊掔殑
+ * 缂栫爜BCD锛屼緥濡�1387缂栫爜鎴� 87 13锛岄『搴忔槸鍊掔殑
* @param value
* @param dest
* @param startIndex
- * @param length
+ * @param length 闀垮害
*/
private static void encodeBCD_LE(String value, byte[] dest, int startIndex, int length)throws Exception {
if (value == null || !value.matches("\\d*")) {
throw new Exception("鏁板瓧杞垚BCD缂栫爜鏃跺嚭閿欙紝涓嶆槸鍚堟硶鏁板瓧:" + value, null);
}
-
+
int[] tmpInts = new int[2 * length];
int index = value.length() - 1;
for (int i = 0; i <= tmpInts.length - 1 && index >= 0; i++, index--) {
@@ -1393,8 +1417,8 @@
* 瑙g爜BCD锛岄『搴忔槸姝g殑
* @param src
* @param startIndex
- * @param length
- * @return
+ * @param length 闀垮害
+ * @return 杩斿洖
*/
private static String decodeBCD_BE(byte[] src, int startIndex, int length)throws Exception {
StringBuilder sb = new StringBuilder();
@@ -1415,8 +1439,8 @@
* 缂栫爜BCD锛岄『搴忔槸鍊掔殑
* @param src
* @param startIndex
- * @param length
- * @return
+ * @param length 闀垮害
+ * @return 杩斿洖
*/
private static String decodeBCD_LE(byte[] src, int startIndex, int length)throws Exception {
StringBuilder sb = new StringBuilder();
@@ -1462,6 +1486,7 @@
// System.out.println(v5);
//
// }
+ /*
public static void main(String[] args) throws Exception {
byte[] bs = new byte[]{0x38, 0x36, 0x39, 0x31} ;
String s = bytes2String_BE(bs, 0, 3) ;
@@ -1475,5 +1500,6 @@
}
System.out.println(v);
}
-
+ */
+
}
diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/Server.java b/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/Server.java
index a368845..3a89030 100644
--- a/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/Server.java
+++ b/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/Server.java
@@ -144,13 +144,6 @@
ServerProperties.lastUpDataTimeLive = conf.getSetAttrPlusInt(doc, "config.base", "lastUpDataTimeLive", null, 0, 5, null) * 1000L ;
//鏁版嵁搴撴暟鎹甶d鐢熸垚鍣ㄧ殑id鍚庣紑锛�0鏄粯璁ょ殑鍚庣紑锛屼竴鑸瑆eb绯荤粺搴旂敤锛屾暟鎹腑闂翠欢id鍚庣紑澶т簬绛変簬1
ServerProperties.dbDataIdSuffix = conf.getSetAttrInt(doc, "config.base", "dbDataIdSuffix", null, 0, 99, null);
- //涓婁笅琛屾暟鎹紦瀛橀槦鍒椾腑缂撳瓨鏁版嵁涓暟鐨勬姤璀﹂噺锛岃繖涓笌鐜板疄椤圭洰鎵�鎺ユ按琛ㄦ暟鐩稿叧
- ServerProperties.cacheUpDownDataWarnCount = conf.getSetAttrPlusInt(doc, "config.base", "cacheUpDownDataWarnCount", null, 1, null, null) ;
- //涓婁笅琛屾暟鎹紦瀛橀槦鍒椾腑缂撳瓨鏁版嵁涓暟鐨勬渶澶у�硷紝杩欎釜涓庣幇瀹為」鐩墍鎺ユ按琛ㄦ暟鐩稿叧
- ServerProperties.cacheUpDownDataMaxCount = conf.getSetAttrPlusInt(doc, "config.base", "cacheUpDownDataMaxCount", null, 1, null, null) ;
- if(ServerProperties.cacheUpDownDataMaxCount <= ServerProperties.cacheUpDownDataWarnCount){
- throw new Exception("cacheUpDownDataMaxCount蹇呴』澶т簬cacheUpDownDataWarnCount") ;
- }
//璁剧疆ID鐢熸垚鍣ㄧ殑鍚庣紑
IDLongGenerator.setSuffix(ServerProperties.dbDataIdSuffix.intValue());
diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/ServerProperties.java b/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/ServerProperties.java
index 84a9a42..670ef33 100644
--- a/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/ServerProperties.java
+++ b/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/ServerProperties.java
@@ -25,6 +25,12 @@
public static Long lastUpDataTimeLive = 1000L ;
//鏁版嵁搴撴暟鎹甶d鐢熸垚鍣ㄧ殑id鍚庣紑锛�0鏄粯璁ょ殑鍚庣紑锛屼竴鑸瑆eb绯荤粺搴旂敤锛屾暟鎹腑闂翠欢id鍚庣紑澶т簬绛変簬1
- public static Integer dbDataIdSuffix = 1 ;
+ public static Integer dbDataIdSuffix = 1 ;
+
+ //涓婁笅琛屾暟鎹紦瀛橀槦鍒椾腑缂撳瓨鏁版嵁涓暟鐨勬姤璀﹂噺锛岃繖涓笌瀹炰綋椤圭洰鎵�鎺ユ按琛ㄦ暟鐩稿叧
+ public static Integer cacheUpDownDataWarnCount = 1000000 ;
+
+ //涓婁笅琛屾暟鎹紦瀛橀槦鍒椾腑缂撳瓨鏁版嵁涓暟鐨勬渶澶у�硷紝杩欎釜涓庡疄浣撻」鐩墍鎺ユ按琛ㄦ暟鐩稿叧
+ public static Integer cacheUpDownDataMaxCount = 1100000 ;
}
diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/forTcp/MidResultActionToRtu.java b/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/forTcp/MidResultActionToRtu.java
index 33e2417..e8d0d3c 100644
--- a/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/forTcp/MidResultActionToRtu.java
+++ b/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/forTcp/MidResultActionToRtu.java
@@ -15,7 +15,7 @@
if(result != null && result instanceof MidResultToRtu){
try {
MidResultToRtu resToRtu = (MidResultToRtu)result ;
- TcpDownCommandCach.cachCommand(resToRtu);
+ TcpDownCommandCache.cacheCommand(resToRtu);
log.info("涓嬭鍛戒护(toRtu)" + resToRtu.downCode + "涓棿缁撴灉宸茬粡鏀惧叆涓嬭鍛戒护缂撳瓨涓�");
} catch (Exception e) {
log.error(e);
diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/forTcp/TcpDownCommandCache.java b/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/forTcp/TcpDownCommandCache.java
new file mode 100644
index 0000000..7a0cf8b
--- /dev/null
+++ b/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/forTcp/TcpDownCommandCache.java
@@ -0,0 +1,129 @@
+package com.dy.aceMw.server.forTcp;
+
+
+import com.dy.common.queue.Node;
+import com.dy.common.queue.Queue;
+import com.dy.common.mw.protocol.MidResultFromRtu;
+import com.dy.common.mw.protocol.MidResultToRtu;
+import com.dy.aceMw.server.ServerProperties;
+
+/**
+ * 闈炵嚎绋嬪畨鍏ㄧ殑锛屽彧鑳藉湪鍗曠嚎绋嬩腑杩愯
+ */
+public class TcpDownCommandCache {
+
+ //TCP涓嬭鍛戒护缂撳瓨闃熷垪
+ private static Queue cacheQueue = new Queue("tcpDownCommandQueue") ;
+
+ private static TcpDownCommandCache instance = new TcpDownCommandCache() ;
+
+ private TcpDownCommandCache(){
+ cacheQueue.setLimit(ServerProperties.cacheUpDownDataWarnCount, ServerProperties.cacheUpDownDataMaxCount);
+ }
+
+ public static TcpDownCommandCache getInstance(){
+ return instance ;
+ }
+
+ /**
+ * 缂撳瓨鍛戒护
+ * @param result
+ * @throws Exception
+ */
+ public static void cacheCommand(MidResultToRtu result) throws Exception{
+ if(result != null){
+ if(result.maxSendTimes == null){
+ //璁剧疆鏈�澶у彂閫佹鏁�
+ result.maxSendTimes = ServerProperties.downComandMaxResendTimes ;
+ }
+ if(result.isSendFirst){
+ cacheQueue.pushHead(new TcpDownCommandObj(result));
+ }else{
+ cacheQueue.pushTail(new TcpDownCommandObj(result));
+ }
+ }
+ }
+
+ /**
+ * 鍖归厤鍛戒护缁撴灉
+ * @param rsFromRtu
+ * @return
+ */
+ public static MidResultToRtu matchFromHead(MidResultFromRtu rsFromRtu){
+ MidResultToRtu res = null ;
+ TcpDownCommandObj obj = null ;
+ Node node = cacheQueue.getFirstNode() ;
+ while(node != null && node.obj != null){
+ obj = (TcpDownCommandObj)node.obj;
+ res = obj.result ;
+ if(res != null
+ && res.rtuAddr.equals(rsFromRtu.rtuAddr)
+ && res.downCode.equals(rsFromRtu.upCode)){
+ obj.onceReceivedResult = true ;//鏍囪瘑宸茬粡鏀跺埌鍛戒护缁撴灉
+ return res ;
+ }else{
+ node = node.pre ;
+ }
+ }
+
+ return null ;
+ }
+
+ /**
+ * 鍖归厤鍛戒护缁撴灉
+ * @param rsFromRtu
+ * @return
+ */
+ public static MidResultToRtu matchFromTail(MidResultFromRtu rsFromRtu){
+ MidResultToRtu res = null ;
+ TcpDownCommandObj obj = null ;
+ Node node = cacheQueue.getLastNode() ;
+ while(node != null && node.obj != null){
+ obj = (TcpDownCommandObj)node.obj;
+ res = obj.result ;
+ if(res != null
+ && res.rtuAddr.equals(rsFromRtu.rtuAddr)
+ && res.downCode.equals(rsFromRtu.upCode)){
+ obj.onceReceivedResult = true ;//鏍囪瘑宸茬粡鏀跺埌鍛戒护缁撴灉
+ return res ;
+ }else{
+ node = node.pre ;
+ }
+ }
+
+ return null ;
+ }
+
+ /**
+ * 寰楀埌绗竴涓妭鐐�
+ * @return
+ */
+ public static Node getFirstQueueNode(){
+ return cacheQueue.getFirstNode() ;
+ }
+
+ /**
+ * 寰楀埌鏈�鍚庝竴涓妭鐐�
+ * @return
+ */
+ public static Node getLastQueueNode(){
+ return cacheQueue.getLastNode() ;
+ }
+
+ /**
+ * 绉婚櫎鑺傜偣
+ * @param node
+ */
+ public static void removeNode(Node node){
+ cacheQueue.remove(node);
+ }
+
+ /**
+ * 缂撳瓨鐨勮妭鐐规暟
+ * @Return 缂撳瓨鑺傜偣鏁�
+ */
+ public static Integer size(){
+ return cacheQueue.size() ;
+ }
+
+}
diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/forTcp/TcpDownCommandObj.java b/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/forTcp/TcpDownCommandObj.java
index 40dad55..ae05e4f 100644
--- a/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/forTcp/TcpDownCommandObj.java
+++ b/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/forTcp/TcpDownCommandObj.java
@@ -73,8 +73,8 @@
}
Long lastSendStamp = tcpSe.lastDownComTime ;
- if(lastSendStamp == null || (now - lastSendStamp >= ServerProperties.commandSendInterval)){
- //鏈敹鍒板懡浠ょ粨鏋滐紝鏈揪鍒版渶澶у彂閫佹鏁帮紝RTU鍦ㄧ嚎锛岃秴杩囧懡浠ら棿涓嬪彂闂撮殧锛屼互涓婃弧瓒冲彂閫佸懡浠ゆ潯浠讹紝鎵ц鍙戦�佸懡浠�
+ if(this.result.isQuickSend || lastSendStamp == null || (now - lastSendStamp >= ServerProperties.commandSendInterval)){
+ //鏈敹鍒板懡浠ょ粨鏋滐紝鏈揪鍒版渶澶у彂閫佹鏁帮紝RTU鍦ㄧ嚎锛岄�熷彂鍛戒护鎴栬秴杩囧懡浠や笅鍙戦棿闅旓紝浠ヤ笂婊¤冻鍙戦�佸懡浠ゆ潯浠讹紝鎵ц鍙戦�佸懡浠�
tcpSe.ioSession.write(this.result.downBuffer) ;
tcpSe.lastDownComTime = now ;
if(!this.result.hasResponse){
diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/rtuData/TreeParse.java b/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/rtuData/TreeParse.java
index c9182f1..1c15098 100644
--- a/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/rtuData/TreeParse.java
+++ b/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/rtuData/TreeParse.java
@@ -161,9 +161,9 @@
if (c == null) {
throw new Exception("涓婅鏁版嵁澶勭悊浠诲姟閰嶇疆鏂囦欢涓笉鑳藉疄渚嬪寲class=" + clazz + "锛�");
}else{
- Object o = c.newInstance();
- if(o instanceof Task){
- }else{
+ Object o = c.getDeclaredConstructor().newInstance();
+ //Object o = c.newInstance();
+ if(!(o instanceof Task)){
throw new Exception("涓婅鏁版嵁澶勭悊浠诲姟閰嶇疆鏂囦欢涓璫lass=" + clazz + "蹇呴』瀹炵幇Task鎺ュ彛锛�");
}
}
diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/tasks/RtuDownTask.java b/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/tasks/RtuDownTask.java
index 410f43c..64891d0 100644
--- a/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/tasks/RtuDownTask.java
+++ b/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/tasks/RtuDownTask.java
@@ -7,7 +7,7 @@
import com.dy.common.mw.protocol.MidResult;
import com.dy.common.mw.protocol.Command;
import com.dy.common.mw.protocol.Driver;
-import com.dy.common.mw.protocol.ProtocolCach;
+import com.dy.common.mw.protocol.ProtocolCache;
import com.dy.aceMw.server.ServerProperties;
import com.dy.aceMw.server.forTcp.TcpSessionCach;
@@ -34,8 +34,7 @@
/**
* 澶勭悊鍛戒护
- * @param webJgroupName
- * @param com
+ * @param com 鍛戒护
* @throws Exception
*/
private void deal(Command com) throws Exception{
@@ -45,13 +44,13 @@
String protocolName = TcpSessionCach.getTcpProtocolName(rtuAddr) ;
if(protocolName == null){
//RTU鏈浘涓婄嚎
- int count = ProtocolCach.driverCount() ;
+ int count = ProtocolCache.driverCount() ;
if(count == 1){
//鍙湁涓�涓崗璁�
- dri = ProtocolCach.getFirstDriver() ;
+ dri = ProtocolCache.getFirstDriver() ;
}
}else{
- dri = ProtocolCach.getDriver(protocolName) ;
+ dri = ProtocolCache.getDriver(protocolName) ;
}
if(dri == null){
log.error("涓ラ噸閿欒锛屾湭鑳藉緱鍒板崗璁�" + protocolName + "椹卞姩绫诲疄渚嬶紒");
diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/tasks/RtuUpTask.java b/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/tasks/RtuUpTask.java
index 16418cf..c27241f 100644
--- a/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/tasks/RtuUpTask.java
+++ b/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/tasks/RtuUpTask.java
@@ -14,7 +14,7 @@
import com.dy.common.mw.protocol.Driver;
import com.dy.common.mw.protocol.OnLine;
import com.dy.common.mw.protocol.OnLineHandle;
-import com.dy.common.mw.protocol.ProtocolCach;
+import com.dy.common.mw.protocol.ProtocolCache;
import com.dy.aceMw.server.ServerProperties;
import com.dy.aceMw.server.forTcp.RtuLogDealer;
import com.dy.aceMw.server.forTcp.RtuStatusDealer;
@@ -144,13 +144,13 @@
* @throws Exception 寮傚父
*/
private void dealUpData(IoSession session, String rtuAddrAtHead, String protocolName, boolean isOnLine, byte[] upBuf, String upHex) throws Exception{
- Driver dri = ProtocolCach.getDriver(protocolName) ;
+ Driver dri = ProtocolCache.getDriver(protocolName) ;
if(dri == null){
log.error("涓ラ噸閿欒锛屾湭鑳藉緱鍒板崗璁�" + protocolName + "椹卞姩绫诲疄渚嬶紒");
}else{
MidResult[] midRs = dri.parseData(ServerProperties.isLowPower, rtuAddrAtHead, upBuf, upHex, new DriverParserDataCallback(){
@Override
- public void callback(String rtuAddrAtHead, String meterNoAtHead, String code, String upHex, Boolean reportOrResponse_trueOrFalse, boolean parseFail, String rtuAddrInData, String meterNoInData) {
+ public void callback(String rtuAddrAtHead, String code, String upHex, Boolean reportOrResponse_trueOrFalse, boolean parseFail, String rtuAddrInData) {
//鏇存柊缁堢鐘舵��
if(rtuAddrInData != null && !rtuAddrInData.equals(rtuAddrAtHead)){
//鏁版嵁澶翠腑鐨凴TU鍦板潃涓庢暟鎹腑鐨凴TU鍦板潃涓嶄竴鑷达紝鏇存崲鎴愭暟鎹腑鐨凴TU鍦板潃
diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/tasks/ToRtuConstantTask.java b/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/tasks/ToRtuConstantTask.java
index 08721c8..291184a 100644
--- a/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/tasks/ToRtuConstantTask.java
+++ b/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/tasks/ToRtuConstantTask.java
@@ -5,7 +5,7 @@
import com.dy.common.queue.Node;
import com.dy.common.mw.core.CoreTask;
-import com.dy.aceMw.server.forTcp.TcpDownCommandCach;
+import com.dy.aceMw.server.forTcp.TcpDownCommandCache;
import com.dy.aceMw.server.forTcp.TcpDownCommandObj;
import com.dy.aceMw.server.forTcp.TcpSessionCach;
@@ -40,16 +40,12 @@
* 澶勭悊涓嬭鍛戒护
*/
public Integer dealDownCommand(Long now) {
- try{
- Node first = TcpDownCommandCach.getFirstQueueNode() ;
- if(first != null){
- Integer count = TcpDownCommandCach.size() ;
- Node last = TcpDownCommandCach.getLastQueueNode() ;
- this.doDealDownCommand(now, first, last);
- return count ;
- }
- }catch(Exception e){
- log.error(e);
+ Node first = TcpDownCommandCache.getFirstQueueNode() ;
+ if(first != null){
+ Integer count = TcpDownCommandCache.size() ;
+ Node last = TcpDownCommandCache.getLastQueueNode() ;
+ this.doDealDownCommand(now, first, last);
+ return count ;
}
return null ;
}
@@ -57,9 +53,9 @@
* 澶勭悊缂撳瓨鐨勪笅琛屽懡浠よ妭鐐�
* @param now 褰撳墠鏃跺埢
* @param first 绗竴涓妭鐐�
- * @param last 鏄悗涓�涓妭鐐�
+ * @param last 鏈�鍚庝竴涓妭鐐�
*/
- private void doDealDownCommand(Long now, Node first, Node last){
+ private void doDealDownCommand1(Long now, Node first, Node last){
if(first != null){
//鍦╠ealNode鏂规硶涓紝鍙兘瑕佹妸first浠庨槦鍒椾腑绉婚櫎锛岃繖鏃秄irst.next涓虹┖锛屾墍浠ユ彁鍓嶆妸first.next鍙栧嚭鏉�
Node next = first.next ;
@@ -74,7 +70,29 @@
}
}
}
-
+
+ /**
+ * 澶勭悊缂撳瓨鐨勪笅琛屽懡浠よ妭鐐�
+ * @param now 褰撳墠鏃跺埢
+ * @param first 绗竴涓妭鐐�
+ * @param last 鏈�鍚庝竴涓妭鐐�
+ */
+ private void doDealDownCommand(Long now, Node first, Node last){
+ if(last != null){
+ //鍦╠ealNode鏂规硶涓紝鍙兘瑕佹妸last浠庨槦鍒椾腑绉婚櫎锛岃繖鏃秎ast.pre涓虹┖锛屾墍浠ユ彁鍓嶆妸last.pre鍙栧嚭鏉�
+ Node pre = last.pre ;
+ dealNode(now, last) ;
+ if(first != null && first != last){
+ doDealDownCommand(now, first, pre) ;
+ }else if(first != null && first == last){
+ //鍋滄
+ }else if(first == null){
+ //杩欑鎯呭喌涓嶄細瀛樺湪
+ doDealDownCommand(now, null, pre) ;
+ }
+ }
+ }
+
/**
* 澶勭悊涓�涓妭鐐�
* @param now 鐜板湪鏃跺埢
@@ -84,7 +102,7 @@
TcpDownCommandObj obj = (TcpDownCommandObj)node.obj ;
boolean removeNode = obj.dealSelf(now) ;
if(removeNode){
- TcpDownCommandCach.removeNode(node);
+ TcpDownCommandCache.removeNode(node);
}
}
diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/java/com/dy/testServer/AdapterImp_RmiUnit.java b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/java/com/dy/testServer/AdapterImp_RmiUnit.java
new file mode 100644
index 0000000..de59d8c
--- /dev/null
+++ b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/java/com/dy/testServer/AdapterImp_RmiUnit.java
@@ -0,0 +1,26 @@
+package com.dy.testServer;
+
+import com.dy.common.mw.channel.rmi.RmiConfigVo;
+import com.dy.common.mw.channel.rmi.RmiRequestCallback;
+import com.dy.common.mw.channel.rmi.RmiUnitAdapter;
+import com.dy.testServer.forRmi.RmiRequestedCallback;
+
+public class AdapterImp_RmiUnit implements RmiUnitAdapter {
+
+ private RmiConfigVo configVo ;
+
+ @Override
+ public RmiConfigVo getConfig() {
+ return configVo;
+ }
+
+ public void setConfig(RmiConfigVo configVo){
+ this.configVo = configVo ;
+ }
+
+ @Override
+ public RmiRequestCallback newRequestCallback() {
+ return new RmiRequestedCallback();
+ }
+
+}
diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/java/com/dy/testServer/forRmi/ResRegisterVo.java b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/java/com/dy/testServer/forRmi/ResRegisterVo.java
new file mode 100644
index 0000000..7a71d33
--- /dev/null
+++ b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/java/com/dy/testServer/forRmi/ResRegisterVo.java
@@ -0,0 +1,46 @@
+package com.dy.testServer.forRmi;
+
+
+import com.alibaba.fastjson2.JSON;
+
+public class ResRegisterVo {
+
+ public String token ;
+
+ /**
+ * 瀵硅薄杞垚json
+ * @return json
+ * @throws Exception 寮傚父
+ */
+ public String toJson()throws Exception{
+ try{
+ return JSON.toJSONString(this) ;
+ //return new JSONSerializer().exclude(new String[]{"class", "*.class"}).deepSerialize(this);
+ }catch(Exception e){
+ throw new Exception(e.getMessage() , e ) ;
+ }
+ }
+ /**
+ * json杞垚瀵硅薄
+ * @param json 鍙傛暟
+ * @return 瀵硅薄
+ * @throws Exception 寮傚父
+ */
+ public static ResRegisterVo jsonToObject(String json)throws Exception{
+ try{
+ return JSON.parseObject(json, ResRegisterVo.class) ;
+ //return new JSONDeserializer<ResRegisterVo>().deserialize(json, ResRegisterVo.class) ;
+ }catch(Exception e){
+ throw new Exception(e.getMessage() , e ) ;
+ }
+ }
+
+ public String getToken() {
+ return token;
+ }
+
+ public void setToken(String id) {
+ this.token = id;
+ }
+
+}
diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/java/com/dy/testServer/forRmi/ResStartVo.java b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/java/com/dy/testServer/forRmi/ResStartVo.java
new file mode 100644
index 0000000..ce87eb6
--- /dev/null
+++ b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/java/com/dy/testServer/forRmi/ResStartVo.java
@@ -0,0 +1,63 @@
+package com.dy.testServer.forRmi;
+
+
+import com.alibaba.fastjson2.JSON;
+
+public class ResStartVo {
+
+ public boolean success = true ;
+
+ public String errorInfo ;
+
+ public boolean start ;
+
+
+ /**
+ * 瀵硅薄杞垚json
+ * @return json
+ * @throws Exception 寮傚父
+ */
+ public String toJson()throws Exception{
+ try{
+ return JSON.toJSONString(this) ;
+ //return new JSONSerializer().exclude(new String[]{"class", "*.class"}).deepSerialize(this);
+ }catch(Exception e){
+ throw new Exception(e.getMessage() , e ) ;
+ }
+ }
+ /**
+ * json杞垚瀵硅薄
+ * @param json 鍙傛暟
+ * @return 瀵硅薄
+ * @throws Exception 寮傚父
+ */
+ public static ResStartVo jsonToObject(String json)throws Exception{
+ try{
+ return JSON.parseObject(json, ResStartVo.class) ;
+ //return new JSONDeserializer<ResStartVo>().deserialize(json, ResStartVo.class) ;
+ }catch(Exception e){
+ throw new Exception(e.getMessage() , e ) ;
+ }
+ }
+
+ public boolean isSuccess() {
+ return success;
+ }
+ public void setSuccess(boolean success) {
+ this.success = success;
+ }
+ public String getErrorInfo() {
+ return errorInfo;
+ }
+ public void setErrorInfo(String errorInfo) {
+ this.errorInfo = errorInfo;
+ }
+ public boolean isStart() {
+ return start;
+ }
+
+ public void setStart(boolean start) {
+ this.start = start;
+ }
+
+}
diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/java/com/dy/testServer/forRmi/RmiRequestedCallback.java b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/java/com/dy/testServer/forRmi/RmiRequestedCallback.java
new file mode 100644
index 0000000..da9d2b2
--- /dev/null
+++ b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/java/com/dy/testServer/forRmi/RmiRequestedCallback.java
@@ -0,0 +1,36 @@
+package com.dy.testServer.forRmi;
+
+import java.rmi.RemoteException;
+
+import com.dy.common.mw.channel.rmi.RmiRequestCallback;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+
+public class RmiRequestedCallback implements RmiRequestCallback {
+
+ @SuppressWarnings("unused")
+ private static Logger log = LogManager.getLogger(RmiRequestedCallback.class.getName()) ;
+
+ @Override
+ public Object syncRequest(Object obj) throws RemoteException {
+ String json ;
+ try {
+ json = Manager.dealRequest(obj);
+ } catch (Exception e) {
+ throw new RemoteException("鏈嶅姟绔紓甯�" , e) ;
+ }
+ return json ;
+ }
+
+ @Override
+ public String asyncRequest(Object obj) throws RemoteException {
+ String json ;
+ try {
+ json = Manager.dealRequest(obj);
+ } catch (Exception e) {
+ throw new RemoteException("鏈嶅姟绔紓甯�" , e) ;
+ }
+ return json ;
+ }
+
+}
diff --git "a/pipIrr-platform/\346\226\207\346\241\243/Git\346\223\215\344\275\234.txt" "b/pipIrr-platform/\346\226\207\346\241\243/Git\346\223\215\344\275\234.txt"
new file mode 100644
index 0000000..9294710
--- /dev/null
+++ "b/pipIrr-platform/\346\226\207\346\241\243/Git\346\223\215\344\275\234.txt"
@@ -0,0 +1,2 @@
+push涔嬪墠鍏坧ull
+pull鍓嶈鍏坈ommit
\ No newline at end of file
diff --git "a/pipIrr-platform/\346\226\207\346\241\243/Maven \346\211\223\345\214\205\346\217\222\344\273\266 maven-jar-plugin.docx" "b/pipIrr-platform/\346\226\207\346\241\243/Maven \346\211\223\345\214\205\346\217\222\344\273\266 maven-jar-plugin.docx"
new file mode 100644
index 0000000..ea62d10
--- /dev/null
+++ "b/pipIrr-platform/\346\226\207\346\241\243/Maven \346\211\223\345\214\205\346\217\222\344\273\266 maven-jar-plugin.docx"
Binary files differ
diff --git "a/pipIrr-platform/\346\226\207\346\241\243/Maven\346\211\223\345\214\205.docx" "b/pipIrr-platform/\346\226\207\346\241\243/Maven\346\211\223\345\214\205.docx"
new file mode 100644
index 0000000..4b1a0a9
--- /dev/null
+++ "b/pipIrr-platform/\346\226\207\346\241\243/Maven\346\211\223\345\214\205.docx"
Binary files differ
diff --git "a/pipIrr-platform/\346\226\207\346\241\243/Maven\347\232\204maven-compiler-plugin\346\217\222\344\273\266.docx" "b/pipIrr-platform/\346\226\207\346\241\243/Maven\347\232\204maven-compiler-plugin\346\217\222\344\273\266.docx"
new file mode 100644
index 0000000..88a43ce
--- /dev/null
+++ "b/pipIrr-platform/\346\226\207\346\241\243/Maven\347\232\204maven-compiler-plugin\346\217\222\344\273\266.docx"
Binary files differ
diff --git "a/pipIrr-platform/\346\226\207\346\241\243/\347\274\226\347\240\201\350\256\276\350\256\241.docx" "b/pipIrr-platform/\346\226\207\346\241\243/\347\274\226\347\240\201\350\256\276\350\256\241.docx"
new file mode 100644
index 0000000..a42ca3a
--- /dev/null
+++ "b/pipIrr-platform/\346\226\207\346\241\243/\347\274\226\347\240\201\350\256\276\350\256\241.docx"
Binary files differ
--
Gitblit v1.8.0