lipenghui 1 сар өмнө
parent
commit
b982a9789d

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

@@ -7,6 +7,8 @@ import cn.iocoder.yudao.module.pms.dal.dataobject.devicegroup.IotDeviceGroupDeta
 import cn.iocoder.yudao.module.pms.dal.dataobject.inspect.IotInspectOrderDetailDO;
 import cn.iocoder.yudao.module.pms.service.devicegroup.IotDeviceGroupDetailService;
 import cn.iocoder.yudao.module.pms.service.devicegroup.IotDeviceGroupService;
+import cn.iocoder.yudao.module.system.api.dept.DeptApi;
+import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.validation.annotation.Validated;
@@ -47,6 +49,8 @@ public class IotDeviceGroupController {
     private IotDeviceGroupService iotDeviceGroupService;
     @Autowired
     private IotDeviceGroupDetailService iotDeviceGroupDetailService;
+    @Autowired
+    private DeptApi deptApi;
 
     @PostMapping("/create")
     @Operation(summary = "创建PMS成套")
@@ -92,6 +96,10 @@ public class IotDeviceGroupController {
         List<IotDeviceGroupRespVO> collect = pageResult.getList().stream().map(e -> {
             IotDeviceGroupRespVO bean = BeanUtil.toBean(e, IotDeviceGroupRespVO.class);
             List<IotDeviceGroupDetailDO> iotDeviceGroupDetailListByGroupId = iotDeviceGroupDetailService.getIotDeviceGroupDetailListByGroupId(e.getId());
+            DeptRespDTO dept = deptApi.getDept(e.getDeptId());
+            if (dept != null) {
+                bean.setDeptName(dept.getName());
+            }
             bean.setDetails(iotDeviceGroupDetailListByGroupId);
             return bean;
         }).collect(Collectors.toList());

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

@@ -38,5 +38,7 @@ public class IotDeviceGroupRespVO {
     @ExcelProperty("创建时间")
     private LocalDateTime createTime;
 
+    private String deptName;
+
     private List<IotDeviceGroupDetailDO> details;
 }

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

@@ -117,8 +117,9 @@ public class IotDeviceGroupServiceImpl implements IotDeviceGroupService {
         IotDeviceGroupDetailDO iotDeviceGroupDetailDO = deviceCodes.get(0);
         Long groupId = iotDeviceGroupDetailDO.getGroupId();
 //        IotDeviceGroupDetailPageReqVO pageReqVO = new IotDeviceGroupDetailPageReqVO();
-        reqVO.setGroupId(groupId);
-        PageResult<IotDeviceGroupDetailDO> iotDeviceGroupDetailDOPageResult = iotDeviceGroupDetailMapper.selectPage(reqVO);
+        IotDeviceGroupDetailPageReqVO pageReqVO = new IotDeviceGroupDetailPageReqVO();
+        pageReqVO.setGroupId(groupId);
+        PageResult<IotDeviceGroupDetailDO> iotDeviceGroupDetailDOPageResult = iotDeviceGroupDetailMapper.selectPage(pageReqVO);
         return iotDeviceGroupDetailDOPageResult;
     }