根据《视频设备监控点编号》查询海康视频播放url

This commit is contained in:
guoshengxiong 2024-09-06 23:47:03 +08:00
parent 75bdfdf411
commit dda22278f6
2 changed files with 23 additions and 6 deletions

View File

@ -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"),

View File

@ -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<VideoItemMapper, VideoItem
public Map<String, Object> getHikVideoUrl(Map<String, Object> map) {
Map<String, Object> 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);