Commit d04f9cf8 by 杨林龙

新增设备验证接口

1 parent abcaa8c3
...@@ -326,6 +326,24 @@ public class VehicleController { ...@@ -326,6 +326,24 @@ public class VehicleController {
FileIOUtil.download(inputStream, FileIOUtil.MimeType.EXCEL2007, fileName, response); FileIOUtil.download(inputStream, FileIOUtil.MimeType.EXCEL2007, fileName, response);
} }
@ApiOperation(value = "验证试驾设备")
@SysLog(module = "车辆管理", value = "验证试驾设备", action = OperateType.QUERY)
@GetMapping("/vehicleinfo/verifydevice")
public R verifydevice(@RequestParam String sn) {
// 校验设备号是否存在
boolean snExist = deviceService.checkSnLocalAndRemote(sn);
if (!snExist) {
return R.error(1001, sn + "该设备不存在");
}
// 校验设备号是否已经绑定
boolean bindSn = deviceService.checkBindSn(sn);
if (!bindSn) {
return R.error(1001, sn + "该设备已经绑定");
}
return R.ok(sn + "设备验证通过");
}
@ApiOperation(value = "新增车辆信息") @ApiOperation(value = "新增车辆信息")
@SysLog(module = "车辆管理", value = "新增试驾车辆", action = OperateType.ADD) @SysLog(module = "车辆管理", value = "新增试驾车辆", action = OperateType.ADD)
@PostMapping("/vehicleinfo/add") @PostMapping("/vehicleinfo/add")
...@@ -341,7 +359,7 @@ public class VehicleController { ...@@ -341,7 +359,7 @@ public class VehicleController {
if (!snExist) { if (!snExist) {
noExistSnList.add(deviceInfoDto.getSn()); noExistSnList.add(deviceInfoDto.getSn());
} }
// 校验设备号是否存在 // 校验设备号是否已经绑定
boolean bindSn = deviceService.checkBindSn(deviceInfoDto.getSn()); boolean bindSn = deviceService.checkBindSn(deviceInfoDto.getSn());
if (!bindSn) { if (!bindSn) {
bindSnList.add(deviceInfoDto.getSn()); bindSnList.add(deviceInfoDto.getSn());
...@@ -377,7 +395,7 @@ public class VehicleController { ...@@ -377,7 +395,7 @@ public class VehicleController {
if (!snExist) { if (!snExist) {
noExistSnList.add(deviceInfoDto.getSn()); noExistSnList.add(deviceInfoDto.getSn());
} }
// 校验设备号是否存在 // 校验设备号是否已经绑定
boolean bindSn = deviceService.checkBindSn(deviceInfoDto.getSn()); boolean bindSn = deviceService.checkBindSn(deviceInfoDto.getSn());
if (!bindSn) { if (!bindSn) {
bindSnList.add(deviceInfoDto.getSn()); bindSnList.add(deviceInfoDto.getSn());
......
...@@ -163,6 +163,7 @@ public class DeviceService { ...@@ -163,6 +163,7 @@ public class DeviceService {
VehicleDevice param = new VehicleDevice(); VehicleDevice param = new VehicleDevice();
param.setSn(sn); param.setSn(sn);
param.setBindStatus(ConstantsDevice.BIND_VEHICLE_STATUS); param.setBindStatus(ConstantsDevice.BIND_VEHICLE_STATUS);
param.setDelFlag(ConstantsDevice.NOT_DEL_FLAG);
VehicleDevice vehicleDevice = vehicleDeviceMapper.getVehicleDeviceBySnStatus(param); VehicleDevice vehicleDevice = vehicleDeviceMapper.getVehicleDeviceBySnStatus(param);
if (vehicleDevice == null) { if (vehicleDevice == null) {
return true; return true;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!