mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-21 11:35:12 +08:00
update 电单车
This commit is contained in:
@@ -1,11 +1,10 @@
|
||||
package com.jsowell.pile.domain.ebike.deviceupload;
|
||||
|
||||
import com.jsowell.common.YouDianUtils;
|
||||
import com.jsowell.common.util.BytesUtil;
|
||||
import com.jsowell.pile.domain.ebike.AbsEBikeMessage;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* 结算消费信息上传(03指令)
|
||||
*/
|
||||
@@ -37,7 +36,7 @@ public class EBikeMessageCmd03 extends AbsEBikeMessage {
|
||||
private int chargingTime; // 充电时长, 单位:"秒"
|
||||
private int maxPower; // 最大功率, 单位:"0.1W"
|
||||
private int consumedEnergy; // 耗电量, 单位:"0.01度"
|
||||
private int portNumber; // 端口号
|
||||
private String portNumber; // 端口号
|
||||
private int startMode; // 在线/离线启动/验证码
|
||||
private int cardNumberOrVerificationCode; // 卡号/验证码
|
||||
private int stopReason; // 停止原因
|
||||
@@ -47,16 +46,42 @@ public class EBikeMessageCmd03 extends AbsEBikeMessage {
|
||||
// private String placeholderDuration; // 占位时长 充电柜专用,其他设备忽略此字段 表示充满后占用设备的时长,单位为分钟
|
||||
|
||||
public SettlementInfo(byte[] dataBytes) {
|
||||
this.chargingTime = BytesUtil.bytesToIntLittle(Arrays.copyOfRange(dataBytes, 0, 2));
|
||||
this.maxPower = BytesUtil.bytesToIntLittle(Arrays.copyOfRange(dataBytes, 2, 4));
|
||||
this.consumedEnergy = BytesUtil.bytesToIntLittle(Arrays.copyOfRange(dataBytes, 4, 6));
|
||||
this.portNumber = BytesUtil.bytesToIntLittle(new byte[]{dataBytes[6]});
|
||||
this.startMode = BytesUtil.bytesToIntLittle(new byte[]{dataBytes[7]});
|
||||
this.cardNumberOrVerificationCode = BytesUtil.bytesToIntLittle(Arrays.copyOfRange(dataBytes, 8, 12));
|
||||
this.stopReason = BytesUtil.bytesToIntLittle(new byte[]{dataBytes[12]});
|
||||
// this.orderNumber = BytesUtil.bcd2Str(Arrays.copyOfRange(dataBytes, 13, 29));
|
||||
this.orderNumber = BytesUtil.bcd2Str(BytesUtil.copyBytes(dataBytes, 13, 16));
|
||||
this.secondMaxPower = BytesUtil.bytesToIntLittle(Arrays.copyOfRange(dataBytes, 29, 31));
|
||||
int startIndex = 0;
|
||||
int length = 2;
|
||||
this.chargingTime = BytesUtil.bytesToIntLittle(BytesUtil.copyBytes(dataBytes, startIndex, length));
|
||||
|
||||
startIndex += length;
|
||||
length = 2;
|
||||
this.maxPower = BytesUtil.bytesToIntLittle(BytesUtil.copyBytes(dataBytes, startIndex, length));
|
||||
|
||||
startIndex += length;
|
||||
length = 2;
|
||||
this.consumedEnergy = BytesUtil.bytesToIntLittle(BytesUtil.copyBytes(dataBytes, startIndex, length));
|
||||
|
||||
startIndex += length;
|
||||
length = 1;
|
||||
this.portNumber = YouDianUtils.convertPortNumberToString(BytesUtil.bytesToIntLittle(BytesUtil.copyBytes(dataBytes, startIndex, length)));
|
||||
|
||||
startIndex += length;
|
||||
length = 1;
|
||||
this.startMode = BytesUtil.bytesToIntLittle(BytesUtil.copyBytes(dataBytes, startIndex, length));
|
||||
|
||||
startIndex += length;
|
||||
length = 4;
|
||||
this.cardNumberOrVerificationCode = BytesUtil.bytesToIntLittle(BytesUtil.copyBytes(dataBytes, startIndex, length));
|
||||
|
||||
startIndex += length;
|
||||
length = 1;
|
||||
this.stopReason = BytesUtil.bytesToIntLittle(BytesUtil.copyBytes(dataBytes, startIndex, length));
|
||||
|
||||
startIndex += length;
|
||||
length = 16;
|
||||
this.orderNumber = BytesUtil.bcd2Str(BytesUtil.copyBytes(dataBytes, startIndex, length));
|
||||
|
||||
startIndex += length;
|
||||
length = 2;
|
||||
this.secondMaxPower = BytesUtil.bytesToIntLittle(BytesUtil.copyBytes(dataBytes, startIndex, length));
|
||||
|
||||
// this.timestamp = BytesUtil.bytesToIntLittle(Arrays.copyOfRange(dataBytes, 31, 35)) + "";
|
||||
// this.placeholderDuration = BytesUtil.bytesToIntLittle(Arrays.copyOfRange(dataBytes, 35, 37)) + "";
|
||||
}
|
||||
|
||||
@@ -136,8 +136,7 @@ public class EBikeMessageCmd06 extends AbsEBikeMessage {
|
||||
public PowerHeartbeat(byte[] dataBytes) {
|
||||
int startIndex = 0;
|
||||
int length = 1;
|
||||
int i = BytesUtil.bytesToIntLittle(BytesUtil.copyBytes(dataBytes, startIndex, length));
|
||||
this.port = YouDianUtils.convertPortNumberToString(i);
|
||||
this.port = YouDianUtils.convertPortNumberToString(BytesUtil.bytesToIntLittle(BytesUtil.copyBytes(dataBytes, startIndex, length)));
|
||||
|
||||
startIndex += length;
|
||||
length = 1;
|
||||
|
||||
Reference in New Issue
Block a user