From 3896cbb9ed6fa03d90a4032238dad7b2f39c607c Mon Sep 17 00:00:00 2001
From: “mitao” <“2763622819@qq.com”>
Date: 星期二, 24 三月 2026 20:23:55 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
xp-robotaxi-operation-boot/src/main/java/com/xiaopeng/operation/controller/XpTestPlanController.java | 194 ++++++++---------------------------------------
1 files changed, 35 insertions(+), 159 deletions(-)
diff --git a/xp-robotaxi-operation-boot/src/main/java/com/xiaopeng/operation/controller/XpTestPlanController.java b/xp-robotaxi-operation-boot/src/main/java/com/xiaopeng/operation/controller/XpTestPlanController.java
index c507328..69b3bda 100644
--- a/xp-robotaxi-operation-boot/src/main/java/com/xiaopeng/operation/controller/XpTestPlanController.java
+++ b/xp-robotaxi-operation-boot/src/main/java/com/xiaopeng/operation/controller/XpTestPlanController.java
@@ -1,15 +1,11 @@
package com.xiaopeng.operation.controller;
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.xiaopeng.api.dto.operation.CruisePointDto;
-import com.xiaopeng.api.dto.operation.NewCruiseOrderDto;
import com.xiaopeng.api.feignClient.vehicleConvoy.XpVehicleClient;
import com.xiaopeng.api.model.operation.XpTestPlan;
import com.xiaopeng.api.model.operation.XpTestPlanPoint;
import com.xiaopeng.api.model.operation.XpTestPlanVehicle;
import com.xiaopeng.api.model.operation.XpTestPoint;
-import com.xiaopeng.api.model.order.XpCruiseOrder;
import com.xiaopeng.common.core.domain.R;
import com.xiaopeng.common.core.web.page.PageInfo;
import com.xiaopeng.operation.dto.XpTestPlanAddDTO;
@@ -24,14 +20,11 @@
import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
import org.springframework.context.annotation.Lazy;
-import org.springframework.data.mongodb.core.geo.GeoJsonPoint;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.List;
-import java.util.Objects;
-import java.util.stream.Collectors;
/**
* <p>
@@ -46,10 +39,12 @@
@RequiredArgsConstructor(onConstructor_ = @Lazy)
public class XpTestPlanController {
private final IXpTestPlanService xpTestPlanService;
- private final IXpTestPlanVehicleService xpTestPlanVehicleService;
- private final IXpTestPlanPointService xpTestPlanPointService;
- private final XpTestPointService testPointService;
private final XpVehicleClient xpVehicleClient;
+ private final IXpTestPlanPointService xpTestPlanPointService;
+ private final XpTestPointService xpTestPointService;
+ private final IXpTestPlanVehicleService xpTestPlanVehicleService;
+
+
@ApiOperation(value = "获取测试计划分页列表", tags = {"管理后台-测试计划"})
@PostMapping(value = {"/api/v1/xp-test-plan/pageList"})
@@ -86,172 +81,53 @@
/**
- * 获取车辆下个点位
+ * 根据id获取测试计划
+ * @param id
* @return
*/
- @PostMapping("/inner/cruise/getCruisePoint")
- public R<XpTestOrder> getCruisePoint(@RequestBody CruisePointDto dto) {
- // 先找计划
- XpTestPlanVehicle plan = xpTestPlanVehicleService.getOne(new LambdaQueryWrapper<XpTestPlanVehicle>().eq(XpTestPlanVehicle::getVehicleId, dto.getVehicleId()));
- if (plan == null) {
- return R.fail("没有找到对应的计划");
- }
- // 找对应的多个点位
- List<XpTestPlanPoint> planPointList = xpTestPlanPointService.list(new LambdaQueryWrapper<XpTestPlanPoint>().eq(XpTestPlanPoint::getTestPlanId, plan.getTestPlanId()).orderByAsc(XpTestPlanPoint::getSortOrder));
- // 找到现在这个点位
- // 根据dto的pointId 是第几个
- int index = 0;
- for (int i = 0; i < planPointList.size(); i++) {
- if (planPointList.get(i).getTestPointId().equals(dto.getPointId())) {
- index = i;
- break;
- }
- }
- XpCruiseOrder newXpCruiseOrder = dto.getNewXpCruiseOrder();
- XpTestPlanPoint xpCruisePlanPoint = null;
- // 判断是否是最后一个 是则往前一个 否找下一个
- if (index == planPointList.size() - 1) {
- // 最后一个 找上一个
- xpCruisePlanPoint = planPointList.get(index - 1);
- newXpCruiseOrder.setOrderReverse(2);
- } else if (index == 0) {
- // 第一个 找下一个
- xpCruisePlanPoint = planPointList.get(index + 1);
- newXpCruiseOrder.setOrderReverse(1);
- } else {
- // 中间点位
- if (dto.getOrderReverse() == 1) {
- // 正向 找下一个
- xpCruisePlanPoint = planPointList.get(index + 1);
- newXpCruiseOrder.setOrderReverse(1);
- } else {
- // 反向找上一个
- xpCruisePlanPoint = planPointList.get(index - 1);
- newXpCruiseOrder.setOrderReverse(2);
- }
- }
- Long pointId = xpCruisePlanPoint.getTestPointId();
- XpTestPoint point = testPointService.getById(pointId);
-
- newXpCruiseOrder.setEndPointId(pointId);
- newXpCruiseOrder.setEndPointName(point.getPointName());
- newXpCruiseOrder.setEndLon(point.getPointLon());
- newXpCruiseOrder.setEndLat(point.getPointLat());
- newXpCruiseOrder.setMissionId(xpCruisePlanPoint.getTestPlanId());
-
-
- return R.ok(newXpCruiseOrder);
- }
-
- /**
- * 获取测试计划
- * @param vehicleId
- * @return
- */
- @PostMapping("/inner/cruise/getCruisePlan")
- public R<XpTestPlanVehicle> getCruisePlan(@RequestParam Long vehicleId) {
- XpTestPlanVehicle plan = xpTestPlanVehicleService.getOne(new LambdaQueryWrapper<XpTestPlanVehicle>().eq(XpTestPlanVehicle::getVehicleId, vehicleId));
- return R.ok(plan);
- }
-
-
- /**
- * 获取测试计划点位列表
- * @param vehicleId
- * @return
- */
- @PostMapping("/inner/cruise/getCruisePlanPointList")
- public R<List<XpTestPlanPoint>> getCruisePlanPointList(@RequestParam Long vehicleId) {
- // 先找计划
- XpTestPlanVehicle plan = xpTestPlanVehicleService.getOne(new LambdaQueryWrapper<XpTestPlanVehicle>().eq(XpTestPlanVehicle::getVehicleId, vehicleId));
- // 找对应的多个点位
- List<XpTestPlanPoint> planPointList = xpTestPlanPointService.list(new LambdaQueryWrapper<XpTestPlanPoint>().eq(XpTestPlanPoint::getTestPlanId, plan.getTestPlanId()).orderByAsc(XpTestPlanPoint::getSortOrder));
- return R.ok(planPointList);
+ @PostMapping("/inner/v1/xp-test-plan/getXpTestPlanById")
+ public R<XpTestPlan> getXpTestPlanById(@RequestParam Long id){
+ XpTestPlan xpTestPlan = xpTestPlanService.getById(id);
+ return R.ok(xpTestPlan);
}
-
/**
- * 获取测试订单数据
+ * 根据id获取测试计划点
+ * @param id
* @return
*/
- @PostMapping("/inner/cruise/getNewCruiseOrder")
- public R<XpCruiseOrder> getNewCruiseOrder(@RequestBody NewCruiseOrderDto dto) {
-
- // 先找计划
- XpTestPlanVehicle plan = xpTestPlanVehicleService.getOne(new LambdaQueryWrapper<XpTestPlanVehicle>().eq(XpTestPlanVehicle::getVehicleId, dto.getVehicleId()));
- // 找对应的多个点位
- List<XpTestPlanPoint> planPointList = xpTestPlanPointService.list(new LambdaQueryWrapper<XpTestPlanPoint>().eq(XpTestPlanPoint::getTestPlanId, plan.getTestPlanId()).orderByAsc(XpTestPlanPoint::getSortOrder));
+ @PostMapping("/inner/v1/xp-test-plan/getXpTestPlanPointById")
+ public R<XpTestPlanPoint> getXpTestPlanPointById(@RequestParam Long id){
+ XpTestPlanPoint xpTestPlanPoint = xpTestPlanPointService.getById(id);
+ return R.ok(xpTestPlanPoint);
+ }
- XpCruiseOrder newXpCruiseOrder = new XpCruiseOrder();
- newXpCruiseOrder.setFleetId(dto.getFleetId());
- newXpCruiseOrder.setVehicleId(dto.getVehicleId());
- newXpCruiseOrder.setVehicleVin(dto.getVehicleVin());
- newXpCruiseOrder.setOrderType(1);
- newXpCruiseOrder.setMissionId(plan.getTestPlanId());
- newXpCruiseOrder.setStatus(1);
- newXpCruiseOrder.setOrderReverse(1);
- GeoJsonPoint point = dto.getPoint();
-
- // 起点
- newXpCruiseOrder.setStartLon(point.getX());
- newXpCruiseOrder.setStartLat(point.getY());
-
- // 终点
- XpTestPlanPoint endCruisePlanPoint = planPointList.get(0);
- Long endPointId = endCruisePlanPoint.getPointId();
- XpTestPoint endPoint = testPointService.getById(endPointId);
- newXpCruiseOrder.setEndPointId(endPointId);
- newXpCruiseOrder.setEndPointName(endPoint.getPointName());
- newXpCruiseOrder.setEndLon(endPoint.getPointLon());
- newXpCruiseOrder.setEndLat(endPoint.getPointLat());
-
-
-
- return R.ok(newXpCruiseOrder);
+ /**
+ * 根据id获取测试计划点位
+ * @param id
+ * @return
+ */
+ @PostMapping("/inner/v1/xp-test-plan/getXpTestPointById")
+ public R<XpTestPoint> getXpTestPointById(@RequestParam Long id){
+ XpTestPoint xpTestPoint = xpTestPointService.getById(id);
+ return R.ok(xpTestPoint);
}
/**
- * 获取车辆返回点位
- * @param xpCruiseOrder
+ * 根据测试计划获取车辆信息
+ * @param testPlanId
* @return
*/
- @PostMapping("/inner/cruise/findReturnCruisePoint")
- public R<XpCruiseOrder> findReturnCruisePoint(@RequestBody XpCruiseOrder xpCruiseOrder) {
- // 先找计划
- XpTestPlanVehicle plan = xpTestPlanVehicleService.getOne(new LambdaQueryWrapper<XpTestPlanVehicle>().eq(XpTestPlanVehicle::getVehicleId, xpCruiseOrder.getVehicleId()));
- // 找对应的多个点位
- List<XpTestPlanPoint> planPointList = xpTestPlanPointService.list(new LambdaQueryWrapper<XpTestPlanPoint>().eq(XpTestPlanPoint::getTestPlanId, plan.getTestPlanId()).orderByAsc(XpTestPlanPoint::getSortOrder));
-
- XpTestPoint xpPoint = testPointService.list(new LambdaQueryWrapper<XpTestPoint>().eq(XpTestPoint::getParkingPoint, 1).in(XpTestPoint::getId, planPointList.stream().map(XpTestPlanPoint::getPointId).collect(Collectors.toList()))).get(0);
- xpCruiseOrder.setEndPointId(xpPoint.getId());
- xpCruiseOrder.setEndPointName(xpPoint.getPointName());
- xpCruiseOrder.setEndLon(xpPoint.getPointLon());
- xpCruiseOrder.setEndLat(xpPoint.getPointLat());
- xpCruiseOrder.setMissionId(plan.getTestPlanId());
- return R.ok(xpCruiseOrder);
- }
-
- /**
- * 判断点位ID列表是否存在关联的测试计划点位(内部接口)
- */
- @PostMapping("/inner/cruise/existsCruisePlanPointByPointIds")
- public R<Boolean> existsCruisePlanPointByPointIds(@RequestBody List<Long> pointIds) {
- List<Long> distinctPointIds = pointIds == null
- ? java.util.Collections.emptyList()
- : pointIds.stream().filter(Objects::nonNull).distinct().collect(Collectors.toList());
- if (distinctPointIds.isEmpty()) {
- return R.ok(Boolean.FALSE);
- }
- XpTestPlanPoint exists = xpTestPlanPointService.getOne(
- new LambdaQueryWrapper<XpTestPlanPoint>()
- .in(XpTestPlanPoint::getPointId, distinctPointIds)
- .last("limit 1")
- );
- return R.ok(exists != null);
+ @PostMapping("/inner/v1/xp-test-plan/getXpTestPlanVehicleByTestPlanId")
+ public R<List<XpTestPlanVehicle>> getXpTestPlanVehicleByTestPlanId(@RequestParam Long testPlanId){
+ List<XpTestPlanVehicle> xpTestPlanVehicleList = xpTestPlanVehicleService.lambdaQuery()
+ .eq(XpTestPlanVehicle::getTestPlanId, testPlanId)
+ .list();
+ return R.ok(xpTestPlanVehicleList);
}
}
--
Gitblit v1.7.1