Commit 6e67b1902e783b4a13a7d8e83fd894dda2e4f61e
1 parent
57bbbc9f
解决更新通道导致的点播丢失
Showing
5 changed files
with
13 additions
and
7 deletions
src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java
| @@ -16,10 +16,10 @@ public interface DeviceChannelMapper { | @@ -16,10 +16,10 @@ public interface DeviceChannelMapper { | ||
| 16 | 16 | ||
| 17 | @Insert("INSERT INTO device_channel (channelId, deviceId, name, manufacture, model, owner, civilCode, block, " + | 17 | @Insert("INSERT INTO device_channel (channelId, deviceId, name, manufacture, model, owner, civilCode, block, " + |
| 18 | "address, parental, parentId, safetyWay, registerWay, certNum, certifiable, errCode, secrecy, " + | 18 | "address, parental, parentId, safetyWay, registerWay, certNum, certifiable, errCode, secrecy, " + |
| 19 | - "ipAddress, port, password, PTZType, status) " + | 19 | + "ipAddress, port, password, PTZType, status, streamId) " + |
| 20 | "VALUES ('${channelId}', '${deviceId}', '${name}', '${manufacture}', '${model}', '${owner}', '${civilCode}', '${block}'," + | 20 | "VALUES ('${channelId}', '${deviceId}', '${name}', '${manufacture}', '${model}', '${owner}', '${civilCode}', '${block}'," + |
| 21 | "'${address}', ${parental}, '${parentId}', ${safetyWay}, ${registerWay}, '${certNum}', ${certifiable}, ${errCode}, '${secrecy}', " + | 21 | "'${address}', ${parental}, '${parentId}', ${safetyWay}, ${registerWay}, '${certNum}', ${certifiable}, ${errCode}, '${secrecy}', " + |
| 22 | - "'${ipAddress}', ${port}, '${password}', ${PTZType}, ${status})") | 22 | + "'${ipAddress}', ${port}, '${password}', ${PTZType}, ${status}, '${streamId}')") |
| 23 | int add(DeviceChannel channel); | 23 | int add(DeviceChannel channel); |
| 24 | 24 | ||
| 25 | @Update(value = {" <script>" + | 25 | @Update(value = {" <script>" + |
src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStoragerImpl.java
| @@ -2,7 +2,9 @@ package com.genersoft.iot.vmp.storager.impl; | @@ -2,7 +2,9 @@ package com.genersoft.iot.vmp.storager.impl; | ||
| 2 | 2 | ||
| 3 | import java.util.*; | 3 | import java.util.*; |
| 4 | 4 | ||
| 5 | +import com.genersoft.iot.vmp.common.StreamInfo; | ||
| 5 | import com.genersoft.iot.vmp.gb28181.bean.*; | 6 | import com.genersoft.iot.vmp.gb28181.bean.*; |
| 7 | +import com.genersoft.iot.vmp.gb28181.session.VideoStreamSessionManager; | ||
| 6 | import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem; | 8 | import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem; |
| 7 | import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem; | 9 | import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem; |
| 8 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; | 10 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| @@ -60,6 +62,9 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager { | @@ -60,6 +62,9 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager { | ||
| 60 | @Autowired | 62 | @Autowired |
| 61 | private GbStreamMapper gbStreamMapper; | 63 | private GbStreamMapper gbStreamMapper; |
| 62 | 64 | ||
| 65 | + @Autowired | ||
| 66 | + private VideoStreamSessionManager streamSession; | ||
| 67 | + | ||
| 63 | 68 | ||
| 64 | /** | 69 | /** |
| 65 | * 根据设备ID判断设备是否存在 | 70 | * 根据设备ID判断设备是否存在 |
| @@ -106,6 +111,7 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager { | @@ -106,6 +111,7 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager { | ||
| 106 | public synchronized void updateChannel(String deviceId, DeviceChannel channel) { | 111 | public synchronized void updateChannel(String deviceId, DeviceChannel channel) { |
| 107 | String channelId = channel.getChannelId(); | 112 | String channelId = channel.getChannelId(); |
| 108 | channel.setDeviceId(deviceId); | 113 | channel.setDeviceId(deviceId); |
| 114 | + channel.setStreamId(streamSession.getStreamId(deviceId, channel.getChannelId())); | ||
| 109 | DeviceChannel deviceChannel = deviceChannelMapper.queryChannel(deviceId, channelId); | 115 | DeviceChannel deviceChannel = deviceChannelMapper.queryChannel(deviceId, channelId); |
| 110 | if (deviceChannel == null) { | 116 | if (deviceChannel == null) { |
| 111 | deviceChannelMapper.add(channel); | 117 | deviceChannelMapper.add(channel); |
src/main/resources/application.yml
web_src/src/components/UiHeader.vue
| @@ -59,8 +59,8 @@ export default { | @@ -59,8 +59,8 @@ export default { | ||
| 59 | sseControl() { | 59 | sseControl() { |
| 60 | let that = this; | 60 | let that = this; |
| 61 | if (this.alarmNotify) { | 61 | if (this.alarmNotify) { |
| 62 | - console.log("申请SSE推送API调用,浏览器ID: " + this.$browserId); | ||
| 63 | - this.sseSource = new EventSource('/api/emit?browserId=' + this.$browserId); | 62 | + console.log("申请SSE推送API调用,浏览器ID: " + this.$browserId); |
| 63 | + this.sseSource = new EventSource('/api/emit?browserId=' + this.$browserId); | ||
| 64 | this.sseSource.addEventListener('message', function(evt) { | 64 | this.sseSource.addEventListener('message', function(evt) { |
| 65 | that.$notify({ | 65 | that.$notify({ |
| 66 | title: '收到报警信息', | 66 | title: '收到报警信息', |
web_src/src/components/channelList.vue
| 1 | <template> | 1 | <template> |
| 2 | <div id="channelList"> | 2 | <div id="channelList"> |
| 3 | <el-container> | 3 | <el-container> |
| 4 | - | ||
| 5 | <el-header> | 4 | <el-header> |
| 6 | <uiHeader></uiHeader> | 5 | <uiHeader></uiHeader> |
| 7 | </el-header> | 6 | </el-header> |
| @@ -118,7 +117,7 @@ export default { | @@ -118,7 +117,7 @@ export default { | ||
| 118 | }, | 117 | }, |
| 119 | methods: { | 118 | methods: { |
| 120 | initData: function () { | 119 | initData: function () { |
| 121 | - if (this.parentChannelId == "" || this.parentChannelId == 0) { | 120 | + if (typeof (this.parentChannelId) == "undefined" || this.parentChannelId == 0) { |
| 122 | this.getDeviceChannelList(); | 121 | this.getDeviceChannelList(); |
| 123 | } else { | 122 | } else { |
| 124 | this.showSubchannels(); | 123 | this.showSubchannels(); |
| @@ -153,6 +152,7 @@ export default { | @@ -153,6 +152,7 @@ export default { | ||
| 153 | }, | 152 | }, |
| 154 | getDeviceChannelList: function () { | 153 | getDeviceChannelList: function () { |
| 155 | let that = this; | 154 | let that = this; |
| 155 | + if (typeof (this.$route.params.deviceId) == "undefined") return; | ||
| 156 | this.$axios({ | 156 | this.$axios({ |
| 157 | method: 'get', | 157 | method: 'get', |
| 158 | url: `/api/device/query/devices/${this.$route.params.deviceId}/channels`, | 158 | url: `/api/device/query/devices/${this.$route.params.deviceId}/channels`, |