Commit 7b73d433 by gdj

机场新增和查询优化。

parent 2c27e2da
...@@ -669,6 +669,11 @@ public class DeviceServiceImpl extends ServiceImpl<IDeviceMapper, DeviceEntity> ...@@ -669,6 +669,11 @@ public class DeviceServiceImpl extends ServiceImpl<IDeviceMapper, DeviceEntity>
} }
DeviceDTO device = devicesList.get(0); DeviceDTO device = devicesList.get(0);
device.setStatus(deviceRedisService.checkDeviceOnline(sn)); device.setStatus(deviceRedisService.checkDeviceOnline(sn));
// 查询 无人机
List<DeviceDTO> childrenList = this.getDevicesByParams(DeviceQueryParam.builder().deviceSn(device.getChildDeviceSn()).build());
if (!devicesList.isEmpty()) {
device.setChildren(childrenList.get(0));
}
return Optional.of(device); return Optional.of(device);
} }
...@@ -1017,14 +1022,23 @@ public class DeviceServiceImpl extends ServiceImpl<IDeviceMapper, DeviceEntity> ...@@ -1017,14 +1022,23 @@ public class DeviceServiceImpl extends ServiceImpl<IDeviceMapper, DeviceEntity>
// 飞机存在 // 飞机存在
if (StringUtils.hasText(drone.getWorkspaceId())) { if (StringUtils.hasText(drone.getWorkspaceId())) {
throw new RuntimeException("The current drone has been bound");
}
// 绑定无人机 // 假如是绑定了其他客户的设备 那么报错
LambdaUpdateWrapper<DeviceEntity> updateDroneWrapper = new LambdaUpdateWrapper<>(); if (!drone.getWorkspaceId().equals(dock.getWorkspaceId())) {
updateDroneWrapper.set(DeviceEntity::getWorkspaceId, dock.getWorkspaceId()); throw new RuntimeException("The current drone has been bound");
updateDroneWrapper.eq(DeviceEntity::getDeviceSn, droneSn); } else {
int updateDroneInt = mapper.update(new DeviceEntity(), updateDroneWrapper); // 绑定了自己的设备
// 是否需要改动什么?
}
} else {
// 绑定无人机
LambdaUpdateWrapper<DeviceEntity> updateDroneWrapper = new LambdaUpdateWrapper<>();
updateDroneWrapper.set(DeviceEntity::getWorkspaceId, dock.getWorkspaceId());
updateDroneWrapper.eq(DeviceEntity::getDeviceSn, droneSn);
int updateDroneInt = mapper.update(new DeviceEntity(), updateDroneWrapper);
}
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment