update 电单车协议

This commit is contained in:
Guoqs
2024-09-05 15:51:51 +08:00
parent f3d4b13895
commit 8c273e5a39
6 changed files with 218 additions and 18 deletions

View File

@@ -34,28 +34,28 @@ public class EBikeMessageCmd03 extends AbsEBikeMessage {
@Data
public static class SettlementInfo {
private String chargingDuration; // 充电时长, 单位:"秒"
private String maxPower; // 最大功率, 单位:"0.1W"
private String consumedEnergy; // 耗电量, 单位:"0.01度"
private String portNumber; // 端口号
private String startMode; // 在线/离线启动/验证码
private String cardNumberOrVerificationCode; // 卡号/验证码
private String stopReason; // 停止原因
private String orderNumber; // 订单编号
private String secondMaxPower; // 第二最大功率
private int chargingDuration; // 充电时长, 单位:"秒"
private int maxPower; // 最大功率, 单位:"0.1W"
private int consumedEnergy; // 耗电量, 单位:"0.01度"
private int portNumber; // 端口号
private int startMode; // 在线/离线启动/验证码
private int cardNumberOrVerificationCode; // 卡号/验证码
private int stopReason; // 停止原因
private int orderNumber; // 订单编号
private int secondMaxPower; // 第二最大功率
// private String timestamp; // 时间戳 上发指令当时的时间,有时候不准确,该字段属于调试使用,服务器无需关心此字段
// private String placeholderDuration; // 占位时长 充电柜专用,其他设备忽略此字段 表示充满后占用设备的时长,单位为分钟
public SettlementInfo(byte[] dataBytes) {
this.chargingDuration = 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.bcd2StrLittle(new byte[]{dataBytes[6]});
this.startMode = BytesUtil.bcd2StrLittle(new byte[]{dataBytes[7]});
this.cardNumberOrVerificationCode = BytesUtil.bcd2StrLittle(Arrays.copyOfRange(dataBytes, 8, 12));
this.stopReason = BytesUtil.bcd2StrLittle(new byte[]{dataBytes[12]});
this.orderNumber = BytesUtil.bcd2StrLittle(Arrays.copyOfRange(dataBytes, 13, 29));
this.secondMaxPower = BytesUtil.bytesToIntLittle(Arrays.copyOfRange(dataBytes, 29, 31)) + "";
this.chargingDuration = 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.bytesToIntLittle(Arrays.copyOfRange(dataBytes, 13, 29));
this.secondMaxPower = BytesUtil.bytesToIntLittle(Arrays.copyOfRange(dataBytes, 29, 31));
// this.timestamp = BytesUtil.bytesToIntLittle(Arrays.copyOfRange(dataBytes, 31, 35)) + "";
// this.placeholderDuration = BytesUtil.bytesToIntLittle(Arrays.copyOfRange(dataBytes, 35, 37)) + "";
}

View File

@@ -14,6 +14,7 @@ import com.jsowell.common.enums.ykc.*;
import com.jsowell.common.util.DateUtils;
import com.jsowell.common.util.StringUtils;
import com.jsowell.pile.domain.*;
import com.jsowell.pile.domain.ebike.deviceupload.EBikeMessageCmd03;
import com.jsowell.pile.dto.*;
import com.jsowell.pile.service.*;
import com.jsowell.pile.transaction.service.TransactionService;
@@ -141,6 +142,13 @@ public abstract class AbstractProgramLogic implements InitializingBean {
*/
public abstract void settleOrder(TransactionRecordsData data, OrderBasicInfo orderBasicInfo);
/**
* 电单车结算逻辑
* @param message
* @param orderBasicInfo
*/
public abstract void settleOrderForEBike(EBikeMessageCmd03 message, OrderBasicInfo orderBasicInfo);
/**
* 第三方平台结算订单(目前给华为用)
*

View File

@@ -27,6 +27,7 @@ import com.jsowell.common.util.DateUtils;
import com.jsowell.common.util.StringUtils;
import com.jsowell.common.util.id.SnowflakeIdWorker;
import com.jsowell.pile.domain.*;
import com.jsowell.pile.domain.ebike.deviceupload.EBikeMessageCmd03;
import com.jsowell.pile.dto.*;
import com.jsowell.pile.transaction.dto.OrderTransactionDTO;
import com.jsowell.pile.vo.uniapp.customer.MemberVO;
@@ -470,6 +471,11 @@ public class DelayMerchantProgramLogic extends AbstractProgramLogic {
orderBasicInfo.getOrderCode(), orderBasicInfo.getTransactionCode(), JSON.toJSONString(dto));
}
@Override
public void settleOrderForEBike(EBikeMessageCmd03 message, OrderBasicInfo orderBasicInfo) {
}
/**
* 第三方平台结算订单(目前给华为用)
* @param data

View File

@@ -27,6 +27,7 @@ import com.jsowell.common.util.DateUtils;
import com.jsowell.common.util.StringUtils;
import com.jsowell.common.util.id.SnowflakeIdWorker;
import com.jsowell.pile.domain.*;
import com.jsowell.pile.domain.ebike.deviceupload.EBikeMessageCmd03;
import com.jsowell.pile.dto.*;
import com.jsowell.pile.transaction.dto.OrderTransactionDTO;
import com.jsowell.pile.vo.uniapp.customer.MemberVO;
@@ -417,6 +418,11 @@ public class NotDelayMerchantProgramLogic extends AbstractProgramLogic {
logger.info("结算订单end:{} OrderTransactionDTO:{}", orderBasicInfo.getOrderCode(), JSON.toJSONString(dto));
}
@Override
public void settleOrderForEBike(EBikeMessageCmd03 message, OrderBasicInfo orderBasicInfo) {
}
/**
* 第三方平台结算订单(目前给华为用)
* @param data