mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-06-13 03:39:55 +08:00
update 电单车协议
This commit is contained in:
@@ -112,6 +112,12 @@ public interface PileBasicInfoMapper {
|
|||||||
*/
|
*/
|
||||||
PileDetailVO selectBasicInfoById(Long id);
|
PileDetailVO selectBasicInfoById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过桩sn查询basic信息
|
||||||
|
* @param pileSn 桩sn
|
||||||
|
*/
|
||||||
|
PileDetailVO selectPileDetailByPileSn(String pileSn);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过idList批量查询
|
* 通过idList批量查询
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ public interface EBikeSendCommandService {
|
|||||||
* 停止充电
|
* 停止充电
|
||||||
* @param command
|
* @param command
|
||||||
*/
|
*/
|
||||||
ChargingOperationResponse sendStopChargingCommand(StopChargingCommand command) throws Exception;
|
ChargingOperationResponse sendStopChargingCommand(StopChargingCommand command);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -105,6 +105,14 @@ public interface PileBasicInfoService {
|
|||||||
*/
|
*/
|
||||||
PileDetailVO selectBasicInfoById(Long id);
|
PileDetailVO selectBasicInfoById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过桩sn查询basic信息
|
||||||
|
*
|
||||||
|
* @param id 桩id
|
||||||
|
* @return 结果集合
|
||||||
|
*/
|
||||||
|
PileDetailVO selectPileDetailByPileSn(String pileSn);
|
||||||
|
|
||||||
PileInfoVO selectPileInfoBySn(String pileSn);
|
PileInfoVO selectPileInfoBySn(String pileSn);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -125,20 +133,6 @@ public interface PileBasicInfoService {
|
|||||||
*/
|
*/
|
||||||
void firstUnplugCharger(String pileConnectorCode);
|
void firstUnplugCharger(String pileConnectorCode);
|
||||||
|
|
||||||
/**
|
|
||||||
* 通过桩编号查询站点id
|
|
||||||
* @param sn 桩编号
|
|
||||||
* @return 站点id
|
|
||||||
*/
|
|
||||||
// String selectStationIdBySn(String sn);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* uniApp通过桩号查询桩详情
|
|
||||||
* @param pileSn 桩号
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
// PileDetailVO uniAppGetPileDetailByPileSn(String pileSn);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改状态
|
* 修改状态
|
||||||
* @param frameType
|
* @param frameType
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package com.jsowell.pile.service;
|
|||||||
import com.alibaba.fastjson2.JSON;
|
import com.alibaba.fastjson2.JSON;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import com.jsowell.common.constant.CacheConstants;
|
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.domain.ykc.YKCDataProtocol;
|
||||||
import com.jsowell.common.core.redis.RedisCache;
|
import com.jsowell.common.core.redis.RedisCache;
|
||||||
import com.jsowell.common.enums.ebike.EBikeChargeResponseEnum;
|
import com.jsowell.common.enums.ebike.EBikeChargeResponseEnum;
|
||||||
@@ -162,14 +163,44 @@ public class PileRemoteService {
|
|||||||
log.info("发送远程停止充电指令-充电桩枪口编号:{}, 获取到正在充电中的交易流水号:{}, 与入参交易流水号:{}不一致, function return", pileSn + connectorCode, redisResult, transactionCode);
|
log.info("发送远程停止充电指令-充电桩枪口编号:{}, 获取到正在充电中的交易流水号:{}, 与入参交易流水号:{}不一致, function return", pileSn + connectorCode, redisResult, transactionCode);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 查询桩信息
|
||||||
|
PileDetailVO pileDetailVO = pileBasicInfoService.selectPileDetailByPileSn(pileSn);
|
||||||
|
if (pileDetailVO == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
StopChargingCommand command = StopChargingCommand.builder()
|
StopChargingCommand command = StopChargingCommand.builder()
|
||||||
.pileSn(pileSn)
|
.pileSn(pileSn)
|
||||||
.connectorCode(connectorCode)
|
.connectorCode(connectorCode)
|
||||||
|
.transactionCode(transactionCode)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
String chargePortType = pileDetailVO.getChargePortType();
|
||||||
|
if (StringUtils.equals(chargePortType, Constants.THREE)) {
|
||||||
|
// 发送电动自行车桩停止充电指令
|
||||||
|
eBikeSendCommandService.sendStopChargingCommand(command);
|
||||||
|
} else {
|
||||||
|
// 发送电动汽车桩停止充电指令
|
||||||
ykcPushCommandService.pushStopChargingCommand(command);
|
ykcPushCommandService.pushStopChargingCommand(command);
|
||||||
|
}
|
||||||
log.info("remoteStopCharging success, pileConnectorCode:{}, transactionCode:{}", pileSn + connectorCode, transactionCode);
|
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
|
* @param command
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public ChargingOperationResponse sendStopChargingCommand(StopChargingCommand command) throws Exception {
|
public ChargingOperationResponse sendStopChargingCommand(StopChargingCommand command) {
|
||||||
String pileSn = command.getPileSn();
|
String pileSn = command.getPileSn();
|
||||||
String connectorCode = command.getConnectorCode();
|
String connectorCode = command.getConnectorCode();
|
||||||
String transactionCode = command.getTransactionCode();
|
String transactionCode = command.getTransactionCode();
|
||||||
@@ -131,10 +131,10 @@ public class EBikeSendCommandServiceImpl implements EBikeSendCommandService {
|
|||||||
* 公共方法, 发送指令
|
* 公共方法, 发送指令
|
||||||
* @param msg
|
* @param msg
|
||||||
*/
|
*/
|
||||||
private byte[] send(AbsEBikeMessage2 msg) throws Exception {
|
private byte[] send(AbsEBikeMessage2 msg) {
|
||||||
return this.send(msg, 5, TimeUnit.SECONDS);
|
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() + "";
|
String pileSn = msg.getPhysicalId() + "";
|
||||||
byte[] messageBytes = msg.getMessageBytes();
|
byte[] messageBytes = msg.getMessageBytes();
|
||||||
String command = YKCUtils.frameType2Str(msg.getCommand());
|
String command = YKCUtils.frameType2Str(msg.getCommand());
|
||||||
@@ -172,7 +172,9 @@ public class EBikeSendCommandServiceImpl implements EBikeSendCommandService {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// 等待获取结果
|
// 等待获取结果
|
||||||
byte[] rpcResponse = syncPromise.get(timeout, unit);
|
byte[] rpcResponse;
|
||||||
|
try {
|
||||||
|
rpcResponse = syncPromise.get(timeout, unit);
|
||||||
if(rpcResponse == null) {
|
if(rpcResponse == null) {
|
||||||
if(syncPromise.isTimeout()) {
|
if(syncPromise.isTimeout()) {
|
||||||
// throw new TimeoutException("等待响应结果超时");
|
// throw new TimeoutException("等待响应结果超时");
|
||||||
@@ -181,8 +183,12 @@ public class EBikeSendCommandServiceImpl implements EBikeSendCommandService {
|
|||||||
log.error("发送[{}]指令后, 发生其他异常", command);
|
log.error("发送[{}]指令后, 发生其他异常", command);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
} finally {
|
||||||
// 移除容器
|
// 移除容器
|
||||||
RpcUtil.getSyncPromiseMap().remove(msgId);
|
RpcUtil.getSyncPromiseMap().remove(msgId);
|
||||||
|
}
|
||||||
return rpcResponse;
|
return rpcResponse;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -417,6 +417,25 @@ public class PileBasicInfoServiceImpl implements PileBasicInfoService {
|
|||||||
return pileInfoVO;
|
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
|
* @param pileSn
|
||||||
|
|||||||
@@ -419,4 +419,32 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
id desc
|
id desc
|
||||||
limit 1
|
limit 1
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectPileDetailByPileSn" resultType="com.jsowell.pile.vo.web.PileDetailVO">
|
||||||
|
SELECT
|
||||||
|
t1.id as pileId,
|
||||||
|
t1.sn AS pileSn,
|
||||||
|
t1.name as name,
|
||||||
|
t1.merchant_id AS merchantId,
|
||||||
|
t2.merchant_name AS merchantName,
|
||||||
|
t1.station_id AS stationId,
|
||||||
|
t3.station_name AS stationName,
|
||||||
|
t1.model_id AS modelId,
|
||||||
|
t4.rated_power AS ratedPower,
|
||||||
|
t4.rated_current AS ratedCurrent,
|
||||||
|
t1.sim_id AS simId,
|
||||||
|
t5.iccid AS iccid ,
|
||||||
|
t5.sim_supplier as simSupplier,
|
||||||
|
IF(t4.charger_pile_type = '2','3',(IF(t4.speed_type = '1','1','2'))) AS pileType,
|
||||||
|
t5.operator
|
||||||
|
FROM
|
||||||
|
pile_basic_info t1
|
||||||
|
left JOIN pile_merchant_info t2 ON t1.merchant_id = t2.id
|
||||||
|
left JOIN pile_station_info t3 ON t1.station_id = t3.id
|
||||||
|
left JOIN pile_model_info t4 ON t1.model_id = t4.id
|
||||||
|
left JOIN pile_sim_info t5 ON t1.sim_id = t5.id
|
||||||
|
WHERE
|
||||||
|
t1.del_flag = '0'
|
||||||
|
and t1.sn = #{pileSn,jdbcType=VARCHAR}
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
Reference in New Issue
Block a user