完善分组通道管理

pull/1642/head
648540858 2024-08-07 17:12:39 +08:00
parent a3f7753b84
commit 5abf5012eb
10 changed files with 122 additions and 50 deletions

View File

@ -399,4 +399,19 @@ public interface CommonGBChannelMapper {
int updateGroup(@Param("parentId") String parentId, @Param("businessGroup") String businessGroup, int updateGroup(@Param("parentId") String parentId, @Param("businessGroup") String businessGroup,
List<CommonGBChannel> channelList); List<CommonGBChannel> channelList);
@Select("<script>" +
" select " +
" coalesce(gb_device_id, device_id) as id," +
" coalesce(gb_name, name) as label, " +
" id as db_id, " +
" gb_parent_id as parent_device_id," +
" gb_business_group_id as business_group," +
" 1 as type, " +
" true as is_leaf " +
" from wvp_device_channel " +
" where gb_parent_id = #{parent} " +
" <if test='query != null'> AND (coalesce(gb_device_id, device_id) LIKE concat('%',#{query},'%') " +
" OR coalesce(gb_name, name) LIKE concat('%',#{query},'%'))</if> " +
" </script>")
List<GroupTree> queryForGroupTreeByParentId(@Param("query") String query, @Param("parent") String parent);
} }

View File

