liding
3 天以前 7f9e375391e30fd3c367cb5a080a609a6e25e524
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
package com.zbkj.admin.controller;
 
import cn.hutool.core.date.DateTime;
import com.zbkj.common.annotation.Loggable;
import com.zbkj.common.exception.ExceptionCodeEnum;
import com.zbkj.common.page.CommonPage;
import com.zbkj.common.request.AddEbVehicleInfoListReq;
import com.zbkj.common.request.AddEbVehicleInfoReq;
import com.zbkj.common.request.EditEbVehicleInfoReq;
import com.zbkj.common.request.PageEbVehicleInfoReq;
import com.zbkj.common.response.*;
import com.zbkj.admin.service.EbVehicleInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
 
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.List;
import java.util.UUID;
 
@RestController
@RequestMapping("/api/admin/vehicle")
@Api(tags = "车辆信息登记")
public class EbVehicleInfoController {
 
    @Autowired
    private EbVehicleInfoService ebVehicleInfoService;
 
 
    /**
     * @Description:分页查询车辆信息
     * @author:chenbing
     * @date 2025/7/3 10:31
     */
    @Loggable(value = "分页查询车辆信息", trackParams = true)
    @PreAuthorize("hasAuthority('admin:vehicle:page')")
    @ApiOperation(value = "分页查询车辆信息")
    @PostMapping(value = "/page")
    public CommonResult<CommonPage<PageEbVehicleInfoRep>> page(@RequestBody PageEbVehicleInfoReq request) {
        return CommonResult.success(CommonPage.restPage(ebVehicleInfoService.getPage(request)));
    }
 
    /**
     * @Description:获取关联关系ID
     * @author:chenbing
     * @date 2025/8/5 17:02
     */
    @ApiOperation(value = "获取关联关系ID")
    @GetMapping(value = "/master")
    public CommonResult<String> generate() {
        final String masterId = UUID.randomUUID().toString().replace("-", "");
        return CommonResult.success(masterId, ExceptionCodeEnum.SUCCESS.getMessage());
    }
 
 
    /**
     * @Description:添加车辆信息
     * @author:chenbing
     * @date 2025/7/3 9:55
     */
    @Loggable(value = "添加车辆信息", trackParams = true)
    @PreAuthorize("hasAuthority('admin:vehicle:add')")
    @ApiOperation(value = "添加车辆信息")
    @PostMapping(value = "/add")
    public CommonResult<List<EbVehicleInfoRep>> add(@RequestBody AddEbVehicleInfoListReq request) {
        return CommonResult.success(ebVehicleInfoService.add(request));
    }
 
    /**
     * @Description:删除车辆信息
     * @author:chenbing
     * @date 2025/7/3 10:46
     */
    @Loggable(value = "删除车辆信息", trackParams = true)
    @PreAuthorize("hasAuthority('admin:vehicle:delete')")
    @ApiOperation(value = "删除车辆信息")
    @PostMapping(value = "/delete")
    public CommonResult<String> delete(@RequestParam(value = "masterId") String masterId) {
        if (ebVehicleInfoService.delete(masterId)) {
            return CommonResult.success();
        }
        return CommonResult.failed();
    }
 
    /**
     * @Description:修改车辆信息
     * @author:chenbing
     * @date 2025/7/3 10:49
     */
    @Loggable(value = "编辑车辆信息", trackParams = true)
    @PreAuthorize("hasAuthority('admin:vehicle:edit')")
    @ApiOperation(value = "修改车辆信息")
    @PostMapping(value = "/edit")
    public CommonResult<String> edit(@RequestBody EditEbVehicleInfoReq request) {
        if (ebVehicleInfoService.edit(request)) {
            return CommonResult.success();
        }
        return CommonResult.failed();
    }
 
    /**
     * @Description:根据身份证号获取最近的一条车辆信息数据
     * @author:chenbing
     * @date 2025/7/7 16:53
     */
    @ApiOperation(value = "根据身份证号获取最近的一条车辆信息数据")
    @GetMapping(value = "/getVehicleInfoByCard")
    public CommonResult<PageEbVehicleInfoRep> getVehicleInfoByCard(
            @ApiParam(value = "身份证号")
            @RequestParam(value = "card") String card
    ) {
        return CommonResult.success(ebVehicleInfoService.getVehicleInfoByCard(card));
    }
 
