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);