@ -142,7 +142,7 @@ public class ChannelProvider {
public String queryByGbDeviceIds(Map<String, Object> params ){ public String queryByGbDeviceIds(Map<String, Object> params ){
StringBuilder sqlBuild = new StringBuilder(); StringBuilder sqlBuild = new StringBuilder();
sqlBuild.append(getBaseSelectSql()); sqlBuild.append(getBaseSelectSql());
sqlBuild.append("where device_db_id in ( "); sqlBuild.append("where id in ( ");
Collection<Integer> ids = (Collection<Integer>)params.get("deviceIds"); Collection<Integer> ids = (Collection<Integer>)params.get("deviceIds");
boolean first = true; boolean first = true;
@ -208,7 +208,7 @@ public class ChannelProvider {
StringBuilder sqlBuild = new StringBuilder(); StringBuilder sqlBuild = new StringBuilder();
sqlBuild.append(getBaseSelectSql()); sqlBuild.append(getBaseSelectSql());
sqlBuild.append(" where gb_business_group_id in ( "); sqlBuild.append(" where gb_parent_id in ( ");
Collection<Group> ids = (Collection<Group>)params.get("groupList"); Collection<Group> ids = (Collection<Group>)params.get("groupList");
boolean first = true; boolean first = true;
for (Group group : ids) { for (Group group : ids) {

View File

@ -531,11 +531,16 @@ public class GbChannelServiceImpl implements IGbChannelService {
throw new ControllerException(ErrorCode.ERROR100.getCode(), "所有通道Id不存在"); throw new ControllerException(ErrorCode.ERROR100.getCode(), "所有通道Id不存在");
} }
for (CommonGBChannel channel : channelList) { 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) { if (result > 0) {
for (CommonGBChannel channel : channelList) {
channel.setGbBusinessGroupId(businessGroup);
channel.setGbParentId(parentId);
}
try { try {
// 发送catalog // 发送catalog
eventPublisher.catalogEventPublish(null, channelList, CatalogEvent.UPDATE); eventPublisher.catalogEventPublish(null, channelList, CatalogEvent.UPDATE);
@ -547,6 +552,10 @@ public class GbChannelServiceImpl implements IGbChannelService {
@Override @Override
public void deleteChannelToGroupByGbDevice(List<Integer> deviceIds) { public void deleteChannelToGroupByGbDevice(List<Integer> deviceIds) {
List<CommonGBChannel> channelList = commonGBChannelMapper.queryByGbDeviceIds(deviceIds);
if (channelList.isEmpty()) {
throw new ControllerException(ErrorCode.ERROR100.getCode(), "所有通道Id不存在");
}
commonGBChannelMapper.removeParentIdByChannels(channelList);
} }
} }

View File

@ -1,9 +1,6 @@
package com.genersoft.iot.vmp.gb28181.service.impl; package com.genersoft.iot.vmp.gb28181.service.impl;
import com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel; import com.genersoft.iot.vmp.gb28181.bean.*;
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.dao.CommonGBChannelMapper; import com.genersoft.iot.vmp.gb28181.dao.CommonGBChannelMapper;
import com.genersoft.iot.vmp.gb28181.dao.GroupMapper; import com.genersoft.iot.vmp.gb28181.dao.GroupMapper;
import com.genersoft.iot.vmp.gb28181.event.EventPublisher; import com.genersoft.iot.vmp.gb28181.event.EventPublisher;
@ -182,7 +179,16 @@ public class GroupServiceImpl implements IGroupService {
if (gbCode.getTypeCode().equals("215")) { if (gbCode.getTypeCode().equals("215")) {
return groupManager.queryForTreeByBusinessGroup(query, parent, platformId); return groupManager.queryForTreeByBusinessGroup(query, parent, platformId);
}else { }else {
return groupManager.queryForTree(query, parent, platformId); // 查询业务分组以及所属的通道
List<GroupTree> groupTrees = groupManager.queryForTree(query, parent, platformId);
if (platformId == null) {
List<GroupTree> channelList = commonGBChannelMapper.queryForGroupTreeByParentId(query, parent);
groupTrees.addAll(channelList);
}else {
// TODO 查询平台独属的关联通道
}
return groupTrees;
} }
} }

View File

@ -143,7 +143,7 @@ public class ZLMHttpHookListener {
} }
if (param.getSchema().equalsIgnoreCase("rtsp")) { if (param.getSchema().equalsIgnoreCase("rtsp")) {
if (param.isRegist()) { 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(); String queryParams = param.getParams();
if (queryParams == null) { if (queryParams == null) {
try { try {

View File

@ -15,6 +15,8 @@
</el-select> </el-select>
<el-button icon="el-icon-plus" size="mini" style="margin-right: 1rem;" type="primary" @click="add"> <el-button icon="el-icon-plus" size="mini" style="margin-right: 1rem;" type="primary" @click="add">
</el-button> </el-button>
<el-button icon="el-icon-info" size="mini" style="margin-right: 1rem;" type="primary" @click="showInfo">
</el-button>
<el-button icon="el-icon-refresh-right" circle size="mini" :loading="getDeviceListLoading" <el-button icon="el-icon-refresh-right" circle size="mini" :loading="getDeviceListLoading"
@click="getDeviceList()"></el-button> @click="getDeviceList()"></el-button>
</div> </div>
@ -97,6 +99,7 @@
</el-pagination> </el-pagination>
<deviceEdit ref="deviceEdit"></deviceEdit> <deviceEdit ref="deviceEdit"></deviceEdit>
<syncChannelProgress ref="syncChannelProgress"></syncChannelProgress> <syncChannelProgress ref="syncChannelProgress"></syncChannelProgress>
<configInfo ref="configInfo"></configInfo>
</div> </div>
</template> </template>
@ -104,10 +107,12 @@
import uiHeader from '../layout/UiHeader.vue' import uiHeader from '../layout/UiHeader.vue'
import deviceEdit from './dialog/deviceEdit.vue' import deviceEdit from './dialog/deviceEdit.vue'
import syncChannelProgress from './dialog/SyncChannelProgress.vue' import syncChannelProgress from './dialog/SyncChannelProgress.vue'
import configInfo from "./dialog/configInfo.vue";
export default { export default {
name: 'app', name: 'app',
components: { components: {
configInfo,
uiHeader, uiHeader,
deviceEdit, deviceEdit,
syncChannelProgress, syncChannelProgress,
@ -305,6 +310,21 @@ export default {
setTimeout(this.getDeviceList, 200) 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)=> {
});
} }

View File

@ -27,7 +27,7 @@
> >
<span class="custom-tree-node" slot-scope="{ node, data }"> <span class="custom-tree-node" slot-scope="{ node, data }">
<span @click.stop > <span @click.stop >
<el-radio v-if="node.data.type === 0 && node.level > 2 " style="margin-right: 0" v-model="chooseId" @input="chooseIdChange" :label="node.data.id">{{''}}</el-radio> <el-radio v-if="node.data.type === 0 && node.level > 2 " style="margin-right: 0" v-model="chooseId" @input="chooseIdChange(node.data.id, node.data.businessGroup)" :label="node.data.id">{{''}}</el-radio>
</span> </span>
<span v-if="node.data.type === 0" style="color: #409EFF" class="iconfont icon-bianzubeifen3"></span> <span v-if="node.data.type === 0" style="color: #409EFF" class="iconfont icon-bianzubeifen3"></span>
<span v-if="node.data.type === 1" style="color: #409EFF" class="iconfont icon-shexiangtou2"></span> <span v-if="node.data.type === 1" style="color: #409EFF" class="iconfont icon-shexiangtou2"></span>
@ -232,6 +232,9 @@ export default {
console.log("移除成功") console.log("移除成功")
node.parent.loaded = false node.parent.loaded = false
node.parent.expand(); node.parent.expand();
if (this.onChannelChange) {
this.onChannelChange()
}
} }
}).catch(function (error) { }).catch(function (error) {
console.log(error); console.log(error);
@ -247,7 +250,8 @@ export default {
method: 'post', method: 'post',
url: `/api/common/channel/group/device/add`, url: `/api/common/channel/group/device/add`,
data: { data: {
civilCode: node.data.id, parentId: node.data.id,
businessGroup: node.data.businessGroup,
deviceIds: deviceIds, deviceIds: deviceIds,
} }
}).then((res)=> { }).then((res)=> {

View File

@ -2,10 +2,6 @@
<div id="app" style="width: 100%"> <div id="app" style="width: 100%">
<div class="page-header"> <div class="page-header">
<div class="page-title">控制台</div> <div class="page-title">控制台</div>
<div class="page-header-btn">
<el-button icon="el-icon-info" size="mini" style="margin-right: 1rem;" type="primary" @click="showInfo">
</el-button>
</div>
</div> </div>
<el-row style="width: 100%"> <el-row style="width: 100%">
<el-col :xl="{ span: 8 }" :lg="{ span: 8 }" :md="{ span: 12 }" :sm="{ span: 12 }" :xs="{ span: 24 }" > <el-col :xl="{ span: 8 }" :lg="{ span: 8 }" :md="{ span: 12 }" :sm="{ span: 12 }" :xs="{ span: 24 }" >
@ -52,7 +48,6 @@
</div> </div>
</el-col> </el-col>
</el-row> </el-row>
<configInfo ref="configInfo"></configInfo>
</div> </div>
</template> </template>
@ -64,7 +59,6 @@ import consoleNet from './console/ConsoleNet.vue'
import consoleNodeLoad from './console/ConsoleNodeLoad.vue' import consoleNodeLoad from './console/ConsoleNodeLoad.vue'
import consoleDisk from './console/ConsoleDisk.vue' import consoleDisk from './console/ConsoleDisk.vue'
import consoleResource from './console/ConsoleResource.vue' import consoleResource from './console/ConsoleResource.vue'
import configInfo from './dialog/configInfo.vue'
import echarts from 'echarts'; import echarts from 'echarts';
@ -79,7 +73,6 @@ export default {
consoleNodeLoad, consoleNodeLoad,
consoleDisk, consoleDisk,
consoleResource, consoleResource,
configInfo,
}, },
data() { data() {
return { return {
@ -147,21 +140,6 @@ export default {
}).catch( (error)=> { }).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)=> {
});
}
} }
}; };

View File

@ -27,9 +27,12 @@
<el-option label="已添加" value="true"></el-option> <el-option label="已添加" value="true"></el-option>
<el-option label="未添加" value="false"></el-option> <el-option label="未添加" value="false"></el-option>
</el-select> </el-select>
<el-button size="mini" type="primary" @click="add()"> <el-button v-if="hasGroup !=='true'" size="mini" type="primary" @click="add()">
添加 添加
</el-button> </el-button>
<el-button v-if="hasGroup ==='true'" size="mini" type="danger" @click="remove()">
移除
</el-button>
<el-button icon="el-icon-refresh-right" circle size="mini" @click="getChannelList()"></el-button> <el-button icon="el-icon-refresh-right" circle size="mini" @click="getChannelList()"></el-button>
</div> </div>
</div> </div>
@ -64,8 +67,8 @@
<el-table-column label="添加状态" min-width="100"> <el-table-column label="添加状态" min-width="100">
<template slot-scope="scope"> <template slot-scope="scope">
<div slot="reference" class="name-wrapper"> <div slot="reference" class="name-wrapper">
<el-tag size="medium" :title="scope.row.gbBusinessGroupId" v-if="scope.row.gbBusinessGroupId"></el-tag> <el-tag size="medium" :title="scope.row.gbParentId" v-if="scope.row.gbParentId"></el-tag>
<el-tag size="medium" type="info" v-if="!scope.row.gbBusinessGroupId"></el-tag> <el-tag size="medium" type="info" v-if="!scope.row.gbParentId"></el-tag>
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
@ -110,7 +113,8 @@ export default {
total: 0, total: 0,
loading: false, loading: false,
loadSnap: {}, loadSnap: {},
regionId: "", groupId: "",
businessGroup: "",
multipleSelection: [] multipleSelection: []
}; };
}, },
@ -160,19 +164,23 @@ export default {
this.multipleSelection = val; this.multipleSelection = val;
}, },
selectable: function (row, rowIndex) { selectable: function (row, rowIndex) {
if (row.gbCivilCode) { if (this.hasGroup === "") {
return false if (row.gbParentId) {
return false
}else {
return true
}
}else { }else {
return true return true
} }
}, },
rowDblclick: function (row, rowIndex) { rowDblclick: function (row, rowIndex) {
if (row.gbCivilCode) { if (row.gbParentId) {
this.$refs.groupTree.refresh(row.gbCivilCode) this.$refs.groupTree.refresh(row.gbParentId)
} }
}, },
add: function (row) { add: function (row) {
if (!this.regionId) { if (!this.groupId) {
this.$message.info("请选择左侧行政区划节点") this.$message.info("请选择左侧行政区划节点")
return; return;
} }
@ -188,9 +196,10 @@ export default {
this.$axios({ this.$axios({
method: 'post', method: 'post',
url: `/api/common/channel/region/add`, url: `/api/common/channel/group/add`,
data: { data: {
civilCode: this.regionId, parentId: this.groupId,
businessGroup: this.businessGroup,
channelIds: channels channelIds: channels
} }
}).then((res)=> { }).then((res)=> {
@ -198,7 +207,7 @@ export default {
this.$message.success("保存成功") this.$message.success("保存成功")
this.getChannelList() this.getChannelList()
// //
this.$refs.groupTree.refresh(this.regionId) this.$refs.groupTree.refresh(this.groupId)
}else { }else {
this.$message.error(res.data.msg) this.$message.error(res.data.msg)
} }
@ -209,6 +218,37 @@ export default {
}); });
}, },
remove: function (row) { 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) { getSnap: function (row) {
let baseUrl = window.baseUrl ? window.baseUrl : ""; let baseUrl = window.baseUrl ? window.baseUrl : "";
@ -225,8 +265,9 @@ export default {
treeNodeClickEvent: function (device, data, isCatalog) { treeNodeClickEvent: function (device, data, isCatalog) {
}, },
chooseIdChange: function (id) { chooseIdChange: function (id, businessGroup) {
this.regionId = id; this.groupId = id;
this.businessGroup = businessGroup;
}, },
} }
}; };

View File

@ -14,7 +14,6 @@
<template slot="title">通道管理</template> <template slot="title">通道管理</template>
<el-menu-item index="/channel/region">行政区划</el-menu-item> <el-menu-item index="/channel/region">行政区划</el-menu-item>
<el-menu-item index="/channel/group">业务分组</el-menu-item> <el-menu-item index="/channel/group">业务分组</el-menu-item>
<el-menu-item index="/channel/list">通道列表</el-menu-item>
</el-submenu> </el-submenu>
<el-menu-item index="/cloudRecord">云端录像</el-menu-item> <el-menu-item index="/cloudRecord">云端录像</el-menu-item>
<el-menu-item index="/mediaServerManger">节点管理</el-menu-item> <el-menu-item index="/mediaServerManger">节点管理</el-menu-item>