diff --git a/electripper-admin/src/main/java/com/ruoyi/web/controller/app/AppVerifyController.java b/electripper-admin/src/main/java/com/ruoyi/web/controller/app/AppVerifyController.java index 52268de..cd9cd49 100644 --- a/electripper-admin/src/main/java/com/ruoyi/web/controller/app/AppVerifyController.java +++ b/electripper-admin/src/main/java/com/ruoyi/web/controller/app/AppVerifyController.java @@ -1163,10 +1163,29 @@ public class AppVerifyController extends BaseController @PostMapping("/changeVehicle/lock") public AjaxResult changeVehicleLock(String orderNo,String changeReason,String isBluetooth,String lon,String lat,String voltage,String newSn) { + if (StrUtil.isBlank(newSn)){ + logger.info("没有sn号参数:【newSn={}】",newSn); + return error("请传sn号参数"+"【newSn="+newSn+"】"); + } if (StrUtil.isBlank(orderNo)){ logger.info("没有orderNo参数:【orderNo={}】",orderNo); return error("请传orderNo号参数"+"【orderNo="+orderNo+"】"); } + //非正常状态不得骑行 + AsDevice newDevice = asDeviceMapper.selectAsDeviceBySn(newSn); + String status = newDevice.getStatus(); + if(!ServiceConstants.VEHICLE_STATUS_NORMAL.equals(status)){ + return error(CommonUtil.format(status)); + } + // 当前有骑行中的订单 + EtOrder currentOrder = etOrderService.getCurrentOrder(newDevice.getSn()); + if(ObjectUtil.isNotNull(currentOrder) && !currentOrder.getOrderNo().equals(orderNo)){ + return error("当前车辆有骑行中的订单,请换车"); + } + //低电量不得骑行判断 + if(asDeviceService.isLowBattery(newDevice.getSn())){ + return error("低电量不得骑行"); + } logger.info("【换车关锁请求】:orderNo={}",orderNo); Boolean aBoolean = etOrderService.changeVehicleLock(orderNo,changeReason,isBluetooth,lon,lat,voltage,newSn); return success(aBoolean);