From 5abf5012eb03044593c6d7c277bdba7f3ee7c3e6 Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: Wed, 7 Aug 2024 17:12:39 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=E5=88=86=E7=BB=84=E9=80=9A?= =?UTF-8?q?=E9=81=93=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gb28181/dao/CommonGBChannelMapper.java | 15 ++++ .../gb28181/dao/provider/ChannelProvider.java | 4 +- .../service/impl/GbChannelServiceImpl.java | 15 +++- .../service/impl/GroupServiceImpl.java | 16 +++-- .../vmp/media/zlm/ZLMHttpHookListener.java | 2 +- web_src/src/components/DeviceList.vue | 20 ++++++ web_src/src/components/common/GroupTree.vue | 8 ++- web_src/src/components/console.vue | 22 ------ web_src/src/components/group.vue | 69 +++++++++++++++---- web_src/src/layout/UiHeader.vue | 1 - 10 files changed, 122 insertions(+), 50 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/dao/CommonGBChannelMapper.java b/src/main/java/com/genersoft/iot/vmp/gb28181/dao/CommonGBChannelMapper.java index 59b423db..287b5177 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/dao/CommonGBChannelMapper.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/dao/CommonGBChannelMapper.java @@ -399,4 +399,19 @@ public interface CommonGBChannelMapper { int updateGroup(@Param("parentId") String parentId, @Param("businessGroup") String businessGroup, List channelList); + @Select("") + List queryForGroupTreeByParentId(@Param("query") String query, @Param("parent") String parent); } diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/dao/provider/ChannelProvider.java b/src/main/java/com/genersoft/iot/vmp/gb28181/dao/provider/ChannelProvider.java index 7ccc8866..cedd0f0a 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/dao/provider/ChannelProvider.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/dao/provider/ChannelProvider.java @@ -142,7 +142,7 @@ public class ChannelProvider { public String queryByGbDeviceIds(Map params ){ StringBuilder sqlBuild = new StringBuilder(); sqlBuild.append(getBaseSelectSql()); - sqlBuild.append("where device_db_id in ( "); + sqlBuild.append("where id in ( "); Collection ids = (Collection)params.get("deviceIds"); boolean first = true; @@ -208,7 +208,7 @@ public class ChannelProvider { StringBuilder sqlBuild = new StringBuilder(); sqlBuild.append(getBaseSelectSql()); - sqlBuild.append(" where gb_business_group_id in ( "); + sqlBuild.append(" where gb_parent_id in ( "); Collection ids = (Collection)params.get("groupList"); boolean first = true; for (Group group : ids) { diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/GbChannelServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/GbChannelServiceImpl.java index fdb46a8e..2c74cdb9 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/GbChannelServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/GbChannelServiceImpl.java @@ -531,11 +531,16 @@ public class GbChannelServiceImpl implements IGbChannelService { throw new ControllerException(ErrorCode.ERROR100.getCode(), "所有通道Id不存在"); } for (CommonGBChannel channel : channelList) { - channel.setGbCivilCode(civilCode); + channel.setGbParentId(parentId); + channel.setGbBusinessGroupId(businessGroup); } - int result = commonGBChannelMapper.updateRegion(civilCode, channelList); + int result = commonGBChannelMapper.updateGroup(parentId, businessGroup, channelList); // 发送通知 if (result > 0) { + for (CommonGBChannel channel : channelList) { + channel.setGbBusinessGroupId(businessGroup); + channel.setGbParentId(parentId); + } try { // 发送catalog eventPublisher.catalogEventPublish(null, channelList, CatalogEvent.UPDATE); @@ -547,6 +552,10 @@ public class GbChannelServiceImpl implements IGbChannelService { @Override public void deleteChannelToGroupByGbDevice(List deviceIds) { - + List channelList = commonGBChannelMapper.queryByGbDeviceIds(deviceIds); + if (channelList.isEmpty()) { + throw new ControllerException(ErrorCode.ERROR100.getCode(), "所有通道Id不存在"); + } + commonGBChannelMapper.removeParentIdByChannels(channelList); } } diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/GroupServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/GroupServiceImpl.java index ca8a08dd..108fb833 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/GroupServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/GroupServiceImpl.java @@ -1,9 +1,6 @@ package com.genersoft.iot.vmp.gb28181.service.impl; -import com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel; -import com.genersoft.iot.vmp.gb28181.bean.GbCode; -import com.genersoft.iot.vmp.gb28181.bean.Group; -import com.genersoft.iot.vmp.gb28181.bean.GroupTree; +import com.genersoft.iot.vmp.gb28181.bean.*; import com.genersoft.iot.vmp.gb28181.dao.CommonGBChannelMapper; import com.genersoft.iot.vmp.gb28181.dao.GroupMapper; import com.genersoft.iot.vmp.gb28181.event.EventPublisher; @@ -182,7 +179,16 @@ public class GroupServiceImpl implements IGroupService { if (gbCode.getTypeCode().equals("215")) { return groupManager.queryForTreeByBusinessGroup(query, parent, platformId); }else { - return groupManager.queryForTree(query, parent, platformId); + // 查询业务分组以及所属的通道 + List groupTrees = groupManager.queryForTree(query, parent, platformId); + if (platformId == null) { + List channelList = commonGBChannelMapper.queryForGroupTreeByParentId(query, parent); + groupTrees.addAll(channelList); + }else { + // TODO 查询平台独属的关联通道 + } + + return groupTrees; } } diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java index 36557c54..f2ecb44f 100755 --- a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java +++ b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java @@ -143,7 +143,7 @@ public class ZLMHttpHookListener { } if (param.getSchema().equalsIgnoreCase("rtsp")) { if (param.isRegist()) { - logger.info("[ZLM HOOK] 流注册, {}->{}->{}/{}", param.getMediaServerId(), param.getSchema(), param.getApp(), param.getStream()); + log.info("[ZLM HOOK] 流注册, {}->{}->{}/{}", param.getMediaServerId(), param.getSchema(), param.getApp(), param.getStream()); String queryParams = param.getParams(); if (queryParams == null) { try { diff --git a/web_src/src/components/DeviceList.vue b/web_src/src/components/DeviceList.vue index 8a41b611..5461e375 100755 --- a/web_src/src/components/DeviceList.vue +++ b/web_src/src/components/DeviceList.vue @@ -15,6 +15,8 @@ 添加设备 + 平台信息 + @@ -97,6 +99,7 @@ + @@ -104,10 +107,12 @@ import uiHeader from '../layout/UiHeader.vue' import deviceEdit from './dialog/deviceEdit.vue' import syncChannelProgress from './dialog/SyncChannelProgress.vue' +import configInfo from "./dialog/configInfo.vue"; export default { name: 'app', components: { + configInfo, uiHeader, deviceEdit, syncChannelProgress, @@ -305,6 +310,21 @@ export default { setTimeout(this.getDeviceList, 200) }) + }, + showInfo: function (){ + + this.$axios({ + method: 'get', + url: `/api/server/system/configInfo`, + }).then( (res)=> { + console.log(res) + if (res.data.code === 0) { + console.log(2222) + console.log(this.$refs.configInfo) + this.$refs.configInfo.openDialog(res.data.data) + } + }).catch( (error)=> { + }); } diff --git a/web_src/src/components/common/GroupTree.vue b/web_src/src/components/common/GroupTree.vue index 0e488e80..23074e0e 100755 --- a/web_src/src/components/common/GroupTree.vue +++ b/web_src/src/components/common/GroupTree.vue @@ -27,7 +27,7 @@ > - {{''}} + {{''}} @@ -232,6 +232,9 @@ export default { console.log("移除成功") node.parent.loaded = false node.parent.expand(); + if (this.onChannelChange) { + this.onChannelChange() + } } }).catch(function (error) { console.log(error); @@ -247,7 +250,8 @@ export default { method: 'post', url: `/api/common/channel/group/device/add`, data: { - civilCode: node.data.id, + parentId: node.data.id, + businessGroup: node.data.businessGroup, deviceIds: deviceIds, } }).then((res)=> { diff --git a/web_src/src/components/console.vue b/web_src/src/components/console.vue index e192fb1b..faa441bc 100755 --- a/web_src/src/components/console.vue +++ b/web_src/src/components/console.vue @@ -2,10 +2,6 @@
@@ -52,7 +48,6 @@
- @@ -64,7 +59,6 @@ import consoleNet from './console/ConsoleNet.vue' import consoleNodeLoad from './console/ConsoleNodeLoad.vue' import consoleDisk from './console/ConsoleDisk.vue' import consoleResource from './console/ConsoleResource.vue' -import configInfo from './dialog/configInfo.vue' import echarts from 'echarts'; @@ -79,7 +73,6 @@ export default { consoleNodeLoad, consoleDisk, consoleResource, - configInfo, }, data() { return { @@ -147,21 +140,6 @@ export default { }).catch( (error)=> { }); }, - showInfo: function (){ - - this.$axios({ - method: 'get', - url: `/api/server/system/configInfo`, - }).then( (res)=> { - console.log(res) - if (res.data.code === 0) { - console.log(2222) - console.log(this.$refs.configInfo) - this.$refs.configInfo.openDialog(res.data.data) - } - }).catch( (error)=> { - }); - } } }; diff --git a/web_src/src/components/group.vue b/web_src/src/components/group.vue index a857b097..43889a14 100755 --- a/web_src/src/components/group.vue +++ b/web_src/src/components/group.vue @@ -27,9 +27,12 @@ - + 添加 + + 移除 + @@ -64,8 +67,8 @@ @@ -110,7 +113,8 @@ export default { total: 0, loading: false, loadSnap: {}, - regionId: "", + groupId: "", + businessGroup: "", multipleSelection: [] }; }, @@ -160,19 +164,23 @@ export default { this.multipleSelection = val; }, selectable: function (row, rowIndex) { - if (row.gbCivilCode) { - return false + if (this.hasGroup === "") { + if (row.gbParentId) { + return false + }else { + return true + } }else { return true } }, rowDblclick: function (row, rowIndex) { - if (row.gbCivilCode) { - this.$refs.groupTree.refresh(row.gbCivilCode) + if (row.gbParentId) { + this.$refs.groupTree.refresh(row.gbParentId) } }, add: function (row) { - if (!this.regionId) { + if (!this.groupId) { this.$message.info("请选择左侧行政区划节点") return; } @@ -188,9 +196,10 @@ export default { this.$axios({ method: 'post', - url: `/api/common/channel/region/add`, + url: `/api/common/channel/group/add`, data: { - civilCode: this.regionId, + parentId: this.groupId, + businessGroup: this.businessGroup, channelIds: channels } }).then((res)=> { @@ -198,7 +207,7 @@ export default { this.$message.success("保存成功") this.getChannelList() // 刷新树节点 - this.$refs.groupTree.refresh(this.regionId) + this.$refs.groupTree.refresh(this.groupId) }else { this.$message.error(res.data.msg) } @@ -209,6 +218,37 @@ export default { }); }, remove: function (row) { + + let channels = [] + for (let i = 0; i < this.multipleSelection.length; i++) { + channels.push(this.multipleSelection[i].gbId) + } + if (channels.length === 0) { + this.$message.info("请选择右侧通道") + return; + } + this.loading = true + + this.$axios({ + method: 'post', + url: `/api/common/channel/group/delete`, + data: { + channelIds: channels + } + }).then((res)=> { + if (res.data.code === 0) { + this.$message.success("保存成功") + this.getChannelList() + // 刷新树节点 + this.$refs.groupTree.refresh(this.groupId) + }else { + this.$message.error(res.data.msg) + } + this.loading = false + }).catch((error)=> { + this.$message.error(error) + this.loading = false + }); }, getSnap: function (row) { let baseUrl = window.baseUrl ? window.baseUrl : ""; @@ -225,8 +265,9 @@ export default { treeNodeClickEvent: function (device, data, isCatalog) { }, - chooseIdChange: function (id) { - this.regionId = id; + chooseIdChange: function (id, businessGroup) { + this.groupId = id; + this.businessGroup = businessGroup; }, } }; diff --git a/web_src/src/layout/UiHeader.vue b/web_src/src/layout/UiHeader.vue index a3f130fc..6378cb44 100755 --- a/web_src/src/layout/UiHeader.vue +++ b/web_src/src/layout/UiHeader.vue @@ -14,7 +14,6 @@ 行政区划 业务分组 - 通道列表 云端录像 节点管理