...
|
...
|
@@ -9,13 +9,15 @@ 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.http.HttpStatus;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import java.util.Date;
|
|
|
|
|
|
/**
|
|
|
* @author 子诚
|
|
|
* Description:
|
|
|
* Description:车辆信息管理.
|
|
|
* 时间:2020/4/24 17:03
|
|
|
*/
|
|
|
@CrossOrigin
|
...
|
...
|
@@ -23,9 +25,20 @@ import java.util.Date; |
|
|
@RequestMapping("dispatch/vehicleInfo")
|
|
|
@RestController
|
|
|
public class VehicleInfoController {
|
|
|
@Autowired
|
|
|
@Resource
|
|
|
private VehicleInfoService vehicleInfoService;
|
|
|
|
|
|
/**
|
|
|
* 分页获取车辆列表.
|
|
|
*
|
|
|
* @param vehicleStatus 车辆状态
|
|
|
* @param vehicleType 车辆类型
|
|
|
* @param licensePlateNumber 车牌号码
|
|
|
* @param vehicleCompany 车辆所属公司
|
|
|
* @param pageNum 当前页数
|
|
|
* @param pageSize 每页数量
|
|
|
* @return 成功返回查询列表
|
|
|
*/
|
|
|
@ApiOperation("获取车辆列表")
|
|
|
@GetMapping("/selectVehicleInfoList")
|
|
|
public ResultJson<PageInfo> selectVehicleInfoList(
|
...
|
...
|
@@ -65,11 +78,17 @@ public class VehicleInfoController { |
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 增加
|
|
|
* 添加车辆信息.
|
|
|
*
|
|
|
* @param vehicleInfo {@link VehicleInfo}
|
|
|
* @return
|
|
|
*/
|
|
|
@ApiOperation("添加车辆信息")
|
|
|
@PostMapping("/insertVehicleInfo")
|
|
|
public ResultJson insertVehicleInfo(@RequestBody VehicleInfo vehicleInfo) {
|
|
|
String message = validateVehicle(vehicleInfo);
|
|
|
//验证通过
|
|
|
if (message == null) {
|
|
|
ResultJson result = new ResultJson<>();
|
|
|
//设置车辆id,(uuid)
|
|
|
vehicleInfo.setId(GetUUID.getuuid());
|
...
|
...
|
@@ -87,9 +106,14 @@ public class VehicleInfoController { |
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
return new ResultJson("406", message != null ? message : "添加车辆信息,失败!");
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 修改
|
|
|
* 修改车辆信息.
|
|
|
*
|
|
|
* @param vehicleInfo {@link VehicleInfo}
|
|
|
* @return
|
|
|
*/
|
|
|
@ApiOperation("修改车辆信息")
|
|
|
@PutMapping("/updateVehicleInfo")
|
...
|
...
|
@@ -106,7 +130,12 @@ public class VehicleInfoController { |
|
|
return result;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 删除车辆信息.
|
|
|
*
|
|
|
* @param vehicleInfo {@link VehicleInfo}
|
|
|
* @return
|
|
|
*/
|
|
|
@ApiOperation("删除车辆信息")
|
|
|
@DeleteMapping("/deleteVehicleInfo")
|
|
|
public ResultJson deleteVehicleInfo(@RequestBody VehicleInfo vehicleInfo) {
|
...
|
...
|
@@ -122,6 +151,12 @@ public class VehicleInfoController { |
|
|
return result;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 批量删除车辆信息.
|
|
|
*
|
|
|
* @param ids 所要删除的id以','相连接的字符串
|
|
|
* @return
|
|
|
*/
|
|
|
@ApiOperation("批量删除车辆信息")
|
|
|
@GetMapping("/batchRemove")
|
|
|
public ResultJson batchRemoveVehicleInfo(String ids) {
|
...
|
...
|
@@ -136,4 +171,18 @@ public class VehicleInfoController { |
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 验证新增车辆信息
|
|
|
*
|
|
|
* @param vehicleInfo {@link VehicleInfo}
|
|
|
* @return 错误信息
|
|
|
*/
|
|
|
private String validateVehicle(VehicleInfo vehicleInfo) {
|
|
|
VehicleInfo info = vehicleInfoService.selectByLPN(vehicleInfo.getLicensePlateNumber());
|
|
|
if (info != null) {
|
|
|
return "车牌号已存在,请谨慎输入";
|
|
|
}
|
|
|
return null;
|
|
|
}
|
|
|
} |
...
|
...
|
|