Browse Source

解决更新通道导致的点播丢失

pull/93/head
panlinlin 4 years ago
parent
commit
6e67b1902e
  1. 4
      src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java
  2. 6
      src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStoragerImpl.java
  3. 2
      src/main/resources/application.yml
  4. 4
      web_src/src/components/channelList.vue

4
src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java

@ -16,10 +16,10 @@ public interface DeviceChannelMapper {
@Insert("INSERT INTO device_channel (channelId, deviceId, name, manufacture, model, owner, civilCode, block, " +
"address, parental, parentId, safetyWay, registerWay, certNum, certifiable, errCode, secrecy, " +
"ipAddress, port, password, PTZType, status) " +
"ipAddress, port, password, PTZType, status, streamId) " +
"VALUES ('${channelId}', '${deviceId}', '${name}', '${manufacture}', '${model}', '${owner}', '${civilCode}', '${block}'," +
"'${address}', ${parental}, '${parentId}', ${safetyWay}, ${registerWay}, '${certNum}', ${certifiable}, ${errCode}, '${secrecy}', " +
"'${ipAddress}', ${port}, '${password}', ${PTZType}, ${status})")
"'${ipAddress}', ${port}, '${password}', ${PTZType}, ${status}, '${streamId}')")
int add(DeviceChannel channel);
@Update(value = {" <script>" +

6
src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStoragerImpl.java

@ -2,7 +2,9 @@ package com.genersoft.iot.vmp.storager.impl;
import java.util.*;
import com.genersoft.iot.vmp.common.StreamInfo;
import com.genersoft.iot.vmp.gb28181.bean.*;
import com.genersoft.iot.vmp.gb28181.session.VideoStreamSessionManager;
import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem;
import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem;
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
@ -60,6 +62,9 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager {
@Autowired
private GbStreamMapper gbStreamMapper;
@Autowired
private VideoStreamSessionManager streamSession;
/**
* 根据设备ID判断设备是否存在
@ -106,6 +111,7 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager {
public synchronized void updateChannel(String deviceId, DeviceChannel channel) {
String channelId = channel.getChannelId();
channel.setDeviceId(deviceId);
channel.setStreamId(streamSession.getStreamId(deviceId, channel.getChannelId()));
DeviceChannel deviceChannel = deviceChannelMapper.queryChannel(deviceId, channelId);
if (deviceChannel == null) {
deviceChannelMapper.add(channel);

2
src/main/resources/application.yml

@ -1,3 +1,3 @@
spring:
profiles:
active: dev
active: local

4
web_src/src/components/channelList.vue

@ -1,7 +1,6 @@
<template>
<div id="channelList">
<el-container>
<el-header>
<uiHeader></uiHeader>
</el-header>
@ -118,7 +117,7 @@ export default {
},
methods: {
initData: function () {
if (this.parentChannelId == "" || this.parentChannelId == 0) {
if (typeof (this.parentChannelId) == "undefined" || this.parentChannelId == 0) {
this.getDeviceChannelList();
} else {
this.showSubchannels();
@ -153,6 +152,7 @@ export default {
},
getDeviceChannelList: function () {
let that = this;
if (typeof (this.$route.params.deviceId) == "undefined") return;
this.$axios({
method: 'get',
url: `/api/device/query/devices/${this.$route.params.deviceId}/channels`,

Loading…
Cancel
Save