puzhibing
2026-05-17 993a6e6ea8ae047b9e5fffd249ae7adfcd650d3a
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());