lipenghui 1 месяц назад
Родитель
Сommit
7436ce7069

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

@@ -663,7 +663,7 @@ public class IotDeviceController {
         IotDevicePageReqVO iotDevicePageReqVO = new IotDevicePageReqVO();
         iotDevicePageReqVO.setDeptId(id);
         List<IotDeviceDO> allDevices = iotDeviceService.getAllDevices(iotDevicePageReqVO);
-        List<ImmutableMap<String, ? extends Serializable>> collect = allDevices.stream().map(e -> ImmutableMap.of("id", e.getId(), "deviceName", e.getDeviceName(), "deviceCode", e.getDeviceCode(), "yfCode", e.getYfDeviceCode())).collect(Collectors.toList());
+        List<ImmutableMap<String, ? extends Serializable>> collect = allDevices.stream().map(e -> ImmutableMap.of("id", e.getId(), "deviceName", e.getDeviceName(), "deviceCode", e.getDeviceCode())).collect(Collectors.toList());
         return success(collect);
     }
 }

+ 3 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/devicegroup/IotDeviceGroupController.java

@@ -126,6 +126,9 @@ public class IotDeviceGroupController {
     @PreAuthorize("@ss.hasPermission('rq:iot-device-group:query')")
     public CommonResult<PageResult<IotDeviceGroupDetailRespVO>> getDeviceGroup(@Valid IotDeviceGroupDetailPageReqVO reqVO) {
         PageResult<IotDeviceGroupDetailDO> deviceGroupList = iotDeviceGroupService.getDeviceGroupList(reqVO);
+        if (Objects.isNull(deviceGroupList.getList())){
+            return success(new PageResult<>(new ArrayList<>(),0L));
+        }
         List<IotDeviceGroupDetailRespVO> collect = deviceGroupList.getList().stream().map(e -> {
             IotDeviceGroupDetailRespVO bean = BeanUtil.toBean(e, IotDeviceGroupDetailRespVO.class);
             IotDeviceGroupDO iotDeviceGroup = iotDeviceGroupService.getIotDeviceGroup(e.getGroupId());

+ 4 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/service/devicegroup/IotDeviceGroupServiceImpl.java

@@ -1,6 +1,7 @@
 package cn.iocoder.yudao.module.pms.service.devicegroup;
 
 import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.collection.CollUtil;
 import cn.iocoder.yudao.framework.common.exception.ErrorCode;
 import cn.iocoder.yudao.module.pms.controller.admin.devicegroup.IotDeviceGroupDetailPageReqVO;
 import cn.iocoder.yudao.module.pms.controller.admin.devicegroup.IotDeviceGroupDetailSaveReqVO;
@@ -114,6 +115,9 @@ public class IotDeviceGroupServiceImpl implements IotDeviceGroupService {
     public PageResult<IotDeviceGroupDetailDO> getDeviceGroupList(IotDeviceGroupDetailPageReqVO reqVO) {
         IotDeviceDO iotDevice = iotDeviceService.getIotDevice(reqVO.getDeviceId());
         List<IotDeviceGroupDetailDO> deviceCodes = iotDeviceGroupDetailMapper.selectList("device_code", iotDevice.getDeviceCode());
+        if (CollUtil.isEmpty(deviceCodes)) {
+            return new PageResult<>();
+        }
         IotDeviceGroupDetailDO iotDeviceGroupDetailDO = deviceCodes.get(0);
         Long groupId = iotDeviceGroupDetailDO.getGroupId();
 //        IotDeviceGroupDetailPageReqVO pageReqVO = new IotDeviceGroupDetailPageReqVO();