From 6e67b1902e783b4a13a7d8e83fd894dda2e4f61e Mon Sep 17 00:00:00 2001 From: panlinlin <648540858@qq.com> Date: 星期一, 19 四月 2021 14:24:08 +0800 Subject: [PATCH] 解决更新通道导致的点播丢失 --- web_src/src/components/channelList.vue | 4 ++-- web_src/src/components/UiHeader.vue | 4 ++-- src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStoragerImpl.java | 6 ++++++ src/main/resources/application.yml | 2 +- src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java | 4 ++-- 5 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java index b98b66f..66162fc 100644 --- a/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java +++ b/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java @@ -16,10 +16,10 @@ @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>" + diff --git a/src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStoragerImpl.java b/src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStoragerImpl.java index 770fa5a..8354b56 100644 --- a/src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStoragerImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStoragerImpl.java @@ -2,7 +2,9 @@ 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 @@ @Autowired private GbStreamMapper gbStreamMapper; + @Autowired + private VideoStreamSessionManager streamSession; + /** * 鏍规嵁璁惧ID鍒ゆ柇璁惧鏄惁瀛樺湪 @@ -106,6 +111,7 @@ 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); diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index caf4dfc..ef46c2a 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -1,3 +1,3 @@ spring: profiles: - active: dev \ No newline at end of file + active: local \ No newline at end of file diff --git a/web_src/src/components/UiHeader.vue b/web_src/src/components/UiHeader.vue index e537953..af59f6f 100644 --- a/web_src/src/components/UiHeader.vue +++ b/web_src/src/components/UiHeader.vue @@ -59,8 +59,8 @@ sseControl() { let that = this; if (this.alarmNotify) { - console.log("鐢宠SSE鎺ㄩ�丄PI璋冪敤锛屾祻瑙堝櫒ID: " + this.$browserId); - this.sseSource = new EventSource('/api/emit?browserId=' + this.$browserId); + console.log("鐢宠SSE鎺ㄩ�丄PI璋冪敤锛屾祻瑙堝櫒ID: " + this.$browserId); + this.sseSource = new EventSource('/api/emit?browserId=' + this.$browserId); this.sseSource.addEventListener('message', function(evt) { that.$notify({ title: '鏀跺埌鎶ヨ淇℃伅', diff --git a/web_src/src/components/channelList.vue b/web_src/src/components/channelList.vue index 7dbed08..324eef4 100644 --- a/web_src/src/components/channelList.vue +++ b/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 @@ }, 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 @@ }, 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`, -- Gitblit v1.8.0