package com.xiaopeng.operation.controller; import com.xiaopeng.api.feignClient.operation.XpTestPointClient; import com.xiaopeng.api.feignClient.vehicleConvoy.XpVehicleClient; import com.xiaopeng.api.model.map.XpTestPoint; import com.xiaopeng.api.model.operation.XpTestPlan; import com.xiaopeng.api.model.operation.XpTestPlanPoint; import com.xiaopeng.api.model.operation.XpTestPlanVehicle; import com.xiaopeng.common.core.domain.R; import com.xiaopeng.common.core.web.page.PageInfo; import com.xiaopeng.operation.dto.XpTestPlanAddDTO; import com.xiaopeng.operation.dto.XpTestPlanEditDTO; import com.xiaopeng.operation.query.TestPlanQuery; import com.xiaopeng.operation.service.IXpTestPlanPointService; import com.xiaopeng.operation.service.IXpTestPlanService; import com.xiaopeng.operation.service.IXpTestPlanVehicleService; import com.xiaopeng.operation.vo.XpTestPlanDetailVO; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import lombok.RequiredArgsConstructor; import org.springframework.context.annotation.Lazy; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import javax.validation.Valid; import java.util.List; /** *

* 测试计划 前端控制器 *

* * @author mitao * @since 2026-02-26 */ @Validated @RestController @RequiredArgsConstructor(onConstructor_ = @Lazy) public class XpTestPlanController { private final IXpTestPlanService xpTestPlanService; private final XpVehicleClient xpVehicleClient; private final IXpTestPlanPointService xpTestPlanPointService; private final XpTestPointClient xpTestPointService; private final IXpTestPlanVehicleService xpTestPlanVehicleService; @ApiOperation(value = "获取测试计划分页列表", tags = {"管理后台-测试计划"}) @PostMapping(value = {"/api/v1/xp-test-plan/pageList"}) public R> getPageList(@RequestBody TestPlanQuery query) { return R.ok(xpTestPlanService.getPageList(query)); } @ApiOperation(value = "新增测试计划", tags = {"管理后台-测试计划"}) @PostMapping(value = {"/api/v1/xp-test-plan/add"}) public R add(@Valid @RequestBody XpTestPlanAddDTO dto) { xpTestPlanService.add(dto); return R.ok(); } @ApiOperation(value = "编辑测试计划", tags = {"管理后台-测试计划"}) @PostMapping(value = {"/api/v1/xp-test-plan/edit"}) public R edit(@Valid @RequestBody XpTestPlanEditDTO dto) { xpTestPlanService.edit(dto); return R.ok(); } @ApiOperation(value = "删除测试计划", tags = {"管理后台-测试计划"}) @DeleteMapping(value = {"/api/v1/xp-test-plan/deleteById/{id}"}) public R deleteById(@ApiParam(name = "id", value = "测试计划ID") @PathVariable Long id) { xpTestPlanService.deleteById(id); return R.ok(); } @ApiOperation(value = "测试计划详情", tags = {"管理后台-测试计划"}) @GetMapping(value = {"/api/v1/xp-test-plan/detail"}) public R detail(@ApiParam(name = "id", value = "测试计划ID") @RequestParam Long id) { return R.ok(xpTestPlanService.detail(id)); } /** * 根据id获取测试计划 * @param id * @return */ @PostMapping("/inner/v1/xp-test-plan/getXpTestPlanById") public R getXpTestPlanById(@RequestParam Long id){ XpTestPlan xpTestPlan = xpTestPlanService.getById(id); return R.ok(xpTestPlan); } /** * 根据id获取测试计划点 * @param id * @return */ @PostMapping("/inner/v1/xp-test-plan/getXpTestPlanPointById") public R getXpTestPlanPointById(@RequestParam Long id){ XpTestPlanPoint xpTestPlanPoint = xpTestPlanPointService.getById(id); return R.ok(xpTestPlanPoint); } /** * 根据id获取测试计划点位 * @param id * @return */ @PostMapping("/inner/v1/xp-test-plan/getXpTestPointById") public R getXpTestPointById(@RequestParam Long id){ XpTestPoint xpTestPoint = xpTestPointService.queryById(id).getData(); return R.ok(xpTestPoint); } /** * 根据测试计划获取车辆信息 * @param testPlanId * @return */ @PostMapping("/inner/v1/xp-test-plan/getXpTestPlanVehicleByTestPlanId") public R> getXpTestPlanVehicleByTestPlanId(@RequestParam Long testPlanId){ List xpTestPlanVehicleList = xpTestPlanVehicleService.lambdaQuery() .eq(XpTestPlanVehicle::getTestPlanId, testPlanId) .list(); return R.ok(xpTestPlanVehicleList); } }