Commit 381e3129a3e4efbf2423be6a63342fc9c35befbc
1 parent
dcd78a1c
存储部分使用sqlite代替redis-4
Showing
6 changed files
with
39 additions
and
18 deletions
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java
| @@ -357,11 +357,7 @@ public class SIPCommander implements ISIPCommander { | @@ -357,11 +357,7 @@ public class SIPCommander implements ISIPCommander { | ||
| 357 | 357 | ||
| 358 | ClientTransaction transaction = transmitRequest(device, request, errorEvent); | 358 | ClientTransaction transaction = transmitRequest(device, request, errorEvent); |
| 359 | streamSession.put(streamId, transaction); | 359 | streamSession.put(streamId, transaction); |
| 360 | - DeviceChannel deviceChannel = storager.queryChannel(device.getDeviceId(), channelId); | ||
| 361 | - if (deviceChannel != null) { | ||
| 362 | - deviceChannel.setStreamId(streamId); | ||
| 363 | - storager.updateChannel(device.getDeviceId(), deviceChannel); | ||
| 364 | - } | 360 | + |
| 365 | 361 | ||
| 366 | 362 | ||
| 367 | } catch ( SipException | ParseException | InvalidArgumentException e) { | 363 | } catch ( SipException | ParseException | InvalidArgumentException e) { |
src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java
| @@ -23,7 +23,8 @@ public interface DeviceChannelMapper { | @@ -23,7 +23,8 @@ public interface DeviceChannelMapper { | ||
| 23 | "SET name=#{name}, manufacture=#{manufacture}, model=#{model}, owner=#{owner}, civilCode=#{civilCode}, " + | 23 | "SET name=#{name}, manufacture=#{manufacture}, model=#{model}, owner=#{owner}, civilCode=#{civilCode}, " + |
| 24 | "block=#{block}, address=#{address}, parental=#{parental}, parentId=#{parentId}, safetyWay=#{safetyWay}, " + | 24 | "block=#{block}, address=#{address}, parental=#{parental}, parentId=#{parentId}, safetyWay=#{safetyWay}, " + |
| 25 | "registerWay=#{registerWay}, certNum=#{certNum}, certifiable=#{certifiable}, errCode=#{errCode}, secrecy=#{secrecy}, " + | 25 | "registerWay=#{registerWay}, certNum=#{certNum}, certifiable=#{certifiable}, errCode=#{errCode}, secrecy=#{secrecy}, " + |
| 26 | - "ipAddress=#{ipAddress}, port=#{port}, password=#{password}, PTZType=#{PTZType}, status=#{status} " + | 26 | + "ipAddress=#{ipAddress}, port=#{port}, password=#{password}, PTZType=#{PTZType}, status=#{status}, streamId=#{streamId}, " + |
| 27 | + "hasAudio=#{hasAudio}" + | ||
| 27 | "WHERE deviceId=#{deviceId} AND channelId=#{channelId}") | 28 | "WHERE deviceId=#{deviceId} AND channelId=#{channelId}") |
| 28 | int update(DeviceChannel channel); | 29 | int update(DeviceChannel channel); |
| 29 | 30 |
src/main/java/com/genersoft/iot/vmp/vmanager/service/impl/PlayServiceImpl.java
| @@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON; | @@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON; | ||
| 4 | import com.alibaba.fastjson.JSONObject; | 4 | import com.alibaba.fastjson.JSONObject; |
| 5 | import com.genersoft.iot.vmp.common.StreamInfo; | 5 | import com.genersoft.iot.vmp.common.StreamInfo; |
| 6 | import com.genersoft.iot.vmp.conf.MediaServerConfig; | 6 | import com.genersoft.iot.vmp.conf.MediaServerConfig; |
| 7 | +import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel; | ||
| 7 | import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder; | 8 | import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder; |
| 8 | import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage; | 9 | import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage; |
| 9 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; | 10 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| @@ -37,6 +38,12 @@ public class PlayServiceImpl implements IPlayService { | @@ -37,6 +38,12 @@ public class PlayServiceImpl implements IPlayService { | ||
| 37 | msg.setId(DeferredResultHolder.CALLBACK_CMD_PlAY + uuid); | 38 | msg.setId(DeferredResultHolder.CALLBACK_CMD_PlAY + uuid); |
| 38 | StreamInfo streamInfo = onPublishHandler(resonse, deviceId, channelId, uuid); | 39 | StreamInfo streamInfo = onPublishHandler(resonse, deviceId, channelId, uuid); |
| 39 | if (streamInfo != null) { | 40 | if (streamInfo != null) { |
| 41 | + DeviceChannel deviceChannel = storager.queryChannel(deviceId, channelId); | ||
| 42 | + if (deviceChannel != null) { | ||
| 43 | + deviceChannel.setStreamId(streamInfo.getStreamId()); | ||
| 44 | + storager.updateChannel(deviceId, deviceChannel); | ||
| 45 | + } | ||
| 46 | + | ||
| 40 | redisCatchStorage.startPlay(streamInfo); | 47 | redisCatchStorage.startPlay(streamInfo); |
| 41 | msg.setData(JSON.toJSONString(streamInfo)); | 48 | msg.setData(JSON.toJSONString(streamInfo)); |
| 42 | resultHolder.invokeResult(msg); | 49 | resultHolder.invokeResult(msg); |
src/main/resources/application-dev.yml
| @@ -20,13 +20,20 @@ spring: | @@ -20,13 +20,20 @@ spring: | ||
| 20 | timeout: 10000 | 20 | timeout: 10000 |
| 21 | # [不可用] jdbc数据库配置, 暂不支持 | 21 | # [不可用] jdbc数据库配置, 暂不支持 |
| 22 | datasource: | 22 | datasource: |
| 23 | + # name: eiot | ||
| 24 | + # url: jdbc:mysql://127.0.0.1:3306/eiot?useUnicode=true&characterEncoding=UTF8&rewriteBatchedStatements=true | ||
| 25 | + # username: | ||
| 26 | + # password: | ||
| 27 | + # type: com.alibaba.druid.pool.DruidDataSource | ||
| 28 | + # driver-class-name: com.mysql.jdbc.Driver | ||
| 23 | name: eiot | 29 | name: eiot |
| 24 | - url: jdbc:mysql://127.0.0.1:3306/eiot?useUnicode=true&characterEncoding=UTF8&rewriteBatchedStatements=true | 30 | + url: jdbc:sqlite::resource:wvp.sqlite |
| 25 | username: | 31 | username: |
| 26 | password: | 32 | password: |
| 27 | type: com.alibaba.druid.pool.DruidDataSource | 33 | type: com.alibaba.druid.pool.DruidDataSource |
| 28 | - driver-class-name: com.mysql.jdbc.Driver | ||
| 29 | - | 34 | + driver-class-name: org.sqlite.JDBC |
| 35 | + max-active: 1 | ||
| 36 | + min-idle: 1 | ||
| 30 | 37 | ||
| 31 | # [可选] WVP监听的HTTP端口, 网页和接口调用都是这个端口 | 38 | # [可选] WVP监听的HTTP端口, 网页和接口调用都是这个端口 |
| 32 | server: | 39 | server: |
src/main/resources/wvp.sqlite
No preview for this file type
web_src/src/components/channelList.vue
| @@ -19,12 +19,12 @@ | @@ -19,12 +19,12 @@ | ||
| 19 | <el-option label="设备" value="false"></el-option> | 19 | <el-option label="设备" value="false"></el-option> |
| 20 | <el-option label="子目录" value="true"></el-option> | 20 | <el-option label="子目录" value="true"></el-option> |
| 21 | </el-select> | 21 | </el-select> |
| 22 | - 在线状态: <el-select size="mini" @change="search" v-model="online" placeholder="请选择" default-first-option> | 22 | + 在线状态: <el-select size="mini" style="margin-right: 1rem;" @change="search" v-model="online" placeholder="请选择" default-first-option> |
| 23 | <el-option label="全部" value=""></el-option> | 23 | <el-option label="全部" value=""></el-option> |
| 24 | <el-option label="在线" value="true"></el-option> | 24 | <el-option label="在线" value="true"></el-option> |
| 25 | <el-option label="离线" value="false"></el-option> | 25 | <el-option label="离线" value="false"></el-option> |
| 26 | </el-select> | 26 | </el-select> |
| 27 | - | 27 | + <el-checkbox size="mini" style="margin-right: 1rem; float: right;" v-model="autoList" @change="autoListChange">自动刷新</el-checkbox> |
| 28 | </div> | 28 | </div> |
| 29 | <devicePlayer ref="devicePlayer" v-loading="isLoging"></devicePlayer> | 29 | <devicePlayer ref="devicePlayer" v-loading="isLoging"></devicePlayer> |
| 30 | <!--设备列表--> | 30 | <!--设备列表--> |
| @@ -56,7 +56,7 @@ | @@ -56,7 +56,7 @@ | ||
| 56 | <el-button-group> | 56 | <el-button-group> |
| 57 | <!-- <el-button size="mini" icon="el-icon-video-play" v-if="scope.row.parental == 0" @click="sendDevicePush(scope.row)">播放</el-button> --> | 57 | <!-- <el-button size="mini" icon="el-icon-video-play" v-if="scope.row.parental == 0" @click="sendDevicePush(scope.row)">播放</el-button> --> |
| 58 | <el-button size="mini" icon="el-icon-video-play" @click="sendDevicePush(scope.row)">播放</el-button> | 58 | <el-button size="mini" icon="el-icon-video-play" @click="sendDevicePush(scope.row)">播放</el-button> |
| 59 | - <el-button size="mini" icon="el-icon-switch-button" type="danger" v-if="scope.row.play" @click="stopDevicePush(scope.row)">停止</el-button> | 59 | + <el-button size="mini" icon="el-icon-switch-button" type="danger" v-if="!!scope.row.streamId" @click="stopDevicePush(scope.row)">停止</el-button> |
| 60 | <el-button size="mini" icon="el-icon-s-open" type="primary" v-if="scope.row.parental == 1" @click="changeSubchannel(scope.row)">查看</el-button> | 60 | <el-button size="mini" icon="el-icon-s-open" type="primary" v-if="scope.row.parental == 1" @click="changeSubchannel(scope.row)">查看</el-button> |
| 61 | <el-button size="mini" icon="el-icon-video-camera" type="primary" @click="queryRecords(scope.row)">设备录象</el-button> | 61 | <el-button size="mini" icon="el-icon-video-camera" type="primary" @click="queryRecords(scope.row)">设备录象</el-button> |
| 62 | <!-- <el-button size="mini" @click="sendDevicePush(scope.row)">录像查询</el-button> --> | 62 | <!-- <el-button size="mini" @click="sendDevicePush(scope.row)">录像查询</el-button> --> |
| @@ -98,13 +98,17 @@ export default { | @@ -98,13 +98,17 @@ export default { | ||
| 98 | count: parseInt(this.$route.params.count), | 98 | count: parseInt(this.$route.params.count), |
| 99 | total: 0, | 99 | total: 0, |
| 100 | beforeUrl: "/videoList", | 100 | beforeUrl: "/videoList", |
| 101 | - isLoging: false | 101 | + isLoging: false, |
| 102 | + autoList: false | ||
| 102 | }; | 103 | }; |
| 103 | }, | 104 | }, |
| 104 | 105 | ||
| 105 | mounted() { | 106 | mounted() { |
| 106 | this.initData(); | 107 | this.initData(); |
| 107 | - this.updateLooper = setInterval(this.initData, 1000); | 108 | + if (this.autoList) { |
| 109 | + this.updateLooper = setInterval(this.initData, 1500); | ||
| 110 | + } | ||
| 111 | + | ||
| 108 | }, | 112 | }, |
| 109 | destroyed() { | 113 | destroyed() { |
| 110 | this.$destroy('videojs'); | 114 | this.$destroy('videojs'); |
| @@ -179,12 +183,11 @@ export default { | @@ -179,12 +183,11 @@ export default { | ||
| 179 | let deviceId = this.deviceId; | 183 | let deviceId = this.deviceId; |
| 180 | this.isLoging = true; | 184 | this.isLoging = true; |
| 181 | let channelId = itemData.channelId; | 185 | let channelId = itemData.channelId; |
| 182 | - let getEncoding = itemData.hasAudio ? '1' : '0' | ||
| 183 | - console.log("通知设备推流1:" + deviceId + " : " + channelId + ":" + getEncoding); | 186 | + console.log("通知设备推流1:" + deviceId + " : " + channelId ); |
| 184 | let that = this; | 187 | let that = this; |
| 185 | this.$axios({ | 188 | this.$axios({ |
| 186 | method: 'get', | 189 | method: 'get', |
| 187 | - url: '/api/play/' + deviceId + '/' + channelId + '?getEncoding=' + getEncoding | 190 | + url: '/api/play/' + deviceId + '/' + channelId |
| 188 | }).then(function (res) { | 191 | }).then(function (res) { |
| 189 | console.log(res.data) | 192 | console.log(res.data) |
| 190 | let streamId = res.data.streamId; | 193 | let streamId = res.data.streamId; |
| @@ -258,7 +261,7 @@ export default { | @@ -258,7 +261,7 @@ export default { | ||
| 258 | }) | 261 | }) |
| 259 | .then(function (res) { | 262 | .then(function (res) { |
| 260 | that.total = res.data.total; | 263 | that.total = res.data.total; |
| 261 | - that.deviceChannelList = res.data.data; | 264 | + that.deviceChannelList = res.data.list; |
| 262 | // 防止出现表格错位 | 265 | // 防止出现表格错位 |
| 263 | that.$nextTick(() => { | 266 | that.$nextTick(() => { |
| 264 | that.$refs.channelListTable.doLayout(); | 267 | that.$refs.channelListTable.doLayout(); |
| @@ -283,6 +286,13 @@ export default { | @@ -283,6 +286,13 @@ export default { | ||
| 283 | }).then(function (res) { | 286 | }).then(function (res) { |
| 284 | console.log(JSON.stringify(res)); | 287 | console.log(JSON.stringify(res)); |
| 285 | }); | 288 | }); |
| 289 | + }, | ||
| 290 | + autoListChange: function () { | ||
| 291 | + if (this.autoList) { | ||
| 292 | + this.updateLooper = setInterval(this.initData, 1500); | ||
| 293 | + }else{ | ||
| 294 | + window.clearInterval(this.updateLooper); | ||
| 295 | + } | ||
| 286 | } | 296 | } |
| 287 | 297 | ||
| 288 | } | 298 | } |