|
@@ -245,8 +245,34 @@ public class IotDeviceController {
|
|
|
}
|
|
|
Map<Long, DeptDO> deptMap = deptService.getDeptMap(
|
|
|
convertList(pageResult.getList(), IotDeviceDO::getDeptId));
|
|
|
- return success(new PageResult<>(IotDeviceConvert.INSTANCE.convertList(pageResult.getList(), deptMap),
|
|
|
- pageResult.getTotal()));
|
|
|
+ // 查询当前分页的设备是否已经设置了 保养BOM
|
|
|
+ List<Long> deviceIds = convertList(pageResult.getList(), IotDeviceDO::getId);
|
|
|
+ IotDevicePageReqVO reqVO = new IotDevicePageReqVO();
|
|
|
+ reqVO.setDeviceIds(deviceIds);
|
|
|
+ reqVO.setBomFlag("b");
|
|
|
+ List<IotDeviceRespVO> devicesWithBoms = iotDeviceService.deviceAssociateBomList(reqVO);
|
|
|
+ Map<Long, List<IotDeviceRespVO>> devicesWithBomsPair = new HashMap<>();
|
|
|
+ if (CollUtil.isNotEmpty(devicesWithBoms)) {
|
|
|
+ devicesWithBoms.forEach(bom -> {
|
|
|
+ if (devicesWithBomsPair.containsKey(bom.getId())) {
|
|
|
+ List<IotDeviceRespVO> tempDevices = devicesWithBomsPair.get(bom.getId());
|
|
|
+ tempDevices.add(bom);
|
|
|
+ devicesWithBomsPair.put(bom.getId(), tempDevices);
|
|
|
+ } else {
|
|
|
+ List<IotDeviceRespVO> tempDevices = new ArrayList<>();
|
|
|
+ tempDevices.add(bom);
|
|
|
+ devicesWithBomsPair.put(bom.getId(), tempDevices);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ List<IotDeviceRespVO> iotDeviceRespVOS = IotDeviceConvert.INSTANCE.convertList(pageResult.getList(), deptMap);
|
|
|
+ iotDeviceRespVOS.forEach(e ->{
|
|
|
+ // 设置保养项标识
|
|
|
+ if (devicesWithBomsPair.containsKey(e.getId())) {
|
|
|
+ e.setHasSetMaintenanceBom(true);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return success(new PageResult<>(iotDeviceRespVOS, pageResult.getTotal()));
|
|
|
}
|
|
|
|
|
|
@GetMapping("/getDevicesByDepts")
|