mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-22 03:55:17 +08:00
update 电单车协议
This commit is contained in:
@@ -112,6 +112,12 @@ public interface PileBasicInfoMapper {
|
||||
*/
|
||||
PileDetailVO selectBasicInfoById(Long id);
|
||||
|
||||
/**
|
||||
* 通过桩sn查询basic信息
|
||||
* @param pileSn 桩sn
|
||||
*/
|
||||
PileDetailVO selectPileDetailByPileSn(String pileSn);
|
||||
|
||||
/**
|
||||
* 通过idList批量查询
|
||||
*
|
||||
|
||||
@@ -19,7 +19,7 @@ public interface EBikeSendCommandService {
|
||||
* 停止充电
|
||||
* @param command
|
||||
*/
|
||||
ChargingOperationResponse sendStopChargingCommand(StopChargingCommand command) throws Exception;
|
||||
ChargingOperationResponse sendStopChargingCommand(StopChargingCommand command);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -105,6 +105,14 @@ public interface PileBasicInfoService {
|
||||
*/
|
||||
PileDetailVO selectBasicInfoById(Long id);
|
||||
|
||||
/**
|
||||
* 通过桩sn查询basic信息
|
||||
*
|
||||
* @param id 桩id
|
||||
* @return 结果集合
|
||||
*/
|
||||
PileDetailVO selectPileDetailByPileSn(String pileSn);
|
||||
|
||||
PileInfoVO selectPileInfoBySn(String pileSn);
|
||||
|
||||
/**
|
||||
@@ -125,20 +133,6 @@ public interface PileBasicInfoService {
|
||||
*/
|
||||
void firstUnplugCharger(String pileConnectorCode);
|
||||
|
||||
/**
|
||||
* 通过桩编号查询站点id
|
||||
* @param sn 桩编号
|
||||
* @return 站点id
|
||||
*/
|
||||
// String selectStationIdBySn(String sn);
|
||||
|
||||
/**
|
||||
* uniApp通过桩号查询桩详情
|
||||
* @param pileSn 桩号
|
||||
* @return
|
||||
*/
|
||||
// PileDetailVO uniAppGetPileDetailByPileSn(String pileSn);
|
||||
|
||||
/**
|
||||
* 修改状态
|
||||
* @param frameType
|
||||
|
||||
@@ -3,6 +3,7 @@ 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.constant.Constants;
|
||||
import com.jsowell.common.core.domain.ykc.YKCDataProtocol;
|
||||
import com.jsowell.common.core.redis.RedisCache;
|
||||
import com.jsowell.common.enums.ebike.EBikeChargeResponseEnum;
|
||||
@@ -162,14 +163,44 @@ public class PileRemoteService {
|
||||
log.info("发送远程停止充电指令-充电桩枪口编号:{}, 获取到正在充电中的交易流水号:{}, 与入参交易流水号:{}不一致, function return", pileSn + connectorCode, redisResult, transactionCode);
|
||||
return;
|
||||
}
|
||||
|
||||
// 查询桩信息
|
||||
PileDetailVO pileDetailVO = pileBasicInfoService.selectPileDetailByPileSn(pileSn);
|
||||
if (pileDetailVO == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
StopChargingCommand command = StopChargingCommand.builder()
|
||||
.pileSn(pileSn)
|
||||
.connectorCode(connectorCode)
|
||||
.transactionCode(transactionCode)
|
||||
.build();
|
||||
ykcPushCommandService.pushStopChargingCommand(command);
|
||||
|
||||
String chargePortType = pileDetailVO.getChargePortType();
|
||||
if (StringUtils.equals(chargePortType, Constants.THREE)) {
|
||||
// 发送电动自行车桩停止充电指令
|
||||
eBikeSendCommandService.sendStopChargingCommand(command);
|
||||
} else {
|
||||
// 发送电动汽车桩停止充电指令
|
||||
ykcPushCommandService.pushStopChargingCommand(command);
|
||||
}
|
||||
log.info("remoteStopCharging success, pileConnectorCode:{}, transactionCode:{}", pileSn + connectorCode, transactionCode);
|
||||
}
|
||||
|
||||
public void remoteStopChargingForEBike(String pileSn, String connectorCode, String transactionCode) {
|
||||
StopChargingCommand command = StopChargingCommand.builder()
|
||||
.pileSn(pileSn)
|
||||
.connectorCode(connectorCode)
|
||||
.transactionCode(transactionCode)
|
||||
.build();
|
||||
try {
|
||||
eBikeSendCommandService.sendStopChargingCommand(command);
|
||||
} catch (Exception e) {
|
||||
log.error("remoteStopChargingForEBike error, pileSn:{}, connectorCode:{}, transactionCode:{}"
|
||||
,pileSn, connectorCode, transactionCode, e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 下发充电桩二维码
|
||||
*
|
||||
|
||||
@@ -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