| package com.dayu.henanlibrary.socketBean; | 
|   | 
| import com.dayu.baselibrary.tools.ArraysUtil; | 
| import com.dayu.baselibrary.tools.BcdUtil; | 
| import com.dayu.baselibrary.utils.CRC8; | 
| import com.dayu.baselibrary.utils.MornyUtil; | 
| import com.dayu.henanlibrary.utils.SocketUtil; | 
|   | 
| /** | 
|  * Copyright (C), 2022, | 
|  * Author: zuo | 
|  * Date: 2022/2/7 16:15 | 
|  * Description: 充值 | 
|  */ | 
| public class RechargeRequestBean extends BaseSocketBean { | 
|     String control;//控制域C表示报文传输方向和所提供的传输服务类型的信息,0x00代表此帧报文是由中心端发出的下行报文;0x01 表示此帧报文是由终端发出的上行报文; | 
|   | 
|     String initCode;///= new String[16];//设备注册号 | 
|     String xuLie;// = new String[3];//充值管理机序列号(低)充值管理机序列号(中)充值管理机序列号(高) | 
|     String AFN = "95"; | 
|     String initPeasantCode;// = new String[16];//农户注册编号 | 
|     String balance;// = new String[4];// 充值金额(低)---充值金额(高) 16进制     单位:0.01元 | 
|     String orderId;//= new String[8];//订单号 | 
|   | 
|     @Override | 
|     public byte[] toByte() { | 
|         byte[] data = new byte[49]; | 
|         data[0] = CRC8.hexStrToBinaryStr(this.control)[0]; | 
|         byte[] initCodeBytes = CRC8.hexStrToBinaryStr(this.initCode); | 
|         ArraysUtil.copyof(data, initCodeBytes, 1); | 
|         byte[] machineCodeByte = CRC8.hexStrToBinaryStr(this.xuLie); | 
|         ArraysUtil.copyof(data, machineCodeByte, 17); | 
|         ArraysUtil.copyof(data, CRC8.hexStrToBinaryStr(this.AFN)[0], 20); | 
|         byte[] initPeasantCodeByte = CRC8.hexStrToBinaryStr(this.initPeasantCode); | 
|         ArraysUtil.copyof(data, initPeasantCodeByte, 21); | 
|         byte[] balanceByte = CRC8.hexStrToBinaryStr(SocketUtil.get10to16LowHigh(MornyUtil.changeY2F(balance), 8)); | 
|         ArraysUtil.copyof(data, balanceByte, 37); | 
|         byte[] orderIdByte = BcdUtil.strToBcd(this.orderId); | 
|         ArraysUtil.copyof(data, orderIdByte, 41); | 
|         return data; | 
|     } | 
|   | 
|     @Override | 
|     public String toString() { | 
|         return | 
|                 control + | 
|                         initCode + | 
|                         xuLie + | 
|                         AFN + | 
|                         initPeasantCode + | 
|                         balance + | 
|                         orderId; | 
|     } | 
|   | 
|     public String getControl() { | 
|         return control; | 
|     } | 
|   | 
|     public void setControl(String control) { | 
|         this.control = control; | 
|     } | 
|   | 
|     public String getInitCode() { | 
|         return initCode; | 
|     } | 
|   | 
|     public void setInitCode(String initCode) { | 
|         this.initCode = initCode; | 
|     } | 
|   | 
|     public String getXuLie() { | 
|         return xuLie; | 
|     } | 
|   | 
|     public void setXuLie(String xuLie) { | 
|         this.xuLie = xuLie; | 
|     } | 
|   | 
|     public String getAFN() { | 
|         return AFN; | 
|     } | 
|   | 
|     public void setAFN(String AFN) { | 
|         this.AFN = AFN; | 
|     } | 
|   | 
|     public String getInitPeasantCode() { | 
|         return initPeasantCode; | 
|     } | 
|   | 
|     public void setInitPeasantCode(String initPeasantCode) { | 
|         this.initPeasantCode = initPeasantCode; | 
|     } | 
|   | 
|     public String getBalance() { | 
|         return balance; | 
|     } | 
|   | 
|     public void setBalance(String balance) { | 
|         this.balance = balance; | 
|     } | 
|   | 
|     public String getOrderId() { | 
|         return orderId; | 
|     } | 
|   | 
|     public void setOrderId(String orderId) { | 
|         this.orderId = orderId; | 
|     } | 
|   | 
| } |