|
@@ -207,6 +207,30 @@ public class IotDeviceController {
|
|
|
return success(new PageResult<>(buildDevicePersonsList(pageResult.getList()), pageResult.getTotal()));
|
|
|
}
|
|
|
|
|
|
+ @GetMapping("/statusRelationDevices")
|
|
|
+ @Operation(summary = "查询是否调整过状态的设备列表 分页")
|
|
|
+ @PreAuthorize("@ss.hasPermission('rq:iot-device:query')")
|
|
|
+ public CommonResult<PageResult<IotDeviceRespVO>> statusRelationDevices(@Valid IotDevicePageReqVO pageReqVO) {
|
|
|
+ // 查询是否调整过状态的设备列表 分页
|
|
|
+ PageResult<IotDeviceRespVO> pageResult = iotDeviceService.statusRelationDevices(pageReqVO);
|
|
|
+ if (CollUtil.isEmpty(pageResult.getList())) {
|
|
|
+ return success(new PageResult<>(pageResult.getTotal()));
|
|
|
+ }
|
|
|
+ return success(new PageResult<>(buildDeviceStatusList(pageResult.getList()), pageResult.getTotal()));
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/allotRelationDevices")
|
|
|
+ @Operation(summary = "查询是否发生过调拨的设备列表 分页")
|
|
|
+ @PreAuthorize("@ss.hasPermission('rq:iot-device:query')")
|
|
|
+ public CommonResult<PageResult<IotDeviceRespVO>> allotRelationDevices(@Valid IotDevicePageReqVO pageReqVO) {
|
|
|
+ // 查询是否发生过调拨的设备列表 分页
|
|
|
+ PageResult<IotDeviceRespVO> pageResult = iotDeviceService.allotRelationDevices(pageReqVO);
|
|
|
+ if (CollUtil.isEmpty(pageResult.getList())) {
|
|
|
+ return success(new PageResult<>(pageResult.getTotal()));
|
|
|
+ }
|
|
|
+ return success(new PageResult<>(buildDeviceStatusList(pageResult.getList()), pageResult.getTotal()));
|
|
|
+ }
|
|
|
+
|
|
|
@GetMapping("/deviceDynamicsPage")
|
|
|
@Operation(summary = "获得设备动态 分页")
|
|
|
@PreAuthorize("@ss.hasPermission('rq:iot-device:query')")
|
|
@@ -373,6 +397,25 @@ public class IotDeviceController {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 组装 设备-bom 关联关系对象
|
|
|
+ * @param devices
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private List<IotDeviceRespVO> buildDeviceStatusList(List<IotDeviceRespVO> devices) {
|
|
|
+ if (CollUtil.isEmpty(devices)) {
|
|
|
+ return Collections.emptyList();
|
|
|
+ }
|
|
|
+ // 设备部门信息
|
|
|
+ Map<Long, DeptDO> deptMap = deptService.getDeptMap(
|
|
|
+ convertList(devices, IotDeviceRespVO::getDeptId));
|
|
|
+ // 2. 拼接数据
|
|
|
+ return BeanUtils.toBean(devices, IotDeviceRespVO.class, (deviceVO) -> {
|
|
|
+ // 2.1 拼接部门信息
|
|
|
+ findAndThen(deptMap, deviceVO.getDeptId(), dept -> deviceVO.setDeptName(dept.getName()));
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
@GetMapping("/export-excel")
|
|
|
@Operation(summary = "导出设备台账 Excel")
|
|
|
@PreAuthorize("@ss.hasPermission('rq:iot-device:export')")
|