|
|
@@ -181,17 +181,22 @@ public class ChargeServiceImpl implements ChargeService {
|
|
|
@Override
|
|
|
@DSTransactional(noRollbackFor = java.net.SocketTimeoutException.class)
|
|
|
public Map<String, String> queryStartCharge(Long userId, String connectorId, Long userRechargeRightsId, Boolean isBooking, LocalDateTime startTime, LocalDateTime endTime) {
|
|
|
+ var map = getConnectorIdAndStationId(connectorId);
|
|
|
+ connectorId = map.get("connectorId");
|
|
|
+ var stationId = map.get("stationId");
|
|
|
+
|
|
|
+ LOGGER.info("用户:{},站点:{},设备:{}请求充电", userId, stationId, connectorId);
|
|
|
+
|
|
|
+ // 设备是否插枪
|
|
|
+ if (ConnectorStatusCache.INSTANCE.get(connectorId) != EquipmentInfo.SERVICE_STATUS_已连接) {
|
|
|
+ throw new BusinessException("请插入充电枪");
|
|
|
+ }
|
|
|
+
|
|
|
if (isBooking) {
|
|
|
// 预约时间不能超过未来24H
|
|
|
if (TimeUnit.SECONDS.convert(Duration.between(LocalDateTime.now(), startTime)) > 3600 * 24) {
|
|
|
throw new BusinessException("预约充电启动时间不能超过未来24小时");
|
|
|
}
|
|
|
-
|
|
|
- // 设备是否插枪
|
|
|
- if (ConnectorStatusCache.INSTANCE.get(connectorId) != EquipmentInfo.SERVICE_STATUS_已连接) {
|
|
|
- throw new BusinessException("请插入充电枪");
|
|
|
- }
|
|
|
-
|
|
|
// 预约充电通过connectorId查询预约中的订单
|
|
|
var bookingOrder = chargeOrderService.lambdaQuery().eq(ChargeOrder::getUserId, userId).eq(ChargeOrder::getConnectorId, connectorId).eq(ChargeOrder::getIsBooking, ChargeOrder.IS_BOOKING_是).eq(ChargeOrder::getOrderStatus, ChargeOrder.ORDER_STATUS_未知).eq(ChargeOrder::getChargeStatus, ChargeOrder.CHARGE_STATUS_预约中).one();
|
|
|
if (bookingOrder != null) {
|
|
|
@@ -199,10 +204,6 @@ public class ChargeServiceImpl implements ChargeService {
|
|
|
throw new BusinessException(ResponseEnum.ORDER_IN_BOOKING);
|
|
|
}
|
|
|
}
|
|
|
- var map = getConnectorIdAndStationId(connectorId);
|
|
|
- connectorId = map.get("connectorId");
|
|
|
- var stationId = map.get("stationId");
|
|
|
- LOGGER.info("用户:{},设备:{}请求启动充电", userId, connectorId);
|
|
|
|
|
|
// 二维码文本
|
|
|
var qrCode = "";
|
|
|
@@ -284,7 +285,6 @@ public class ChargeServiceImpl implements ChargeService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
if (equipAuth.containsKey("SuccStat") && equipAuth.getIntValue("SuccStat") == 0) {
|
|
|
// 启动充电
|
|
|
var startCharge = enPlusService.queryStartCharge(order.getStartChargeSeq(), connectorId, qrCode, amount);
|