From dda22278f6db621307b445a8f4c0bdcabeb56d64 Mon Sep 17 00:00:00 2001 From: guoshengxiong <1923636941@qq.com> Date: Fri, 6 Sep 2024 23:47:03 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A0=B9=E6=8D=AE=E3=80=8A=E8=A7=86=E9=A2=91?= =?UTF-8?q?=E8=AE=BE=E5=A4=87=E7=9B=91=E6=8E=A7=E7=82=B9=E7=BC=96=E5=8F=B7?= =?UTF-8?q?=E3=80=8B=E6=9F=A5=E8=AF=A2=E6=B5=B7=E5=BA=B7=E8=A7=86=E9=A2=91?= =?UTF-8?q?=E6=92=AD=E6=94=BEurl?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../video/controller/VideoItemController.java | 1 + .../service/impl/VideoItemServiceImpl.java | 28 +++++++++++++++---- 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/zhgd/xmgl/modules/video/controller/VideoItemController.java b/src/main/java/com/zhgd/xmgl/modules/video/controller/VideoItemController.java index 6c7793f52..b3623dfe7 100644 --- a/src/main/java/com/zhgd/xmgl/modules/video/controller/VideoItemController.java +++ b/src/main/java/com/zhgd/xmgl/modules/video/controller/VideoItemController.java @@ -175,6 +175,7 @@ public class VideoItemController { @ApiOperation(value = "根据视频设备监控点编号查询海康视频播放url", notes = "根据视频设备监控点编号查询海康视频播放url", httpMethod = "POST") @ApiImplicitParams({ + @ApiImplicitParam(name = "projectSn", value = "项目SN", paramType = "body", required = false, dataType = "String"), @ApiImplicitParam(name = "serialNumber", value = "视频设备监控点编号", paramType = "body", required = true, dataType = "String"), @ApiImplicitParam(name = "type", value = "取流协议 rtsp、rtmp、hls,默认hls", paramType = "body", required = false, dataType = "String"), @ApiImplicitParam(name = "streamType", value = "码流类型:1、子码流,2、主码流,默认子码流", paramType = "body", required = false, dataType = "String"), diff --git a/src/main/java/com/zhgd/xmgl/modules/video/service/impl/VideoItemServiceImpl.java b/src/main/java/com/zhgd/xmgl/modules/video/service/impl/VideoItemServiceImpl.java index 8089dd73a..3514cbdae 100644 --- a/src/main/java/com/zhgd/xmgl/modules/video/service/impl/VideoItemServiceImpl.java +++ b/src/main/java/com/zhgd/xmgl/modules/video/service/impl/VideoItemServiceImpl.java @@ -1,6 +1,7 @@ package com.zhgd.xmgl.modules.video.service.impl; import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.StrUtil; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; @@ -515,14 +516,29 @@ public class VideoItemServiceImpl extends ServiceImpl getHikVideoUrl(Map map) { Map data = new HashMap<>(16); String url = ""; - EntityMap videoInfo = videoItemMapper.selectVideoInfoByserialNumber(MapUtils.getString(map, "serialNumber")); - if (videoInfo != null && videoInfo.size() > 0) { - if (String.valueOf(STANDER.getCode()).equals(MapUtils.getString(videoInfo, VIDEO_TYPE))) { - //海康ISC + String projectSn = MapUtils.getString(map, "projectSn"); + if (StrUtil.isNotBlank(projectSn)) { + ProjectVideoConfig projectVideoConfig = getEnableProjectVideoConfigByProjectSn(map); + if (projectVideoConfig == null) { + throw new OpenAlertException("未启用视频配置"); + } + if (Objects.equals(projectVideoConfig.getVideoType(), 3)) { url = HikVideoUtil.callPostApiGetPreviewURL(MapUtils.getString(map, "serialNumber"), MapUtils.getString(map, "type"), - MapUtils.getInteger(map, "streamType"), MapUtils.getString(videoInfo, "account"), - MapUtils.getString(videoInfo, "password"), MapUtils.getString(videoInfo, "appId"), MapUtils.getString(videoInfo, "appSecret")); + MapUtils.getInteger(map, "streamType"), projectVideoConfig.getAccount(), + projectVideoConfig.getPassword(), projectVideoConfig.getAppId(), projectVideoConfig.getAppSecret()); + } else { + throw new OpenAlertException("未启用海康视频配置"); + } + } else { + EntityMap videoInfo = videoItemMapper.selectVideoInfoByserialNumber(MapUtils.getString(map, "serialNumber")); + if (videoInfo != null && videoInfo.size() > 0) { + if ("3".equals(MapUtils.getString(videoInfo, "videoType"))) { + //海康ISC + url = HikVideoUtil.callPostApiGetPreviewURL(MapUtils.getString(map, "serialNumber"), MapUtils.getString(map, "type"), + MapUtils.getInteger(map, "streamType"), MapUtils.getString(videoInfo, "account"), + MapUtils.getString(videoInfo, "password"), MapUtils.getString(videoInfo, "appId"), MapUtils.getString(videoInfo, "appSecret")); + } } } data.put("url", url);