|
@@ -703,9 +703,13 @@ public class IotDeviceServiceImpl implements IotDeviceService {
|
|
pageReqVO.getPageSize()), pageReqVO.getDeviceIds(), pageReqVO.getBomFlag());
|
|
pageReqVO.getPageSize()), pageReqVO.getDeviceIds(), pageReqVO.getBomFlag());
|
|
// 查询所有 设备boms节点的所有上级节点名称 拼接出 全路径 的bom节点
|
|
// 查询所有 设备boms节点的所有上级节点名称 拼接出 全路径 的bom节点
|
|
List<Long> bomNodeIds = new ArrayList<>();
|
|
List<Long> bomNodeIds = new ArrayList<>();
|
|
|
|
+ Set<Long> deptIds = new HashSet<>();
|
|
|
|
+ Set<Long> deviceIds = new HashSet<>();
|
|
if (CollUtil.isNotEmpty(page.getRecords())) {
|
|
if (CollUtil.isNotEmpty(page.getRecords())) {
|
|
page.getRecords().forEach(device -> {
|
|
page.getRecords().forEach(device -> {
|
|
bomNodeIds.add(Long.valueOf(device.getBomNodeId()));
|
|
bomNodeIds.add(Long.valueOf(device.getBomNodeId()));
|
|
|
|
+ deptIds.add(device.getDeptId());
|
|
|
|
+ deviceIds.add(device.getId());
|
|
});
|
|
});
|
|
// 查询 bomNodeIds 集合中每个bom节点的所有上级节点
|
|
// 查询 bomNodeIds 集合中每个bom节点的所有上级节点
|
|
Map<Long, String> bomFullPaths = iotDeviceBomService.buildBomFullPaths(bomNodeIds);
|
|
Map<Long, String> bomFullPaths = iotDeviceBomService.buildBomFullPaths(bomNodeIds);
|
|
@@ -717,6 +721,13 @@ public class IotDeviceServiceImpl implements IotDeviceService {
|
|
}
|
|
}
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
+ Map<String, List<IotDeviceMaterialRespVO>> bomMaterialsPair = iotDeviceMaterialService.bomMaterials(deptIds, deviceIds, new HashSet<>(bomNodeIds));
|
|
|
|
+ page.getRecords().forEach(device -> {
|
|
|
|
+ String uniqueKey = StrUtil.join("-", device.getId(), device.getBomNodeId());
|
|
|
|
+ if (bomMaterialsPair.containsKey(uniqueKey)) {
|
|
|
|
+ device.setDeviceBomMaterials(bomMaterialsPair.get(uniqueKey));
|
|
|
|
+ }
|
|
|
|
+ });
|
|
return new PageResult<>(page.getRecords(), page.getTotal());
|
|
return new PageResult<>(page.getRecords(), page.getTotal());
|
|
}
|
|
}
|
|
|
|
|