    /**
     * @Description:排队叫号列表
     * @author:chenbing
     * @date 2025/7/3 13:13
     */
    @Loggable(value = "排队叫号列表", trackParams = true)
    @PreAuthorize("hasAuthority('admin:vehicle:queue')")
    @ApiOperation(value = "排队叫号列表")
    @GetMapping(value = "/queue")
    public CommonResult<CommonPage<PageEbVehicleInfoRep>> queueList(
            @ApiParam(value = "厂区ID")
            @RequestParam(value = "areaId") Integer areaId,
            @RequestParam(value = "queueNumber", required = false) Integer queueNumber,
            @RequestParam(value = "phone", required = false) String phone,
            @RequestParam(value = "page", defaultValue = "1") Integer page,
            @RequestParam(value = "limit", defaultValue = "10") Integer limit
    ) {
        return CommonResult.success(CommonPage.restPage(ebVehicleInfoService.queueList(areaId, queueNumber, phone, page, limit)));
    }
 
    /**
     * @Description:根据厂区ID统计车辆信息数据
     * @author:chenbing
     * @date 2025/7/3 13:29
     */
    @Loggable(value = "根据厂区ID统计车辆信息数据", trackParams = true)
//    @PreAuthorize("hasAuthority('admin:vehicle:statistics')")
    @ApiOperation(value = "根据厂区ID统计车辆信息数据")
    @GetMapping(value = "/statistics")
    public CommonResult<VehicleInfoStatistics> statistics(@RequestParam(value = "areaId") Integer areaId) {
        return CommonResult.success(ebVehicleInfoService.statistics(areaId));
    }
 
    /**
     * @Description:调整排序
     * @author:chenbing
     * @date 2025/7/3 14:11
     */
    @Loggable(value = "调整排序", trackParams = true)
    @PreAuthorize("hasAuthority('admin:vehicle:sort')")
    @ApiOperation(value = "调整排序")
    @PutMapping(value = "/sort/{vehicleId}/{sort}")
    public CommonResult<String> sort(@PathVariable(value = "vehicleId") String vehicleId, @PathVariable(value = "sort") Integer sort) {
        if (ebVehicleInfoService.sort(vehicleId, sort)) {
            return CommonResult.success();
        }
        return CommonResult.failed();
    }
 
    /**
     * @Description:手动叫号
     * @author:chenbing
     * @date 2025/7/3 14:15
     */
    @Loggable(value = "手动叫号", trackParams = true)
    @PreAuthorize("hasAuthority('admin:vehicle:call')")
    @ApiOperation(value = "手动叫号")
    @PutMapping(value = "/call/number/{vehicleId}")
    public CommonResult<String> callNumber(@PathVariable(value = "vehicleId") String vehicleId) {
        if (ebVehicleInfoService.callNumber(vehicleId)) {
            return CommonResult.success();
        }
        return CommonResult.failed();
    }
 
    // 不是已叫号的状态,提示当前车辆未叫号
 
    /**
     * @Description:发送短信提醒
     * @author:chenbing
     * @date 2025/8/4 18:26
     */
    @ApiOperation(value = "发送短信提醒")
    @PostMapping(value = "/sendSms/{vehicleId}")
    public CommonResult<String> sendSms(@PathVariable(value = "vehicleId") String vehicleId) {
        if (ebVehicleInfoService.sendSms(vehicleId)) {
            return CommonResult.success();
        }
        return CommonResult.failed();
    }
 
    /**
     * @Description:标记为已过号
     * @author:chenbing
     * @date 2025/7/3 14:16
     */
    @Loggable(value = "标记为已过号", trackParams = true)
    @PreAuthorize("hasAuthority('admin:vehicle:pass')")
    @ApiOperation(value = "标记为已过号")
    @PutMapping(value = "/pass/number/{masterId}")
    public CommonResult<String> passNumber(@PathVariable(value = "masterId") String masterId) {
        if (ebVehicleInfoService.passNumber(masterId)) {
            return CommonResult.success();
        }
        return CommonResult.failed();
    }
 
    /**
     * @Description:重新排队
     * @author:chenbing
     * @date 2025/7/3 14:18
     */
    @Loggable(value = "重新排队", trackParams = true)
    @PreAuthorize("hasAuthority('admin:vehicle:reQueue')")
    @ApiOperation(value = "重新排队")
    @PutMapping(value = "/reQueue/{masterId}/{sort}")
    public CommonResult<String> reQueue(@PathVariable(value = "masterId") String masterId, @PathVariable(value = "sort") Integer sort) {
        if (ebVehicleInfoService.reQueue(masterId, sort)) {
            return CommonResult.success();
        }
        return CommonResult.failed();
    }
 
