puzhibing
2026-02-13 40c97867e634b0c4949dfd964bf06da35fc4bd88
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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
package com.xiaopeng.vehicleConvoy.controller;
 
import com.xiaopeng.api.model.vehicleConvoy.XpFleet;
import com.xiaopeng.common.core.domain.R;
import com.xiaopeng.common.core.web.page.PageInfo;
import com.xiaopeng.vehicleConvoy.model.dto.FleetAddDTO;
import com.xiaopeng.vehicleConvoy.model.dto.FleetEditDTO;
import com.xiaopeng.vehicleConvoy.model.query.FleetPageQuery;
import com.xiaopeng.vehicleConvoy.model.query.FleetUserPageQuery;
import com.xiaopeng.vehicleConvoy.model.query.FleetVehiclePageQuery;
import com.xiaopeng.vehicleConvoy.model.vo.*;
import com.xiaopeng.vehicleConvoy.service.IXpFleetService;
import io.swagger.annotations.*;
import lombok.RequiredArgsConstructor;
import org.springframework.context.annotation.Lazy;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*;
 
import javax.validation.Valid;
import java.util.ArrayList;
import java.util.List;
 
/**
 * <p>
 * 车队管理 前端控制器
 * </p>
 *
 * @author mitao
 * @since 2026-02-03
 */
@Api(tags = "车队管理")
@RequiredArgsConstructor(onConstructor_ = @Lazy)
@RestController
public class XpFleetController {
 
    private final IXpFleetService xpFleetService;
 
    /**
     * 根据ID列表批量查询车队信息(内部接口)
     *
     * @param ids 车队ID列表
     * @return 车队列表
     */
    @ApiOperation(value = "批量查询车队信息", tags = {"内部接口"})
    @PostMapping("/inner/fleet/listByIds")
    public R<List<XpFleet>> listByIds(@RequestBody List<Long> ids) {
        if (CollectionUtils.isEmpty(ids)) {
            return R.ok(new ArrayList<>());
        }
        return R.ok(xpFleetService.listByIds(ids));
    }
 
    /**
     * 添加车队
     *
     * @param dto 添加车队DTO
     * @return 操作结果
     */
    @ApiOperation(value = "添加车队", tags = {"管理后台-车队管理"}, notes = "打卡地列表接口在xp-robotaxi-maintenance-boot,人员列表在xp-robotaxi-account-boot")
    @PostMapping("/api/v1/fleet/add")
    public R<Void> add(@Valid @RequestBody FleetAddDTO dto) {
        return xpFleetService.add(dto);
    }
 
    /**
     * 编辑车队
     *
     * @param dto 编辑车队DTO
     * @return 操作结果
     */
    @ApiOperation(value = "编辑车队", tags = {"管理后台-车队管理"}, notes = "打卡地列表接口在xp-robotaxi-maintenance-boot,人员列表在xp-robotaxi-account-boot")
    @PostMapping("/api/v1/fleet/edit")
    public R<Void> edit(@Valid @RequestBody FleetEditDTO dto) {
        return xpFleetService.edit(dto);
    }
 
    /**
     * 查询车队详情
     *
     * @param id 车队id
     * @return 车队详情
     */
    @ApiOperation(value = "查询车队详情", tags = {"管理后台-车队管理"})
    @GetMapping("/api/v1/fleet/queryById")
    public R<FleetDetailVO> queryById(@RequestParam Long id) {
        return xpFleetService.queryById(id);
    }
 
    /**
     * 车队分页列表
     *
     * @param query 查询参数
     * @return 分页结果
     */
    @ApiOperation(value = "车队分页列表", tags = {"管理后台-车队管理"})
    @PostMapping("/api/v1/fleet/pageList")
    public R<PageInfo<FleetPageVO>> pageList(@Valid @RequestBody FleetPageQuery query) {
        return xpFleetService.pageList(query);
    }
 
    /**
     * 查询车队车辆分页列表
     *
     * @param query 查询参数
     * @return 分页结果
     */
    @ApiOperation(value = "查询车队车辆分页列表", tags = {"管理后台-车队管理"})
    @PostMapping("/api/v1/fleet/queryVehiclePageList")
    public R<PageInfo<FleetVehicleVO>> queryVehiclePageList(@Valid @RequestBody FleetVehiclePageQuery query) {
        return xpFleetService.queryVehiclePageList(query);
    }
 
    /**
     * 查询车队人员分页列表
     *
     * @param query 查询参数
     * @return 分页结果
     */
    @ApiOperation(value = "查询车队人员分页列表", tags = {"管理后台-车队管理"})
    @PostMapping("/api/v1/fleet/queryUserPageList")
    public R<PageInfo<FleetUserVO>> queryUserPageList(@Valid @RequestBody FleetUserPageQuery query) {
        return xpFleetService.queryUserPageList(query);
    }
 
    @ApiOperation(value = "删除车队", tags = {"管理后台-车队管理"})
    @DeleteMapping("/api/v1/fleet/delete/{id}")
    public R<?> deleteById(@ApiParam(name = "id", value = "车队ID") @PathVariable Long id) {
        xpFleetService.deleteById(id);
        return R.ok();
    }
 
    @ApiOperation(value = "车队添加车辆成员", tags = {"管理后台-车队管理"})
    @PostMapping("/api/v1/fleet/vehicle/add")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "fleetId", value = "车队ID", dataTypeClass = Long.class),
            @ApiImplicitParam(name = "vehicleId", value = "车辆ID", dataTypeClass = Long.class)})
    public R<?> addVehicle(Long fleetId, Long vehicleId) {
        xpFleetService.addVehicle(fleetId, vehicleId);
        return R.ok();
    }
 
    @ApiOperation(value = "车队添加人员成员", tags = {"管理后台-车队管理"})
    @PostMapping("/api/v1/fleet/operation-user/add")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "fleetId", value = "车队ID", dataTypeClass = Long.class),
            @ApiImplicitParam(name = "operationUserId", value = "车辆ID", dataTypeClass = Long.class)})
    public R<?> addOperationUserId(Long fleetId, Long operationUserId) {
        xpFleetService.addOperationUserId(fleetId, operationUserId);
        return R.ok();
    }
 
    @ApiOperation(value = "车队删除车辆成员", tags = {"管理后台-车队管理"})
    @PostMapping("/api/v1/fleet/vehicle/remove")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "fleetId", value = "车队ID", dataTypeClass = Long.class, required = true),
            @ApiImplicitParam(name = "vehicleId", value = "车辆ID", dataTypeClass = Long.class, required = true)})
    public R<?> removeVehicle(Long fleetId, Long vehicleId) {
        xpFleetService.removeVehicle(fleetId, vehicleId);
        return R.ok();
    }
 
    @ApiOperation(value = "车队删除人员成员", tags = {"管理后台-车队管理"})
    @PostMapping("/api/v1/fleet/operation-user/remove")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "fleetId", value = "车队ID", dataTypeClass = Long.class, required = true),
            @ApiImplicitParam(name = "operationUserId", value = "人员ID", dataTypeClass = Long.class, required = true)})
    public R<?> removeOperationUser(Long fleetId, Long operationUserId) {
        xpFleetService.removeOperationUser(fleetId, operationUserId);
        return R.ok();
    }
 
}