Commit fa52c825 authored by zhangjianqian's avatar zhangjianqian

Merge remote-tracking branch 'origin/master'

parents b013a9d2 c15fa3f3
......@@ -25,11 +25,11 @@ public class ArtemisController {
*/
static {
// 代理API网关nginx服务器ip端口
ArtemisConfig.host = "27.128.189.137:1443";
ArtemisConfig.host = "60.3.252.114:10443";
// 秘钥appkey
ArtemisConfig.appKey = "28616162";
ArtemisConfig.appKey = "29791064";
// 秘钥appSecret
ArtemisConfig.appSecret = "5ueTWDOJ21jRbpHACAzF";
ArtemisConfig.appSecret = "EArAS02rV0krs1waU5nE";
}
/**
* 能力开放平台的网站路径
......
package com.zehong.web.controller.video;
import com.alibaba.fastjson.JSONObject;
import com.hikvision.artemis.sdk.ArtemisHttpUtil;
import com.hikvision.artemis.sdk.config.ArtemisConfig;
import com.zehong.common.core.domain.AjaxResult;
import com.zehong.system.domain.vo.EventSubscriptionVo;
import com.zehong.system.domain.vo.EventUnSubscriptionVo;
import org.springframework.web.bind.annotation.*;
import java.util.HashMap;
import java.util.Map;
/**
* 鸿海海康视频接口
*/
@RestController
@RequestMapping("/honghai/artemis")
public class HonghaiArtemisController {
/**
* 请根据自己的appKey和appSecret更换static静态块中的三个参数. [1 host]
* 如果你选择的是和现场环境对接,host要修改为现场环境的ip,https端口默认为443,http端口默认为80.例如10.33.25.22:443 或者10.33.25.22:80
* appKey和appSecret请按照或得到的appKey和appSecret更改.
*/
static {
// 代理API网关nginx服务器ip端口
ArtemisConfig.host = "60.3.252.114:20443";
// 秘钥appkey
ArtemisConfig.appKey = "20289095";
// 秘钥appSecret
ArtemisConfig.appSecret = "2ESpESEYcMNQsnlmsnec";
}
/**
* 能力开放平台的网站路径
*/
private static final String ARTEMIS_PATH = "/artemis";
/**
* 获取监控点预览取流URL
*/
private static final String GET_PREVIEWURLS = ARTEMIS_PATH + "/api/video/v1/cameras/previewURLs";
/**
* 分页获取监控点资源
*/
private static final String GET_CAMERAS = ARTEMIS_PATH + "/api/resource/v1/cameras";
private static final String VEDIO_CONTROLLING = ARTEMIS_PATH + "/api/video/v1/ptzs/controlling";
/**
* 按事件类型订阅事件
*/
private static final String EVENT_SUBSCIRPTION_BY_ENVENTTYPES = ARTEMIS_PATH + "/api/eventService/v1/eventSubscriptionByEventTypes";
/**
* 按事件类型取消订阅事件
*/
private static final String EVENT_UNSUBSCRIPTION_BY_EVENTTYPES = ARTEMIS_PATH + "/api/eventService/v1/eventUnSubscriptionByEventTypes";
/**
* 获取监控点预览取流URL
* @return
*/
@GetMapping("/getPreviewURLs")
public AjaxResult getPreviewURLs(@RequestParam(value = "cameraIndexCode") String cameraIndexCode){
/**
* 根据API文档可以看出来,这是一个POST请求的Rest接口,而且传入的参数值为一个json
* ArtemisHttpUtil工具类提供了doPostStringArtemis这个函数,一共六个参数在文档里写明其中的意思,因为接口是https,
* 所以第一个参数path是一个hashmap类型,请put一个key-value,query为传入的参数,body为传入的json数据
* 传入的contentType为application/json,accept不指定为null
* header没有额外参数可不传,指定为null
*
*/
Map<String, String> path = new HashMap<String, String>(2) {
{
//根据现场环境部署确认是http还是https
put("https://", GET_PREVIEWURLS);
}
};
JSONObject jsonBody = new JSONObject();
//jsonBody.put("cameraIndexCode", "2a9891a194c24747b277f3ea4836d433");
jsonBody.put("cameraIndexCode", cameraIndexCode);
jsonBody.put("streamType", 0);//0主码流,1子码流
jsonBody.put("protocol", "ws");
jsonBody.put("transmode", 1);
String body = jsonBody.toJSONString();
// post请求application/json类型参数
String result = ArtemisHttpUtil.doPostStringArtemis(path,body,null,null,"application/json",null);
return AjaxResult.success(JSONObject.parseObject(result));
}
/**
* 分页获取监控点资源
* @param pageNo 页码
* @param pageSize 每页条数
* @return
*/
@GetMapping("/getCameras")
public AjaxResult getCameras(@RequestParam("pageNo") int pageNo, @RequestParam("pageSize") int pageSize){
Map<String, String> path = new HashMap<String, String>(2) {
{
//根据现场环境部署确认是http还是https
put("https://", GET_CAMERAS);
}
};
JSONObject jsonBody = new JSONObject();
jsonBody.put("pageNo", pageNo);
jsonBody.put("pageSize", pageSize);
jsonBody.put("treeCode", 0);
String body = jsonBody.toJSONString();
// post请求application/json类型参数
String result = ArtemisHttpUtil.doPostStringArtemis(path,body,null,null,"application/json",null);
return AjaxResult.success(JSONObject.parseObject(result));
}
/**
* 云控操作
* @param cameraIndexCode
* @param command
* @param action
* @return
*/
@RequestMapping("/videoControlling")
public AjaxResult videoControlling(@RequestParam("cameraIndexCode") String cameraIndexCode, @RequestParam("command") String command, @RequestParam("action") String action, @RequestParam("speed") String speed){
Map<String, String> path = new HashMap<String, String>(2) {
{
//根据现场环境部署确认是http还是https
put("https://", VEDIO_CONTROLLING);
}
};
JSONObject jsonBody = new JSONObject();
jsonBody.put("cameraIndexCode", cameraIndexCode);
jsonBody.put("action", action);
jsonBody.put("command", command);
jsonBody.put("speed", speed);
String body = jsonBody.toJSONString();
// post请求application/json类型参数
String result = ArtemisHttpUtil.doPostStringArtemis(path,body,null,null,"application/json",null);
return AjaxResult.success(JSONObject.parseObject(result));
}
/**
* 按事件类型订阅事件
* @param eventSubscriptionVo 事件订阅实体
* @return
*/
@PostMapping("/eventSubscriptionByEventTypes")
public AjaxResult eventSubscriptionByEventTypes(@RequestBody EventSubscriptionVo eventSubscriptionVo){
Map<String, String> path = new HashMap<String, String>(2) {
{
//根据现场环境部署确认是http还是https
put("https://", EVENT_SUBSCIRPTION_BY_ENVENTTYPES);
}
};
JSONObject jsonBody = new JSONObject();
jsonBody.put("eventTypes", eventSubscriptionVo.getEventTypes());
jsonBody.put("eventDest", eventSubscriptionVo.getEventDest());
if(eventSubscriptionVo.getSubType() !=0){
jsonBody.put("subType", eventSubscriptionVo.getSubType());
}
if(null !=eventSubscriptionVo.getEventLvl() && eventSubscriptionVo.getEventLvl().size() != 0){
jsonBody.put("eventLvl", eventSubscriptionVo.getEventLvl());
}
String body = jsonBody.toJSONString();
String result = ArtemisHttpUtil.doPostStringArtemis(path,body,null,null,"application/json",null);
return AjaxResult.success(JSONObject.parseObject(result));
}
/**
* 按事件类型取消订阅
* @param eventUnSubscriptionVo 事件类型
* @return
*/
@PostMapping("/eventUnSubscriptionByEventTypes")
public AjaxResult eventUnSubscriptionByEventTypes(@RequestBody EventUnSubscriptionVo eventUnSubscriptionVo){
Map<String, String> path = new HashMap<String, String>(2) {
{
//根据现场环境部署确认是http还是https
put("https://", EVENT_UNSUBSCRIPTION_BY_EVENTTYPES);
}
};
JSONObject jsonBody = new JSONObject();
jsonBody.put("eventTypes", eventUnSubscriptionVo.getEventTypes());
String body = jsonBody.toJSONString();
String result = ArtemisHttpUtil.doPostStringArtemis(path,body,null,null,"application/json",null);
return AjaxResult.success(JSONObject.parseObject(result));
}
}
......@@ -26,6 +26,9 @@ public class TVideoManage extends BaseEntity
@Excel(name = "视频资源号")
private String videoResource;
@Excel(name = "类型",readConverterExp = "1=华鑫,2=鸿海")
private String videoType;
/** 是否删除(0正常,1删除) */
private String isDel;
......@@ -79,6 +82,14 @@ public class TVideoManage extends BaseEntity
return remarks;
}
public String getVideoType() {
return videoType;
}
public void setVideoType(String videoType) {
this.videoType = videoType;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
......
......@@ -12,10 +12,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="createTime" column="create_time" />
<result property="isDel" column="is_del" />
<result property="remarks" column="remarks" />
<result property="videoType" column="video_type" />
</resultMap>
<sql id="selectTVideoManageVo">
select video_id, video_name, video_resource, create_by, create_time, is_del, remarks from t_video_manage
select video_id, video_name, video_resource, create_by, create_time, is_del, remarks, video_type from t_video_manage
</sql>
<select id="selectTVideoManageList" parameterType="TVideoManage" resultMap="TVideoManageResult">
......@@ -25,6 +26,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="videoResource != null and videoResource != ''"> and video_resource like concat('%', #{videoResource}, '%')</if>
<if test="isDel != null and isDel != ''"> and is_del = #{isDel}</if>
<if test="remarks != null and remarks != ''"> and remarks = #{remarks}</if>
<if test="videoType != null and videoType != ''"> and video_type = #{videoType}</if>
</where>
</select>
......@@ -42,6 +44,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createTime != null">create_time,</if>
<if test="isDel != null">is_del,</if>
<if test="remarks != null">remarks,</if>
<if test="videoType != null">video_type,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="videoName != null">#{videoName},</if>
......@@ -50,6 +53,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createTime != null">#{createTime},</if>
<if test="isDel != null">#{isDel},</if>
<if test="remarks != null">#{remarks},</if>
<if test="videoType != null">videoType,</if>
</trim>
</insert>
......@@ -61,7 +65,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="isDel != null">is_del = #{isDel},</if>
<if test="remarks != null">remarks = #{remarks},</if>
<if test="videoType != null">video_type = #{videoType},</if>
</trim>
where video_id = #{videoId}
</update>
......
import request from '@/utils/request'
/**
* api根地址
* @type {{"1": "华鑫", "2": "鸿海"}}
*/
const apiBaseConfig = {
'1': "/artemis",
'2': "/honghai/artemis"
};
// 查询视频地址
export function getPreviewURLs(query) {
export function getPreviewURLs(query,type='1') {
return request({
url: '/artemis/getPreviewURLs',
url: apiBaseConfig[type] + '/getPreviewURLs',
method: 'get',
params: query
})
}
// 云台控制
export function videoControlling(query) {
export function videoControlling(query,type='1') {
return request({
url: '/artemis/videoControlling',
url: apiBaseConfig[type] + '/videoControlling',
method: 'get',
params: query
})
}
......@@ -126,7 +126,7 @@ export default {
playVideo(data) {
this.videoName = data.videoName;
this.cameraIndexCode = data.videoResource;
getPreviewURLs({ cameraIndexCode: data.videoResource }).then((response) => {
getPreviewURLs({ cameraIndexCode: data.videoResource },data.videoType).then((response) => {
if (response.data.code == "0") {
this.videoOpenNum++;
let url = response.data.data.url;
......
......@@ -19,6 +19,17 @@
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="视频类型" prop="videoType">
<el-select
v-model="queryParams.videoType"
placeholder="请选择视频资类型"
clearable
size="small"
>
<el-option label="华鑫" value="1" />
<el-option label="鸿海" value="2" />
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
......@@ -76,6 +87,13 @@
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="视频名称" align="center" prop="videoName" />
<el-table-column label="视频资源号" align="center" prop="videoResource" />
<el-table-column label="视频类型" align="center" prop="videoType">
<template slot-scope="scope">
<span v-if="scope.row.videoType == '1'">华鑫</span>
<span v-else-if="scope.row.videoType == '2'">鸿海</span>
<span v-else>-</span>
</template>
</el-table-column>
<el-table-column label="备注" align="center" prop="remarks">
<template slot-scope="scope">
<span v-if="scope.row.remarks">{{ scope.row.remarks }}</span>
......@@ -119,6 +137,12 @@
<el-form-item label="视频资源号" prop="videoResource">
<el-input v-model="form.videoResource" placeholder="请输入视频资源号" />
</el-form-item>
<el-form-item label="视频资类型" prop="videoType">
<el-select v-model="form.videoType" placeholder="请选择视频资类型" style="width: 100%">
<el-option label="华鑫" value="1" />
<el-option label="鸿海" value="2" />
</el-select>
</el-form-item>
<el-form-item label="备注" prop="remarks">
<el-input type="textarea" v-model="form.remarks" placeholder="请输入备注" />
</el-form-item>
......@@ -168,7 +192,8 @@ export default {
videoName: null,
videoResource: null,
isDel: null,
remarks: null
remarks: null,
videoType: null
},
// 表单参数
form: {},
......@@ -179,6 +204,9 @@ export default {
],
videoResource: [
{ required: true, message: "视频资源号不能为空", trigger: "blur" }
],
videoType: [
{ required: true, message: "请选择视频类型", trigger: "change" }
]
}
};
......@@ -210,7 +238,8 @@ export default {
createBy: null,
createTime: null,
isDel: null,
remarks: null
remarks: null,
videoType: null
};
this.resetForm("form");
},
......
<template>
<div style="padding: 2px">
<div style="padding: 2px;">
<el-input
class="leftInput"
clearable
......@@ -8,6 +8,11 @@
@clear="search"
size="mini"/>
<el-button size="mini" type="primary" @click="search">搜索</el-button>
<el-tabs
v-model="activeName"
@tab-click="handleClick"
>
<el-tab-pane label="华鑫" name="1">
<el-tree class="leftTree" :data="data">
<div slot-scope="{ node, data }" @dblclick="handleNodeClick(data)" style="width:100%">
<div style="width:100%">
......@@ -17,6 +22,19 @@
</div>
</div>
</el-tree>
</el-tab-pane>
<el-tab-pane label="鸿海" name="2" :lazy="true">
<el-tree class="leftTree" :data="data">
<div slot-scope="{ node, data }" @dblclick="handleNodeClick(data)" style="width:100%">
<div style="width:100%">
<span class="tree_span ">
<i class=" el-icon-video-camera"/>{{data.videoName}}
</span>
</div>
</div>
</el-tree>
</el-tab-pane>
</el-tabs>
</div>
</template>
......@@ -29,7 +47,10 @@ export default {
return {
data: [],
videoName: "",
params: {}
params: {
videoType: "1"
},
activeName: "1"
};
},
created(){
......@@ -49,6 +70,10 @@ export default {
search(){
this.params.videoName = this.videoName;
this.getVideoInfo();
},
handleClick(tab, event) {
this.params.videoType = tab.name;
this.getVideoInfo();
}
}
}
......@@ -60,7 +85,22 @@ export default {
margin-right: 15px
}
.leftTree{
margin-top: 15px;
height: calc(100vh - 194px);
overflow-y: auto;
&::-webkit-scrollbar {
height: 6px;
width: 6px;
background: #dfe4ed;
position: absolute;
top: 0;
}
&::-webkit-scrollbar-thumb {
/*滚动条里面小方块*/
// border-radius: 10px;
// box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
background: #cccccc;
border-radius: 5px;
}
}
</style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment