mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-06-10 18:30:02 +08:00
update 预约充电
This commit is contained in:
@@ -34,6 +34,55 @@ public class ReservationChargingStartupResultHandler extends AbstractYkcHandler
|
|||||||
YKCOperateFactory.register(type, this);
|
YKCOperateFactory.register(type, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
// 获取消息体
|
||||||
|
String msg = "8823000000071801240823102300000088230000000718010190";
|
||||||
|
byte[] msgBody = BytesUtil.str2Bcd(msg);
|
||||||
|
|
||||||
|
int startIndex = 0;
|
||||||
|
int length = 16;
|
||||||
|
|
||||||
|
// 交易流水号
|
||||||
|
byte[] transactionCodeByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||||||
|
String transactionCode = BytesUtil.bcd2Str(transactionCodeByteArr);
|
||||||
|
|
||||||
|
// 桩编码
|
||||||
|
startIndex += length;
|
||||||
|
length = 7;
|
||||||
|
byte[] pileSnByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||||||
|
String pileSn = BytesUtil.bcd2Str(pileSnByteArr);
|
||||||
|
|
||||||
|
// 枪号
|
||||||
|
startIndex += length;
|
||||||
|
length = 1;
|
||||||
|
byte[] connectorCodeByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||||||
|
String connectorCode = BytesUtil.bcd2Str(connectorCodeByteArr);
|
||||||
|
|
||||||
|
// vin
|
||||||
|
startIndex += length;
|
||||||
|
length = 17;
|
||||||
|
byte[] vinCodeByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||||||
|
String vinCode = YKCUtils.parseVin(vinCodeByteArr); // 解析vin
|
||||||
|
|
||||||
|
// 启动结果 0x00失败 0x01成功
|
||||||
|
startIndex += length;
|
||||||
|
length = 1;
|
||||||
|
byte[] startupResultByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||||||
|
String startupResult = BytesUtil.bcd2Str(startupResultByteArr);
|
||||||
|
String startupResultMsg = StringUtils.equals(startupResult, "00") ? "失败" : "成功";
|
||||||
|
|
||||||
|
// 失败原因
|
||||||
|
startIndex += length;
|
||||||
|
length = 1;
|
||||||
|
byte[] failReasonByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||||||
|
String failReason = BytesUtil.bcd2Str(failReasonByteArr);
|
||||||
|
String failReasonMsg = ChargingFailedReasonEnum.getMsgByCode(Integer.parseInt(failReason, 16));
|
||||||
|
|
||||||
|
log.info("[===预约充电启动结果上送===]交易流水号:{}, 桩编号:{}, 枪号:{}, vin:{}, 启动结果:{}, 失败原因:{}",
|
||||||
|
transactionCode, pileSn, connectorCode, vinCode, startupResult + "-" +startupResultMsg, failReasonMsg);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, ChannelHandlerContext channel) {
|
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, ChannelHandlerContext channel) {
|
||||||
log.info("[===预约充电启动结果上送===] param:{}, channel:{}", JSON.toJSONString(ykcDataProtocol), channel.toString());
|
log.info("[===预约充电启动结果上送===] param:{}, channel:{}", JSON.toJSONString(ykcDataProtocol), channel.toString());
|
||||||
|
|||||||
@@ -3796,7 +3796,7 @@ public class OrderBasicInfoServiceImpl implements OrderBasicInfoService {
|
|||||||
String orderCode = generateNewOrderCode();
|
String orderCode = generateNewOrderCode();
|
||||||
String transactionCode = chargingStartupResult.getTransactionCode();
|
String transactionCode = chargingStartupResult.getTransactionCode();
|
||||||
|
|
||||||
String status = StringUtils.equals(chargingStartupResult.getStartupResult(), "00")
|
String status = StringUtils.equals(chargingStartupResult.getStartupResult(), "01")
|
||||||
? OrderStatusEnum.IN_THE_CHARGING.getValue()
|
? OrderStatusEnum.IN_THE_CHARGING.getValue()
|
||||||
: OrderStatusEnum.ORDER_CLOSE_TIMEOUT.getValue();
|
: OrderStatusEnum.ORDER_CLOSE_TIMEOUT.getValue();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user