mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-05-01 00:20:03 +08:00
update 电单车协议
This commit is contained in:
@@ -84,7 +84,7 @@ public class EBikeSendCommandServiceImpl implements EBikeSendCommandService {
|
||||
* @param command
|
||||
*/
|
||||
@Override
|
||||
public ChargingOperationResponse sendStopChargingCommand(StopChargingCommand command) throws Exception {
|
||||
public ChargingOperationResponse sendStopChargingCommand(StopChargingCommand command) {
|
||||
String pileSn = command.getPileSn();
|
||||
String connectorCode = command.getConnectorCode();
|
||||
String transactionCode = command.getTransactionCode();
|
||||
@@ -131,10 +131,10 @@ public class EBikeSendCommandServiceImpl implements EBikeSendCommandService {
|
||||
* 公共方法, 发送指令
|
||||
* @param msg
|
||||
*/
|
||||
private byte[] send(AbsEBikeMessage2 msg) throws Exception {
|
||||
private byte[] send(AbsEBikeMessage2 msg) {
|
||||
return this.send(msg, 5, TimeUnit.SECONDS);
|
||||
}
|
||||
private byte[] send(AbsEBikeMessage2 msg, long timeout, TimeUnit unit) throws Exception {
|
||||
private byte[] send(AbsEBikeMessage2 msg, long timeout, TimeUnit unit) {
|
||||
String pileSn = msg.getPhysicalId() + "";
|
||||
byte[] messageBytes = msg.getMessageBytes();
|
||||
String command = YKCUtils.frameType2Str(msg.getCommand());
|
||||
@@ -172,17 +172,23 @@ public class EBikeSendCommandServiceImpl implements EBikeSendCommandService {
|
||||
});
|
||||
|
||||
// 等待获取结果
|
||||
byte[] rpcResponse = syncPromise.get(timeout, unit);
|
||||
if(rpcResponse == null) {
|
||||
if(syncPromise.isTimeout()) {
|
||||
// throw new TimeoutException("等待响应结果超时");
|
||||
log.error("发送[{}]指令后, 等待响应结果超时", command);
|
||||
} else{
|
||||
log.error("发送[{}]指令后, 发生其他异常", command);
|
||||
byte[] rpcResponse;
|
||||
try {
|
||||
rpcResponse = syncPromise.get(timeout, unit);
|
||||
if(rpcResponse == null) {
|
||||
if(syncPromise.isTimeout()) {
|
||||
// throw new TimeoutException("等待响应结果超时");
|
||||
log.error("发送[{}]指令后, 等待响应结果超时", command);
|
||||
} else{
|
||||
log.error("发送[{}]指令后, 发生其他异常", command);
|
||||
}
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
} finally {
|
||||
// 移除容器
|
||||
RpcUtil.getSyncPromiseMap().remove(msgId);
|
||||
}
|
||||
// 移除容器
|
||||
RpcUtil.getSyncPromiseMap().remove(msgId);
|
||||
return rpcResponse;
|
||||
}
|
||||
|
||||
|
||||
@@ -417,6 +417,25 @@ public class PileBasicInfoServiceImpl implements PileBasicInfoService {
|
||||
return pileInfoVO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PileDetailVO selectPileDetailByPileSn(String pileSn) {
|
||||
PileDetailVO pileInfoVO = pileBasicInfoMapper.selectPileDetailByPileSn(pileSn);
|
||||
if (pileInfoVO == null) {
|
||||
return null;
|
||||
}
|
||||
// 获取桩状态
|
||||
Map<String, String> pileStatusMap = pileConnectorInfoService.getPileStatus(Lists.newArrayList(pileInfoVO.getPileSn()));
|
||||
pileInfoVO.setStatus(pileStatusMap.get(pileInfoVO.getPileSn()));
|
||||
String pileQrCodeUrl = getPileQrCodeUrl(pileInfoVO.getPileSn());
|
||||
pileInfoVO.setQrCodeURL(pileQrCodeUrl);
|
||||
// 设备型号
|
||||
PileModelInfo pileModelInfo = pileModelInfoService.selectPileModelInfoById(Long.parseLong(pileInfoVO.getModelId()));
|
||||
if (pileModelInfo != null) {
|
||||
pileInfoVO.setModelName(pileModelInfo.getModelName());
|
||||
}
|
||||
return pileInfoVO;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据桩编号查询桩信息
|
||||
* @param pileSn
|
||||
|
||||
Reference in New Issue
Block a user