소스 검색

智慧连油

Zimo 1 일 전
부모
커밋
b760601a7e

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

@@ -487,7 +487,8 @@ public class IotDeviceController {
         }
         //连油设备
         devicePageReqVO.setProductId(649L);
-        List<String> codes = yfDeviceService.getDevicePage(devicePageReqVO).getList().stream().map(YfDeviceDO::getSerialNumber).collect(Collectors.toList());
+        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()));
@@ -501,6 +502,9 @@ public class IotDeviceController {
             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);