From c19de84fa332a00c651f28e3a52292fd14f143a1 Mon Sep 17 00:00:00 2001
From: liurunyu <lry9898@163.com>
Date: 星期二, 23 九月 2025 17:30:07 +0800
Subject: [PATCH] 陆常丽反应软件系统财务对账时而数据不准确,分析源码,找到bug原因是,财务对账统计只有用户点击后才会触发统计功能,把历史上及当天进行了统计,如果当天统计时未下班,例如是中午触发统计了,而下午又进行了充值售水,但下班后未再点击触发对账统计,那么今天的对账统计完成了但数据不对。编写自动任务,在下半夜进行对账统计。
---
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V2/CommonV2.java | 45 +++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 43 insertions(+), 2 deletions(-)
diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V2/CommonV2.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V2/CommonV2.java
index ebcaacf..cae3753 100644
--- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V2/CommonV2.java
+++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V2/CommonV2.java
@@ -3,10 +3,11 @@
import com.dy.common.mw.protocol.p206V1.ProtocolConstantV206V1;
import com.dy.common.util.ByteUtil;
import com.dy.common.util.ByteUtilUnsigned;
+import com.dy.common.util.CRC16;
import com.dy.common.util.CRC8_for_2_0;
-
public class CommonV2 {
+
/**
* 妫�鏌ュご
* @param bs 涓婅瀛楄妭鏁扮粍
@@ -20,7 +21,7 @@
&& bs[ProtocolConstantV206V2.headFlag1Index] == ProtocolConstantV206V2.P_Head_Byte
&& bs[ProtocolConstantV206V2.headFlag2Index] == ProtocolConstantV206V2.P_Head_Byte){
Short vs = this.parseVersion(bs) ;
- if(vs.shortValue() == ProtocolConstantV206V2.protocolVer.shortValue()){
+ if(vs.shortValue() == ProtocolConstantV206V2.protocolVer){
return new Boolean[]{true, true};
}else{
return new Boolean[]{false, true};
@@ -159,6 +160,19 @@
}
/**
+ * 鍒嗘瀽鍔熻兘鐮�
+ * @param bs 涓婅瀛楄妭鏁扮粍
+ * @return 鍔熻兘鐮�
+ */
+ public String parseCode(byte[] bs, boolean p206TrueUgFalse){
+ if(p206TrueUgFalse) {
+ return ByteUtil.bytes2Hex(bs, false, ProtocolConstantV206V1.codeIndex, 1);
+ }else{
+ return ByteUtil.bytes2Hex(bs, false, ProtocolConstantV206V1.UG_codeIndex, 2);
+ }
+ }
+
+ /**
* 鏍¢獙鍜屾鏌�
* @param bs 涓婅瀛楄妭鏁扮粍
* @return 閫氳繃null锛屾湭閫氳繃杩斿洖鍘熷洜
@@ -175,6 +189,33 @@
}
+ /**
+ * 鏍¢獙鍜屾鏌�
+ * @param bs 涓婅瀛楄妭鏁扮粍
+ * @param p206TrueUgFalse 206鍗忚涓簍rue锛屽崌绾у崗璁负false
+ * @return 閫氳繃null锛屾湭閫氳繃杩斿洖鍘熷洜
+ * @throws Exception 寮傚父
+ */
+ public String checkCrc_str(byte[] bs, boolean p206TrueUgFalse) throws Exception {
+ if(p206TrueUgFalse){
+ byte crcCompute = (byte)new CRC8_for_2_0().CRC8(bs, ProtocolConstantV206V1.ctrlIndex, bs.length - 3) ;
+ byte crcInBs = bs[bs.length - 2] ;
+ if(crcCompute == crcInBs){
+ return null ;
+ }else{
+ return "璁$畻CRC鏄�:" + crcCompute + "锛屼笂浼燙RC鏄�" + crcInBs ;
+ }
+ }else{
+ short crcCompute = new CRC16().CRC(bs, 0, bs.length - 4) ;
+ short crcInBs = ByteUtil.bytes2Short_BE(bs,bs.length - 3) ;
+ //int crcInBs = ByteUtilUnsigned.bytes2Short_BE(bs, bs.length - 3) ;
+ if(crcCompute == crcInBs){
+ return null ;
+ }else{
+ return "璁$畻CRC鏄�:" + crcCompute + "锛屼笂浼燙RC鏄�" + crcInBs ;
+ }
+ }
+ }
/*
鏋勯�犳帶鍒跺煙
D7 D6 D5锝濪4 D3锝濪0
--
Gitblit v1.8.0