    /**
     * @Description:根据车辆ID查询车辆信息
     * @author:chenbing
     * @date 2025/7/3 14:28
     */
    @ApiOperation(value = "司机端-司机扫码查询")
    @GetMapping(value = "/drivers/info")
    public CommonResult<EbVehicleInfoRep> driversInfoByVehicleId(
            @ApiParam(value = "车辆信息ID")
            @RequestParam(value = "vehicleId", required = false) String vehicleId,
            @ApiParam(value = "排队号码")
            @RequestParam(value = "queueNumber", required = false) Integer queueNumber,
            @ApiParam(value = "链接CODE")
            @RequestParam(value = "linkCode", required = false) String linkCode,
            HttpServletRequest httpServletRequest
    ) {
        return CommonResult.success(ebVehicleInfoService.getVehicleInfoById(vehicleId, queueNumber, linkCode, httpServletRequest, true));
    }
 
    /**
     * @Description:根据车辆ID查询车辆信息
     * @author:chenbing
     * @date 2025/7/3 14:28
     */
    @Loggable(value = "门卫端-获取车辆信息", trackParams = true)
//    @PreAuthorize("hasAuthority('admin:vehicle:info')")
    @ApiOperation(value = "门卫端-根据车辆信息ID查询车辆信息")
    @GetMapping(value = "/getVehicleInfoById")
    public CommonResult<EbVehicleInfoRep> getVehicleInfoById(
            @ApiParam(value = "车辆信息ID")
            @RequestParam(value = "vehicleId", required = false) String vehicleId,
            @ApiParam(value = "排队号码")
            @RequestParam(value = "queueNumber", required = false) Integer queueNumber,
            @ApiParam(value = "链接CODE")
            @RequestParam(value = "linkCode", required = false) String linkCode,
            HttpServletRequest httpServletRequest
    ) {
        return CommonResult.success(ebVehicleInfoService.getVehicleInfoById(vehicleId, queueNumber, linkCode, httpServletRequest, false));
    }
 
    /**
     * @Description:打印时获取车辆排队信息
     * @author:chenbing
     * @date 2025/7/23 13:16
     */
    @ApiOperation(value = "打印时获取车辆排队信息")
    @GetMapping(value = "/info")
    public CommonResult<EbVehicleInfoRep> getVehicleInfo(
            @ApiParam(value = "车辆信息ID")
            @RequestParam(value = "vehicleId", required = false) String vehicleId,
            @ApiParam(value = "排队号码")
            @RequestParam(value = "queueNumber", required = false) Integer queueNumber,
            @ApiParam(value = "链接CODE")
            @RequestParam(value = "linkCode", required = false) String linkCode,
            HttpServletRequest httpServletRequest
    ) {
        return CommonResult.success(ebVehicleInfoService.getVehicleInfoById(vehicleId, queueNumber, linkCode, httpServletRequest, true));
    }
 
    /**
     * @Description:门卫-车辆入厂核销
     * @author:chenbing
     * @date 2025/7/3 14:51
     */
//    @PreAuthorize("hasAuthority('admin:vehicle:in')")
    @Loggable(value = "车辆入厂核销", trackParams = true)
    @ApiOperation(value = "门卫-车辆入厂核销")
    @PostMapping(value = "/vehicleIn")
    public CommonResult<String> vehicleIn(
            @ApiParam(value = "关联关系ID")
            @RequestParam(value = "masterId") String masterId,
            HttpServletRequest httpServletRequest
    ) {
        if (ebVehicleInfoService.vehicleIn(masterId, httpServletRequest)) {
            return CommonResult.success();
        }
        return CommonResult.failed();
    }
 
    /**
     * @Description:获取登记时间的起始时间
     * @author:chenbing
     * @date 2025/7/18 15:39
     */
    @ApiOperation(value = "获取登记时间的起始时间")
    @GetMapping(value = "/time")
    public CommonResult<HashMap<String, DateTime>> getRegisterTimeStart() {
        return CommonResult.success(ebVehicleInfoService.getSystemConfigTime(null));
    }
 
 
    /**
     * @Description:门卫-车辆离厂核销
     * @author:chenbing
     * @date 2025/7/3 14:51
     */
//    @PreAuthorize("hasAuthority('admin:vehicle:out')")
    @Loggable(value = "车辆离厂核销", trackParams = true)
    @ApiOperation(value = "门卫-车辆离厂核销")
    @PostMapping(value = "/vehicleOut")
    public CommonResult<String> vehicleOut(
            @ApiParam(value = "关联关系ID")
            @RequestParam(value = "masterId") String masterId,
            HttpServletRequest httpServletRequest
    ) {
        if (ebVehicleInfoService.vehicleOut(masterId, httpServletRequest)) {
            return CommonResult.success();
        }
        return CommonResult.failed();
    }
 
    @ApiOperation(value = "大屏")
    @GetMapping(value = "/screen")
    public CommonResult<Object> screen() {
        return CommonResult.success(ebVehicleInfoService.screen(""));
    }
}