Zimo 5 godzin temu
rodzic
commit
dbf814ce3d

+ 22 - 2
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/alarm/IotVideoAlarmController.java

@@ -3,8 +3,13 @@ package cn.iocoder.yudao.module.pms.controller.admin.alarm;
 import cn.iocoder.yudao.module.pms.controller.admin.alarm.vo.IotVideoAlarmPageReqVO;
 import cn.iocoder.yudao.module.pms.controller.admin.alarm.vo.IotVideoAlarmRespVO;
 import cn.iocoder.yudao.module.pms.controller.admin.alarm.vo.IotVideoAlarmSaveReqVO;
+import cn.iocoder.yudao.module.pms.controller.admin.inspect.order.vo.IotInspectOrderRespVO;
 import cn.iocoder.yudao.module.pms.dal.dataobject.alarm.IotVideoAlarmDO;
+import cn.iocoder.yudao.module.pms.dal.dataobject.yanfan.sip.device.channel.YfSipDeviceChannelDO;
+import cn.iocoder.yudao.module.pms.dal.mysql.yanfan.sip.device.channel.YfSipDeviceChannelMapper;
 import cn.iocoder.yudao.module.pms.service.alarm.IotVideoAlarmService;
+import cn.iocoder.yudao.module.pms.service.yanfan.sip.device.channel.YfSipDeviceChannelService;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.security.access.prepost.PreAuthorize;
@@ -14,6 +19,7 @@ import io.swagger.v3.oas.annotations.Operation;
 
 import java.util.*;
 import java.io.IOException;
+import java.util.stream.Collectors;
 
 import cn.iocoder.yudao.framework.common.pojo.PageParam;
 import cn.iocoder.yudao.framework.common.pojo.PageResult;
@@ -40,6 +46,8 @@ public class IotVideoAlarmController {
 
     @Resource
     private IotVideoAlarmService iotVideoAlarmService;
+    @Resource
+    private YfSipDeviceChannelMapper yfsipDeviceChannelMapper;
 
     @PostMapping("/create")
     @Operation(summary = "创建资料")
@@ -75,11 +83,23 @@ public class IotVideoAlarmController {
     }
 
     @GetMapping("/page")
-    @Operation(summary = "获得资料分页")
+    @Operation(summary = "获得视频告警分页")
     @PreAuthorize("@ss.hasPermission('rq:iot-video-alarm:query')")
     public CommonResult<PageResult<IotVideoAlarmRespVO>> getIotVideoAlarmPage(@Valid IotVideoAlarmPageReqVO pageReqVO) {
         PageResult<IotVideoAlarmDO> pageResult = iotVideoAlarmService.getIotVideoAlarmPage(pageReqVO);
-        return success(BeanUtils.toBean(pageResult, IotVideoAlarmRespVO.class));
+        List<IotVideoAlarmRespVO> collect = pageResult.getList().stream().map(e -> {
+            IotVideoAlarmRespVO iotVideoAlarmRespVO = new IotVideoAlarmRespVO();
+            BeanUtils.copyProperties(e, iotVideoAlarmRespVO);
+            if (StringUtils.isNotBlank(e.getBusinessChannel())) {
+                YfSipDeviceChannelDO yfSipDeviceChannelDO = yfsipDeviceChannelMapper.selectSipDeviceChannelByChannelSipId(e.getBusinessChannel());
+                if (yfSipDeviceChannelDO != null) {
+                    iotVideoAlarmRespVO.setDeviceName(yfSipDeviceChannelDO.getDeviceSipId());
+                    iotVideoAlarmRespVO.setChannelName(yfSipDeviceChannelDO.getChannelName());
+                }
+            }
+            return iotVideoAlarmRespVO;
+        }).collect(Collectors.toList());
+        return success(new PageResult<>(collect, pageResult.getTotal()));
     }
 
     @GetMapping("/export-excel")

+ 3 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/alarm/vo/IotVideoAlarmRespVO.java

@@ -90,4 +90,7 @@ public class IotVideoAlarmRespVO {
 
     private String businessChannel;
     private String imageUrl;
+
+    @Schema(description = "设备名称")
+    private String deviceName;
 }