From 43a19a4424f67c379934ed0d70e0d1b3512cd769 Mon Sep 17 00:00:00 2001
From: zhubaomin <zhubaomin>
Date: 星期四, 27 三月 2025 09:31:44 +0800
Subject: [PATCH] 灌溉计划表中增加项目ID字段,计划列表返回值中增加项目名称,项目状态改为整数表示
---
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1/PrefixedDataAvailableV1.java | 35 ++++++++++++++++++++---------------
1 files changed, 20 insertions(+), 15 deletions(-)
diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1/PrefixedDataAvailableV1.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1/PrefixedDataAvailableV1.java
index d51dba2..eece0d6 100644
--- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1/PrefixedDataAvailableV1.java
+++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1/PrefixedDataAvailableV1.java
@@ -8,11 +8,13 @@
import org.apache.logging.log4j.Logger;
import org.apache.mina.core.buffer.BufferDataException;
import org.apache.mina.core.buffer.IoBuffer;
+import org.apache.mina.core.session.IoSession;
@AnnotationPrefixedDataAvailable(
enable = true,
protocolName = ProtocolConstantV206V1.protocolName,
+ protocolVersion = ProtocolConstantV206V1.protocolVer,
priority = ProtocolConstantV206V1.priority,
onLineDataMinLength = ProtocolConstantV206V1.onLineDataMinLength,
headMinLength = ProtocolConstantV206V1.headMinLength)
@@ -22,7 +24,7 @@
private static final Logger log = LogManager.getLogger(PrefixedDataAvailableV1.class) ;
private static final String protocolName = ProtocolConstantV206V1.protocolName ;
-
+ private static final short protocolVersion = ProtocolConstantV206V1.protocolVer ;
/**
* 鍒嗘瀽涓婄嚎鏁版嵁(缃戠粶杩炴帴鍚庣涓�鍖呮暟鎹�)鏄惁鍙幏寰�
@@ -33,11 +35,12 @@
* @return 涓嶆槸鏈崗璁暟鎹椂杩斿洖绌�
* @throws Exception 寮傚父
*/
- public PrefixedDataAvailableStatus forOnLine(IoBuffer in,
- int remain,
- int minDataLength,
- int maxDataLength
- ) throws Exception {
+ public PrefixedDataAvailableStatus forOnLine(IoSession ioSession,
+ IoBuffer in,
+ int remain,
+ int minDataLength,
+ int maxDataLength
+ ) throws Exception {
int oldPosition = in.position() ;
byte[] preByte = new byte[remain];
@@ -45,7 +48,7 @@
//in.position(0) ;//閿欒鐢ㄦ硶锛屽鏋滃彂鐢熺矘鍖呮暟鎹紝灏嗕細姝诲惊鐜�
in.position(oldPosition) ;
- return this.doForData(preByte, minDataLength, maxDataLength) ;
+ return this.doForData(ioSession, preByte, minDataLength, maxDataLength) ;
}
/**
@@ -58,28 +61,30 @@
* @throws Exception 寮傚父
*/
@Override
- public PrefixedDataAvailableStatus forUpData(IoBuffer in,
- int remain,
- int minDataLength,
- int maxDataLength) throws Exception {
+ public PrefixedDataAvailableStatus forUpData(IoSession ioSession,
+ IoBuffer in,
+ int remain,
+ int minDataLength,
+ int maxDataLength) throws Exception {
int oldPosition = in.position() ;
byte[] preByte = new byte[remain];
in.get(preByte) ;
//in.position(0) ;//閿欒鐢ㄦ硶锛屽鏋滃彂鐢熺矘鍖呮暟鎹紝灏嗕細姝诲惊鐜�
in.position(oldPosition) ;
- return this.doForData(preByte, minDataLength, maxDataLength) ;
+ return this.doForData(ioSession, preByte, minDataLength, maxDataLength) ;
}
/**
* 杩涜鍒ゆ柇
+ * @param ioSession ioSession
* @param preByte byte[]
* @param minDataLength 鏈�灏忔暟鎹暱搴�
* @param maxDataLength 鏈�澶ф暟鎹暱搴�
* @return PrefixedDataAvailableStatus
* @throws Exception 寮傚父
*/
- private PrefixedDataAvailableStatus doForData(byte[] preByte, int minDataLength, int maxDataLength) throws Exception{
+ private PrefixedDataAvailableStatus doForData(IoSession ioSession, byte[] preByte, int minDataLength, int maxDataLength) throws Exception{
int remain = preByte.length ;
if (remain < minDataLength) {
@@ -114,11 +119,11 @@
if(remain == dataLen){
//涓嶆柇涓嶇矘
- return new PrefixedDataAvailableStatus().completed(dataLen) ;
+ return new PrefixedDataAvailableStatus().completed(dataLen, protocolName, protocolVersion) ;
}else if(remain > dataLen){
String headHex = ByteUtil.bytes2Hex(preByte, true) ;
log.warn("鏀跺埌鏁版嵁涔嬪抚鍓嶉儴锛�" + headHex + "锛屼絾鍙戠敓绮樺寘鐜拌薄銆�") ;
- return new PrefixedDataAvailableStatus().adjoined(dataLen) ;
+ return new PrefixedDataAvailableStatus().adjoined(dataLen, protocolName, protocolVersion) ;
}else{
// remain < dataLen
String headHex = ByteUtil.bytes2Hex(preByte, true) ;
--
Gitblit v1.8.0