update 电单车协议

This commit is contained in:
Guoqs
2024-09-19 14:58:48 +08:00
parent 0ca737e195
commit 6f46dfff4a
3 changed files with 68 additions and 1 deletions

View File

@@ -64,7 +64,7 @@ public class ChargingOperationResponse extends AbsEBikeMessage2 {
public static void main(String[] args) {
String s = "444e591d00198bca07da0c8200132738810124091416463569289954500000007907";
String s = "444e591d00198bca07f106820013273881052409191439471814850828040000ad06";
byte[] messageBytes = BytesUtil.hexStringToByteArray(s);
ChargingOperationResponse response = new ChargingOperationResponse(messageBytes);
System.out.println(response);

View File

@@ -5,6 +5,7 @@ import com.google.common.collect.Lists;
import com.jsowell.common.constant.CacheConstants;
import com.jsowell.common.core.domain.ykc.YKCDataProtocol;
import com.jsowell.common.core.redis.RedisCache;
import com.jsowell.common.enums.ebike.EBikeChargeCommandResponse;
import com.jsowell.common.enums.ykc.ChargingFailedReasonEnum;
import com.jsowell.common.enums.ykc.ReturnCodeEnum;
import com.jsowell.common.exception.BusinessException;
@@ -55,6 +56,9 @@ public class PileRemoteService {
@Autowired
private EBikeSendCommandService eBikeSendCommandService;
@Autowired
private OrderBasicInfoService orderBasicInfoService;
@Value("${remoteUpdate.server}")
private String serverAddress;
@@ -131,6 +135,17 @@ public class PileRemoteService {
try {
ChargingOperationResponse startChargingResponse = eBikeSendCommandService.sendStartChargingCommand(startChargingCommand);
log.info("StartChargingResponse:{}", JSON.toJSONString(startChargingResponse));
if (startChargingResponse != null) {
int result = startChargingResponse.getResult();
if (result == 0) {
// 启动成功
orderBasicInfoService.chargingPileStartedSuccessfully(transactionCode);
} else {
String failedReasonMsg = EBikeChargeCommandResponse.getDescriptionByCode(result);
// 启动失败 682204000001000000000041
orderBasicInfoService.chargingPileFailedToStart(transactionCode, failedReasonMsg);
}
}
} catch (Exception e) {
log.error("电单车远程启动充电error", e);
}