xuhy
2026-04-19 73242feacea752b9efb8f294d3f85da26bcfdb7d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
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;
 
/**
 * <p>
 * 测试计划 前端控制器
 * </p>
 *
 * @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<PageInfo<XpTestPlan>> getPageList(@RequestBody TestPlanQuery query) {
        return R.ok(xpTestPlanService.getPageList(query));
    }
 
    @ApiOperation(value = "新增测试计划", tags = {"管理后台-测试计划"})
    @PostMapping(value = {"/api/v1/xp-test-plan/add"})
    public R<Long> add() {
        XpTestPlan plan = new XpTestPlan();
        xpTestPlanService.save(plan);
        return R.ok(plan.getId());
    }
 
    @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<XpTestPlanDetailVO> detail(@ApiParam(name = "id", value = "测试计划ID") @RequestParam Long id) {
        return R.ok(xpTestPlanService.detail(id));
    }
 
 
    /**
     * 根据id获取测试计划
     * @param id
     * @return
     */
    @PostMapping("/logan/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("/logan/inner/v1/xp-test-plan/getXpTestPlanPointById")
    public R<XpTestPlanPoint> getXpTestPlanPointById(@RequestParam Long id){
        XpTestPlanPoint xpTestPlanPoint = xpTestPlanPointService.getById(id);
        return R.ok(xpTestPlanPoint);
    }
 
 
 
    /**
     * 根据id获取测试计划点位
     * @param id
     * @return
     */
    @PostMapping("/logan/inner/v1/xp-test-plan/getXpTestPointById")
    public R<XpTestPoint> getXpTestPointById(@RequestParam Long id){
        XpTestPoint xpTestPoint = xpTestPointService.queryById(id).getData();
        return R.ok(xpTestPoint);
    }
 
 
    /**
     * 根据测试计划获取车辆信息
     * @param testPlanId
     * @return
     */
    @PostMapping("/logan/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);
    }
}