!47 新增 充电桩主动申请启动充电(0x31)2.运营平台确认启动充电(0x32)

* fix(ProtocolUplinkConsumerService):指标初始化代码恢复
* update:启动方式枚举类调整
* update:增加 0x31、0x32 的枚举类
* update:添加下行日志打印
* add:1.充电桩主动申请启动充电(0x31)2.运营平台确认启动充电(0x32)
This commit is contained in:
白板
2025-09-12 05:44:33 +00:00
committed by 三丙
parent 4eebd3d1b0
commit bc5411eb4b
12 changed files with 708 additions and 4 deletions

View File

@@ -72,6 +72,11 @@ public interface PileProtocolService {
*/
void onTransactionRecordRequest(UplinkQueueMessage uplinkQueueMessage, Callback callback);
/**
* 充电桩主动申请启动充电
*/
void onStartChargeRequest(UplinkQueueMessage uplinkQueueMessage, Callback callback);
/**
* 启动充电(支持卡号和并充序号)
* 当 parallelNo 不为空时,自动使用并充启机命令

View File

@@ -394,6 +394,36 @@ public class DefaultPileProtocolService implements PileProtocolService {
callback.onSuccess();
}
@Override
public void onStartChargeRequest(UplinkQueueMessage uplinkQueueMessage, Callback callback) {
log.info("接收到充电桩启动充电请求 {}", uplinkQueueMessage);
StartChargeRequest startChargeRequest = uplinkQueueMessage.getStartChargeRequest();
String pileCode = startChargeRequest.getPileCode();
String gunCode = startChargeRequest.getGunCode();
// TODO 处理相关业务逻辑
// 构造下行回复
DownlinkRequestMessage.Builder downlinkMessageBuilder = createDownlinkMessageBuilder(uplinkQueueMessage, startChargeRequest.getPileCode());
downlinkMessageBuilder.setDownlinkCmd(DownlinkCmdEnum.START_CHARGE_ACK.name());
downlinkMessageBuilder.setStartChargeResponse(StartChargeResponse.newBuilder()
.setTradeNo("")
.setPileCode(startChargeRequest.getPileCode())
.setGunCode(startChargeRequest.getGunCode())
.setLogicalCardNo("")
.setLimitYuan("0")
.setAuthSuccess(false)
.setFailReason(FailReason.ACCOUNT_NOT_ALLOWED_ON_PILE.name())
);
log.info("业务[充电桩启动充电请求应答] 发送下行消息到充电桩: {}, 充电枪: {}", pileCode, gunCode);
downlinkCallService.sendDownlinkMessage(downlinkMessageBuilder,pileCode);
callback.onSuccess();
}
@Override
public void startCharge(String pileCode, String gunCode, BigDecimal limitYuan, String orderNo,
String logicalCardNo, String physicalCardNo, String parallelNo) {

View File

@@ -70,7 +70,7 @@ public class ProtocolUplinkConsumerService extends AbstractConsumerService {
private AppQueueConsumerManager<ProtoQueueMsg<UplinkQueueMessage>, AppQueueConfig> appConsumer;
private final StatsFactory statsFactory;
private AppConsumerStats stats;
public ProtocolUplinkConsumerService(PartitionProvider partitionProvider,
@@ -87,7 +87,7 @@ public class ProtocolUplinkConsumerService extends AbstractConsumerService {
@PostConstruct
public void init() {
super.init("jcpp-app");
this.stats = new AppConsumerStats(statsFactory, timerTopN);
log.info("Initializing Protocol Uplink Messages Queue Subscriptions.");
@@ -249,7 +249,11 @@ public class ProtocolUplinkConsumerService extends AbstractConsumerService {
pileProtocolService.postBmsDemandChargerOutput(uplinkQueueMsg, callback);
}else {
} else if (uplinkQueueMsg.hasStartChargeRequest()) {
pileProtocolService.onStartChargeRequest(uplinkQueueMsg, callback);
} else {
callback.onSuccess();
}