From 246c72b8e1cba97de66efd8112ed166210ebc686 Mon Sep 17 00:00:00 2001
From: “mitao” <“2763622819@qq.com”>
Date: 星期五, 17 四月 2026 12:02:38 +0800
Subject: [PATCH] fix:围栏点位重名校验、围栏禁行区禁用

---
 xp-robotaxi-map-boot/src/main/java/com/xiaopeng/map/service/serviceimpl/XpPointServiceImpl.java |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/xp-robotaxi-map-boot/src/main/java/com/xiaopeng/map/service/serviceimpl/XpPointServiceImpl.java b/xp-robotaxi-map-boot/src/main/java/com/xiaopeng/map/service/serviceimpl/XpPointServiceImpl.java
index 0cffd2f..e013adf 100644
--- a/xp-robotaxi-map-boot/src/main/java/com/xiaopeng/map/service/serviceimpl/XpPointServiceImpl.java
+++ b/xp-robotaxi-map-boot/src/main/java/com/xiaopeng/map/service/serviceimpl/XpPointServiceImpl.java
@@ -107,6 +107,7 @@
         if (pointAddDto.getElectronicAreaId() == null) {
             throw new ServiceException("运营区域ID不能为空", I18nKeyConstant.POINT_ELECTRONIC_AREA_ID_EMPTY);
         }
+        validatePointNameUnique(pointAddDto.getPointName(), null);
 
         String cityPrefix = buildCityPrefix(pointAddDto.getElectronicAreaId());
         String lockKey = buildPointNumberLockKey(cityPrefix, POINT_BIZ_TYPE);
@@ -147,6 +148,20 @@
     }
 
     @Override
+    public void validatePointNameUnique(String pointName, Long excludeId) {
+        if (!StringUtils.hasText(pointName)) {
+            return;
+        }
+        long count = this.lambdaQuery()
+                .eq(XpPoint::getPointName, pointName)
+                .ne(excludeId != null, XpPoint::getId, excludeId)
+                .count();
+        if (count > 0) {
+            throw new ServiceException("点位名称已存在", I18nKeyConstant.POINT_NAME_EXISTS);
+        }
+    }
+
+    @Override
     public NearestVo nearest(NearestDto dto) {
         // 走缓存
         Object orderDistanceObj = redisService.getCacheObject(CacheConstants.NEAR_POINT_DISTANCE);

--
Gitblit v1.7.1