From 71c72f125bc10a5bd39317e51b7ee5a41035ee92 Mon Sep 17 00:00:00 2001
From: “mitao” <“2763622819@qq.com”>
Date: 星期六, 21 三月 2026 19:38:50 +0800
Subject: [PATCH] fix:运营后台工单、点位、围栏问题修改

---
 xp-robotaxi-map-boot/src/main/java/com/xiaopeng/map/controller/XpElectronicFenceManagementController.java |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/xp-robotaxi-map-boot/src/main/java/com/xiaopeng/map/controller/XpElectronicFenceManagementController.java b/xp-robotaxi-map-boot/src/main/java/com/xiaopeng/map/controller/XpElectronicFenceManagementController.java
index f1c911e..efdfddc 100644
--- a/xp-robotaxi-map-boot/src/main/java/com/xiaopeng/map/controller/XpElectronicFenceManagementController.java
+++ b/xp-robotaxi-map-boot/src/main/java/com/xiaopeng/map/controller/XpElectronicFenceManagementController.java
@@ -334,19 +334,23 @@
     private void validateFenceTime(@NotNull Integer status, Integer effectType, LocalDateTime effectTime,
                                    Integer failureType, LocalDateTime failureTime) {
         LocalDateTime now = LocalDateTime.now();
-        // 定时生效时,生效时间不能早于当前时间
-        if (null != status && status == 2 && effectType != null && effectType != 1) {
+        // 发布/启用时,定时生效的生效时间不能早于当前时间
+        if (requiresScheduleValidation(status) && effectType != null && effectType != 1) {
             if (effectTime == null || effectTime.isBefore(now)) {
                 throw new ServiceException("围栏生效时间不合法,定时生效时生效时间不能早于当前时间",
                         I18nKeyConstant.FENCE_EFFECT_TIME_INVALID);
             }
         }
-        // 定时失效时,失效时间不能早于当前时间
-        if (null != status && status == 2 && failureType != null && failureType != 1) {
+        // 发布/启用时,定时失效的失效时间不能早于当前时间
+        if (requiresScheduleValidation(status) && failureType != null && failureType != 1) {
             if (failureTime == null || failureTime.isBefore(now)) {
                 throw new ServiceException("围栏失效时间不合法,定时失效时失效时间不能早于当前时间",
                         I18nKeyConstant.FENCE_FAILURE_TIME_INVALID);
             }
         }
     }
+
+    private boolean requiresScheduleValidation(Integer status) {
+        return status != null && (status == 1 || status == 2);
+    }
 }

--
Gitblit v1.7.1