From 194f901847d7d55b5bc812bd6d5b99561349341f Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: Mon, 17 Jan 2022 16:46:28 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E7=BA=A7=E8=81=94=E9=80=89?= =?UTF-8?q?=E6=8B=A9=E9=80=9A=E9=81=93=E9=A1=B5=E9=9D=A2=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../subscribe/catalog/CatalogEventLister.java | 4 +- .../vmp/storager/IVideoManagerStorager.java | 4 ++ .../storager/dao/PlatformChannelMapper.java | 5 ++ .../storager/dao/PlatformGbStreamMapper.java | 2 +- .../impl/VideoManagerStoragerImpl.java | 11 ++++ .../gb28181/platform/PlatformController.java | 2 + .../src/components/dialog/chooseChannel.vue | 6 +- .../dialog/chooseChannelForCatalog.vue | 28 +++++----- .../components/dialog/chooseChannelForGb.vue | 55 +++++++++++++++++-- .../dialog/chooseChannelForStream.vue | 52 ++++++++++++++++-- 10 files changed, 137 insertions(+), 32 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/event/subscribe/catalog/CatalogEventLister.java b/src/main/java/com/genersoft/iot/vmp/gb28181/event/subscribe/catalog/CatalogEventLister.java index ad1fa51d..e6dc517f 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/event/subscribe/catalog/CatalogEventLister.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/event/subscribe/catalog/CatalogEventLister.java @@ -92,7 +92,7 @@ public class CatalogEventLister implements ApplicationListener { if (event.getDeviceChannels() != null) { deviceChannelList.addAll(event.getDeviceChannels()); } - if (event.getGbStreams().size() > 0){ + if (event.getGbStreams() != null && event.getGbStreams().size() > 0){ for (GbStream gbStream : event.getGbStreams()) { DeviceChannel deviceChannelByStream = gbStreamService.getDeviceChannelListByStream(gbStream, gbStream.getCatalogId(), parentPlatform.getDeviceGBId()); deviceChannelList.add(deviceChannelByStream); @@ -131,7 +131,7 @@ public class CatalogEventLister implements ApplicationListener { if (event.getDeviceChannels() != null) { deviceChannelList.addAll(event.getDeviceChannels()); } - if (event.getGbStreams().size() > 0){ + if (event.getGbStreams() != null && event.getGbStreams().size() > 0){ for (GbStream gbStream : event.getGbStreams()) { DeviceChannel deviceChannelByStream = gbStreamService.getDeviceChannelListByStream(gbStream, gbStream.getCatalogId(), parentPlatform.getDeviceGBId()); deviceChannelList.add(deviceChannelByStream); diff --git a/src/main/java/com/genersoft/iot/vmp/storager/IVideoManagerStorager.java b/src/main/java/com/genersoft/iot/vmp/storager/IVideoManagerStorager.java index a89fc562..e4bda3f0 100644 --- a/src/main/java/com/genersoft/iot/vmp/storager/IVideoManagerStorager.java +++ b/src/main/java/com/genersoft/iot/vmp/storager/IVideoManagerStorager.java @@ -466,4 +466,8 @@ public interface IVideoManagerStorager { List queryPlatFormListForStreamWithGBId(String app, String stream, List platforms); GbStream getGbStream(String app, String streamId); + + void delCatalogByPlatformId(String serverGBId); + + void delRelationByPlatformId(String serverGBId); } diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformChannelMapper.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformChannelMapper.java index 81f869c6..0991c843 100644 --- a/src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformChannelMapper.java +++ b/src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformChannelMapper.java @@ -88,4 +88,9 @@ public interface PlatformChannelMapper { " #{item}" + " ") List queryPlatFormListForGBWithGBId(String channelId, List platforms); + + @Delete("") + void delByPlatformId(String serverGBId); } diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformGbStreamMapper.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformGbStreamMapper.java index d9eafa0e..a07e68ee 100644 --- a/src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformGbStreamMapper.java +++ b/src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformGbStreamMapper.java @@ -52,7 +52,7 @@ public interface PlatformGbStreamMapper { "from gb_stream gs\n" + " left join platform_gb_stream pgs\n" + " on gs.app = pgs.app and gs.stream = pgs.stream\n" + - "where and pgs.platformId=#{platformId} and pgs.catalogId=#{catalogId}") + "where pgs.platformId=#{platformId} and pgs.catalogId=#{catalogId}") List queryChannelInParentPlatformAndCatalogForCatalog(String platformId, String catalogId); @Delete("DELETE FROM platform_gb_stream WHERE catalogId=#{id}") 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 369b659d..ac278a7b 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 @@ -1044,4 +1044,15 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager { public GbStream getGbStream(String app, String streamId) { return gbStreamMapper.selectOne(app, streamId); } + + @Override + public void delCatalogByPlatformId(String serverGBId) { + catalogMapper.delByPlatformId(serverGBId); + } + + @Override + public void delRelationByPlatformId(String serverGBId) { + platformGbStreamMapper.delByPlatformId(serverGBId); + platformChannelMapper.delByPlatformId(serverGBId); + } } diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/platform/PlatformController.java b/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/platform/PlatformController.java index 69ea9731..4929dad0 100644 --- a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/platform/PlatformController.java +++ b/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/platform/PlatformController.java @@ -172,6 +172,8 @@ public class PlatformController { })); boolean deleteResult = storager.deleteParentPlatform(parentPlatform); + storager.delCatalogByPlatformId(parentPlatform.getServerGBId()); + storager.delRelationByPlatformId(parentPlatform.getServerGBId()); if (deleteResult) { diff --git a/web_src/src/components/dialog/chooseChannel.vue b/web_src/src/components/dialog/chooseChannel.vue index 5544b383..ebca9dd3 100644 --- a/web_src/src/components/dialog/chooseChannel.vue +++ b/web_src/src/components/dialog/chooseChannel.vue @@ -131,11 +131,9 @@ export default { this.$refs.chooseChannelFoStream.catalogIdChange(id); } }, - updateChooseChannelCallback (id, nodeIds){ + updateChooseChannelCallback (id){ console.log("中间模块收到选择通道变化: " + id) - console.log("中间模块收到选择通道变化: " + nodeIds) - console.log("中间模块收到选择通道变化: " + typeof (nodeIds)) - this.$refs.chooseChannelForCatalog.refreshCatalogById(id, nodeIds) + this.$refs.chooseChannelForCatalog.refreshCatalogById(id) } } }; diff --git a/web_src/src/components/dialog/chooseChannelForCatalog.vue b/web_src/src/components/dialog/chooseChannelForCatalog.vue index 89fa32b2..8446c2a6 100644 --- a/web_src/src/components/dialog/chooseChannelForCatalog.vue +++ b/web_src/src/components/dialog/chooseChannelForCatalog.vue @@ -121,25 +121,23 @@ export default { node.loaded = false node.expand(); }, - refreshCatalogById: function (id, nodeIds) { + refreshCatalogById: function (id) { if (id) { - console.log("refreshCatalogById: " + id) let node = this.$refs.tree.getNode(id); - console.log(node) this.refreshCatalog(node); } - if (nodeIds !== null) { - let refreshNode = {} - for (let i = 0; i < nodeIds.length; i++) { - let node = this.$refs.tree.getNode(nodeIds[i]); - refreshNode[node.parent.data.id] = node.parent - } - if (Object.values(refreshNode).length > 0) { - for (let j = 0; j < Object.values(refreshNode).length; j++) { - this.refreshCatalog(Object.values(refreshNode)[j]); - } - } - } + // if (nodeIds !== null) { + // let refreshNode = {} + // for (let i = 0; i < nodeIds.length; i++) { + // let node = this.$refs.tree.getNode(nodeIds[i]); + // refreshNode[node.parent.data.id] = node.parent + // } + // if (Object.values(refreshNode).length > 0) { + // for (let j = 0; j < Object.values(refreshNode).length; j++) { + // this.refreshCatalog(Object.values(refreshNode)[j]); + // } + // } + // } }, editCatalog: function (data, node){ let that = this; diff --git a/web_src/src/components/dialog/chooseChannelForGb.vue b/web_src/src/components/dialog/chooseChannelForGb.vue index 742b3de5..6c22a876 100644 --- a/web_src/src/components/dialog/chooseChannelForGb.vue +++ b/web_src/src/components/dialog/chooseChannelForGb.vue @@ -21,10 +21,9 @@ - 全部共享 + - - + @@ -40,6 +39,14 @@ + + + @@ -108,6 +115,45 @@ export default { // return false; // } // }, + add: function (row) { + console.log(row) + row.catalogId = this.catalogId + row.platformId = this.platformId + this.$axios({ + method:"post", + url:"/api/platform/update_channel_for_gb", + data:{ + platformId: this.platformId, + channelReduces: [row], + catalogId: this.catalogId + } + }).then((res)=>{ + console.log("保存成功") + if(this.updateChoosedCallback)this.updateChoosedCallback(this.catalogId) + }).catch(function (error) { + console.log(error); + }); + }, + remove: function (row) { + console.log(row) + + this.$axios({ + method:"delete", + url:"/api/platform/del_channel_for_gb", + data:{ + platformId: this.platformId, + channelReduces: [row] + } + }).then((res)=>{ + console.log("移除成功") + let nodeIds = new Array(); + if(this.updateChoosedCallback)this.updateChoosedCallback(row.catalogId) + row.platformId = null; + row.catalogId = null + }).catch(function (error) { + console.log(error); + }); + }, checkedChange: function (val) { let that = this; if (!that.eventEnanle) { @@ -182,10 +228,9 @@ export default { console.log(error); }); } - }, shareAllCheckedChange: function (val) { - this.chooseChanage(null, val) + }, getChannelList: function () { let that = this; diff --git a/web_src/src/components/dialog/chooseChannelForStream.vue b/web_src/src/components/dialog/chooseChannelForStream.vue index 3cc5f3cf..931083ad 100644 --- a/web_src/src/components/dialog/chooseChannelForStream.vue +++ b/web_src/src/components/dialog/chooseChannelForStream.vue @@ -1,7 +1,6 @@ + + + @@ -82,14 +89,49 @@ export default { console.log(val) console.log(row) }, + add: function (row) { + console.log(row) + row.catalogId = this.catalogId + row.platformId = this.platformId + this.$axios({ + method:"post", + url:"/api/gbStream/add", + data:{ + platformId: this.platformId, + catalogId: this.catalogId, + gbStreams: [row], + } + }).then((res)=>{ + console.log("保存成功") + if(this.updateChoosedCallback)this.updateChoosedCallback(this.catalogId) + }).catch(function (error) { + console.log(error); + }); + }, + remove: function (row) { + console.log(row) + + this.$axios({ + method:"delete", + url:"/api/gbStream/del", + data:{ + platformId: this.platformId, + gbStreams: [row], + } + }).then((res)=>{ + console.log("移除成功") + if(this.updateChoosedCallback)this.updateChoosedCallback(row.catalogId) + row.platformId = null; + row.catalogId = null + }).catch(function (error) { + console.log(error); + }); + }, checkedChanage: function (val) { var that = this; if (!that.eventEnanle) { return; } - var tabelData = JSON.parse(JSON.stringify(this.$refs.gbStreamsTable.data)); - console.log("checkedChanage") - console.log(val) var newData = {}; var addData = [];