From 844597b5813ff8589de503cd7d7b1bbd0586d287 Mon Sep 17 00:00:00 2001
From: zuoxiao <470321431@qq.com>
Date: 星期一, 13 五月 2024 19:38:03 +0800
Subject: [PATCH] 1.添加水量单价 2.修复发现的bug

---
 qihealonelibrary/src/main/java/com/dayu/qihealonelibrary/card/RegionCard.java |   41 +++++++++++++++++++++++++----------------
 1 files changed, 25 insertions(+), 16 deletions(-)

diff --git a/qihealonelibrary/src/main/java/com/dayu/qihealonelibrary/card/RegionCard.java b/qihealonelibrary/src/main/java/com/dayu/qihealonelibrary/card/RegionCard.java
index 222a0d4..2db7a51 100644
--- a/qihealonelibrary/src/main/java/com/dayu/qihealonelibrary/card/RegionCard.java
+++ b/qihealonelibrary/src/main/java/com/dayu/qihealonelibrary/card/RegionCard.java
@@ -16,17 +16,25 @@
 
     public String cardType = CardCommon.REGION;//鍗″懡浠�
 
-    public short region;//鍖哄煙鍦板潃(浣庡墠楂樺悗) 鍙互璇嗗埆鏌愬幙闀囨潙
+    public int region;//鍖哄煙鍦板潃(浣庡墠楂樺悗) 鍙互璇嗗埆鏌愬幙闀囨潙
 
-    public short controllerCodel;// 鎺у埗鍣ㄧ紪鍙�(浣庡墠楂樺悗) 鏈尯鍩熷唴鎺у埗鍣ㄧ紪鍙�
+    public int controllerCodel;// 鎺у埗鍣ㄧ紪鍙�(浣庡墠楂樺悗) 鏈尯鍩熷唴鎺у埗鍣ㄧ紪鍙�
 
 
-    public short getRegion() {
+    public int getRegion() {
         return region;
     }
 
-    public short getControllerCodel() {
+    public void setRegion(int region) {
+        this.region = region;
+    }
+
+    public int getControllerCodel() {
         return controllerCodel;
+    }
+
+    public void setControllerCodel(int controllerCodel) {
+        this.controllerCodel = controllerCodel;
     }
 
     public byte[] toByte() {
@@ -35,20 +43,19 @@
     }
 
 
-
-    public static RegionCard getBean(List<byte[]> data){
-        RegionCard regionCard=new RegionCard();
-        byte[] zero=data.get(0);
-        regionCard.cardType= HexUtil.byteToHex(zero[0]);
+    public static RegionCard getBean(List<byte[]> data) {
+        RegionCard regionCard = new RegionCard();
+        byte[] zero = data.get(0);
+        regionCard.cardType = HexUtil.byteToHex(zero[0]);
 
         byte[] regionByte = new byte[2];
         System.arraycopy(zero, 1, regionByte, 0, regionByte.length);
-        regionCard.region = (short) HexUtil.get16to10LowHigh(HexUtil.bytesToHex(regionByte));
+        regionCard.region = HexUtil.get16To10LowHightByBytes(regionByte);
 
 
         byte[] controllerCodelByte = new byte[2];
         System.arraycopy(zero, 3, controllerCodelByte, 0, controllerCodelByte.length);
-        regionCard.controllerCodel = (short) HexUtil.get16to10LowHigh(HexUtil.bytesToHex(controllerCodelByte));
+        regionCard.controllerCodel = HexUtil.get16To10LowHightByBytes(controllerCodelByte);
 
 
         return regionCard;
@@ -58,17 +65,19 @@
     /**
      * 绗�1鎵囧尯0鍧� 瀛樺偍鐨勬暟鎹�
      */
-    public class Zero  {
+    public class Zero {
         public byte[] toByte() {
             byte[] data = new byte[16];
             data[0] = HexUtil.hexToByte(cardType);
-
-            byte[] regionBytes = HexUtil.hexToByteArray(HexUtil.get10To16LowHigh(region));
+            byte[] regionBytes = new byte[2];
+            byte[] regionDatas = HexUtil.hexToByteArray(HexUtil.get10To16LowHigh(region));
+            System.arraycopy(regionDatas, 0, regionBytes, 0, regionDatas.length);
             if (regionBytes != null) {
                 System.arraycopy(regionBytes, 0, data, 1, regionBytes.length);
             }
-
-            byte[] controllerCodelBytes = HexUtil.hexToByteArray(HexUtil.get10To16LowHigh(controllerCodel));
+            byte[] controllerCodelBytes = new byte[2];
+            byte[] controllerCodelDatas = HexUtil.hexToByteArray(HexUtil.get10To16LowHigh(controllerCodel));
+            System.arraycopy(controllerCodelDatas, 0, controllerCodelBytes, 0, controllerCodelDatas.length);
             if (controllerCodelBytes != null) {
                 System.arraycopy(controllerCodelBytes, 0, data, 3, controllerCodelBytes.length);
             }

--
Gitblit v1.8.0