Commit 00dec344 by gdj

新建机场时,自动更新没有workspaceId的空机场。

parent 1decbaa7
......@@ -758,7 +758,30 @@ public class DeviceServiceImpl implements IDeviceService {
// sn码不重复
List<DeviceEntity> dbDroneList = mapper.selectList(new LambdaQueryWrapper<DeviceEntity>().eq(DeviceEntity::getDeviceSn, droneDeviceSn));
if (!CollectionUtils.isEmpty(dbDroneList)) {
throw new RuntimeException("droneSn is already exit");
if (dbDroneList.size() != 1) {
throw new RuntimeException("droneSn is already exit");
}
DeviceEntity dbDrone = dbDroneList.get(0);
// throw new RuntimeException("droneSn is already exit");
if (StringUtils.hasText(dbDrone.getWorkspaceId())) {
throw new RuntimeException("droneSn is already exit");
}
// 修改当前无人机数据
DeviceEntity updateDrone = new DeviceEntity();
updateDrone.setId(dbDrone.getId());
updateDrone.setWorkspaceId(drone.getWorkspaceId());
updateDrone.setNickname(drone.getNickname());
deviceEntity.setDeviceName(drone.getDeviceName());
// 类型
updateDrone.setDomain(DeviceDomainEnum.DRONE.getDomain());
updateDrone.setDeviceType(drone.getType().getType());
updateDrone.setSubType(drone.getSubType().getSubType());
updateDrone.setBoundStatus(true);
updateDrone.setBoundTime(System.currentTimeMillis());
int update = this.mapper.updateById(updateDrone);
return update > 0;
}
}
......@@ -786,6 +809,8 @@ public class DeviceServiceImpl implements IDeviceService {
// bound_time bigint
// bound_status The status when the device is bound to the workspace. 1: bound; 0: not bound;
deviceEntity.setBoundStatus(true);
deviceEntity.setBoundTime(System.currentTimeMillis());
// deviceEntity.setDeviceDesc(drone.getDeviceDesc());
// url_normal The icon displayed on the remote control.
// url_select The icon displayed on the remote control when it is selected.
......
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