This commit is contained in:
YAS\29473
2025-05-22 14:26:27 +08:00
parent db44ef86c3
commit 66dd65d84f
5 changed files with 12 additions and 22 deletions

View File

@@ -47,7 +47,7 @@ public class RemoteStartChargingRequestHandler extends AbstractYkcHandler {
@Override
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, ChannelHandlerContext channel) {
log.info("[===远程启动充电命令回复===] start");
// log.info("[===远程启动充电命令回复===] param:{}, channel:{}", JSON.toJSONString(ykcDataProtocol), channel.toString());
// 消息体
byte[] msgBody = ykcDataProtocol.getMsgBody();

View File

@@ -144,7 +144,6 @@ public class NettyServerHandler extends ChannelInboundHandlerAdapter {
BytesUtil.binary(ykcDataProtocol.getBytes(), 16));
}
// 处理数据
log.info("开始处理数据");
byte[] response = ykcService.process(ykcDataProtocol, ctx);
if (Objects.nonNull(response)) {
// 响应客户端

View File

@@ -53,23 +53,15 @@ public class YKCBusinessServiceImpl implements YKCBusinessService {
@Override
public byte[] process(YKCDataProtocol ykcDataProtocol, ChannelHandlerContext ctx) {
log.info("收到一条YKC协议数据, 帧类型:{}, 长度:{}, 序列号:{}, 加密标识:{}, 帧名称:{}, 报文:{}",
YKCUtils.frameType2Str(ykcDataProtocol.getFrameType()),
ykcDataProtocol.getLength(),
ykcDataProtocol.getSerialNumber(),
ykcDataProtocol.getEncryptFlag(),
YKCUtils.frameType2Str(ykcDataProtocol.getFrameType()),
ykcDataProtocol.getMsgBody());
if (!YKCUtils.checkMsg(ykcDataProtocol)) {
// 校验不通过,丢弃消息
return null;
}
// 获取帧类型
String frameType = YKCUtils.frameType2Str(ykcDataProtocol.getFrameType());
log.info("获取帧类型:{}" , frameType);
// 获取业务处理handler
AbstractYkcHandler invokeStrategy = YKCOperateFactory.getInvokeStrategy(frameType); // 老逻辑
log.info("获取业务处理handler:{}" , invokeStrategy);
// AbstractYkcStrategy invokeStrategy = ykcOperateFactoryV2.getInvokeStrategy(frameType); // 新逻辑
return invokeStrategy.supplyProcess(ykcDataProtocol, ctx);
}

View File

@@ -105,7 +105,7 @@ public class RemoteStartChargingStrategy implements AbstractYkcStrategy {
}
// orderBasicInfoService.updateOrderBasicInfo(orderInfo);
log.info("远程启动充电命令回复-交易流水号:{}, 桩编码:{}, 枪号:{}, 启动结果(00-失败, 01-成功):{}, 失败原因:{}", transactionCode, pileSn, connectorCode, startResult, failedReasonMsg);
log.info("[===远程启动充电命令回复===] 2222222");
// 异步推送第三方平台
CompletableFuture.runAsync(() -> {
OrderBasicInfo orderInfo = orderBasicInfoService.getOrderInfoByTransactionCode(transactionCode);
@@ -114,9 +114,8 @@ public class RemoteStartChargingStrategy implements AbstractYkcStrategy {
}
try {
// 启动结果回复
// commonService.commonPushStartChargeResult(orderInfo);
commonService.commonPushStartChargeResultV2(orderInfo);
log.info("异步推送第三方平台订单信息成功");
commonService.commonPushStartChargeResult(orderInfo);
} catch (Exception e) {
e.printStackTrace();
}
@@ -124,7 +123,7 @@ public class RemoteStartChargingStrategy implements AbstractYkcStrategy {
if (StringUtils.equals(startResult, Constants.DOUBLE_ZERO)) {
try {
Thread.sleep(500);
commonService.commonPushOrderInfoV2(orderInfo);
commonService.commonPushOrderInfo(orderInfo);
} catch (Exception e) {
log.error("统一推送第三方平台订单信息error, ", e);
}