Commit 16ea099e authored by 耿迪迪's avatar 耿迪迪

视频监控 gengdidi

parent 6ac8be6c
......@@ -61,6 +61,13 @@
<artifactId>gassafetyprogress-generator</artifactId>
</dependency>
<!--海康-->
<dependency>
<groupId>com.hikvision.ga</groupId>
<artifactId>artemis-http-client</artifactId>
<version>1.1.3</version>
</dependency>
</dependencies>
<build>
......
......@@ -41,7 +41,7 @@ JAVA_MEM_OPTS="-server -Xms2048M -Xmx2048M -Xmn1024M"
echo -e "Starting the GassafetyProgressApplication ...\c"
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$DEPLOY_DIR/libs/linux_64
nohup java -Dlog.path=$LOGS_DIR -Dapp.home=$DEPLOY_DIR $JAVA_OPTS $JAVA_MEM_OPTS $JAVA_DEBUG_OPTS $JAVA_JMX_OPTS -classpath $CONF_DIR:$LIB_JARS $APP_MAINCLASS >/dev/null 2>&1
nohup java -Dlog.path=$LOGS_DIR -Dapp.home=$DEPLOY_DIR $JAVA_OPTS $JAVA_MEM_OPTS $JAVA_DEBUG_OPTS $JAVA_JMX_OPTS -classpath $CONF_DIR:$LIB_JARS $APP_MAINCLASS >/dev/null 2>&1 &
sleep 1
echo "started"
PIDS=`ps -ef | grep java | grep "$DEPLOY_DIR" | awk '{print $2}'`
......
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 lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap;
import java.util.Map;
/**
* 海康视频接口
*/
@RestController
@RequestMapping("artemis")
@Slf4j
public class ArtemisController {
/**
* 请根据自己的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 = "222.223.203.154:1443";
// 秘钥appkey
ArtemisConfig.appKey = "24786595";
// 秘钥appSecret
ArtemisConfig.appSecret = "AxzrQTvNWvSVKjKbYGOn";
}
/**
* 能力开放平台的网站路径
*/
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";
/**
* 获取监控点预览取流URL
* @return
*/
@GetMapping("/getPreviewURLs")
public Object 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", 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 Object 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 JSONObject.parseObject(result);
}
/**
* 云控操作
* @param cameraIndexCode
* @param command
* @param action
* @return
*/
@RequestMapping("/videoControlling")
public Object videoControlling(@RequestParam("cameraIndexCode") String cameraIndexCode, @RequestParam("command") String command, @RequestParam("action") String action){
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", 40);
String body = jsonBody.toJSONString();
// post请求application/json类型参数
String result = ArtemisHttpUtil.doPostStringArtemis(path,body,null,null,"application/json",null);
return JSONObject.parseObject(result);
}
}
package com.zehong.web.controller.video;
import com.zehong.common.annotation.Log;
import com.zehong.common.core.controller.BaseController;
import com.zehong.common.core.domain.AjaxResult;
import com.zehong.common.core.page.TableDataInfo;
import com.zehong.common.enums.BusinessType;
import com.zehong.common.utils.poi.ExcelUtil;
import com.zehong.system.domain.TEnterpriseInfo;
import com.zehong.system.domain.TVideoManager;
import com.zehong.system.domain.vo.EnterpriseVideoTreeNode;
import com.zehong.system.service.ITEnterpriseInfoService;
import com.zehong.system.service.ITVideoManagerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
/**
* 视频管理Controller
*
* @author zehong
* @date 2022-02-15
*/
@RestController
@RequestMapping("/system/manager")
public class TVideoManagerController extends BaseController
{
@Autowired
private ITVideoManagerService tVideoManagerService;
@Autowired
private ITEnterpriseInfoService itEmployedPeopleInfoService;
/**
* 查询视频管理列表
*/
@PreAuthorize("@ss.hasPermi('system:manager:list')")
@GetMapping("/list")
public TableDataInfo list(TVideoManager tVideoManager)
{
startPage();
List<TVideoManager> list = tVideoManagerService.selectTVideoManagerList(tVideoManager);
return getDataTable(list);
}
/**
* 导出视频管理列表
*/
@PreAuthorize("@ss.hasPermi('system:manager:export')")
@Log(title = "视频管理", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(TVideoManager tVideoManager)
{
List<TVideoManager> list = tVideoManagerService.selectTVideoManagerList(tVideoManager);
ExcelUtil<TVideoManager> util = new ExcelUtil<TVideoManager>(TVideoManager.class);
return util.exportExcel(list, "视频管理数据");
}
/**
* 获取视频tree
* @param tVideoManager
* @return
*/
@GetMapping("/getVideoTree")
public AjaxResult getVideoTree(TVideoManager tVideoManager){
List<EnterpriseVideoTreeNode> enterpriseVideoList = new ArrayList<>();
//I级树
EnterpriseVideoTreeNode enterpriseVideoFirst = new EnterpriseVideoTreeNode();
List<EnterpriseVideoTreeNode> enterpriseVideoFirstChildrnList = new ArrayList<>();
enterpriseVideoFirst.setVideoName("企业监控");
enterpriseVideoFirst.setLevel("1");
List<TEnterpriseInfo> tEnterpriseInfos = itEmployedPeopleInfoService.selectTEnterpriseInfoList(new TEnterpriseInfo());
for(TEnterpriseInfo tEnterpriseInfo : tEnterpriseInfos){
//II级树
EnterpriseVideoTreeNode enterpriseVideoSecond= new EnterpriseVideoTreeNode();
List<EnterpriseVideoTreeNode> enterpriseVideoSecondChildrenList = new ArrayList<>();
enterpriseVideoSecond.setVideoName(tEnterpriseInfo.getEnterpriseName());
enterpriseVideoSecond.setLevel("2");
tVideoManager.setBeyondEnterpriseId(tEnterpriseInfo.getEnterpriseId());
List<TVideoManager> tVideoManagers = tVideoManagerService.selectTVideoManagerList(tVideoManager);
for(TVideoManager manager : tVideoManagers){
//III级树
EnterpriseVideoTreeNode enterpriseVideoThird= new EnterpriseVideoTreeNode();
enterpriseVideoThird.setVideoName(manager.getVideoName());
enterpriseVideoThird.setResourceId(manager.getResourceId());
enterpriseVideoThird.setLevel("3");
enterpriseVideoSecondChildrenList.add(enterpriseVideoThird);
}
enterpriseVideoSecond.setChildrenVideo(enterpriseVideoSecondChildrenList);
enterpriseVideoFirstChildrnList.add(enterpriseVideoSecond);
}
enterpriseVideoFirst.setChildrenVideo(enterpriseVideoFirstChildrnList);
enterpriseVideoList.add(enterpriseVideoFirst);
return AjaxResult.success(enterpriseVideoList);
}
/**
* 获取视频管理详细信息
*/
@PreAuthorize("@ss.hasPermi('system:manager:query')")
@GetMapping(value = "/{videoManagerId}")
public AjaxResult getInfo(@PathVariable("videoManagerId") Long videoManagerId)
{
return AjaxResult.success(tVideoManagerService.selectTVideoManagerById(videoManagerId));
}
/**
* 新增视频管理
*/
@PreAuthorize("@ss.hasPermi('system:manager:add')")
@Log(title = "视频管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody TVideoManager tVideoManager)
{
return toAjax(tVideoManagerService.insertTVideoManager(tVideoManager));
}
/**
* 修改视频管理
*/
@PreAuthorize("@ss.hasPermi('system:manager:edit')")
@Log(title = "视频管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody TVideoManager tVideoManager)
{
return toAjax(tVideoManagerService.updateTVideoManager(tVideoManager));
}
/**
* 删除视频管理
*/
@PreAuthorize("@ss.hasPermi('system:manager:remove')")
@Log(title = "视频管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{videoManagerIds}")
public AjaxResult remove(@PathVariable Long[] videoManagerIds)
{
return toAjax(tVideoManagerService.deleteTVideoManagerByIds(videoManagerIds));
}
}
package com.zehong.system.domain;
import java.math.BigDecimal;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.zehong.common.annotation.Excel;
import com.zehong.common.core.domain.BaseEntity;
/**
* 视频管理对象 t_video_manager
*
* @author zehong
* @date 2022-02-15
*/
public class TVideoManager extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 视频管理id */
private Long videoManagerId;
/** 视频名称 */
@Excel(name = "视频名称")
private String videoName;
/** 视频资源id */
@Excel(name = "视频资源id")
private String resourceId;
/** 经度 */
@Excel(name = "经度")
private BigDecimal longitude;
/** 纬度 */
@Excel(name = "纬度")
private BigDecimal latitude;
/** 视频地址 */
@Excel(name = "视频地址")
private String videoAddress;
/** 视频类型 */
@Excel(name = "视频类型")
private String type;
/** 所属企业 */
@Excel(name = "所属企业")
private Long beyondEnterpriseId;
/** 所属企业名称 */
@Excel(name = "所属企业名称")
private String beyondEnterpriseName;
/** 是否删除(0正常,1删除) */
@Excel(name = "是否删除(0正常,1删除)")
private String isDel;
/** 备注 */
@Excel(name = "备注")
private String remarks;
public void setVideoManagerId(Long videoManagerId)
{
this.videoManagerId = videoManagerId;
}
public Long getVideoManagerId()
{
return videoManagerId;
}
public void setVideoName(String videoName)
{
this.videoName = videoName;
}
public String getVideoName()
{
return videoName;
}
public void setResourceId(String resourceId)
{
this.resourceId = resourceId;
}
public String getResourceId()
{
return resourceId;
}
public void setLongitude(BigDecimal longitude)
{
this.longitude = longitude;
}
public BigDecimal getLongitude()
{
return longitude;
}
public void setLatitude(BigDecimal latitude)
{
this.latitude = latitude;
}
public BigDecimal getLatitude()
{
return latitude;
}
public void setVideoAddress(String videoAddress)
{
this.videoAddress = videoAddress;
}
public String getVideoAddress()
{
return videoAddress;
}
public void setType(String type)
{
this.type = type;
}
public String getType()
{
return type;
}
public void setBeyondEnterpriseId(Long beyondEnterpriseId)
{
this.beyondEnterpriseId = beyondEnterpriseId;
}
public Long getBeyondEnterpriseId()
{
return beyondEnterpriseId;
}
public void setBeyondEnterpriseName(String beyondEnterpriseName)
{
this.beyondEnterpriseName = beyondEnterpriseName;
}
public String getBeyondEnterpriseName()
{
return beyondEnterpriseName;
}
public void setIsDel(String isDel)
{
this.isDel = isDel;
}
public String getIsDel()
{
return isDel;
}
public void setRemarks(String remarks)
{
this.remarks = remarks;
}
public String getRemarks()
{
return remarks;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("videoManagerId", getVideoManagerId())
.append("videoName", getVideoName())
.append("resourceId", getResourceId())
.append("longitude", getLongitude())
.append("latitude", getLatitude())
.append("videoAddress", getVideoAddress())
.append("type", getType())
.append("beyondEnterpriseId", getBeyondEnterpriseId())
.append("beyondEnterpriseName", getBeyondEnterpriseName())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("isDel", getIsDel())
.append("remarks", getRemarks())
.toString();
}
}
package com.zehong.system.domain.vo;
import com.zehong.system.domain.TEnterpriseInfo;
import com.zehong.system.domain.TVideoManager;
import java.util.List;
/**
* 企业视频树
*/
public class EnterpriseVideoTreeNode {
/**视频名称*/
private String videoName;
/**视频资源号*/
private String resourceId;
//菜单级别
private String level;
private List<EnterpriseVideoTreeNode> childrenVideo;
public String getVideoName() {
return videoName;
}
public void setVideoName(String videoName) {
this.videoName = videoName;
}
public String getResourceId() {
return resourceId;
}
public void setResourceId(String resourceId) {
this.resourceId = resourceId;
}
public String getLevel() {
return level;
}
public void setLevel(String level) {
this.level = level;
}
public List<EnterpriseVideoTreeNode> getChildrenVideo() {
return childrenVideo;
}
public void setChildrenVideo(List<EnterpriseVideoTreeNode> childrenVideo) {
this.childrenVideo = childrenVideo;
}
}
package com.zehong.system.mapper;
import java.util.List;
import com.zehong.system.domain.TVideoManager;
/**
* 视频管理Mapper接口
*
* @author zehong
* @date 2022-02-15
*/
public interface TVideoManagerMapper
{
/**
* 查询视频管理
*
* @param videoManagerId 视频管理ID
* @return 视频管理
*/
public TVideoManager selectTVideoManagerById(Long videoManagerId);
/**
* 查询视频管理列表
*
* @param tVideoManager 视频管理
* @return 视频管理集合
*/
public List<TVideoManager> selectTVideoManagerList(TVideoManager tVideoManager);
/**
* 新增视频管理
*
* @param tVideoManager 视频管理
* @return 结果
*/
public int insertTVideoManager(TVideoManager tVideoManager);
/**
* 修改视频管理
*
* @param tVideoManager 视频管理
* @return 结果
*/
public int updateTVideoManager(TVideoManager tVideoManager);
/**
* 删除视频管理
*
* @param videoManagerId 视频管理ID
* @return 结果
*/
public int deleteTVideoManagerById(Long videoManagerId);
/**
* 批量删除视频管理
*
* @param videoManagerIds 需要删除的数据ID
* @return 结果
*/
public int deleteTVideoManagerByIds(Long[] videoManagerIds);
}
package com.zehong.system.service;
import java.util.List;
import com.zehong.system.domain.TVideoManager;
/**
* 视频管理Service接口
*
* @author zehong
* @date 2022-02-15
*/
public interface ITVideoManagerService
{
/**
* 查询视频管理
*
* @param videoManagerId 视频管理ID
* @return 视频管理
*/
public TVideoManager selectTVideoManagerById(Long videoManagerId);
/**
* 查询视频管理列表
*
* @param tVideoManager 视频管理
* @return 视频管理集合
*/
public List<TVideoManager> selectTVideoManagerList(TVideoManager tVideoManager);
/**
* 新增视频管理
*
* @param tVideoManager 视频管理
* @return 结果
*/
public int insertTVideoManager(TVideoManager tVideoManager);
/**
* 修改视频管理
*
* @param tVideoManager 视频管理
* @return 结果
*/
public int updateTVideoManager(TVideoManager tVideoManager);
/**
* 批量删除视频管理
*
* @param videoManagerIds 需要删除的视频管理ID
* @return 结果
*/
public int deleteTVideoManagerByIds(Long[] videoManagerIds);
/**
* 删除视频管理信息
*
* @param videoManagerId 视频管理ID
* @return 结果
*/
public int deleteTVideoManagerById(Long videoManagerId);
}
package com.zehong.system.service.impl;
import java.util.List;
import com.zehong.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zehong.system.mapper.TVideoManagerMapper;
import com.zehong.system.domain.TVideoManager;
import com.zehong.system.service.ITVideoManagerService;
/**
* 视频管理Service业务层处理
*
* @author zehong
* @date 2022-02-15
*/
@Service
public class TVideoManagerServiceImpl implements ITVideoManagerService
{
@Autowired
private TVideoManagerMapper tVideoManagerMapper;
/**
* 查询视频管理
*
* @param videoManagerId 视频管理ID
* @return 视频管理
*/
@Override
public TVideoManager selectTVideoManagerById(Long videoManagerId)
{
return tVideoManagerMapper.selectTVideoManagerById(videoManagerId);
}
/**
* 查询视频管理列表
*
* @param tVideoManager 视频管理
* @return 视频管理
*/
@Override
public List<TVideoManager> selectTVideoManagerList(TVideoManager tVideoManager)
{
return tVideoManagerMapper.selectTVideoManagerList(tVideoManager);
}
/**
* 新增视频管理
*
* @param tVideoManager 视频管理
* @return 结果
*/
@Override
public int insertTVideoManager(TVideoManager tVideoManager)
{
tVideoManager.setCreateTime(DateUtils.getNowDate());
return tVideoManagerMapper.insertTVideoManager(tVideoManager);
}
/**
* 修改视频管理
*
* @param tVideoManager 视频管理
* @return 结果
*/
@Override
public int updateTVideoManager(TVideoManager tVideoManager)
{
tVideoManager.setUpdateTime(DateUtils.getNowDate());
return tVideoManagerMapper.updateTVideoManager(tVideoManager);
}
/**
* 批量删除视频管理
*
* @param videoManagerIds 需要删除的视频管理ID
* @return 结果
*/
@Override
public int deleteTVideoManagerByIds(Long[] videoManagerIds)
{
return tVideoManagerMapper.deleteTVideoManagerByIds(videoManagerIds);
}
/**
* 删除视频管理信息
*
* @param videoManagerId 视频管理ID
* @return 结果
*/
@Override
public int deleteTVideoManagerById(Long videoManagerId)
{
return tVideoManagerMapper.deleteTVideoManagerById(videoManagerId);
}
}
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zehong.system.mapper.TVideoManagerMapper">
<resultMap type="TVideoManager" id="TVideoManagerResult">
<result property="videoManagerId" column="video_manager_id" />
<result property="videoName" column="video_name" />
<result property="resourceId" column="resource_id" />
<result property="longitude" column="longitude" />
<result property="latitude" column="latitude" />
<result property="videoAddress" column="video_address" />
<result property="type" column="type" />
<result property="beyondEnterpriseId" column="beyond_enterprise_id" />
<result property="beyondEnterpriseName" column="beyond_enterprise_name" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="isDel" column="is_del" />
<result property="remarks" column="remarks" />
</resultMap>
<sql id="selectTVideoManagerVo">
select video_manager_id, video_name, resource_id, longitude, latitude, video_address, type, beyond_enterprise_id, beyond_enterprise_name, create_by, create_time, update_by, update_time, is_del, remarks from t_video_manager
</sql>
<select id="selectTVideoManagerList" parameterType="TVideoManager" resultMap="TVideoManagerResult">
<include refid="selectTVideoManagerVo"/>
<where>
<if test="videoName != null and videoName != ''"> and video_name like concat('%', #{videoName}, '%')</if>
<if test="resourceId != null and resourceId != ''"> and resource_id = #{resourceId}</if>
<if test="longitude != null "> and longitude = #{longitude}</if>
<if test="latitude != null "> and latitude = #{latitude}</if>
<if test="videoAddress != null and videoAddress != ''"> and video_address = #{videoAddress}</if>
<if test="type != null and type != ''"> and type = #{type}</if>
<if test="beyondEnterpriseId != null "> and beyond_enterprise_id = #{beyondEnterpriseId}</if>
<if test="beyondEnterpriseName != null and beyondEnterpriseName != ''"> and beyond_enterprise_name like concat('%', #{beyondEnterpriseName}, '%')</if>
<if test="isDel != null and isDel != ''"> and is_del = #{isDel}</if>
<if test="remarks != null and remarks != ''"> and remarks = #{remarks}</if>
</where>
</select>
<select id="selectTVideoManagerById" parameterType="Long" resultMap="TVideoManagerResult">
<include refid="selectTVideoManagerVo"/>
where video_manager_id = #{videoManagerId}
</select>
<insert id="insertTVideoManager" parameterType="TVideoManager" useGeneratedKeys="true" keyProperty="videoManagerId">
insert into t_video_manager
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="videoName != null">video_name,</if>
<if test="resourceId != null">resource_id,</if>
<if test="longitude != null">longitude,</if>
<if test="latitude != null">latitude,</if>
<if test="videoAddress != null">video_address,</if>
<if test="type != null">type,</if>
<if test="beyondEnterpriseId != null">beyond_enterprise_id,</if>
<if test="beyondEnterpriseName != null">beyond_enterprise_name,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="isDel != null">is_del,</if>
<if test="remarks != null">remarks,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="videoName != null">#{videoName},</if>
<if test="resourceId != null">#{resourceId},</if>
<if test="longitude != null">#{longitude},</if>
<if test="latitude != null">#{latitude},</if>
<if test="videoAddress != null">#{videoAddress},</if>
<if test="type != null">#{type},</if>
<if test="beyondEnterpriseId != null">#{beyondEnterpriseId},</if>
<if test="beyondEnterpriseName != null">#{beyondEnterpriseName},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="isDel != null">#{isDel},</if>
<if test="remarks != null">#{remarks},</if>
</trim>
</insert>
<update id="updateTVideoManager" parameterType="TVideoManager">
update t_video_manager
<trim prefix="SET" suffixOverrides=",">
<if test="videoName != null">video_name = #{videoName},</if>
<if test="resourceId != null">resource_id = #{resourceId},</if>
<if test="longitude != null">longitude = #{longitude},</if>
<if test="latitude != null">latitude = #{latitude},</if>
<if test="videoAddress != null">video_address = #{videoAddress},</if>
<if test="type != null">type = #{type},</if>
<if test="beyondEnterpriseId != null">beyond_enterprise_id = #{beyondEnterpriseId},</if>
<if test="beyondEnterpriseName != null">beyond_enterprise_name = #{beyondEnterpriseName},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="isDel != null">is_del = #{isDel},</if>
<if test="remarks != null">remarks = #{remarks},</if>
</trim>
where video_manager_id = #{videoManagerId}
</update>
<delete id="deleteTVideoManagerById" parameterType="Long">
delete from t_video_manager where video_manager_id = #{videoManagerId}
</delete>
<delete id="deleteTVideoManagerByIds" parameterType="String">
delete from t_video_manager where video_manager_id in
<foreach item="videoManagerId" collection="array" open="(" separator="," close=")">
#{videoManagerId}
</foreach>
</delete>
</mapper>
\ No newline at end of file
......@@ -9,6 +9,7 @@
<title><%= webpackConfig.name %></title>
<!--[if lt IE 11]><script>window.location.href='/html/ie.html';</script><![endif]-->
<script src="https://webapi.amap.com/maps?v=2.0&key=eed7ca3167f765467aa377fa78e61ece&plugin=Map3D,AMap.DistrictSearch,AMap.Scale,AMap.OverView,AMap.ToolBar,AMap.MouseTool,AMap.ControlBar,AMap.CircleEditor,AMap.PolyEditor"></script>
<script src="h5player/h5player.min.js"></script>
<style>
html,
body,
......
import request from '@/utils/request'
// 查询视频地址
export function getPreviewURLs(query) {
return request({
url: '/artemis/getPreviewURLs',
method: 'get',
params: query
})
}
import request from '@/utils/request'
// 查询视频管理列表
export function listManager(query) {
return request({
url: '/system/manager/list',
method: 'get',
params: query
})
}
//获取视频树
export function getVideoTree(query) {
return request({
url: '/system/manager/getVideoTree',
method: 'get',
params: query
})
}
// 查询视频管理详细
export function getManager(videoManagerId) {
return request({
url: '/system/manager/' + videoManagerId,
method: 'get'
})
}
// 新增视频管理
export function addManager(data) {
return request({
url: '/system/manager',
method: 'post',
data: data
})
}
// 修改视频管理
export function updateManager(data) {
return request({
url: '/system/manager',
method: 'put',
data: data
})
}
// 删除视频管理
export function delManager(videoManagerId) {
return request({
url: '/system/manager/' + videoManagerId,
method: 'delete'
})
}
// 导出视频管理
export function exportManager(query) {
return request({
url: '/system/manager/export',
method: 'get',
params: query
})
}
<template>
<div class="app-container">
<el-row>
<el-col :span="5">
<el-tree :data="videoData" :props="defaultProps" @node-click="handleNodeClick"></el-tree>
</el-col>
<el-col :span="19">
<div id="player" style="width: calc(67vw - 8px);height: calc((67vw - 8px) * 5 / 8)"></div>
</el-col>
</el-row>
</div>
</template>
<!--<script src="@api/video/h5player.js"></script>-->
<script>
import { getVideoTree } from "@/api/video/manager";
import { getPreviewURLs } from "@/api/video/artemis"
const IS_MOVE_DEVICE = document.body.clientWidth < 992 // 是否移动设备
const MSE_IS_SUPPORT = !!window.MediaSource // 是否支持mse
export default {
name: "Video",
components: {
},
data() {
return {
videoData: [],
defaultProps: {
children: 'childrenVideo',
label: 'videoName'
},
queryParam: {
cameraIndexCode: ""
},
player: null,
videoOpenNum: -1,
cameraIndexCode: ""
}
},
created() {
this.getVideoData();
},
methods: {
getVideoData(){
getVideoTree().then(response =>{
this.videoData = response.data;
})
},
handleNodeClick(data){
if(this.cameraIndexCode == data.resourceId){
return;
}
this.cameraIndexCode = data.resourceId;
if(data.resourceId){
this.queryParam.cameraIndexCode = data.resourceId;
getPreviewURLs(this.queryParam).then(response =>{
if(response.data.code == '0'){
this.videoOpenNum++;
let url = response.data.data.url;
//let index = this.player.currentWindowIndex;
this.player.JS_Play(url,{playURL: url, mode:"0" }, this.videoOpenNum%4).then(() => {
console.log('realplay success')
},
e => { console.error(e) }
)
}
});
}
},
init() {
// 设置播放容器的宽高并监听窗口大小变化
window.addEventListener('resize', () => {
this.player.JS_Resize()
})
},
createPlayer() {
this.player = new window.JSPlugin({
szId: 'player',
szBasePath: "/h5player",
iMaxSplit: 4,
iCurrentSplit: IS_MOVE_DEVICE ? 1 : 2,
openDebug: true,
oStyle: {
borderSelect: IS_MOVE_DEVICE ? '#000' : '#FFCC00',
}
})
},
loadScript(src){
return new Promise(reslove =>{
let scpritE1 = document.createElement("script");
scpritE1.type = "text/javascript";
scpritE1.src = src;
scpritE1.onload = () => {
reslove();
}
document.body.appendChild(scpritE1);
})
}
},
mounted() {
//this.$el.style.setProperty('display', 'block')
if(!window.JSPlugin){
this.loadScript("/h5player/h5player.min.js").then(() =>{
this.createPlayer();
this.init()
})
}else{
this.createPlayer();
this.init()
}
}
};
</script>
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