update 电单车协议

This commit is contained in:
Guoqs
2024-09-18 16:44:24 +08:00
parent 502488166c
commit c0e981cdb8
12 changed files with 88 additions and 41 deletions

View File

@@ -1,7 +1,7 @@
package com.jsowell.pile.service;
import com.jsowell.pile.domain.ebike.deviceupload.ChargingOperationResponse;
import com.jsowell.pile.domain.ykcCommond.StartChargingCommand;
import com.jsowell.pile.domain.ykcCommond.EBikeStartChargingCommand;
import com.jsowell.pile.domain.ykcCommond.StopChargingCommand;
/**
@@ -13,7 +13,7 @@ public interface EBikeSendCommandService {
* 启动充电
* @param command
*/
ChargingOperationResponse sendStartChargingCommand(StartChargingCommand command) throws Exception;
ChargingOperationResponse sendStartChargingCommand(EBikeStartChargingCommand command) throws Exception;
/**
* 停止充电

View File

@@ -122,12 +122,12 @@ public class PileRemoteService {
return;
}
log.info("【=====平台下发指令=====】: 电单车远程启动充电, 桩号:{}, 枪口号:{}", pileSn, connectorCode);
StartChargingCommand startChargingCommand = StartChargingCommand.builder()
.pileSn(pileSn)
.connectorCode(connectorCode)
.transactionCode(transactionCode)
.chargeAmount(chargeAmount)
.build();
EBikeStartChargingCommand startChargingCommand = new EBikeStartChargingCommand();
startChargingCommand.setPileSn(pileSn);
startChargingCommand.setConnectorCode(connectorCode);
startChargingCommand.setTransactionCode(transactionCode);
startChargingCommand.setChargeAmount(chargeAmount);
try {
ChargingOperationResponse startChargingResponse = eBikeSendCommandService.sendStartChargingCommand(startChargingCommand);
log.info("StartChargingResponse:{}", JSON.toJSONString(startChargingResponse));

View File

@@ -7,7 +7,7 @@ import com.jsowell.common.util.id.IdUtils;
import com.jsowell.pile.domain.ebike.AbsEBikeMessage2;
import com.jsowell.pile.domain.ebike.deviceupload.ChargingOperationResponse;
import com.jsowell.pile.domain.ebike.serversend.EBikeMessageCmd82;
import com.jsowell.pile.domain.ykcCommond.StartChargingCommand;
import com.jsowell.pile.domain.ykcCommond.EBikeStartChargingCommand;
import com.jsowell.pile.domain.ykcCommond.StopChargingCommand;
import com.jsowell.pile.service.EBikeSendCommandService;
import io.netty.buffer.ByteBuf;
@@ -32,7 +32,7 @@ public class EBikeSendCommandServiceImpl implements EBikeSendCommandService {
* 电单车发送启动充电指令
*/
@Override
public ChargingOperationResponse sendStartChargingCommand(StartChargingCommand command) throws Exception {
public ChargingOperationResponse sendStartChargingCommand(EBikeStartChargingCommand command) throws Exception {
String pileSn = command.getPileSn();
String connectorCode = command.getConnectorCode();
String transactionCode = command.getTransactionCode();
@@ -47,12 +47,12 @@ public class EBikeSendCommandServiceImpl implements EBikeSendCommandService {
message.setCommand("82");
// 充电模式
message.setRateMode(3);
message.setRateMode(command.getRateMode());
// 余额(分)或有效期
int balance = command.getChargeAmount().multiply(new BigDecimal("100")).intValue();
message.setBalanceOrValidity(balance);
// 端口号
message.setPortNumber(Integer.parseInt(connectorCode));
message.setConnectorCode(connectorCode);
// 充电命令
message.setChargeCommand(1);
// 充电时长/功率
@@ -96,11 +96,11 @@ public class EBikeSendCommandServiceImpl implements EBikeSendCommandService {
message.setCommand("82");
// 充电模式
message.setRateMode(3);
message.setRateMode(2);
// 余额或有效期
message.setBalanceOrValidity(1234);
message.setBalanceOrValidity(1000);
// 端口号
message.setPortNumber(Integer.parseInt(connectorCode));
message.setConnectorCode(connectorCode);
// 充电命令
message.setChargeCommand(0);
// 充电时长/功率