Zimo před 2 dny
rodič
revize
1c23e1f44f

+ 41 - 1
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/IotDeviceController.java

@@ -418,6 +418,9 @@ public class IotDeviceController {
     @PreAuthorize("@ss.hasPermission('rq:iot-device:query')")
     public CommonResult<PageResult<IotDeviceRespVO>> getIotDeviceTdPage(@Valid IotDevicePageReqVO pageReqVO) {
         List<String> codes = new ArrayList<>();
+        if (Objects.nonNull(pageReqVO.getIfInline())&&pageReqVO.getIfInline()==0) {
+            pageReqVO.setIfInline(null);
+        }
         PageResult<IotDeviceDO> pageResult = iotDeviceService.getIotDeviceTdPage(pageReqVO, codes);
         if (CollUtil.isEmpty(pageResult.getList())) {
             return success(new PageResult<>(pageResult.getTotal()));
@@ -462,7 +465,10 @@ public class IotDeviceController {
     @PreAuthorize("@ss.hasPermission('rq:iot-device:query')")
     public CommonResult<PageResult<IotDeviceRespVO>> getIotDeviceTdPageLy(@Valid IotDevicePageReqVO pageReqVO) {
         DevicePageReqVO devicePageReqVO = new DevicePageReqVO();
-        devicePageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
+//        devicePageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
+        if (Objects.nonNull(pageReqVO.getIfInline())&&pageReqVO.getIfInline()==0) {
+            pageReqVO.setIfInline(null);
+        }
         //连油设备
         devicePageReqVO.setProductId(649L);
         List<String> codes = yfDeviceService.getDevicePage(devicePageReqVO).getList().stream().map(YfDeviceDO::getSerialNumber).collect(Collectors.toList());
@@ -484,6 +490,40 @@ public class IotDeviceController {
         return success(result);
     }
 
+    @GetMapping("/td/ly/screen")
+    @Operation(summary = "连油看板的设备信息")
+    @PreAuthorize("@ss.hasPermission('rq:iot-device:query')")
+    public CommonResult<PageResult<IotDeviceRespVO>> getIotDeviceTdLyScreen(@Valid IotDevicePageReqVO pageReqVO) {
+        DevicePageReqVO devicePageReqVO = new DevicePageReqVO();
+        devicePageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
+        if (Objects.nonNull(pageReqVO.getIfInline())&&pageReqVO.getIfInline()==0) {
+            pageReqVO.setIfInline(null);
+        }
+        //连油设备
+        devicePageReqVO.setProductId(649L);
+        List<YfDeviceDO> list = yfDeviceService.getDevicePage(devicePageReqVO).getList();
+        List<String> codes = list.stream().map(YfDeviceDO::getSerialNumber).collect(Collectors.toList());
+        PageResult<IotDeviceDO> pageResult = iotDeviceService.getIotDeviceTdPage(pageReqVO, codes);
+        if (CollUtil.isEmpty(pageResult.getList())) {
+            return success(new PageResult<>(pageResult.getTotal()));
+        }
+        Map<Long, DeptDO> deptMap = deptService.getDeptMap(
+                convertList(pageResult.getList(), IotDeviceDO::getDeptId));
+        PageResult<IotDeviceRespVO> result = new PageResult<>(IotDeviceConvert.INSTANCE.convertList(pageResult.getList(), deptMap),
+                pageResult.getTotal());
+        for (IotDeviceRespVO iotDeviceRespVO : result.getList()) {
+            IotProductClassifyDO iotProductClassify = iotProductClassifyService.getIotProductClassify(iotDeviceRespVO.getAssetClass());
+            iotDeviceRespVO.setAssetClassName(iotProductClassify.getName());
+            DeptRespDTO dept = deptApi.getDept(iotDeviceRespVO.getDeptId());
+            iotDeviceRespVO.setDeviceName(Objects.nonNull(dept)?dept.getName()+" "+iotDeviceRespVO.getDeviceName():iotDeviceRespVO.getDeviceName());
+            list.stream().filter(e -> e.getSerialNumber().equals(iotDeviceRespVO.getDeviceCode())).findFirst().ifPresent(e ->{
+                iotDeviceRespVO.setMqttUrl("/"+e.getProductId()+"/"+iotDeviceRespVO.getDeviceCode()+"/property/post");
+            });
+        }
+
+        return success(result);
+    }
+
 
     @GetMapping("/td/page/app")
     @Operation(summary = "获得设备台账包含数采信息")

+ 2 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/vo/IotDeviceRespVO.java

@@ -262,4 +262,6 @@ public class IotDeviceRespVO {
     private String deviceNo;
     @Schema(description = "设备等级")
     private String deviceGrade;
+
+    private String mqttUrl;
 }