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(""));
|
}
|
}
|