Commit 7b73d433 by gdj

机场新增和查询优化。

parent 2c27e2da
......@@ -669,6 +669,11 @@ public class DeviceServiceImpl extends ServiceImpl<IDeviceMapper, DeviceEntity>
}
DeviceDTO device = devicesList.get(0);
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);
}
......@@ -1017,9 +1022,17 @@ public class DeviceServiceImpl extends ServiceImpl<IDeviceMapper, DeviceEntity>
// 飞机存在
if (StringUtils.hasText(drone.getWorkspaceId())) {
// 假如是绑定了其他客户的设备 那么报错
if (!drone.getWorkspaceId().equals(dock.getWorkspaceId())) {
throw new RuntimeException("The current drone has been bound");
}
} else {
// 绑定了自己的设备
// 是否需要改动什么?
}
} else {
// 绑定无人机
LambdaUpdateWrapper<DeviceEntity> updateDroneWrapper = new LambdaUpdateWrapper<>();
updateDroneWrapper.set(DeviceEntity::getWorkspaceId, dock.getWorkspaceId());
......@@ -1027,6 +1040,7 @@ public class DeviceServiceImpl extends ServiceImpl<IDeviceMapper, DeviceEntity>
int updateDroneInt = mapper.update(new DeviceEntity(), updateDroneWrapper);
}
}
}
addDockEntity.setWorkspaceId(dock.getWorkspaceId());
// 机场sn
......
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