|
|
@@ -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());
|
|
|
@@ -116,8 +124,20 @@ public class IotDeviceGroupController {
|
|
|
@Operation(summary = "获得某设备的成套信息")
|
|
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
|
|
@PreAuthorize("@ss.hasPermission('rq:iot-device-group:query')")
|
|
|
- public CommonResult<PageResult<IotDeviceGroupDetailDO>> getDeviceGroup(@Valid IotDeviceGroupDetailPageReqVO reqVO) {
|
|
|
+ public CommonResult<PageResult<IotDeviceGroupDetailRespVO>> getDeviceGroup(@Valid IotDeviceGroupDetailPageReqVO reqVO) {
|
|
|
PageResult<IotDeviceGroupDetailDO> deviceGroupList = iotDeviceGroupService.getDeviceGroupList(reqVO);
|
|
|
- return success(deviceGroupList);
|
|
|
+ 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());
|
|
|
+ if (iotDeviceGroup != null) {
|
|
|
+ bean.setGroupName(iotDeviceGroup.getName());
|
|
|
+ }
|
|
|
+ return bean;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ return success(new PageResult<>(collect, deviceGroupList.getTotal()));
|
|
|
+// return success(deviceGroupList);
|
|
|
}
|
|
|
}
|