Kaynağa Gözat

预约订单设备状态校验

skyline 1 yıl önce
ebeveyn
işleme
a620198229

+ 4 - 0
service/src/main/java/com/kym/service/miniapp/impl/ChargeServiceImpl.java

@@ -325,6 +325,10 @@ public class ChargeServiceImpl implements ChargeService {
         }
 
         if (isBooking) {
+            // 设备状态必须为插枪才可以预约
+            if (KymCache.INSTANCE.getConnectorStatus(connectorId) != EquipmentInfo.SERVICE_STATUS_已连接) {
+                throw new BusinessException("设备状态异常");
+            }
             // 预约时间不能超过未来24H
             if (TimeUnit.SECONDS.convert(Duration.between(LocalDateTime.now(), startTime)) > 3600 * 24) {
                 throw new BusinessException("预约充电启动时间不能超过未来24小时");