update 电单车

This commit is contained in:
Guoqs
2024-09-14 17:19:05 +08:00
parent e85e630282
commit 86dd583ad6
6 changed files with 167 additions and 12 deletions

View File

@@ -1,5 +1,6 @@
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.StopChargingCommand;
@@ -12,12 +13,13 @@ public interface EBikeSendCommandService {
* 启动充电
* @param command
*/
void sendStartChargingCommand(StartChargingCommand command) throws Exception;
ChargingOperationResponse sendStartChargingCommand(StartChargingCommand command) throws Exception;
/**
* 停止充电
* @param command
*/
void sendStopChargingCommand(StopChargingCommand command) throws Exception;
ChargingOperationResponse sendStopChargingCommand(StopChargingCommand command) throws Exception;
}

View File

@@ -1,5 +1,6 @@
package com.jsowell.pile.service;
import com.alibaba.fastjson2.JSON;
import com.google.common.collect.Lists;
import com.jsowell.common.constant.CacheConstants;
import com.jsowell.common.core.domain.ykc.YKCDataProtocol;
@@ -11,6 +12,7 @@ import com.jsowell.common.util.BytesUtil;
import com.jsowell.common.util.StringUtils;
import com.jsowell.pile.domain.PileBillingTemplate;
import com.jsowell.pile.domain.PileFirmwareInfo;
import com.jsowell.pile.domain.ebike.deviceupload.ChargingOperationResponse;
import com.jsowell.pile.domain.ykcCommond.*;
import com.jsowell.pile.dto.PublishBillingTemplateDTO;
import com.jsowell.pile.dto.RemoteAccountBalanceUpdateDTO;
@@ -127,7 +129,8 @@ public class PileRemoteService {
.chargeAmount(chargeAmount)
.build();
try {
eBikeSendCommandService.sendStartChargingCommand(startChargingCommand);
ChargingOperationResponse startChargingResponse = eBikeSendCommandService.sendStartChargingCommand(startChargingCommand);
log.info("StartChargingResponse:{}", JSON.toJSONString(startChargingResponse));
} catch (Exception e) {
log.error("电单车远程启动充电error", e);
}

View File

@@ -5,6 +5,7 @@ import com.jsowell.common.protocol.SyncPromise;
import com.jsowell.common.util.*;
import com.jsowell.common.util.id.IdUtils;
import com.jsowell.pile.domain.ebike.AbsEBikeMessage;
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.StopChargingCommand;
@@ -31,7 +32,7 @@ public class EBikeSendCommandServiceImpl implements EBikeSendCommandService {
* 电单车发送启动充电指令
*/
@Override
public void sendStartChargingCommand(StartChargingCommand command) throws Exception {
public ChargingOperationResponse sendStartChargingCommand(StartChargingCommand command) throws Exception {
String pileSn = command.getPileSn();
String connectorCode = command.getConnectorCode();
String transactionCode = command.getTransactionCode();
@@ -75,8 +76,9 @@ public class EBikeSendCommandServiceImpl implements EBikeSendCommandService {
data.setFullChargePower(0);
data.setMaxFullChargePowerCheckTime(0);
message.setData(data);
byte[] send = this.send(message);
log.info("电单车发送启动充电指令response:{}", BytesUtil.binary(send, 16));
byte[] response = this.send(message);
log.info("电单车发送启动充电指令response:{}", BytesUtil.binary(response, 16));
return new ChargingOperationResponse(response);
}
/**
@@ -84,7 +86,7 @@ public class EBikeSendCommandServiceImpl implements EBikeSendCommandService {
* @param command
*/
@Override
public void sendStopChargingCommand(StopChargingCommand command) throws Exception {
public ChargingOperationResponse sendStopChargingCommand(StopChargingCommand command) throws Exception {
String pileSn = command.getPileSn();
String connectorCode = command.getConnectorCode();
String transactionCode = command.getTransactionCode();
@@ -124,8 +126,9 @@ public class EBikeSendCommandServiceImpl implements EBikeSendCommandService {
data.setFullChargePower(0);
data.setMaxFullChargePowerCheckTime(0);
message.setData(data);
byte[] send = this.send(message);
log.info("电单车发送停止充电指令response:{}", BytesUtil.binary(send, 16));
byte[] response = this.send(message);
log.info("电单车发送停止充电指令response:{}", BytesUtil.binary(response, 16));
return new ChargingOperationResponse(response);
}
/**