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 | 16 | |
| 17 | 17 | @Insert("INSERT INTO device_channel (channelId, deviceId, name, manufacture, model, owner, civilCode, block, " + |
| 18 | 18 | "address, parental, parentId, safetyWay, registerWay, certNum, certifiable, errCode, secrecy, " + |
| 19 | - "ipAddress, port, password, PTZType, status) " + | |
| 19 | + "ipAddress, port, password, PTZType, status, streamId) " + | |
| 20 | 20 | "VALUES ('${channelId}', '${deviceId}', '${name}', '${manufacture}', '${model}', '${owner}', '${civilCode}', '${block}'," + |
| 21 | 21 | "'${address}', ${parental}, '${parentId}', ${safetyWay}, ${registerWay}, '${certNum}', ${certifiable}, ${errCode}, '${secrecy}', " + |
| 22 | - "'${ipAddress}', ${port}, '${password}', ${PTZType}, ${status})") | |
| 22 | + "'${ipAddress}', ${port}, '${password}', ${PTZType}, ${status}, '${streamId}')") | |
| 23 | 23 | int add(DeviceChannel channel); |
| 24 | 24 | |
| 25 | 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 | 2 | |
| 3 | 3 | import java.util.*; |
| 4 | 4 | |
| 5 | +import com.genersoft.iot.vmp.common.StreamInfo; | |
| 5 | 6 | import com.genersoft.iot.vmp.gb28181.bean.*; |
| 7 | +import com.genersoft.iot.vmp.gb28181.session.VideoStreamSessionManager; | |
| 6 | 8 | import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem; |
| 7 | 9 | import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem; |
| 8 | 10 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| ... | ... | @@ -60,6 +62,9 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager { |
| 60 | 62 | @Autowired |
| 61 | 63 | private GbStreamMapper gbStreamMapper; |
| 62 | 64 | |
| 65 | + @Autowired | |
| 66 | + private VideoStreamSessionManager streamSession; | |
| 67 | + | |
| 63 | 68 | |
| 64 | 69 | /** |
| 65 | 70 | * 根据设备ID判断设备是否存在 |
| ... | ... | @@ -106,6 +111,7 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager { |
| 106 | 111 | public synchronized void updateChannel(String deviceId, DeviceChannel channel) { |
| 107 | 112 | String channelId = channel.getChannelId(); |
| 108 | 113 | channel.setDeviceId(deviceId); |
| 114 | + channel.setStreamId(streamSession.getStreamId(deviceId, channel.getChannelId())); | |
| 109 | 115 | DeviceChannel deviceChannel = deviceChannelMapper.queryChannel(deviceId, channelId); |
| 110 | 116 | if (deviceChannel == null) { |
| 111 | 117 | deviceChannelMapper.add(channel); | ... | ... |
src/main/resources/application.yml
web_src/src/components/UiHeader.vue
| ... | ... | @@ -59,8 +59,8 @@ export default { |
| 59 | 59 | sseControl() { |
| 60 | 60 | let that = this; |
| 61 | 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 | 64 | this.sseSource.addEventListener('message', function(evt) { |
| 65 | 65 | that.$notify({ |
| 66 | 66 | title: '收到报警信息', | ... | ... |
web_src/src/components/channelList.vue
| 1 | 1 | <template> |
| 2 | 2 | <div id="channelList"> |
| 3 | 3 | <el-container> |
| 4 | - | |
| 5 | 4 | <el-header> |
| 6 | 5 | <uiHeader></uiHeader> |
| 7 | 6 | </el-header> |
| ... | ... | @@ -118,7 +117,7 @@ export default { |
| 118 | 117 | }, |
| 119 | 118 | methods: { |
| 120 | 119 | initData: function () { |
| 121 | - if (this.parentChannelId == "" || this.parentChannelId == 0) { | |
| 120 | + if (typeof (this.parentChannelId) == "undefined" || this.parentChannelId == 0) { | |
| 122 | 121 | this.getDeviceChannelList(); |
| 123 | 122 | } else { |
| 124 | 123 | this.showSubchannels(); |
| ... | ... | @@ -153,6 +152,7 @@ export default { |
| 153 | 152 | }, |
| 154 | 153 | getDeviceChannelList: function () { |
| 155 | 154 | let that = this; |
| 155 | + if (typeof (this.$route.params.deviceId) == "undefined") return; | |
| 156 | 156 | this.$axios({ |
| 157 | 157 | method: 'get', |
| 158 | 158 | url: `/api/device/query/devices/${this.$route.params.deviceId}/channels`, | ... | ... |