切換車輛
This commit is contained in:
@@ -990,13 +990,6 @@ public class HotDriverServiceImpl implements IHotDriverService {
|
|||||||
throw new ServiceException("目标车辆ID不能为空");
|
throw new ServiceException("目标车辆ID不能为空");
|
||||||
}
|
}
|
||||||
|
|
||||||
List<String> boundVehicleIds = getBoundVehicleIds(driver);
|
|
||||||
if (CollUtil.isEmpty(boundVehicleIds)) {
|
|
||||||
throw new ServiceException("当前驾驶员未绑定车辆,不能切换");
|
|
||||||
}
|
|
||||||
if (!boundVehicleIds.contains(targetVehicleId)) {
|
|
||||||
throw new ServiceException("驾驶员只能切换属于自己的车辆");
|
|
||||||
}
|
|
||||||
if (StringUtils.equals(driver.getVehicleId(), targetVehicleId)) {
|
if (StringUtils.equals(driver.getVehicleId(), targetVehicleId)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -1014,9 +1007,6 @@ public class HotDriverServiceImpl implements IHotDriverService {
|
|||||||
if (targetVehicle == null) {
|
if (targetVehicle == null) {
|
||||||
throw new ServiceException("目标车辆不存在");
|
throw new ServiceException("目标车辆不存在");
|
||||||
}
|
}
|
||||||
if (!splitCsv(targetVehicle.getCurrentDriver()).contains(driver.getId())) {
|
|
||||||
throw new ServiceException("驾驶员只能切换属于自己的车辆");
|
|
||||||
}
|
|
||||||
|
|
||||||
return baseMapper.update(null, new LambdaUpdateWrapper<HotDriver>()
|
return baseMapper.update(null, new LambdaUpdateWrapper<HotDriver>()
|
||||||
.set(HotDriver::getVehicleId, targetVehicle.getId())
|
.set(HotDriver::getVehicleId, targetVehicle.getId())
|
||||||
|
|||||||
Reference in New Issue
Block a user