|
@@ -71,31 +71,27 @@ public class IotTreeServiceImpl implements IotTreeService {
|
|
|
List<Long> idds = new ArrayList<>(ids);
|
|
List<Long> idds = new ArrayList<>(ids);
|
|
|
iotDevicePageReqVO.setDeptIds((idds));
|
|
iotDevicePageReqVO.setDeptIds((idds));
|
|
|
List<Long> deviceIds = iotDeviceMapper.selectList(iotDevicePageReqVO).stream().map(IotDeviceDO::getId).collect(Collectors.toList());
|
|
List<Long> deviceIds = iotDeviceMapper.selectList(iotDevicePageReqVO).stream().map(IotDeviceDO::getId).collect(Collectors.toList());
|
|
|
|
|
+
|
|
|
devices.forEach(device -> {
|
|
devices.forEach(device -> {
|
|
|
if (deviceIds.contains(device.getOriginId())) {
|
|
if (deviceIds.contains(device.getOriginId())) {
|
|
|
|
|
+ //更新设备资料库的名称
|
|
|
IotDeviceDO iotDevice = iotDeviceService.getIotDevice(device.getOriginId());
|
|
IotDeviceDO iotDevice = iotDeviceService.getIotDevice(device.getOriginId());
|
|
|
device.setName(iotDevice.getDeviceCode()+iotDevice.getDeviceName());
|
|
device.setName(iotDevice.getDeviceCode()+iotDevice.getDeviceName());
|
|
|
|
|
+
|
|
|
|
|
+ //设备的部门id
|
|
|
|
|
+ Long deptId = iotDevice.getDeptId();
|
|
|
|
|
+ IotTreeListReqVO iotTreeListReqVO = new IotTreeListReqVO();
|
|
|
|
|
+ iotTreeListReqVO.setOriginId(deptId);
|
|
|
|
|
+ iotTreeListReqVO.setType("dept");
|
|
|
|
|
+ List<IotTreeDO> iotTreeDOS1 = iotTreeMapper.selectList(iotTreeListReqVO);
|
|
|
|
|
+ if (CollUtil.isNotEmpty(iotTreeDOS1)&&iotTreeDOS1.size()==1) {
|
|
|
|
|
+ if (!device.getParentId().equals(iotTreeDOS1.get(0).getId())) {
|
|
|
|
|
+ device.setParentId(iotTreeDOS1.get(0).getId());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
iotTreeMapper.updateById(device);
|
|
iotTreeMapper.updateById(device);
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
-
|
|
|
|
|
-// }
|
|
|
|
|
-// List<IotTreeDO> rh = devices.stream().filter(e -> e.getName().contains("RH")).collect(Collectors.toList());
|
|
|
|
|
-// rh.forEach(e -> {
|
|
|
|
|
-// IotDeviceDO iotDevice = iotDeviceService.getIotDevice(e.getOriginId());
|
|
|
|
|
-// if (Objects.nonNull(iotDevice)) {
|
|
|
|
|
-// e.setDeviceCode(iotDevice.getDeviceCode());
|
|
|
|
|
-// e.setName(iotDevice.getDeviceCode()+iotDevice.getDeviceName());
|
|
|
|
|
-// iotTreeMapper.updateById(e);
|
|
|
|
|
-// }
|
|
|
|
|
-// });
|
|
|
|
|
-// devices.forEach(device -> {
|
|
|
|
|
-// Long deviceOriginId = device.getOriginId();
|
|
|
|
|
-// IotDeviceDO iotDevice = iotDeviceService.getIotDevice(deviceOriginId);
|
|
|
|
|
-// device.setDeviceCode(iotDevice.getDeviceCode());
|
|
|
|
|
-// device.setName(device.getDeviceCode()+iotDevice.getDeviceName());
|
|
|
|
|
-// iotTreeMapper.updateById(device);
|
|
|
|
|
-// });
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|