From 993a6e6ea8ae047b9e5fffd249ae7adfcd650d3a Mon Sep 17 00:00:00 2001
From: puzhibing <393733352@qq.com>
Date: 星期日, 17 五月 2026 11:35:44 +0800
Subject: [PATCH] 合并代码
---
xp-robotaxi-operation-boot/src/main/java/com/xiaopeng/operation/service/impl/XpRoutePlanServiceImpl.java | 16 ++++++++++++++++
1 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/xp-robotaxi-operation-boot/src/main/java/com/xiaopeng/operation/service/impl/XpRoutePlanServiceImpl.java b/xp-robotaxi-operation-boot/src/main/java/com/xiaopeng/operation/service/impl/XpRoutePlanServiceImpl.java
index 3822585..8c63010 100644
--- a/xp-robotaxi-operation-boot/src/main/java/com/xiaopeng/operation/service/impl/XpRoutePlanServiceImpl.java
+++ b/xp-robotaxi-operation-boot/src/main/java/com/xiaopeng/operation/service/impl/XpRoutePlanServiceImpl.java
@@ -1,5 +1,6 @@
package com.xiaopeng.operation.service.impl;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.xiaopeng.api.model.operation.XpOpenCity;
import com.xiaopeng.api.model.operation.XpRoutePlan;
import com.xiaopeng.common.core.exception.ServiceException;
@@ -49,6 +50,16 @@
if (openCity == null) {
throw new ServiceException("开通城市不存在");
}
+ long count = this.count(new QueryWrapper<XpRoutePlan>().eq("open_city_id", openCity.getId())
+ .eq("is_deleted", 0));
+ if(count >= 3){
+ throw new ServiceException("同一个城市只能添加三个路线规划");
+ }
+ count = this.count(new QueryWrapper<XpRoutePlan>().eq("open_city_id", openCity.getId())
+ .eq("plan_name", dto.getPlanName()).eq("is_deleted", 0));
+ if(count > 0){
+ throw new ServiceException("路线规划名称不能重复");
+ }
// 2. 创建路线规划配置对象
XpRoutePlan routePlan = new XpRoutePlan();
@@ -82,6 +93,11 @@
if (openCity == null) {
throw new ServiceException("开通城市不存在");
}
+ long count = this.count(new QueryWrapper<XpRoutePlan>().eq("open_city_id", openCity.getId())
+ .eq("plan_name", dto.getPlanName()).eq("is_deleted", 0).ne("id", dto.getId()));
+ if(count > 0){
+ throw new ServiceException("路线规划名称不能重复");
+ }
// 3. 更新字段
routePlan.setOpenCityId(dto.getOpenCityId());
--
Gitblit v1.7.1