From c6b6e81247f4f65cf80ae8e25b3aee5bb3a950f0 Mon Sep 17 00:00:00 2001 From: liurunyu <lry9898@163.com> Date: 星期五, 28 六月 2024 11:13:07 +0800 Subject: [PATCH] 1、靳总协议上行数据处理修改完善 2、SSO系统,实现缓存最大值,缓存时长可配置化 --- pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/parse/Cd_83_Up.java | 83 ++++++++++++++++++++++++----------------- 1 files changed, 48 insertions(+), 35 deletions(-) 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 index fd50a67..7f09c37 100644 --- 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 @@ -3,6 +3,8 @@ 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.mw.protocol.p206V1_0_0.upVos.DataCd83CloseVo; +import com.dy.common.mw.protocol.p206V1_0_0.upVos.DataCd83OpenVo; import com.dy.common.util.ByteUtil; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -83,10 +85,11 @@ */ protected void doParse(byte[] bs, int bsLen, String dataCode, Data data) throws Exception { byte opType = bs[ProtocolConstantV206V1_0_0.dataIndex]; - if(opType == 1 || opType == 3 || opType == 8){ - this.doParseOpen(opType, bs, bsLen, dataCode, data); - }else{ + Boolean isCloseType = CommonV1_0_1.isCloseValveType(opType) ; + if(isCloseType != null && isCloseType.booleanValue()){ this.doParseClose(opType, bs, bsLen, dataCode, data); + }else if(isCloseType != null && !isCloseType.booleanValue()){ + this.doParseOpen(opType, bs, bsLen, dataCode, data); } } private void doParseOpen(byte opType, byte[] bs, int bsLen, String dataCode, Data data) throws Exception { @@ -97,51 +100,46 @@ cdData.type = opType ; short index = ProtocolConstantV206V1_0_0.dataIndex + 1 ; - //绱娴侀噺锛�5瀛楄妭BCD鐮侊紝鍙栧�艰寖鍥�0~9999999999锛屽崟浣嶄负m3銆� + //绱娴侀噺锛�5瀛楄妭BCD鐮侊紝鍙栧�艰寖鍥�0~99999999.99锛屽崟浣嶄负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 ; + int tpInt = ByteUtil.BCD2Int_LE(bs, index, index + 4) ; + cdData.totalAmount += tpInt/100.0 ; + index += 5 ; //鐢ㄦ按鎴峰彿鏁版嵁鏍煎紡锛�5瀛楄妭BCD鐮佷綆浣嶅湪鍓嶉珮浣嶅湪鍚庛�� cdData.icCardNo = ByteUtil.BCD2String_LE(bs, index, index + 4) ; + index += 5 ; - //IC鍗″彿鏍煎紡锛�4瀛楄妭HEX鐮佷綆浣嶅湪鍓嶉珮浣嶅湪鍚庛�� - cdData.icCardNo = ByteUtil.bytesToHex(bs, index, index + 3) ; - index += 4 ; + cdData.icCardAddr = 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++ ; + tpInt = ByteUtil.BCD2Int_LE(bs, index, index + 3) ; 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 ; + index += 4 ; //鐢ㄦ按鎴风敤姘村紑濮嬫椂闂达細6瀛楄妭BCD鐮侊紝椤哄簭鏄勾鏈堟棩鏃跺垎绉掞紝鍏朵腑鍏厓骞�=2000+骞淬�� cdData.openDt = GlParse.parseTp(bs, index) ; - index += 6 ; + index += 6 ; + /* 寮�闃�鏃讹紝姝ら儴鍒嗘病鏈� + cdData.priceType = bs[index] ; + + index++ ; + cdData.price = 0.0D ; + tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ; + index++ ; + cdData.price += tpInt/100.0 ; + tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ; + index++ ; + cdData.price += tpInt; + + cdData.cardType = bs[index] ; + + index++ ; + */ //鎺у埗鍣ㄦ椂閽� cdData.rtuDt = GlParse.parseTp(bs, index) ; //index += 6 ; @@ -178,7 +176,7 @@ index += 5 ; //IC鍗″彿鏍煎紡锛�4瀛楄妭HEX鐮佷綆浣嶅湪鍓嶉珮浣嶅湪鍚庛�� - cdData.icCardNo = ByteUtil.bytesToHex(bs, index, index + 3) ; + cdData.closeDt = ByteUtil.bytesToHex(bs, index, index + 3) ; index += 4 ; //鐢ㄦ按鎴蜂綑棰濓細鐢ㄦ埛浣欓4瀛楄妭BCD鐮侊紝鍙栧�艰寖鍥�0.00~999999.99锛屽崟浣嶄负鍏冦�� @@ -246,6 +244,21 @@ index++ ; cdData.thisTime += tpInt * 100 ; + + cdData.priceType = bs[index] ; + + index++ ; + cdData.price = 0.0D ; + tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ; + index++ ; + cdData.price += tpInt/100.0 ; + tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ; + index++ ; + cdData.price += tpInt; + + cdData.cardType = bs[index] ; + + index++ ; //鎺у埗鍣ㄦ椂閽� cdData.rtuDt = GlParse.parseTp(bs, index) ; //index += 6 ; -- Gitblit v1.8.0