添加国标模块

This commit is contained in:
fengcheng
2025-04-10 17:32:16 +08:00
parent 7bad6dcb83
commit aebf6ee4d4
29 changed files with 3545 additions and 532 deletions

View File

@@ -87,8 +87,8 @@ spring:
# 数据库索引
database: 8
# 密码
# password:
password: 123456
password:
# password: 123456
# 连接超时时间
timeout: 10s
lettuce:

View File

@@ -0,0 +1,34 @@
import request from '@/utils/request'
// 获取通道信息
export function getCommonChannel(id) {
return request({
url: `/api/common/channel/one/${id}`,
method: 'get',
})
}
// 获取通道信息列表
export function getIndustryCodeList() {
return request({
url: `/api/common/channel/industry/list`,
method: 'get',
})
}
// 获取通道类型列表
export function getDeviceTypeList() {
return request({
url: `/api/common/channel/type/list`,
method: 'get',
})
}
// 获取网络标识列表
export function getNetworkIdentificationTypeList() {
return request({
url: `/api/common/channel/network/identification/list`,
method: 'get',
})
}

View File

@@ -66,3 +66,48 @@ export function syncStatus(deviceId) {
})
}
// 同步设备通道
export function devicesSync(deviceId) {
return request({
url: `/api/device/query/devices/${deviceId}/sync`,
method: 'post',
})
}
// 分页查询国标设备
export function listDeviceChannel(query) {
return request({
url: `/api/device/query/devices/channels`,
method: 'get',
params: query
})
}
// 修改通道音频
export function changeAudio(data) {
return request({
url: `/api/device/query/channel/audio`,
method: 'post',
data: data
})
}
// 修改通道码流
export function updateChannelStreamIdentification(data) {
return request({
url: `/api/device/query/channel/stream/identification/update/`,
method: 'post',
data: data
})
}
// 分页查询子目录通道
export function subChannels(query) {
return request({
url: `/api/device/query/sub_channels/channels`,
method: 'get',
params: query
})
}

View File

@@ -0,0 +1,9 @@
import request from '@/utils/request'
// 停止点播
export function playStop(deviceId, channelId) {
return request({
url: `/api/play/stop/${deviceId}/${channelId}`,
method: 'get',
})
}

View File

@@ -0,0 +1,19 @@
import request from '@/utils/request'
// 获取所属的行政区划下的行政区划
export function getAllChild(query) {
return request({
url: `/api/region/base/child/list`,
method: 'get',
params: query
})
}
// 查询区域
export function queryForTree(query) {
return request({
url: `/api/region/tree/list`,
method: 'get',
params: query
})
}

View File

@@ -157,6 +157,21 @@ export const dynamicRoutes = [
meta: { title: '修改生成配置', activeMenu: '/tool/gen' }
}
]
},
{
path: '/channel/list',
component: Layout,
hidden: true,
permissions: ['tool:gen:edit'],
children: [
{
path: 'index/:deviceId(\\d+)/:parentChannelId(\\d+)',
component: () => import('@/views/wvp/channel/index'),
name: 'ChannelList',
meta: { title: '通道列表', activeMenu: '/device' }
}
]
}
]

View File

@@ -0,0 +1,394 @@
<template>
<div id="DeviceTree">
<div v-if="showHeader" class="page-header" style="margin-bottom: 1rem;">
<div class="page-title">业务分组</div>
<div class="page-header-btn">
<div style="display: inline;">
<el-input @input="search" style="visibility:hidden; margin-right: 1rem; width: 12rem;" size="mini"
placeholder="关键字"
prefix-icon="el-icon-search" v-model="searchSrt" clearable></el-input>
<el-checkbox v-model="showCode">显示编号</el-checkbox>
</div>
</div>
</div>
<div v-if="showHeader" style="height: 2rem; background-color: #FFFFFF"></div>
<div>
<el-alert v-if="showAlert && edit" title="操作提示" description="你可以使用右键菜单管理节点" type="info" style="text-align: left"></el-alert>
<!-- <vue-easy-tree-->
<!-- class="flow-tree"-->
<!-- ref="veTree"-->
<!-- node-key="treeId"-->
<!-- :height="treeHeight?treeHeight:'78vh'"-->
<!-- lazy-->
<!-- style="padding: 0 0 2rem 0.5rem"-->
<!-- :load="loadNode"-->
<!-- :data="treeData"-->
<!-- :props="props"-->
<!-- :default-expanded-keys="['']"-->
<!-- @node-contextmenu="contextmenuEventHandler"-->
<!-- @node-click="nodeClickHandler"-->
<!-- >-->
<!-- <template v-slot:default="{ node, data }">-->
<!-- <span class="custom-tree-node">-->
<!-- <span v-if="node.data.type === 0 && chooseId !== node.data.deviceId" style="color: #409EFF" class="iconfont icon-bianzubeifen3"></span>-->
<!-- <span v-if="node.data.type === 0 && chooseId === node.data.deviceId" style="color: #c60135;" class="iconfont icon-bianzubeifen3"></span>-->
<!-- <span v-if="node.data.type === 1 && node.data.status === 'ON'" style="color: #409EFF" class="iconfont icon-shexiangtou2"></span>-->
<!-- <span v-if="node.data.type === 1 && node.data.status !== 'ON'" style="color: #808181" class="iconfont icon-shexiangtou2"></span>-->
<!-- <span style=" padding-left: 1px" v-if="node.data.deviceId !=='' && showCode" :title="node.data.deviceId">{{ node.label }}编号{{ node.data.deviceId }}</span>-->
<!-- <span style=" padding-left: 1px" v-if="node.data.deviceId ==='' || !showCode" :title="node.data.deviceId">{{ node.label }}</span>-->
<!-- </span>-->
<!-- </template>-->
<!-- </vue-easy-tree>-->
</div>
<groupEdit ref="groupEdit"></groupEdit>
<gbDeviceSelect ref="gbDeviceSelect"></gbDeviceSelect>
<gbChannelSelect ref="gbChannelSelect" dataType="group"></gbChannelSelect>
</div>
</template>
<script>
// import VueEasyTree from "@wchbrad/vue-easy-tree";
import groupEdit from './../dialog/groupEdit'
import gbDeviceSelect from './../dialog/GbDeviceSelect'
import GbChannelSelect from "../dialog/GbChannelSelect.vue";
export default {
name: 'DeviceTree',
components: {
GbChannelSelect,
// VueEasyTree,
groupEdit, gbDeviceSelect
},
data() {
return {
props: {
label: "name",
id: "treeId"
},
showCode: false,
showAlert: true,
searchSrt: "",
chooseId: "",
treeData: [],
}
},
props: ['edit','enableAddChannel', 'clickEvent', 'onChannelChange', 'showHeader', 'hasChannel', 'addChannelToGroup', 'treeHeight'],
created() {
},
methods: {
search() {
},
loadNode: function (node, resolve) {
if (node.level === 0) {
resolve([{
treeId: "",
deviceId: "",
name: "根资源组",
isLeaf: false,
type: 0
}]);
} else {
if (node.data.leaf) {
resolve([]);
return
}
this.$axios({
method: 'get',
url: `/api/group/tree/list`,
params: {
query: this.searchSrt,
parent: node.data.id,
hasChannel: this.hasChannel
}
}).then((res) => {
if (res.data.code === 0) {
if (res.data.data.length > 0) {
this.showAlert = false
}
resolve(res.data.data);
}
}).catch(function (error) {
console.log(error);
});
}
},
reset: function () {
this.$forceUpdate();
},
contextmenuEventHandler: function (event, data, node, element) {
if (!this.edit) {
return;
}
if (node.data.type === 0) {
let menuItem = [
{
label: "刷新节点",
icon: "el-icon-refresh",
disabled: false,
onClick: () => {
this.refreshNode(node);
}
},
{
label: "新建节点",
icon: "el-icon-plus",
disabled: false,
onClick: () => {
this.addGroup(data.id, node);
}
},
{
label: "编辑节点",
icon: "el-icon-edit",
disabled: node.level === 1,
onClick: () => {
this.editGroup(data, node);
}
},
{
label: "删除节点",
icon: "el-icon-delete",
disabled: node.level === 1,
divided: true,
onClick: () => {
this.$confirm('确定删除?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.removeGroup(data.id, node)
}).catch(() => {
});
}
},
]
if (this.enableAddChannel) {
menuItem.push(
{
label: "添加设备",
icon: "el-icon-plus",
disabled: node.level <= 2,
onClick: () => {
this.addChannelFormDevice(data.id, node)
}
},
)
menuItem.push(
{
label: "移除设备",
icon: "el-icon-delete",
disabled: node.level <= 2,
divided: true,
onClick: () => {
this.removeChannelFormDevice(data.id, node)
}
},
)
menuItem.push(
{
label: "添加通道",
icon: "el-icon-plus",
disabled: node.level <= 2,
onClick: () => {
this.addChannel(data.id, node)
}
},
)
}
this.$contextmenu({
items: menuItem,
event, // 鼠标事件信息
customClass: "custom-class", // 自定义菜单 class
zIndex: 3000, // 菜单样式 z-index
});
}
return false;
},
removeGroup: function (id, node) {
this.$axios({
method: "delete",
url: `/api/group/delete`,
params: {
id: node.data.id,
}
}).then((res) => {
if (res.data.code === 0) {
console.log("移除成功")
node.parent.loaded = false
node.parent.expand();
if (this.onChannelChange) {
this.onChannelChange(node.data.deviceId)
}
}
}).catch(function (error) {
console.log(error);
});
},
addChannelFormDevice: function (id, node) {
this.$refs.gbDeviceSelect.openDialog((rows) => {
let deviceIds = []
for (let i = 0; i < rows.length; i++) {
deviceIds.push(rows[i].id)
}
this.$axios({
method: 'post',
url: `/api/common/channel/group/device/add`,
data: {
parentId: node.data.deviceId,
businessGroup: node.data.businessGroup,
deviceIds: deviceIds,
}
}).then((res) => {
if (res.data.code === 0) {
this.$message.success({
showClose: true,
message: "保存成功"
})
if (this.onChannelChange) {
this.onChannelChange()
}
console.log(node)
node.loaded = false
node.expand();
} else {
this.$message.error({
showClose: true,
message: res.data.msg
})
}
this.loading = false
}).catch((error) => {
this.$message.error({
showClose: true,
message: error
})
this.loading = false
});
})
},
removeChannelFormDevice: function (id, node) {
this.$refs.gbDeviceSelect.openDialog((rows) => {
let deviceIds = []
for (let i = 0; i < rows.length; i++) {
deviceIds.push(rows[i].id)
}
this.$axios({
method: 'post',
url: `/api/common/channel/group/device/delete`,
data: {
deviceIds: deviceIds,
}
}).then((res) => {
if (res.data.code === 0) {
this.$message.success({
showClose: true,
message: "保存成功"
})
if (this.onChannelChange) {
this.onChannelChange()
}
node.loaded = false
node.expand();
} else {
this.$message.error({
showClose: true,
message: res.data.msg
})
}
this.loading = false
}).catch((error) => {
this.$message.error({
showClose: true,
message: error
})
this.loading = false
});
})
},
addChannel: function (id, node) {
this.$refs.gbChannelSelect.openDialog((data) => {
console.log("选择的数据")
console.log(data)
this.addChannelToGroup(node.data.deviceId, node.data.businessGroup, data)
})
},
refreshNode: function (node) {
console.log(node)
node.loaded = false
node.expand();
},
refresh: function (id) {
console.log("刷新节点: " + id)
// 查询node
let node = this.$refs.veTree.getNode(id)
if (node) {
node.loaded = false
node.expand();
}
},
addGroup: function (id, node) {
this.$refs.groupEdit.openDialog({
id: 0,
name: "",
deviceId: "",
civilCode: "",
parentDeviceId: node.level > 2 ? node.data.deviceId : "",
parentId: node.data.id,
businessGroup: node.level > 2 ? node.data.businessGroup : node.data.deviceId,
}, form => {
console.log(node)
node.loaded = false
node.expand();
}, id);
},
editGroup: function (id, node) {
console.log(node)
this.$refs.groupEdit.openDialog(node.data, form => {
console.log(node)
node.parent.loaded = false
node.parent.expand();
}, id);
},
nodeClickHandler: function (data, node, tree) {
this.chooseId = data.deviceId;
if (this.clickEvent) {
this.clickEvent(data)
}
}
},
destroyed() {
// if (this.jessibuca) {
// this.jessibuca.destroy();
// }
// this.playing = false;
// this.loaded = false;
// this.performance = "";
},
}
</script>
<style>
.device-tree-main-box {
text-align: left;
}
.device-online {
color: #252525;
}
.device-offline {
color: #727272;
}
.custom-tree-node .el-radio__label {
padding-left: 4px !important;
}
</style>

View File

@@ -0,0 +1,44 @@
<template>
<div>
<el-tree
style="max-width: 600px"
:data="treeData"
:props="{label: 'name', children: 'children'}"
@node-click="handleNodeClick"
/>
</div>
</template>
<script setup name="RegionTree">
import {queryForTree} from "../../../api/wvp/region.js";
const {proxy} = getCurrentInstance();
const searchSrt = ref('');
const treeData = ref([]);
const props = defineProps({
hasChannel: {},
});
onMounted(() => {
queryForTree({
query: searchSrt.value,
parent: null,
hasChannel: props.hasChannel
}).then((res) => {
let data = [
{
name: "根资源组",
children: []
}
]
data[0].children = proxy.handleTree(res.data, "id")
treeData.value = data
})
})
function handleNodeClick(data){
console.log(data.deviceId)
}
</script>

View File

@@ -0,0 +1,192 @@
<template>
<div id="gbChannelSelect" v-loading="getChannelListLoading">
<el-dialog
title="添加国标通道"
width="60%"
top="2rem"
:close-on-click-modal="false"
:visible.sync="showDialog"
:destroy-on-close="true"
append-to-body
@close="close()"
>
<div class="page-header" style="width: 100%">
<div class="page-header-btn" style="width: 100%; text-align: left">
搜索:
<el-input @input="getChannelList" style="margin-right: 1rem; width: auto;" size="mini" placeholder="关键字"
prefix-icon="el-icon-search" v-model="searchSrt" clearable></el-input>
在线状态:
<el-select size="mini" style="width: 8rem; margin-right: 1rem;" @change="getChannelList" v-model="online" placeholder="请选择"
default-first-option>
<el-option label="全部" value=""></el-option>
<el-option label="在线" value="true"></el-option>
<el-option label="离线" value="false"></el-option>
</el-select>
类型:
<el-select size="mini" style="width: 8rem; margin-right: 1rem;" @change="getChannelList" v-model="channelType" placeholder="请选择"
default-first-option>
<el-option label="全部" value=""></el-option>
<el-option label="国标设备" :value="1"></el-option>
<el-option label="推流设备" :value="2"></el-option>
<el-option label="拉流代理" :value="3"></el-option>
</el-select>
<el-button size="mini" :loading="getChannelListLoading"
@click="getChannelList()">刷新</el-button>
<el-button type="primary" size="mini" style="float: right" @click="onSubmit"> </el-button>
</div>
</div>
<!--通道列表-->
<el-table size="small" ref="channelListTable" :data="channelList" :height="winHeight" style="width: 100%;"
header-row-class-name="table-header" @selection-change="handleSelectionChange" >
<el-table-column type="selection" width="55" >
</el-table-column>
<el-table-column prop="gbName" label="名称" min-width="180">
</el-table-column>
<el-table-column prop="gbDeviceId" label="编号" min-width="180">
</el-table-column>
<el-table-column prop="gbManufacturer" label="厂家" min-width="100">
</el-table-column>
<el-table-column label="类型" min-width="100">
<template v-slot:default="scope">
<div slot="reference" class="name-wrapper">
<el-tag size="medium" effect="plain" v-if="scope.row.dataType === 1">国标设备</el-tag>
<el-tag size="medium" effect="plain" type="success" v-else-if="scope.row.dataType === 2" >推流设备</el-tag>
<el-tag size="medium" effect="plain" type="warning" v-else-if="scope.row.dataType === 3">拉流代理</el-tag>
</div>
</template>
</el-table-column>
<el-table-column label="状态" min-width="100">
<template v-slot:default="scope">
<div slot="reference" class="name-wrapper">
<el-tag size="medium" v-if="scope.row.gbStatus === 'ON'">在线</el-tag>
<el-tag size="medium" type="info" v-if="scope.row.gbStatus !== 'ON'">离线</el-tag>
</div>
</template>
</el-table-column>
</el-table>
<div style="display: grid; grid-template-columns: 1fr 1fr">
<div style="text-align: left; line-height: 32px">
<i class="el-icon-info"></i>未找到通道可在国标设备/通道中选择编辑按钮 选择{{dataType === 'civilCode'?'行政区划':'父节点编码'}}
</div>
<el-pagination
style="text-align: right"
@size-change="handleSizeChange"
@current-change="currentChange"
:current-page="currentPage"
:page-size="count"
:page-sizes="[10, 25, 35, 50, 200, 1000, 50000]"
layout="total, sizes, prev, pager, next"
:total="total">
</el-pagination>
</div>
</el-dialog>
</div>
</template>
<script>
export default {
name: "gbChannelSelect",
props: ['dataType', "selected"],
computed: {},
data() {
return {
showDialog: false,
channelList: [], //设备列表
currentDevice: {}, //当前操作设备对象
searchSrt: "",
online: null,
channelType: "",
videoComponentList: [],
updateLooper: 0, //数据刷新轮训标志
currentDeviceChannelsLenth: 0,
winHeight: 580,
currentPage: 1,
count: 10,
total: 0,
getChannelListLoading: false,
multipleSelection: [],
};
},
methods: {
initData: function () {
this.getChannelList();
},
currentChange: function (val) {
this.currentPage = val;
this.getChannelList();
},
handleSizeChange: function (val) {
this.count = val;
this.getChannelList();
},
handleSelectionChange: function (val){
this.multipleSelection = val;
},
getChannelList: function () {
this.getChannelListLoading = true;
if (this.dataType === "civilCode") {
this.$axios({
method: 'get',
url: `/api/common/channel/civilcode/list`,
params: {
page: this.currentPage,
count: this.count,
channelType: this.channelType,
query: this.searchSrt,
online: this.online,
}
}).then( (res)=> {
if (res.data.code === 0) {
this.total = res.data.data.total;
this.channelList = res.data.data.list;
}
this.getChannelListLoading = false;
}).catch( (error)=> {
console.error(error);
this.getChannelListLoading = false;
});
}else {
this.$axios({
method: 'get',
url: `/api/common/channel/parent/list`,
params: {
page: this.currentPage,
count: this.count,
query: this.searchSrt,
channelType: this.channelType,
online: this.online,
}
}).then( (res)=> {
if (res.data.code === 0) {
this.total = res.data.data.total;
this.channelList = res.data.data.list;
}
this.getChannelListLoading = false;
}).catch( (error)=> {
console.error(error);
this.getChannelListLoading = false;
});
}
},
openDialog: function (callback) {
this.listChangeCallback = callback;
this.showDialog = true;
this.initData();
},
onSubmit: function () {
if (this.listChangeCallback ) {
this.listChangeCallback(this.multipleSelection)
}
this.showDialog = false;
},
close: function () {
this.showDialog = false;
},
}
};
</script>

View File

@@ -0,0 +1,153 @@
<template>
<div id="addUser" v-loading="getDeviceListLoading">
<el-dialog
title="添加国标设备通道"
width="60%"
top="2rem"
:close-on-click-modal="false"
:visible.sync="showDialog"
:destroy-on-close="true"
append-to-body
@close="close()"
>
<div class="page-header" style="width: 100%">
<div class="page-header-btn" style="width: 100%; text-align: left">
搜索:
<el-input @input="getDeviceList" style="margin-right: 1rem; width: auto;" size="mini" placeholder="关键字"
prefix-icon="el-icon-search" v-model="searchSrt" clearable></el-input>
在线状态:
<el-select size="mini" style="width: 8rem; margin-right: 1rem;" @change="getDeviceList" v-model="online" placeholder="请选择"
default-first-option>
<el-option label="全部" value=""></el-option>
<el-option label="在线" value="true"></el-option>
<el-option label="离线" value="false"></el-option>
</el-select>
<el-button size="mini" :loading="getDeviceListLoading"
@click="getDeviceList()">刷新</el-button>
<el-button type="primary" size="mini" style="float: right" @click="onSubmit"> </el-button>
</div>
</div>
<!--设备列表-->
<el-table size="medium" :data="deviceList" style="width: 100%;font-size: 12px;" :height="winHeight" header-row-class-name="table-header" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" >
</el-table-column>
<el-table-column prop="name" label="名称" min-width="160">
</el-table-column>
<el-table-column prop="deviceId" label="设备编号" min-width="200" >
</el-table-column>
<el-table-column prop="channelCount" label="通道数" min-width="120" >
</el-table-column>
<el-table-column prop="manufacturer" label="厂家" min-width="120" >
</el-table-column>
<el-table-column label="地址" min-width="160" >
<template v-slot:default="scope">
<div slot="reference" class="name-wrapper">
<el-tag v-if="scope.row.hostAddress" size="medium">{{ scope.row.hostAddress }}</el-tag>
<el-tag v-if="!scope.row.hostAddress" size="medium">未知</el-tag>
</div>
</template>
</el-table-column>
<el-table-column label="状态" min-width="120">
<template v-slot:default="scope">
<div slot="reference" class="name-wrapper">
<el-tag size="medium" v-if="scope.row.onLine">在线</el-tag>
<el-tag size="medium" type="info" v-if="!scope.row.onLine">离线</el-tag>
</div>
</template>
</el-table-column>
</el-table>
<el-pagination
style="text-align: right"
@size-change="handleSizeChange"
@current-change="currentChange"
:current-page="currentPage"
:page-size="count"
:page-sizes="[10, 25, 35, 50, 200, 1000, 50000]"
layout="total, sizes, prev, pager, next"
:total="total">
</el-pagination>
</el-dialog>
</div>
</template>
<script>
export default {
name: "gbDeviceSelect",
props: {},
computed: {},
data() {
return {
showDialog: false,
deviceList: [], //设备列表
currentDevice: {}, //当前操作设备对象
searchSrt: "",
online: null,
videoComponentList: [],
updateLooper: 0, //数据刷新轮训标志
currentDeviceChannelsLenth: 0,
winHeight: 580,
currentPage: 1,
count: 10,
total: 0,
getDeviceListLoading: false,
multipleSelection: [],
};
},
mounted() {
this.initData();
},
methods: {
initData: function () {
this.getDeviceList();
},
currentChange: function (val) {
this.currentPage = val;
this.getDeviceList();
},
handleSizeChange: function (val) {
this.count = val;
this.getDeviceList();
},
handleSelectionChange: function (val){
this.multipleSelection = val;
},
getDeviceList: function () {
this.getDeviceListLoading = true;
this.$axios({
method: 'get',
url: `/api/device/query/devices`,
params: {
page: this.currentPage,
count: this.count,
query: this.searchSrt,
status: this.online,
}
}).then( (res)=> {
if (res.data.code === 0) {
this.total = res.data.data.total;
this.deviceList = res.data.data.list;
}
this.getDeviceListLoading = false;
}).catch( (error)=> {
console.error(error);
this.getDeviceListLoading = false;
});
},
openDialog: function (callback) {
this.listChangeCallback = callback;
this.showDialog = true;
},
onSubmit: function () {
if (this.listChangeCallback ) {
this.listChangeCallback(this.multipleSelection)
}
this.showDialog = false;
},
close: function () {
this.showDialog = false;
},
}
};
</script>

View File

@@ -0,0 +1,364 @@
<template>
<el-dialog
title="生成国标编码"
width="65rem"
top="2rem"
center
:append-to-body="true"
:close-on-click-modal="false"
:visible.sync="showVideoDialog"
:destroy-on-close="false"
>
<el-tabs v-model="activeKey" style="padding: 0 1rem; margin: auto 0" @tab-click="getRegionList">
<el-tab-pane name="0" >
<div slot="label" >
<div class="show-code-item">{{ allVal[0].val }}</div>
<div style="text-align: center">{{ allVal[0].meaning }}</div>
</div>
<el-radio-group v-model="allVal[0].val" >
<el-radio v-for="item in regionList" :key="item.deviceId" :label="item.deviceId" style="line-height: 2rem">
{{ item.name }} - {{ item.deviceId }}
</el-radio>
</el-radio-group>
</el-tab-pane>
<el-tab-pane name="1">
<div slot="label">
<div class="show-code-item">{{ allVal[1].val }}</div>
<div style="text-align: center">{{ allVal[1].meaning }}</div>
</div>
<el-radio-group v-model="allVal[1].val" :disabled="allVal[1].lock">
<el-radio v-for="item in regionList" :key="item.deviceId" :label="item.deviceId.substring(2)" style="line-height: 2rem">
{{ item.name }} - {{ item.deviceId.substring(2) }}
</el-radio>
</el-radio-group>
</el-tab-pane>
<el-tab-pane name="2">
<div slot="label">
<div class="show-code-item">{{ allVal[2].val }}</div>
<div style="text-align: center">{{ allVal[2].meaning }}</div>
</div>
<el-radio-group v-model="allVal[2].val" :disabled="allVal[2].lock">
<el-radio v-for="item in regionList" :key="item.deviceId" :label="item.deviceId.substring(4)" style="line-height: 2rem">
{{ item.name }} - {{ item.deviceId.substring(4) }}
</el-radio>
</el-radio-group>
</el-tab-pane>
<el-tab-pane name="3">
请手动输入基层接入单位编码,两位数字
<div slot="label">
<div class="show-code-item">{{ allVal[3].val }}</div>
<div style="text-align: center">{{ allVal[3].meaning }}</div>
</div>
<el-input
type="text"
placeholder="请输入内容"
v-model="allVal[3].val"
maxlength="2"
:disabled="allVal[3].lock"
show-word-limit
>
</el-input>
</el-tab-pane>
<el-tab-pane name="4">
<div slot="label">
<div class="show-code-item">{{ allVal[4].val }}</div>
<div style="text-align: center; ">{{ allVal[4].meaning }}</div>
</div>
<el-radio-group v-model="allVal[4].val" :disabled="allVal[4].lock">
<el-radio v-for="item in industryCodeTypeList" :key="item.code" :label="item.code" style="line-height: 2rem">
{{ item.name }} - {{ item.code }}
</el-radio>
</el-radio-group>
</el-tab-pane>
<el-tab-pane name="5">
<div slot="label">
<div class="show-code-item">{{ allVal[5].val }}</div>
<div style="text-align: center">{{ allVal[5].meaning }}</div>
</div>
<el-radio-group v-model="allVal[5].val" :disabled="allVal[5].lock" >
<el-radio v-for="item in deviceTypeList" :label="item.code" :key="item.code" style="line-height: 2rem">
{{ item.name }} - {{ item.code }}
</el-radio>
</el-radio-group>
</el-tab-pane>
<el-tab-pane name="6">
<div slot="label">
<div class="show-code-item">{{ allVal[6].val }}</div>
<div style="text-align: center">{{ allVal[6].meaning }}</div>
</div>
<el-radio-group v-model="allVal[6].val" :disabled="allVal[6].lock">
<el-radio v-for="item in networkIdentificationTypeList" :label="item.code" :key="item.code" style="line-height: 2rem">
{{ item.name }} - {{ item.code }}
</el-radio>
</el-radio-group>
</el-tab-pane>
<el-tab-pane name="7">
请手动输入设备/用户序号, 六位数字
<div slot="label">
<div class="show-code-item">{{ allVal[7].val }}</div>
<div style="text-align: center">{{ allVal[7].meaning }}</div>
</div>
<el-input
type="text"
placeholder="请输入内容"
v-model="allVal[7].val"
maxlength="6"
:disabled="allVal[7].lock"
show-word-limit
>
</el-input>
</el-tab-pane>
</el-tabs>
<el-form style="">
<el-form-item style="margin-top: 22px; margin-bottom: 0;">
<div style="float:right;">
<el-button type="primary" @click="handleOk">保存</el-button>
<el-button @click="closeModel">取消</el-button>
</div>
</el-form-item>
</el-form>
</el-dialog>
</template>
<script>
export default {
props: {},
computed: {},
data() {
return {
showVideoDialog: false,
activeKey: '0',
allVal: [
{
id: [1, 2],
meaning: '省级编码',
val: '11',
type: '中心编码',
lock: false,
},
{
id: [3, 4],
meaning: '市级编码',
val: '01',
type: '中心编码',
lock: false,
},
{
id: [5, 6],
meaning: '区级编码',
val: '01',
type: '中心编码',
lock: false,
},
{
id: [7, 8],
meaning: '基层接入单位编码',
val: '01',
type: '中心编码',
lock: false,
},
{
id: [9, 10],
meaning: '行业编码',
val: '00',
type: '行业编码',
lock: false,
},
{
id: [11, 13],
meaning: '类型编码',
val: '132',
type: '类型编码',
lock: false,
},
{
id: [14],
meaning: '网络标识编码',
val: '7',
type: '网络标识',
lock: false,
},
{
id: [15, 20],
meaning: '设备/用户序号',
val: '000001',
type: '序号',
lock: false,
}
],
regionList: [],
deviceTypeList: [],
industryCodeTypeList: [],
networkIdentificationTypeList: [],
endCallBck: null,
};
},
methods: {
openDialog: function (endCallBck, code, lockIndex, lockContent) {
console.log(code)
this.showVideoDialog = true
this.activeKey= '0';
this.regionList = []
this.getRegionList()
if (typeof code != 'undefined' && code.length === 20) {
this.allVal[0].val = code.substring(0, 2)
this.allVal[1].val = code.substring(2, 4)
this.allVal[2].val = code.substring(4, 6)
this.allVal[3].val = code.substring(6, 8)
this.allVal[4].val = code.substring(8, 10)
this.allVal[5].val = code.substring(10, 13)
this.allVal[6].val = code.substring(13, 14)
this.allVal[7].val = code.substring(14)
}
console.log(this.allVal)
if (typeof lockIndex != 'undefined') {
this.allVal[lockIndex].lock = true
this.allVal[lockIndex].val = lockContent
}
this.endCallBck = endCallBck;
},
getRegionList: function() {
if (this.activeKey === '0' || this.activeKey === '1' || this.activeKey === '2') {
let parent = ''
if (this.activeKey === '1') {
parent = this.allVal[0].val
}
if (this.activeKey === '2') {
parent = this.allVal[0].val + this.allVal[1].val
}
if (this.activeKey !== '0' && parent === '') {
this.$message.error({
showClose: true,
message: '请先选择上级行政区划'
})
}
this.queryChildList(parent);
} else if (this.activeKey === '4') {
console.log(222)
this.queryIndustryCodeList();
} else if (this.activeKey === '5') {
this.queryDeviceTypeList();
} else if (this.activeKey === '6') {
this.queryNetworkIdentificationTypeList();
}
},
queryChildList: function(parent){
this.regionList = []
this.$axios({
method: 'get',
url: "/api/region/base/child/list",
params: {
parent: parent,
}
}).then((res) => {
if (res.data.code === 0) {
this.regionList = res.data.data
} else {
this.$message.error({
showClose: true,
message: res.data.msg
})
}
}).catch((error) => {
this.$message.error({
showClose: true,
message: error
});
});
},
queryIndustryCodeList: function(){
this.industryCodeTypeList = []
this.$axios({
method: 'get',
url: "/api/common/channel/industry/list",
}).then((res) => {
if (res.data.code === 0) {
this.industryCodeTypeList = res.data.data
} else {
this.$message.error({
showClose: true,
message: res.data.msg
})
}
}).catch((error) => {
this.$message.error({
showClose: true,
message: error
});
});
},
queryDeviceTypeList: function(){
this.deviceTypeList = []
this.$axios({
method: 'get',
url: "/api/common/channel/type/list",
}).then((res) => {
if (res.data.code === 0) {
this.deviceTypeList = res.data.data
} else {
this.$message.error({
showClose: true,
message: res.data.msg
})
}
}).catch((error) => {
this.$message.error({
showClose: true,
message: error
});
});
},
queryNetworkIdentificationTypeList: function(){
this.networkIdentificationTypeList = []
this.$axios({
method: 'get',
url: "/api/common/channel/network/identification/list",
}).then((res) => {
if (res.data.code === 0) {
this.networkIdentificationTypeList = res.data.data
} else {
this.$message.error({
showClose: true,
message: res.data.msg
})
}
}).catch((error) => {
this.$message.error({
showClose: true,
message: error
});
});
},
closeModel: function (){
this.showVideoDialog = false
},
handleOk: function() {
const code =
this.allVal[0].val +
this.allVal[1].val +
this.allVal[2].val +
this.allVal[3].val +
this.allVal[4].val +
this.allVal[5].val +
this.allVal[6].val +
this.allVal[7].val
console.log(code)
if (this.endCallBck) {
this.endCallBck(code)
}
this.showVideoDialog = false
}
},
};
</script>
<style>
.show-code-item {
text-align: center;
font-size: 3rem;
}
</style>

View File

@@ -0,0 +1,65 @@
<template>
<div id="chooseCivilCode" >
<el-dialog
title="选择行政区划"
width="30%"
top="5rem"
:close-on-click-modal="false"
:visible.sync="showDialog"
:destroy-on-close="true"
@close="close()"
>
<RegionTree ref="regionTree" :showHeader=true :edit="true" :enableAddChannel="false" :clickEvent="treeNodeClickEvent"
:onChannelChange="onChannelChange" :treeHeight="'45vh'"></RegionTree>
<el-form>
<el-form-item>
<div style="text-align: right">
<el-button type="primary" @click="onSubmit">保存</el-button>
<el-button @click="close">取消</el-button>
</div>
</el-form-item>
</el-form>
</el-dialog>
</div>
</template>
<script>
import RegionTree from "../common/RegionTree.vue";
export default {
name: "chooseCivilCode",
components: {RegionTree},
props: {},
computed: {},
created() {},
data() {
return {
showDialog: false,
endCallback: false,
regionDeviceId: "",
};
},
methods: {
openDialog: function (callback) {
this.showDialog = true;
this.endCallback = callback;
},
onSubmit: function () {
if (this.endCallback) {
this.endCallback(this.regionDeviceId)
}
this.close();
},
close: function () {
this.showDialog = false;
},
treeNodeClickEvent: function (region) {
this.regionDeviceId = region.deviceId;
},
onChannelChange: function (deviceId) {
//
},
},
};
</script>

View File

@@ -0,0 +1,71 @@
<template>
<div id="chooseGroup" >
<el-dialog
title="选择虚拟组织"
width="30%"
top="5rem"
:append-to-body="true"
:close-on-click-modal="false"
:visible.sync="showDialog"
:destroy-on-close="true"
@close="close()"
>
<GroupTree ref="regionTree" :showHeader=true :edit="true" :enableAddChannel="false" :clickEvent="treeNodeClickEvent"
:onChannelChange="onChannelChange" :treeHeight="'45vh'"></GroupTree>
<el-form>
<el-form-item>
<div style="text-align: right">
<el-button type="primary" @click="onSubmit">保存</el-button>
<el-button @click="close">取消</el-button>
</div>
</el-form-item>
</el-form>
</el-dialog>
</div>
</template>
<script>
import GroupTree from "../common/GroupTree.vue";
export default {
name: "chooseCivilCode",
components: {GroupTree},
props: {},
computed: {},
created() {},
data() {
return {
showDialog: false,
endCallback: false,
groupDeviceId: "",
businessGroup: "",
};
},
methods: {
openDialog: function (callback) {
this.showDialog = true;
this.endCallback = callback;
},
onSubmit: function () {
if (this.endCallback) {
this.endCallback(this.groupDeviceId, this.businessGroup)
}
this.close();
},
close: function () {
this.showDialog = false;
},
treeNodeClickEvent: function (group) {
if (group.deviceId === "" || group.deviceId === group.businessGroup) {
return
}
this.groupDeviceId = group.deviceId;
this.businessGroup = group.businessGroup;
},
onChannelChange: function (deviceId) {
//
},
},
};
</script>

View File

@@ -0,0 +1,129 @@
<template>
<div id="groupEdit" v-loading="loading">
<el-dialog
title="分组编辑"
width="40%"
top="2rem"
:append-to-body="true"
:close-on-click-modal="false"
:visible.sync="showDialog"
:destroy-on-close="true"
@close="close()"
>
<div id="shared" style="margin-top: 1rem;margin-right: 100px;">
<el-form ref="form" :model="group" label-width="140px" >
<el-form-item label="节点编号" prop="id" >
<el-input v-model="group.deviceId" placeholder="请输入编码">
<el-button slot="append" @click="buildDeviceIdCode(group.deviceId)">生成</el-button>
</el-input>
</el-form-item>
<el-form-item label="节点名称" prop="name">
<el-input v-model="group.name" clearable></el-input>
</el-form-item>
<el-form-item label="行政区划" prop="name">
<el-input v-model="group.civilCode" >
<el-button slot="append" @click="buildCivilCode(group.civilCode)">选择</el-button>
</el-input>
</el-form-item>
<el-form-item>
<div style="float: right;">
<el-button type="primary" @click="onSubmit" >确认</el-button>
<el-button @click="close">取消</el-button>
</div>
</el-form-item>
</el-form>
</div>
</el-dialog>
<channelCode ref="channelCode"></channelCode>
<chooseCivilCode ref="chooseCivilCode"></chooseCivilCode>
</div>
</template>
<script>
import channelCode from "./channelCode.vue";
import ChooseCivilCode from "./chooseCivilCode.vue";
export default {
name: "groupEdit",
components: {ChooseCivilCode, channelCode},
computed: {},
props: [],
created() {},
data() {
return {
submitCallback: null,
showDialog: false,
loading: false,
level: 0,
group: {
id: 0,
deviceId: "",
name: "",
parentDeviceId: "",
businessGroup: "",
civilCode: "",
platformId: "",
},
};
},
methods: {
openDialog: function (group, callback) {
console.log(group)
if (group) {
this.group = group;
}
this.showDialog = true;
this.submitCallback = callback;
},
onSubmit: function () {
this.$axios({
method:"post",
url: this.group.id ? '/api/group/update':'/api/group/add',
data: this.group
}).then((res)=> {
if (res.data.code === 0) {
this.$message.success({
showClose: true,
message: "保存成功"
})
if (this.submitCallback)this.submitCallback(this.group)
}else {
this.$message({
showClose: true,
message: res.data.msg,
type: "error",
});
}
this.close();
})
.catch((error)=> {
this.$message({
showClose: true,
message: error,
type: "error",
});
});
},
buildDeviceIdCode: function (deviceId){
console.log(this.group)
let lockContent = this.group.businessGroup ? "216":"215"
this.$refs.channelCode.openDialog(code=>{
this.group.deviceId = code;
}, deviceId, 5 , lockContent);
},
buildCivilCode: function (deviceId){
this.$refs.chooseCivilCode.openDialog(code=>{
this.group.civilCode = code;
});
},
close: function () {
this.showDialog = false;
console.log(this.group)
},
},
};
</script>

View File

@@ -0,0 +1,346 @@
<template>
<el-dialog
title="生成行政区划编码"
width="65rem"
top="2rem"
center
:append-to-body="true"
:close-on-click-modal="false"
:visible.sync="showVideoDialog"
:destroy-on-close="false"
>
<el-tabs v-model="activeKey" style="padding: 0 1rem; margin: auto 0" @tab-click="getRegionList">
<el-tab-pane name="0" >
<div slot="label" >
<div class="show-code-item">{{ allVal[0].val }}</div>
<div style="text-align: center">{{ allVal[0].meaning }}</div>
</div>
<el-radio v-for="item in regionList" v-model="allVal[0].val" :key="item.deviceId" :name="item.name" :label="item.deviceId" @input="deviceChange(item)" style="line-height: 2rem">
{{ item.name }} - {{ item.deviceId }}
</el-radio>
</el-tab-pane>
<el-tab-pane name="1">
<div slot="label">
<div class="show-code-item">{{ allVal[1].val?allVal[1].val:"--" }}</div>
<div style="text-align: center">{{ allVal[1].meaning }}</div>
</div>
<el-radio :key="-1" v-model="allVal[1].val" @input="deviceChange" label="" style="line-height: 2rem">
不添加
</el-radio>
<el-radio v-for="item in regionList" v-model="allVal[1].val" @input="deviceChange(item)" :key="item.deviceId" :label="item.deviceId.substring(2)" style="line-height: 2rem">
{{ item.name }} - {{ item.deviceId.substring(2) }}
</el-radio>
</el-tab-pane>
<el-tab-pane name="2">
<div slot="label">
<div class="show-code-item">{{ allVal[2].val?allVal[2].val:"--" }}</div>
<div style="text-align: center">{{ allVal[2].meaning }}</div>
</div>
<el-radio :key="-1" label="" v-model="allVal[2].val" style="line-height: 2rem" @input="deviceChange">
不添加
</el-radio>
<el-radio v-for="item in regionList" v-model="allVal[2].val" @input="deviceChange(item)" :key="item.deviceId" :label="item.deviceId.substring(4)" style="line-height: 2rem">
{{ item.name }} - {{ item.deviceId.substring(4) }}
</el-radio>
</el-tab-pane>
<el-tab-pane name="3">
请手动输入基层接入单位编码,两位数字
<div slot="label">
<div class="show-code-item">{{ allVal[3].val?allVal[3].val:"--" }}</div>
<div style="text-align: center">{{ allVal[3].meaning }}</div>
</div>
<el-input
type="text"
placeholder="请输入内容"
v-model="allVal[3].val"
maxlength="2"
:disabled="allVal[3].lock"
show-word-limit
@input="deviceChange"
>
</el-input>
</el-tab-pane>
</el-tabs>
<el-form ref="form" style=" display: grid; padding: 1rem 2rem 0 2rem;grid-template-columns: 1fr 1fr 1fr; gap: 1rem;">
<el-form-item label="名称" prop="name" size="mini" >
<el-input v-model="form.name" autocomplete="off"></el-input>
</el-form-item>
<el-form-item label="编号" prop="deviceId" size="mini" >
<el-input v-model="form.deviceId" autocomplete="off"></el-input>
</el-form-item>
<el-form-item style="margin-top: 22px; margin-bottom: 0;">
<div style="float:right;">
<el-button type="primary" @click="handleOk">保存</el-button>
<el-button @click="closeModel">取消</el-button>
</div>
</el-form-item>
</el-form>
</el-dialog>
</template>
<script>
export default {
props: {},
computed: {},
data() {
return {
showVideoDialog: false,
activeKey: '0',
form: {
name: "",
deviceId: "",
parentId: ""
},
allVal: [
{
id: [1, 2],
meaning: '省级编码',
val: '11',
type: '中心编码',
lock: false,
},
{
id: [3, 4],
meaning: '市级编码',
val: '',
type: '中心编码',
lock: false,
},
{
id: [5, 6],
meaning: '区级编码',
val: '',
type: '中心编码',
lock: false,
},
{
id: [7, 8],
meaning: '基层接入单位编码',
val: '',
type: '中心编码',
lock: false,
}
],
regionList: [],
deviceTypeList: [],
industryCodeTypeList: [],
networkIdentificationTypeList: [],
endCallBck: null,
};
},
methods: {
openDialog: function (endCallBck, region, code, lockContent) {
this.showVideoDialog = true
this.activeKey= '0';
this.regionList = []
this.form = region
this.allVal = [
{
id: [1, 2],
meaning: '省级编码',
val: '11',
type: '中心编码',
lock: false,
},
{
id: [3, 4],
meaning: '市级编码',
val: '',
type: '中心编码',
lock: false,
},
{
id: [5, 6],
meaning: '区级编码',
val: '',
type: '中心编码',
lock: false,
},
{
id: [7, 8],
meaning: '基层接入单位编码',
val: '',
type: '中心编码',
lock: false,
}
]
if (this.form.deviceId) {
if (this.form.deviceId.length >= 2) {
this.allVal[0].val = this.form.deviceId.substring(0, 2)
this.activeKey = "0"
}
if (this.form.deviceId.length >= 4) {
this.allVal[1].val = this.form.deviceId.substring(2, 4)
this.activeKey = "1"
}
if (this.form.deviceId.length >= 6) {
this.allVal[2].val = this.form.deviceId.substring(4, 6)
this.activeKey = "2"
}
if (this.form.deviceId.length === 8) {
this.allVal[3].val = this.form.deviceId.substring(6, 8)
this.activeKey = "3"
}
}else {
if (this.form.parentDeviceId) {
if (this.form.parentDeviceId.length >= 2) {
this.allVal[0].val = this.form.parentDeviceId.substring(0, 2)
this.activeKey = "1"
}
if (this.form.parentDeviceId.length >= 4) {
this.allVal[1].val = this.form.parentDeviceId.substring(2, 4)
this.activeKey = "2"
}
if (this.form.parentDeviceId.length >= 6) {
this.allVal[2].val = this.form.parentDeviceId.substring(4, 6)
this.activeKey = "3"
}
}
}
this.getRegionList()
this.endCallBck = endCallBck;
},
getRegionList: function() {
console.log("getRegionList")
if (this.activeKey === '0' ) {
this.queryChildList();
}else if (this.activeKey === '1' || this.activeKey === '2') {
let parent = ''
if (this.activeKey === '1') {
parent = this.allVal[0].val
}
if (this.activeKey === '2') {
if (this.allVal[1].val === ""){
parent = ""
} else {
parent = this.allVal[0].val + this.allVal[1].val
}
}
if (this.activeKey !== '0' && parent === '') {
this.$message.error({
showClose: true,
message: "请先选择上级行政区划"
})
}
if (parent !== "") {
this.queryChildList(parent);
}else {
this.regionList = []
}
}
},
queryChildList: function(parent){
console.log("queryChildList")
this.regionList = []
this.$axios({
method: 'get',
url: "/api/region/base/child/list",
params: {
parent: parent,
}
}).then((res) => {
if (res.data.code === 0) {
this.regionList = res.data.data
} else {
this.$message.error({
showClose: true,
message: res.data.msg
})
}
}).catch((error) => {
this.$message.error({
showClose: true,
message: error
});
});
},
closeModel: function (){
this.showVideoDialog = false
},
deviceChange: function (item){
console.log(item)
let code = this.allVal[0].val
if (this.allVal[1].val) {
code += this.allVal[1].val
if (this.allVal[2].val) {
code += this.allVal[2].val
if (this.allVal[3].val) {
code += this.allVal[3].val
}
}else {
this.allVal[3].val = ""
}
}else {
this.allVal[2].val = ""
this.allVal[3].val = ""
}
this.form.deviceId = code
if (item) {
this.form.name = item.name
}
},
handleOk: function() {
if (this.form.id) {
this.$axios({
method: 'post',
url: "/api/region/update",
data: this.form
}).then((res) => {
if (res.data.code === 0) {
if (typeof this.endCallBck == "function") {
this.endCallBck(this.form)
}
this.showVideoDialog = false
} else {
this.$message.error({
showClose: true,
message: res.data.msg
})
}
}).catch((error) => {
this.$message.error({
showClose: true,
message: error
});
});
}else {
this.$axios({
method: 'post',
url: "/api/region/add",
data: this.form
}).then((res) => {
if (res.data.code === 0) {
if (typeof this.endCallBck == "function") {
this.endCallBck(this.form)
}
this.showVideoDialog = false
} else {
this.$message.error({
showClose: true,
message: res.data.msg
})
}
}).catch((error) => {
this.$message.error({
showClose: true,
message: error
});
});
}
}
},
};
</script>
<style>
.show-code-item {
text-align: center;
font-size: 3rem;
}
</style>

View File

@@ -0,0 +1,313 @@
<template>
<el-dialog
v-model="showVideoDialog"
width="1200px"
append-to-body
title="生成国标编码"
top="2rem"
center
:append-to-body="true"
:close-on-click-modal="false"
:destroy-on-close="false"
>
<el-tabs v-model="activeKey" style="padding: 0 1rem; margin: auto 0" @tab-click="getRegionList">
<el-tab-pane name="0">
<template #label>
<div class="show-code-item">{{ allVal[0].val }}</div>
<div style="text-align: center">{{ allVal[0].meaning }}</div>
</template>
<el-radio-group v-model="allVal[0].val">
<el-radio v-for="item in regionList" :key="item.deviceId" :value="item.deviceId" style="line-height: 2rem">
{{ item.name }} - {{ item.deviceId }}
</el-radio>
</el-radio-group>
</el-tab-pane>
<el-tab-pane name="1">
<template #label>
<div class="show-code-item">{{ allVal[1].val }}</div>
<div style="text-align: center">{{ allVal[1].meaning }}</div>
</template>
<el-radio-group v-model="allVal[1].val" :disabled="allVal[1].lock">
<el-radio v-for="item in regionList" :key="item.deviceId" :value="item.deviceId.substring(2)"
style="line-height: 2rem">
{{ item.name }} - {{ item.deviceId.substring(2) }}
</el-radio>
</el-radio-group>
</el-tab-pane>
<el-tab-pane name="2">
<template #label>
<div class="show-code-item">{{ allVal[2].val }}</div>
<div style="text-align: center">{{ allVal[2].meaning }}</div>
</template>
<el-radio-group v-model="allVal[2].val" :disabled="allVal[2].lock">
<el-radio v-for="item in regionList" :key="item.deviceId" :value="item.deviceId.substring(4)"
style="line-height: 2rem">
{{ item.name }} - {{ item.deviceId.substring(4) }}
</el-radio>
</el-radio-group>
</el-tab-pane>
<el-tab-pane name="3">
请手动输入基层接入单位编码,两位数字
<template #label>
<div class="show-code-item">{{ allVal[3].val }}</div>
<div style="text-align: center">{{ allVal[3].meaning }}</div>
</template>
<el-input
type="text"
placeholder="请输入内容"
v-model="allVal[3].val"
maxlength="2"
:disabled="allVal[3].lock"
show-word-limit
>
</el-input>
</el-tab-pane>
<el-tab-pane name="4">
<template #label>
<div class="show-code-item">{{ allVal[4].val }}</div>
<div style="text-align: center; ">{{ allVal[4].meaning }}</div>
</template>
<el-radio-group v-model="allVal[4].val" :disabled="allVal[4].lock">
<el-radio v-for="item in industryCodeTypeList" :key="item.code" :value="item.code" style="line-height: 2rem">
{{ item.name }} - {{ item.code }}
</el-radio>
</el-radio-group>
</el-tab-pane>
<el-tab-pane name="5">
<template #label>
<div class="show-code-item">{{ allVal[5].val }}</div>
<div style="text-align: center">{{ allVal[5].meaning }}</div>
</template>
<el-radio-group v-model="allVal[5].val" :disabled="allVal[5].lock">
<el-radio v-for="item in deviceTypeList" :value="item.code" :key="item.code" style="line-height: 2rem">
{{ item.name }} - {{ item.code }}
</el-radio>
</el-radio-group>
</el-tab-pane>
<el-tab-pane name="6">
<template #label>
<div class="show-code-item">{{ allVal[6].val }}</div>
<div style="text-align: center">{{ allVal[6].meaning }}</div>
</template>
<el-radio-group v-model="allVal[6].val" :disabled="allVal[6].lock">
<el-radio v-for="item in networkIdentificationTypeList" :value="item.code" :key="item.code"
style="line-height: 2rem">
{{ item.name }} - {{ item.code }}
</el-radio>
</el-radio-group>
</el-tab-pane>
<el-tab-pane name="7">
请手动输入设备/用户序号, 六位数字
<template #label>
<div class="show-code-item">{{ allVal[7].val }}</div>
<div style="text-align: center">{{ allVal[7].meaning }}</div>
</template>
<el-input
type="text"
placeholder="请输入内容"
v-model="allVal[7].val"
maxlength="6"
:disabled="allVal[7].lock"
show-word-limit
>
</el-input>
</el-tab-pane>
</el-tabs>
<el-form style="">
<el-form-item style="margin-top: 22px; margin-bottom: 0;">
<div style="float:right;">
<el-button type="primary" @click="handleOk">保存</el-button>
<el-button @click="closeModel">取消</el-button>
</div>
</el-form-item>
</el-form>
</el-dialog>
</template>
<script setup name="ChannelCode">
import {ElMessage} from 'element-plus'
import {getAllChild} from "../../../api/wvp/region.js";
import {getDeviceTypeList, getIndustryCodeList, getNetworkIdentificationTypeList} from "../../../api/wvp/channel.js";
import {defineEmits} from 'vue';
const emit = defineEmits(['handleOk']);
const showVideoDialog = ref(false);
const activeKey = ref('0');
const allVal = ref([
{
id: [1, 2],
meaning: '省级编码',
val: '11',
type: '中心编码',
lock: false,
},
{
id: [3, 4],
meaning: '市级编码',
val: '01',
type: '中心编码',
lock: false,
},
{
id: [5, 6],
meaning: '区级编码',
val: '01',
type: '中心编码',
lock: false,
},
{
id: [7, 8],
meaning: '基层接入单位编码',
val: '01',
type: '中心编码',
lock: false,
},
{
id: [9, 10],
meaning: '行业编码',
val: '00',
type: '行业编码',
lock: false,
},
{
id: [11, 13],
meaning: '类型编码',
val: '132',
type: '类型编码',
lock: false,
},
{
id: [14],
meaning: '网络标识编码',
val: '7',
type: '网络标识',
lock: false,
},
{
id: [15, 20],
meaning: '设备/用户序号',
val: '000001',
type: '序号',
lock: false,
}
]);
const regionList = ref([]);
const deviceTypeList = ref([]);
const industryCodeTypeList = ref([]);
const networkIdentificationTypeList = ref([]);
const endCallBck = ref(null);
defineExpose({openDialog})
function openDialog(callBck, code, lockIndex, lockContent) {
console.log(code)
showVideoDialog.value = true
activeKey.value = '0';
regionList.value = []
getRegionList()
if (typeof code != 'undefined' && code.length === 20) {
allVal.value[0].val = code.substring(0, 2)
allVal.value[1].val = code.substring(2, 4)
allVal.value[2].val = code.substring(4, 6)
allVal.value[3].val = code.substring(6, 8)
allVal.value[4].val = code.substring(8, 10)
allVal.value[5].val = code.substring(10, 13)
allVal.value[6].val = code.substring(13, 14)
allVal.value[7].val = code.substring(14)
}
if (typeof lockIndex != 'undefined') {
allVal.value[0][lockIndex].lock = true
allVal.value[0][lockIndex].val = lockContent
}
endCallBck.value = callBck;
}
function getRegionList() {
nextTick(() => {
if (activeKey.value === '0' || activeKey.value === '1' || activeKey.value === '2') {
let parent = ''
if (activeKey.value === '1') {
parent = allVal.value[0].val
}
if (activeKey.value === '2') {
parent = allVal.value[0].val + allVal.value[1].val
}
if (activeKey.value !== '0' && parent === '') {
ElMessage.error('请先选择上级行政区划')
}
queryChildList(parent);
} else if (activeKey.value === '4') {
queryIndustryCodeList();
} else if (activeKey.value === '5') {
queryDeviceTypeList();
} else if (activeKey.value === '6') {
queryNetworkIdentificationTypeList();
}
})
}
function queryChildList(parent) {
regionList.value = []
getAllChild({parent: parent}).then((res) => {
regionList.value = res.data
})
}
function queryIndustryCodeList() {
industryCodeTypeList.value = []
getIndustryCodeList().then((res) => {
industryCodeTypeList.value = res.data
})
}
function queryDeviceTypeList() {
deviceTypeList.value = []
getDeviceTypeList().then((res) => {
deviceTypeList.value = res.data
})
}
function queryNetworkIdentificationTypeList() {
networkIdentificationTypeList.value = []
getNetworkIdentificationTypeList().then((res) => {
networkIdentificationTypeList.value = res.data
})
}
function closeModel() {
showVideoDialog.value = false
}
function handleOk() {
const code =
allVal.value[0].val +
allVal.value[1].val +
allVal.value[2].val +
allVal.value[3].val +
allVal.value[4].val +
allVal.value[5].val +
allVal.value[6].val +
allVal.value[7].val
if (endCallBck.value) {
endCallBck.value = code
}
showVideoDialog.value = false
emit('handleOk', code);
}
</script>
<style>
.show-code-item {
text-align: center;
font-size: 3rem;
}
</style>

View File

@@ -0,0 +1,55 @@
<template>
<div>
<el-dialog
title="选择行政区划"
width="30%"
top="5rem"
:close-on-click-modal="false"
v-model="showDialog"
:destroy-on-close="true"
@close="close()"
>
<RegionTree ref="regionTree"
:clickEvent="treeNodeClickEvent"
></RegionTree>
<el-form style="margin-top: 20px">
<el-form-item>
<div style="text-align: right">
<el-button type="primary" @click="onSubmit">保存</el-button>
<el-button @click="close">取消</el-button>
</div>
</el-form-item>
</el-form>
</el-dialog>
</div>
</template>
<script setup name="ChooseCivilCode">
import RegionTree from "../../components/common/RegionTree.vue";
const showDialog = ref(false);
const endCallback = ref(false);
const regionDeviceId = ref('');
defineExpose({openDialog})
function openDialog(callback) {
showDialog.value = true;
endCallback.value = callback;
}
function onSubmit() {
if (endCallback.value) {
endCallback.value = regionDeviceId.value
}
close();
}
function close() {
showDialog.value = false;
}
function treeNodeClickEvent(region) {
regionDeviceId.value = region.deviceId;
}
</script>

View File

@@ -0,0 +1,785 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="关键字" prop="searchSrt">
<el-input
v-model="queryParams.searchSrt"
placeholder="请输入设备名称"
clearable
style="width: 240px"
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="通道类型" prop="channelType">
<el-select v-model="queryParams.channelType" placeholder="请选择通道类型" style="width: 250px;"
default-first-option>
<el-option label="设备" value="false"></el-option>
<el-option label="子目录" value="true"></el-option>
</el-select>
</el-form-item>
<el-form-item label="在线状态" prop="online">
<el-select v-model="queryParams.online" placeholder="请选择在线状态" style="width: 250px;"
default-first-option>
<el-option label="在线" value="true"></el-option>
<el-option label="离线" value="false"></el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-table v-loading="loading" :data="channelList" ref="channelListTable">
<el-table-column prop="name" label="名称" min-width="180" align="center"/>
<el-table-column prop="deviceId" label="编号" min-width="180" align="center"/>
<el-table-column label="快照" min-width="100" align="center">
<template #default="scope">
<el-image
:src="getSnap(scope.row)"
:preview-src-list="getBigSnap(scope.row)"
@error="getSnapErrorEvent(scope.row.deviceId, scope.row.channelId)"
:fit="'contain'"
style="width: 60px">
<div slot="error" class="image-slot">
<i class="el-icon-picture-outline"></i>
</div>
</el-image>
</template>
</el-table-column>
<el-table-column prop="subCount" label="子节点数" min-width="100" align="center"/>
<el-table-column prop="manufacturer" label="厂家" min-width="100" align="center"/>
<el-table-column label="位置信息" min-width="120" align="center">
<template #default="scope">
<span size="medium"
v-if="scope.row.longitude && scope.row.latitude">{{ scope.row.longitude }}<br/>{{ scope.row.latitude }}</span>
<span size="medium" v-if="!scope.row.longitude || !scope.row.latitude"></span>
</template>
</el-table-column>
<el-table-column prop="ptzType" label="云台类型" min-width="100" align="center">
<template #default="scope">
<div>{{ scope.row.ptzTypeText }}</div>
</template>
</el-table-column>
<el-table-column label="开启音频" min-width="100" align="center">
<template #default="scope">
<el-switch @change="updateChannel(scope.row)" v-model="scope.row.hasAudio" active-color="#409EFF">
</el-switch>
</template>
</el-table-column>
<el-table-column label="码流类型" min-width="180" align="center">
<template #default="scope">
<el-select size="mini" style="margin-right: 1rem;" @change="channelSubStreamChange(scope.row)"
v-model="scope.row.streamIdentification"
placeholder="请选择码流类型" default-first-option>
<el-option label="stream:0(主码流)" value="stream:0"></el-option>
<el-option label="stream:1(子码流)" value="stream:1"></el-option>
<el-option label="streamnumber:0(主码流-2022)" value="streamnumber:0"></el-option>
<el-option label="streamnumber:1(子码流-2022)" value="streamnumber:1"></el-option>
<el-option label="streamprofile:0(主码流-大华)" value="streamprofile:0"></el-option>
<el-option label="streamprofile:1(子码流-大华)" value="streamprofile:1"></el-option>
<el-option label="streamMode:main(主码流-水星+TP-LINK)" value="streamMode:main"></el-option>
<el-option label="streamMode:sub(子码流-水星+TP-LINK)" value="streamMode:sub"></el-option>
</el-select>
</template>
</el-table-column>
<el-table-column label="状态" min-width="100" align="center">
<template #default="scope">
<div slot="reference" class="name-wrapper">
<el-tag v-if="scope.row.status === 'ON'">在线</el-tag>
<el-tag type="info" v-if="scope.row.status !== 'ON'">离线</el-tag>
</div>
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="150" class-name="small-padding fixed-width" fixed="right">
<template #default="scope">
<!-- <el-button v-bind:disabled="device == null || device.online === 0" icon="el-icon-video-play"-->
<!-- type="text" @click="sendDevicePush(scope.row)">播放-->
<!-- </el-button>-->
<el-button v-bind:disabled="device == null || device.online === 0"
icon="el-icon-switch-button"
type="text" style="color: #f56c6c" v-if="!!scope.row.streamId"
@click="stopDevicePush(scope.row)">停止
</el-button>
<el-button
type="text"
icon="el-icon-edit"
@click="handleEdit(scope.row)"
>
编辑
</el-button>
<el-dropdown @command="(command)=>{moreClick(command, scope.row)}">
<span class="el-dropdown-link">
<el-button size="medium" type="text">
更多
<el-icon class="el-icon--right">
<arrow-down/>
</el-icon>
</el-button>
</span>
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item command="records" v-bind:disabled="device == null || device.online === 0">
设备录像
</el-dropdown-item>
<el-dropdown-item command="cloudRecords" v-bind:disabled="device == null || device.online === 0">
云端录像
</el-dropdown-item>
<el-dropdown-item command="record" v-bind:disabled="device == null || device.online === 0">
设备录像控制-开始
</el-dropdown-item>
<el-dropdown-item command="stopRecord" v-bind:disabled="device == null || device.online === 0">
设备录像控制-停止
</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total > 0"
:total="total"
v-model:page="queryParams.pageNum"
v-model:limit="queryParams.pageSize"
@pagination="initData"
/>
<el-dialog title="编辑通道" v-model="open" width="1000px" append-to-body>
<el-form ref="formRef" :model="form" :rules="rules" label-width="120px">
<el-row>
<el-col :span="12">
<el-form-item label="名称">
<el-input v-model="form.gbName" placeholder="请输入通道名称"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="编码">
<el-input v-model="form.gbDeviceId" placeholder="请输入通道编码">
<template v-slot:append>
<el-button @click="buildDeviceIdCode(form.gbDeviceId)">生成</el-button>
</template>
</el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="设备厂商">
<el-input v-model="form.gbManufacturer" placeholder="请输入设备厂商"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="设备型号">
<el-input v-model="form.gbModel" placeholder="请输入设备型号"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="行政区域">
<el-input v-model="form.gbCivilCode" placeholder="请输入行政区域">
<template v-slot:append>
<el-button @click="chooseCivilCodeFun()">选择</el-button>
</template>
</el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="安装地址">
<el-input v-model="form.gbAddress" placeholder="请输入安装地址"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="子设备">
<el-select v-model="form.gbParental" style="width: 100%" placeholder="请选择是否有子设备">
<el-option label="有" :value="1"></el-option>
<el-option label="无" :value="0"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="父节点编码">
<el-input v-model="form.gbParentId" placeholder="请输入父节点编码或选择所属虚拟组织">
<template v-slot:append>
<el-button @click="chooseGroup()">选择</el-button>
</template>
</el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="设备状态">
<el-select v-model="form.gbStatus" style="width: 100%" placeholder="请选择设备状态">
<el-option label="在线" value="ON"></el-option>
<el-option label="离线" value="OFF"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="经度">
<el-input v-model="form.gbLongitude" placeholder="请输入经度"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="纬度">
<el-input v-model="form.gbLatitude" placeholder="请输入纬度"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="云台类型">
<el-select v-model="form.gbPtzType" style="width: 100%" placeholder="请选择云台类型">
<el-option label="球机" :value="1"></el-option>
<el-option label="半球" :value="2"></el-option>
<el-option label="固定枪机" :value="3"></el-option>
<el-option label="遥控枪机" :value="4"></el-option>
<el-option label="遥控半球" :value="5"></el-option>
<el-option label="多目设备的全景/拼接通道" :value="6"></el-option>
<el-option label="多目设备的分割通道" :value="7"></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="警区">
<el-input v-model="form.gbBlock" placeholder="请输入警区"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="设备归属">
<el-input v-model="form.gbOwner" placeholder="请输入设备归属"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="信令安全模式">
<el-select v-model="form.gbSafetyWay" style="width: 100%" placeholder="请选择信令安全模式">
<el-option label="不采用" :value="0"></el-option>
<el-option label="S/MIME签名" :value="2"></el-option>
<el-option label="S/MIME加密签名同时采用" :value="3"></el-option>
<el-option label="数字摘要" :value="4"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="注册方式">
<el-select v-model="form.gbRegisterWay" style="width: 100%" placeholder="请选择注册方式">
<el-option label="IETFRFC3261标准" :value="1"></el-option>
<el-option label="基于口令的双向认证" :value="2"></el-option>
<el-option label="基于数字证书的双向认证注册" :value="3"></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="证书序列号">
<el-input type="number" v-model="form.gbCertNum" placeholder="请输入证书序列号"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="证书有效标识">
<el-select v-model="form.gbCertifiable" style="width: 100%" placeholder="请选择证书有效标识">
<el-option label="有效" :value="1"></el-option>
<el-option label="无效" :value="0"></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="无效原因码">
<el-input type="errCode" v-model="form.gbCertNum" placeholder="请输入无效原因码"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="证书终止有效期">
<el-date-picker
v-model="form.gbEndTime"
type="datetime"
placeholder="选择日期时间"
style="width: 100%">
</el-date-picker>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="保密属性">
<el-select v-model="form.gbSecrecy" style="width: 100%" placeholder="请选择保密属性">
<el-option label="不涉密" :value="0"></el-option>
<el-option label="涉密" :value="1"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="IP地址">
<el-input v-model="form.gbIpAddress" placeholder="请输入IP地址"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="端口">
<el-input type="number" v-model="form.gbPort" placeholder="请输入端口"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="设备口令">
<el-input v-model="form.gbPassword" placeholder="请输入设备口令"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="业务分组编号">
<el-input v-model="form.gbBusinessGroupId" placeholder="请输入业务分组编号"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="位置类型">
<el-select v-model="form.gbPositionType" style="width: 100%" placeholder="请选择位置类型">
<el-option label="省际检查站" :value="1"></el-option>
<el-option label="党政机关" :value="2"></el-option>
<el-option label="车站码头" :value="3"></el-option>
<el-option label="中心广场" :value="4"></el-option>
<el-option label="体育场馆" :value="5"></el-option>
<el-option label="商业中心" :value="6"></el-option>
<el-option label="宗教场所" :value="7"></el-option>
<el-option label="校园周边" :value="8"></el-option>
<el-option label="治安复杂区域" :value="9"></el-option>
<el-option label="交通干线" :value="10"></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="室外/室内">
<el-select v-model="form.gbRoomType" style="width: 100%" placeholder="请选择位置类型">
<el-option label="室外" :value="1"></el-option>
<el-option label="室内" :value="2"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="用途">
<el-select v-model="form.gbUseType" style="width: 100%" placeholder="请选择位置类型">
<el-option label="治安" :value="1"></el-option>
<el-option label="交通" :value="2"></el-option>
<el-option label="重点" :value="3"></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="补光">
<el-select v-model="form.gbSupplyLightType" style="width: 100%" placeholder="请选择位置类型">
<el-option label="无补光" :value="1"></el-option>
<el-option label="红外补光" :value="2"></el-option>
<el-option label="白光补光" :value="3"></el-option>
<el-option label="激光补光" :value="4"></el-option>
<el-option label="其他" :value="9"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="监视方位">
<el-select v-model="form.gbDirectionType" style="width: 100%" placeholder="请选择位置类型">
<el-option label="东(西向东)" :value="1"></el-option>
<el-option label="西(东向西)" :value="2"></el-option>
<el-option label="南(北向南)" :value="3"></el-option>
<el-option label="北(南向北)" :value="4"></el-option>
<el-option label="东南(西北到东南)" :value="5"></el-option>
<el-option label="东北(西南到东北)" :value="6"></el-option>
<el-option label="西南(东北到西南)" :value="7"></el-option>
<el-option label="西北(东南到西北)" :value="8"></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="分辨率">
<el-input v-model="form.gbResolution" placeholder="请输入分辨率"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="下载倍速">
<el-select v-model="form.gbDownloadSpeedArray" multiple style="width: 100%" placeholder="请选择位置类型">
<el-option label="1倍速" value="1"></el-option>
<el-option label="2倍速" value="2"></el-option>
<el-option label="4倍速" value="4"></el-option>
<el-option label="8倍速" value="8"></el-option>
<el-option label="16倍速" value="16"></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="空域编码能力">
<el-select v-model="form.gbSvcSpaceSupportMod" style="width: 100%" placeholder="请选择空域编码能力">
<el-option label="1级增强" value="1"></el-option>
<el-option label="2级增强" value="2"></el-option>
<el-option label="3级增强" value="3"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="时域编码能力">
<el-select v-model="form.gbSvcTimeSupportMode" style="width: 100%" placeholder="请选择空域编码能力">
<el-option label="1级增强" value="1"></el-option>
<el-option label="2级增强" value="2"></el-option>
<el-option label="3级增强" value="3"></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</template>
</el-dialog>
<ChannelCode ref="channelCode" @handleOk="handleOk"></ChannelCode>
<ChooseCivilCode ref="chooseCivilCodeRef"></ChooseCivilCode>
<ChooseGroup ref="chooseGroup"></ChooseGroup>
</div>
</template>
<script setup name="Channel">
import ChannelCode from "./channelCode.vue"
import ChooseCivilCode from "./chooseCivilCode.vue"
import ChooseGroup from "../../components/dialog/chooseGroup.vue"
import {playStop} from "../../../api/wvp/play.js";
import {
changeAudio,
getDeviceById,
listDeviceChannel,
subChannels,
updateChannelStreamIdentification
} from "../../../api/wvp/device.js";
import {getCommonChannel} from "../../../api/wvp/channel.js";
const route = useRoute();
const {proxy} = getCurrentInstance();
const channelList = ref([]);
const loading = ref(true);
const total = ref(0);
const deviceId = ref('');
const parentChannelId = ref('');
const device = ref({});
const showTree = ref(false);
const open = ref(false);
const deviceChannelList = ref([])
const showSearch = ref(true);
const loadSnap = ref({});
const channelListTable = ref(null);
const channelCode = ref(null);
const chooseCivilCodeRef = ref(null);
const data = reactive({
form: {},
queryParams: {
pageNum: 1,
pageSize: 10,
searchSrt: undefined,
channelType: undefined,
online: undefined,
},
rules: {}
});
const {queryParams, form, rules} = toRefs(data);
/** 搜索按钮操作 */
function handleQuery() {
queryParams.value.pageNum = 1;
initData();
}
/** 重置按钮操作 */
function resetQuery() {
proxy.resetForm("queryRef");
handleQuery();
}
/** 表单重置 */
function reset() {
form.value = {
gbName: undefined,
gbDeviceId: undefined,
gbManufacturer: undefined,
gbModel: undefined,
gbCivilCode: undefined,
gbAddress: undefined,
gbParental: undefined,
gbParentId: undefined,
gbStatus: undefined,
gbLongitude: undefined,
gbLatitude: undefined,
gbPtzType: undefined,
gbBlock: undefined,
gbOwner: undefined,
gbSafetyWay: undefined,
gbRegisterWay: undefined,
gbCertNum: undefined,
gbCertifiable: undefined,
gbEndTime: undefined,
gbSecrecy: undefined,
gbIpAddress: undefined,
gbPort: undefined,
gbPassword: undefined,
gbBusinessGroupId: undefined,
gbPositionType: undefined,
gbRoomType: undefined,
gbUseType: undefined,
gbSupplyLightType: undefined,
gbDirectionType: undefined,
gbResolution: undefined,
gbDownloadSpeedArray: undefined,
gbSvcSpaceSupportMod: undefined,
gbSvcTimeSupportMode: undefined,
};
proxy.resetForm("formRef");
}
/** 提交按钮 */
function submitForm() {
proxy.$refs["formRef"].validate(valid => {
if (valid) {
}
});
}
/** 取消按钮 */
function cancel() {
open.value = false;
reset();
}
function buildDeviceIdCode(deviceId) {
channelCode.value.openDialog(code => {
}, deviceId);
}
function handleOk(code) {
form.value.gbDeviceId = code
}
function chooseCivilCodeFun() {
chooseCivilCodeRef.value.openDialog(code => {
// this.form.gbCivilCode = code;
});
}
function chooseGroup() {
// this.$refs.chooseGroup.openDialog((deviceId, businessGroupId) => {
// this.form.gbBusinessGroupId = businessGroupId;
// this.form.gbParentId = deviceId;
// });
}
/**
* 初始化数据
*/
function initData() {
if (typeof (parentChannelId.value) == "undefined" || parentChannelId.value === '0') {
getDeviceChannelList();
} else {
showSubchannels();
}
}
/**
* 显示子通道
*/
function showSubchannels() {
if (!showTree.value) {
subChannels({
pageNum: queryParams.value.pageNum,
pageSize: queryParams.value.pageSize,
query: queryParams.value.searchSrt,
online: queryParams.value.online,
channelType: queryParams.value.channelType
}).then((res) => {
total.value = res.total;
deviceChannelList.value = res.rows;
deviceChannelList.value.forEach(e => {
e.ptzType = e.ptzType + "";
});
// 防止出现表格错位
nextTick(() => {
channelListTable.value.doLayout();
})
})
} else {
}
}
/** 获取设备通道列表 */
function getDeviceChannelList() {
loading.value = true;
listDeviceChannel(
{
pageNum: queryParams.value.pageNum,
pageSize: queryParams.value.pageSize,
deviceId: deviceId.value,
query: queryParams.value.searchSrt,
online: queryParams.value.online,
channelType: queryParams.value.channelType,
}
).then(response => {
console.log(response)
channelList.value = response.rows;
total.value = response.total;
loading.value = false;
})
}
function getSnap(row) {
return import.meta.env.VITE_APP_BASE_API + '/api/device/query/snap/' + deviceId.value + '/' + row.deviceId;
}
function getBigSnap(row) {
return [getSnap(row)]
}
function getSnapErrorEvent(deviceId, channelId) {
if (typeof (loadSnap.value[deviceId + channelId]) != "undefined") {
console.log("下载截图" + loadSnap.value[deviceId + channelId])
if (loadSnap.value[deviceId + channelId] > 5) {
delete loadSnap.value[deviceId + channelId];
return;
}
setTimeout(() => {
let url = import.meta.env.VITE_APP_BASE_API + '/api/device/query/snap/' + deviceId + '/' + channelId
loadSnap.value[deviceId + channelId]++
document.getElementById(deviceId + channelId).setAttribute("src", url + '?' + new Date().getTime())
}, 1000)
}
}
/**
* 开启音频
*
* @param row
*/
function updateChannel(row) {
changeAudio({
channelId: row.id,
audio: row.hasAudio
}).then((res) => {
console.log(res)
})
}
/**
* 码流类型
*
* @param row
*/
function channelSubStreamChange(row) {
updateChannelStreamIdentification({
deviceDbId: row.deviceDbId,
id: row.id,
streamIdentification: row.streamIdentification
}).then((res) => {
console.log(res)
})
}
/**
* 停止设备推流
*
* @param itemData
*/
function stopDevicePush(itemData) {
playStop(deviceId, itemData.deviceId).then(() => {
initData();
}).catch(function (error) {
initData();
});
}
// 编辑
function handleEdit(row) {
getCommonChannel(row.id).then((res) => {
console.log(res)
if (res.data.gbDownloadSpeed) {
res.data.gbDownloadSpeedArray = res.data.gbDownloadSpeed.split("/")
}
this.form = res.data;
open.value = true
})
}
function moreClick(command, itemData) {
if (command === "records") {
this.queryRecords(itemData)
} else if (command === "cloudRecords") {
this.queryCloudRecords(itemData)
} else if (command === "record") {
this.startRecord(itemData)
} else if (command === "stopRecord") {
this.stopRecord(itemData)
}
}
onMounted(() => {
deviceId.value = route.params && route.params.deviceId;
parentChannelId.value = route.params && route.params.parentChannelId;
if (deviceId.value) {
getDeviceById(deviceId.value).then(response => {
device.value = response.data;
})
}
initData()
})
</script>
<style scoped>
.example-showcase .el-dropdown-link {
cursor: pointer;
color: var(--el-color-primary);
display: flex;
align-items: center;
}
</style>

View File

@@ -56,6 +56,7 @@
</el-row>
<el-table v-loading="loading" :data="deviceList">
<el-table-column type="index" label="编号" width="50" align="center"/>
<el-table-column prop="name" label="名称" min-width="160" align="center">
</el-table-column>
<el-table-column prop="deviceId" label="设备编号" min-width="160" align="center">
@@ -110,23 +111,13 @@
</el-table-column>
<el-table-column label="操作" align="center" width="150" class-name="small-padding fixed-width" fixed="right">
<template #default="scope">
<el-button link type="primary" :disabled="scope.row.online===0" icon="Edit"
@click="refDevice(scope.row)"
@mouseover="getTooltipContent(scope.row.deviceId)">刷新
</el-button>
<!-- <el-button link type="primary" :disabled="scope.row.online===0" icon="Edit"-->
<!-- @click="refDevice(scope.row)"-->
<!-- @mouseover="getTooltipContent(scope.row.deviceId)">刷新-->
<!-- </el-button>-->
<el-button type="text" icon="Edit"
@click="showChannelList(scope.row)">通道
</el-button>
<el-button link type="primary" icon="Edit"
@click="setGuard(scope.row)"
>布防
</el-button>
<el-button type="text" icon="Edit"
@click="resetGuard(scope.row)">撤防
</el-button>
<el-button type="text" icon="Edit"
@click="syncBasicParam(scope.row)">基础配置同步
</el-button>
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)"
v-hasPermi="['system:config:edit']">修改
@@ -212,6 +203,17 @@
</el-descriptions>
</div>
</el-dialog>
<el-dialog
title="刷新设备"
width="250px"
v-model="showProgress"
append-to-body
>
<div style="display:flex;align-items: center;justify-content: center">
<el-progress type="dashboard" :percentage="percentage" :color="colors"/>
</div>
</el-dialog>
</div>
</template>
@@ -223,14 +225,13 @@ import {
listDevice,
subscribeCatalog,
subscribeMobilePosition,
syncStatus,
updateDevice,
updateTransport,
} from "../../../api/wvp/device.js";
import {configInfo, getOnlineMediaServerList} from "../../../api/wvp/wvpMediaServer.js";
import router from "@/router";
const {proxy} = getCurrentInstance();
const {sys_yes_no} = proxy.useDict("sys_yes_no");
const deviceList = ref([]);
const open = ref(false);
@@ -238,10 +239,19 @@ const loading = ref(true);
const showSearch = ref(true);
const total = ref(0);
const title = ref("");
const dateRange = ref([]);
const configInfoData = ref({});
const percentage = ref(0)
const showDialog = ref(false);
const showProgress = ref(false);
const colors = [
{color: '#f56c6c', percentage: 20},
{color: '#e6a23c', percentage: 40},
{color: '#5cb87a', percentage: 60},
{color: '#1989fa', percentage: 80},
{color: '#6f7ad3', percentage: 100},
]
const mediaServerList = ref([]);
@@ -262,10 +272,10 @@ const data = reactive({
const {queryParams, form, rules} = toRefs(data);
/** 查询参数列表 */
/** 查询列表 */
function getList() {
loading.value = true;
listDevice(proxy.addDateRange(queryParams.value, dateRange.value)).then(response => {
listDevice(queryParams.value).then(response => {
deviceList.value = response.rows;
total.value = response.total;
loading.value = false;
@@ -302,7 +312,6 @@ function handleQuery() {
/** 重置按钮操作 */
function resetQuery() {
dateRange.value = [];
proxy.resetForm("queryRef");
handleQuery();
}
@@ -414,7 +423,8 @@ function showInfo() {
function refDevice(itemData) {
console.log("刷新对应设备:" + itemData.deviceId);
devicesSync(itemData.deviceId).then(response => {
console.log(response)
showProgress.value = true
})
}
@@ -425,9 +435,9 @@ function refDevice(itemData) {
* @returns {Promise<void>}
*/
async function getTooltipContent(deviceId) {
syncStatus(deviceId).then(response => {
})
// syncStatus(deviceId).then(response => {
//
// })
}
/**
@@ -436,92 +446,7 @@ async function getTooltipContent(deviceId) {
* @param row
*/
function showChannelList(row) {
this.$router.push(`/channelList/${row.deviceId}/0`);
}
/**
* 设置设备为布防
*/
function setGuard(){
// this.$axios({
// method: 'get',
// url: `/api/device/control/guard/${itemData.deviceId}/SetGuard`,
// }).then( (res)=> {
// if (res.data.code === 0) {
// this.$message.success({
// showClose: true,
// message: "布防成功"
// })
// }else {
// this.$message.error({
// showClose: true,
// message: res.data.msg
// })
// }
// }).catch( (error)=> {
// this.$message.error({
// showClose: true,
// message: error.message
// })
// });
}
/**
* 设置设备为撤防
*/
function resetGuard(){
// this.$axios({
// method: 'get',
// url: `/api/device/control/guard/${itemData.deviceId}/ResetGuard`,
// }).then( (res)=> {
// if (res.data.code === 0) {
// this.$message.success({
// showClose: true,
// message: "撤防成功"
// })
// }else {
// this.$message.error({
// showClose: true,
// message: res.data.msg
// })
// }
// }).catch( (error)=> {
// this.$message.error({
// showClose: true,
// message: error.message
// })
// });
}
/**
* 基础配置同步
*/
function syncBasicParam(){
console.log(data)
// this.$axios({
// method: 'get',
// url: `/api/device/config/query/${data.deviceId}/BasicParam`,
// params: {
// // channelId: data.deviceId
// }
// }).then( (res)=> {
// if (res.data.code === 0) {
// this.$message.success({
// showClose: true,
// message: `配置已同步,当前心跳间隔: ${res.data.data.BasicParam.HeartBeatInterval} 心跳间隔:${res.data.data.BasicParam.HeartBeatCount}`
// })
// }else {
// this.$message.error({
// showClose: true,
// message: res.data.msg
// })
// }
// }).catch( (error)=> {
// this.$message.error({
// showClose: true,
// message: error.message
// })
// });
router.push(`/channel/list/index/${row.deviceId}/0`);
}
getList();

View File

@@ -1,12 +1,13 @@
package com.ruoyi.wvp.controller;
import com.alibaba.fastjson2.JSONObject;
import com.github.pagehelper.PageInfo;
import com.ruoyi.common.annotation.Anonymous;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.wvp.conf.DynamicTask;
import com.ruoyi.wvp.conf.exception.ControllerException;
import com.ruoyi.wvp.gb28181.bean.ChangeAudio;
import com.ruoyi.wvp.gb28181.bean.Device;
import com.ruoyi.wvp.gb28181.bean.DeviceChannel;
import com.ruoyi.wvp.gb28181.bean.SyncStatus;
@@ -97,24 +98,22 @@ public class DeviceQueryController extends BaseController {
/**
* 分页查询通道数
*
* @param deviceId 设备国标编号
* @param pageNum 当前页
* @param pageSize 每页查询数量
* @param online 是否在线
* @param channelType 设备/子目录-> false/true
* @return
*/
@GetMapping("/devices/{deviceId}/channels")
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
@Parameter(name = "page", description = "当前页", required = true)
@Parameter(name = "count", description = "每页查询数量", required = true)
@Parameter(name = "query", description = "查询内容")
@Parameter(name = "online", description = "是否在线")
@Parameter(name = "channelType", description = "设备/子目录-> false/true")
public PageInfo<DeviceChannel> channels(@PathVariable String deviceId,
int page, int count,
@RequestParam(required = false) String query,
@RequestParam(required = false) Boolean online,
@RequestParam(required = false) Boolean channelType) {
@GetMapping("/devices/channels")
public TableDataInfo channels(String deviceId, int pageNum, int pageSize, @RequestParam(required = false) String query, @RequestParam(required = false) Boolean online, @RequestParam(required = false) Boolean channelType) {
if (ObjectUtils.isEmpty(query)) {
query = null;
}
return deviceChannelService.queryChannelsByDeviceId(deviceId, query, channelType, online, page, count);
startPage();
List<DeviceChannel> list = deviceChannelService.queryChannelsByDeviceId(deviceId, query, channelType, online, pageNum, pageSize);
return getDataTable(list);
}
/**
@@ -190,44 +189,39 @@ public class DeviceQueryController extends BaseController {
* @param channelType 通道类型
* @return 子通道列表
*/
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
@Parameter(name = "channelId", description = "通道国标编号", required = true)
@Parameter(name = "page", description = "当前页", required = true)
@Parameter(name = "count", description = "每页查询数量", required = true)
@Parameter(name = "query", description = "查询内容")
@Parameter(name = "online", description = "是否在线")
@Parameter(name = "channelType", description = "设备/子目录-> false/true")
@GetMapping("/sub_channels/{deviceId}/{channelId}/channels")
public PageInfo<DeviceChannel> subChannels(@PathVariable String deviceId,
@PathVariable String channelId,
int page,
int count,
@RequestParam(required = false) String query,
@RequestParam(required = false) Boolean online,
@RequestParam(required = false) Boolean channelType) {
@GetMapping("/sub_channels/channels")
public TableDataInfo subChannels(String deviceId, String channelId, int page, int count, @RequestParam(required = false) String query, @RequestParam(required = false) Boolean online, @RequestParam(required = false) Boolean channelType) {
DeviceChannel deviceChannel = deviceChannelService.getOne(deviceId, channelId);
if (deviceChannel == null) {
PageInfo<DeviceChannel> deviceChannelPageResult = new PageInfo<>();
return deviceChannelPageResult;
return getDataTable(new ArrayList<>());
}
return deviceChannelService.getSubChannels(deviceChannel.getDataDeviceId(), channelId, query, channelType, online, page, count);
startPage();
List<DeviceChannel> list = deviceChannelService.getSubChannels(deviceChannel.getDataDeviceId(), channelId, query, channelType, online, page, count);
return getDataTable(list);
}
@Parameter(name = "channelId", description = "通道的数据库ID", required = true)
@Parameter(name = "audio", description = "开启/关闭音频", required = true)
/**
* 修改通道音频
*
* @param changeAudio 音频切换
*/
@PostMapping("/channel/audio")
public void changeAudio(Integer channelId, Boolean audio) {
Assert.notNull(channelId, "通道的数据库ID不可为NULL");
Assert.notNull(audio, "开启/关闭音频不可为NULL");
deviceChannelService.changeAudio(channelId, audio);
public AjaxResult changeAudio(@RequestBody ChangeAudio changeAudio) {
Assert.notNull(changeAudio.getChannelId(), "通道的数据库ID不可为NULL");
Assert.notNull(changeAudio.getAudio(), "开启/关闭音频不可为NULL");
deviceChannelService.changeAudio(changeAudio.getChannelId(), changeAudio.getAudio());
return success();
}
/**
* 修改通道码流
*
* @param channel
*/
@PostMapping("/channel/stream/identification/update/")
public void updateChannelStreamIdentification(DeviceChannel channel) {
public AjaxResult updateChannelStreamIdentification(@RequestBody DeviceChannel channel) {
deviceChannelService.updateChannelStreamIdentification(channel);
return success();
}
/**
@@ -252,7 +246,7 @@ public class DeviceQueryController extends BaseController {
* @return
*/
@PostMapping("/device/add/")
public void addDevice(@RequestBody Device device) {
public void addDevice(@RequestBody Device device) {
if (device == null || device.getDeviceId() == null) {
throw new ControllerException(ErrorCode.ERROR400);
}
@@ -344,13 +338,7 @@ public class DeviceQueryController extends BaseController {
@Parameter(name = "startTime", description = "报警发生起始时间")
@Parameter(name = "endTime", description = "报警发生终止时间")
@GetMapping("/alarm/{deviceId}")
public DeferredResult<ResponseEntity<String>> alarmApi(@PathVariable String deviceId,
@RequestParam(required = false) String startPriority,
@RequestParam(required = false) String endPriority,
@RequestParam(required = false) String alarmMethod,
@RequestParam(required = false) String alarmType,
@RequestParam(required = false) String startTime,
@RequestParam(required = false) String endTime) {
public DeferredResult<ResponseEntity<String>> alarmApi(@PathVariable String deviceId, @RequestParam(required = false) String startPriority, @RequestParam(required = false) String endPriority, @RequestParam(required = false) String alarmMethod, @RequestParam(required = false) String alarmType, @RequestParam(required = false) String startTime, @RequestParam(required = false) String endTime) {
if (log.isDebugEnabled()) {
log.debug("设备报警查询API调用");
}
@@ -399,7 +387,7 @@ public class DeviceQueryController extends BaseController {
} else if (channelSyncStatus.getTotal() == null || channelSyncStatus.getTotal() == 0) {
return AjaxResult.success("等待通道信息...");
} else {
return AjaxResult.success("等待通道信息...");
return AjaxResult.success(ErrorCode.SUCCESS.getMsg(), channelSyncStatus);
}
}
@@ -424,13 +412,18 @@ public class DeviceQueryController extends BaseController {
return wvpResult;
}
/**
* 请求截图
*
* @param resp 响应数据
* @param deviceId 设备国标编号
* @param channelId 通道国标编号
* @param mark 标识
*/
@Anonymous
@GetMapping("/snap/{deviceId}/{channelId}")
@Operation(summary = "请求截图")
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
@Parameter(name = "channelId", description = "通道国标编号", required = true)
@Parameter(name = "mark", description = "标识", required = false)
public void getSnap(HttpServletResponse resp, @PathVariable String deviceId, @PathVariable String channelId, @RequestParam(required = false) String mark) {
try {
final InputStream in = Files.newInputStream(new File("snap" + File.separator + deviceId + "_" + channelId + (mark == null ? ".jpg" : ("_" + mark + ".jpg"))).toPath());
resp.setContentType(MediaType.IMAGE_PNG_VALUE);

View File

@@ -0,0 +1,25 @@
package com.ruoyi.wvp.gb28181.bean;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 音频切换
* @author fengcheng
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class ChangeAudio {
/**
* 通道的数据库ID
*/
private Integer channelId;
/**
* 开启/关闭音频
*/
private Boolean audio;
}

View File

@@ -2,6 +2,8 @@ package com.ruoyi.wvp.gb28181.controller;
import com.github.pagehelper.PageInfo;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.wvp.common.StreamInfo;
import com.ruoyi.wvp.conf.UserSetting;
import com.ruoyi.wvp.gb28181.bean.CommonGBChannel;
@@ -20,9 +22,7 @@ import com.ruoyi.wvp.service.bean.InviteErrorCode;
import com.ruoyi.wvp.storager.IRedisCatchStorage;
import com.ruoyi.wvp.vmanager.bean.StreamContent;
import com.ruoyi.wvp.vmanager.bean.WVPResult;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
@@ -37,11 +37,11 @@ import java.net.URL;
import java.util.List;
@Tag(name = "全局通道管理")
@Tag(name = "全局通道管理")
@RestController
@Slf4j
@RequestMapping(value = "/api/common/channel")
public class CommonChannelController {
public class CommonChannelController extends BaseController {
@Autowired
private IRedisCatchStorage redisCatchStorage;
@@ -58,40 +58,59 @@ public class CommonChannelController {
@Autowired
private UserSetting userSetting;
@Parameter(name = "id", description = "通道的数据库自增Id", required = true)
@GetMapping(value = "/one")
public CommonGBChannel getOne(int id){
return channelService.getOne(id);
/**
* 获取通道信息
*
* @param id 通道的数据库自增Id
* @return
*/
@GetMapping(value = "/one/{id}")
public AjaxResult getOne(@PathVariable int id) {
return success(channelService.getOne(id));
}
/**
* 获取通道信息
*
* @return
*/
@GetMapping("/industry/list")
public List<IndustryCodeType> getIndustryCodeList(){
return channelService.getIndustryCodeList();
public AjaxResult getIndustryCodeList() {
return success(channelService.getIndustryCodeList());
}
/**
* 获取通道类型列表
*
* @return
*/
@GetMapping("/type/list")
public List<DeviceType> getDeviceTypeList(){
return channelService.getDeviceTypeList();
public AjaxResult getDeviceTypeList() {
return success(channelService.getDeviceTypeList());
}
/**
* 获取网络标识列表
*
* @return
*/
@GetMapping("/network/identification/list")
public List<NetworkIdentificationType> getNetworkIdentificationTypeList(){
return channelService.getNetworkIdentificationTypeList();
public AjaxResult getNetworkIdentificationTypeList() {
return success(channelService.getNetworkIdentificationTypeList());
}
@PostMapping("/update")
public void update(@RequestBody CommonGBChannel channel){
public void update(@RequestBody CommonGBChannel channel) {
channelService.update(channel);
}
@PostMapping("/reset")
public void reset(Integer id){
public void reset(Integer id) {
channelService.reset(id);
}
@PostMapping("/add")
public CommonGBChannel add(@RequestBody CommonGBChannel channel){
public CommonGBChannel add(@RequestBody CommonGBChannel channel) {
channelService.add(channel);
return channel;
}
@@ -104,11 +123,11 @@ public class CommonChannelController {
@Parameter(name = "channelType", description = "通道类型, 0国标设备1推流设备2拉流代理")
@GetMapping("/list")
public PageInfo<CommonGBChannel> queryList(int page, int count,
@RequestParam(required = false) String query,
@RequestParam(required = false) Boolean online,
@RequestParam(required = false) Boolean hasRecordPlan,
@RequestParam(required = false) Integer channelType){
if (ObjectUtils.isEmpty(query)){
@RequestParam(required = false) String query,
@RequestParam(required = false) Boolean online,
@RequestParam(required = false) Boolean hasRecordPlan,
@RequestParam(required = false) Integer channelType) {
if (ObjectUtils.isEmpty(query)) {
query = null;
}
return channelService.queryList(page, count, query, online, hasRecordPlan, channelType);
@@ -122,11 +141,11 @@ public class CommonChannelController {
@Parameter(name = "civilCode", description = "行政区划")
@GetMapping("/civilcode/list")
public PageInfo<CommonGBChannel> queryListByCivilCode(int page, int count,
@RequestParam(required = false) String query,
@RequestParam(required = false) Boolean online,
@RequestParam(required = false) Integer channelType,
@RequestParam(required = false) String civilCode){
if (ObjectUtils.isEmpty(query)){
@RequestParam(required = false) String query,
@RequestParam(required = false) Boolean online,
@RequestParam(required = false) Integer channelType,
@RequestParam(required = false) String civilCode) {
if (ObjectUtils.isEmpty(query)) {
query = null;
}
return channelService.queryListByCivilCode(page, count, query, online, channelType, civilCode);
@@ -140,75 +159,75 @@ public class CommonChannelController {
@Parameter(name = "groupDeviceId", description = "业务分组下的父节点ID")
@GetMapping("/parent/list")
public PageInfo<CommonGBChannel> queryListByParentId(int page, int count,
@RequestParam(required = false) String query,
@RequestParam(required = false) Boolean online,
@RequestParam(required = false) Integer channelType,
@RequestParam(required = false) String groupDeviceId){
if (ObjectUtils.isEmpty(query)){
@RequestParam(required = false) String query,
@RequestParam(required = false) Boolean online,
@RequestParam(required = false) Integer channelType,
@RequestParam(required = false) String groupDeviceId) {
if (ObjectUtils.isEmpty(query)) {
query = null;
}
return channelService.queryListByParentId(page, count, query, online, channelType, groupDeviceId);
}
@PostMapping("/region/add")
public void addChannelToRegion(@RequestBody ChannelToRegionParam param){
Assert.notEmpty(param.getChannelIds(),"通道ID不可为空");
Assert.hasLength(param.getCivilCode(),"未添加行政区划");
public void addChannelToRegion(@RequestBody ChannelToRegionParam param) {
Assert.notEmpty(param.getChannelIds(), "通道ID不可为空");
Assert.hasLength(param.getCivilCode(), "未添加行政区划");
channelService.addChannelToRegion(param.getCivilCode(), param.getChannelIds());
}
@PostMapping("/region/delete")
public void deleteChannelToRegion(@RequestBody ChannelToRegionParam param){
Assert.isTrue(!param.getChannelIds().isEmpty() || !ObjectUtils.isEmpty(param.getCivilCode()),"参数异常");
public void deleteChannelToRegion(@RequestBody ChannelToRegionParam param) {
Assert.isTrue(!param.getChannelIds().isEmpty() || !ObjectUtils.isEmpty(param.getCivilCode()), "参数异常");
channelService.deleteChannelToRegion(param.getCivilCode(), param.getChannelIds());
}
@PostMapping("/region/device/add")
public void addChannelToRegionByGbDevice(@RequestBody ChannelToRegionByGbDeviceParam param){
Assert.notEmpty(param.getDeviceIds(),"参数异常");
Assert.hasLength(param.getCivilCode(),"未添加行政区划");
public void addChannelToRegionByGbDevice(@RequestBody ChannelToRegionByGbDeviceParam param) {
Assert.notEmpty(param.getDeviceIds(), "参数异常");
Assert.hasLength(param.getCivilCode(), "未添加行政区划");
channelService.addChannelToRegionByGbDevice(param.getCivilCode(), param.getDeviceIds());
}
@PostMapping("/region/device/delete")
public void deleteChannelToRegionByGbDevice(@RequestBody ChannelToRegionByGbDeviceParam param){
Assert.notEmpty(param.getDeviceIds(),"参数异常");
public void deleteChannelToRegionByGbDevice(@RequestBody ChannelToRegionByGbDeviceParam param) {
Assert.notEmpty(param.getDeviceIds(), "参数异常");
channelService.deleteChannelToRegionByGbDevice(param.getDeviceIds());
}
@PostMapping("/group/add")
public void addChannelToGroup(@RequestBody ChannelToGroupParam param){
Assert.notEmpty(param.getChannelIds(),"通道ID不可为空");
Assert.hasLength(param.getParentId(),"未添加上级分组编号");
Assert.hasLength(param.getBusinessGroup(),"未添加业务分组");
public void addChannelToGroup(@RequestBody ChannelToGroupParam param) {
Assert.notEmpty(param.getChannelIds(), "通道ID不可为空");
Assert.hasLength(param.getParentId(), "未添加上级分组编号");
Assert.hasLength(param.getBusinessGroup(), "未添加业务分组");
channelService.addChannelToGroup(param.getParentId(), param.getBusinessGroup(), param.getChannelIds());
}
@PostMapping("/group/delete")
public void deleteChannelToGroup(@RequestBody ChannelToGroupParam param){
public void deleteChannelToGroup(@RequestBody ChannelToGroupParam param) {
Assert.isTrue(!param.getChannelIds().isEmpty()
|| (!ObjectUtils.isEmpty(param.getParentId()) && !ObjectUtils.isEmpty(param.getBusinessGroup())),
|| (!ObjectUtils.isEmpty(param.getParentId()) && !ObjectUtils.isEmpty(param.getBusinessGroup())),
"参数异常");
channelService.deleteChannelToGroup(param.getParentId(), param.getBusinessGroup(), param.getChannelIds());
}
@PostMapping("/group/device/add")
public void addChannelToGroupByGbDevice(@RequestBody ChannelToGroupByGbDeviceParam param){
Assert.notEmpty(param.getDeviceIds(),"参数异常");
Assert.hasLength(param.getParentId(),"未添加上级分组编号");
Assert.hasLength(param.getBusinessGroup(),"未添加业务分组");
public void addChannelToGroupByGbDevice(@RequestBody ChannelToGroupByGbDeviceParam param) {
Assert.notEmpty(param.getDeviceIds(), "参数异常");
Assert.hasLength(param.getParentId(), "未添加上级分组编号");
Assert.hasLength(param.getBusinessGroup(), "未添加业务分组");
channelService.addChannelToGroupByGbDevice(param.getParentId(), param.getBusinessGroup(), param.getDeviceIds());
}
@PostMapping("/group/device/delete")
public void deleteChannelToGroupByGbDevice(@RequestBody ChannelToGroupByGbDeviceParam param){
Assert.notEmpty(param.getDeviceIds(),"参数异常");
public void deleteChannelToGroupByGbDevice(@RequestBody ChannelToGroupByGbDeviceParam param) {
Assert.notEmpty(param.getDeviceIds(), "参数异常");
channelService.deleteChannelToGroupByGbDevice(param.getDeviceIds());
}
@GetMapping("/play")
public DeferredResult<WVPResult<StreamContent>> deleteChannelToGroupByGbDevice(HttpServletRequest request, Integer channelId){
Assert.notNull(channelId,"参数异常");
public DeferredResult<WVPResult<StreamContent>> deleteChannelToGroupByGbDevice(HttpServletRequest request, Integer channelId) {
Assert.notNull(channelId, "参数异常");
CommonGBChannel channel = channelService.getOne(channelId);
Assert.notNull(channel, "通道不存在");
@@ -219,13 +238,13 @@ public class CommonChannelController {
WVPResult<StreamContent> wvpResult = WVPResult.success();
if (streamInfo != null) {
if (userSetting.getUseSourceIpAsStreamIp()) {
streamInfo=streamInfo.clone();//深拷贝
streamInfo = streamInfo.clone();//深拷贝
String host;
try {
URL url=new URL(request.getRequestURL().toString());
host=url.getHost();
URL url = new URL(request.getRequestURL().toString());
host = url.getHost();
} catch (MalformedURLException e) {
host=request.getLocalAddr();
host = request.getLocalAddr();
}
streamInfo.channgeStreamIp(host);
}
@@ -234,13 +253,13 @@ public class CommonChannelController {
streamInfo.setStream(streamInfo.getStream() + "_" + streamInfo.getMediaServer().getTranscodeSuffix());
}
wvpResult.setData(new StreamContent(streamInfo));
}else {
} else {
wvpResult.setCode(code);
wvpResult.setMsg(msg);
}
result.setResult(wvpResult);
}else {
} else {
result.setResult(WVPResult.fail(code, msg));
}
};

View File

@@ -2,6 +2,8 @@ package com.ruoyi.wvp.gb28181.controller;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.wvp.common.InviteSessionType;
import com.ruoyi.wvp.common.StreamInfo;
import com.ruoyi.wvp.conf.UserSetting;
@@ -26,7 +28,6 @@ import com.ruoyi.wvp.vmanager.bean.StreamContent;
import com.ruoyi.wvp.vmanager.bean.WVPResult;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
@@ -45,242 +46,242 @@ import java.util.UUID;
/**
* @author lin
*/
@Tag(name = "国标设备点播")
@Tag(name = "国标设备点播")
@Slf4j
@RestController
@RequestMapping("/api/play")
public class PlayController {
public class PlayController extends BaseController {
@Autowired
private SipInviteSessionManager sessionManager;
@Autowired
private SipInviteSessionManager sessionManager;
@Autowired
private IInviteStreamService inviteStreamService;
@Autowired
private IInviteStreamService inviteStreamService;
@Autowired
private DeferredResultHolder resultHolder;
@Autowired
private DeferredResultHolder resultHolder;
@Autowired
private IPlayService playService;
@Autowired
private IPlayService playService;
@Autowired
private IMediaServerService mediaServerService;
@Autowired
private IMediaServerService mediaServerService;
@Autowired
private UserSetting userSetting;
@Autowired
private UserSetting userSetting;
@Autowired
private IDeviceService deviceService;
@Autowired
private IDeviceService deviceService;
@Autowired
private IDeviceChannelService deviceChannelService;
@Autowired
private IDeviceChannelService deviceChannelService;
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
@Parameter(name = "channelId", description = "通道国标编号", required = true)
@GetMapping("/start/{deviceId}/{channelId}")
public DeferredResult<WVPResult<StreamContent>> play(HttpServletRequest request, @PathVariable String deviceId,
@PathVariable String channelId) {
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
@Parameter(name = "channelId", description = "通道国标编号", required = true)
@GetMapping("/start/{deviceId}/{channelId}")
public DeferredResult<WVPResult<StreamContent>> play(HttpServletRequest request, @PathVariable String deviceId, @PathVariable String channelId) {
log.info("[开始点播] deviceId{}, channelId{}, ", deviceId, channelId);
Assert.notNull(deviceId, "设备国标编号不可为NULL");
Assert.notNull(channelId, "通道国标编号不可为NULL");
// 获取可用的zlm
Device device = deviceService.getDeviceByDeviceId(deviceId);
Assert.notNull(deviceId, "设备不存在");
DeviceChannel channel = deviceChannelService.getOne(deviceId, channelId);
Assert.notNull(channel, "通道不存在");
MediaServer newMediaServerItem = playService.getNewMediaServerItem(device);
log.info("[开始点播] deviceId{}, channelId{}, ", deviceId, channelId);
Assert.notNull(deviceId, "设备国标编号不可为NULL");
Assert.notNull(channelId, "通道国标编号不可为NULL");
// 获取可用的zlm
Device device = deviceService.getDeviceByDeviceId(deviceId);
Assert.notNull(deviceId, "设备不存在");
DeviceChannel channel = deviceChannelService.getOne(deviceId, channelId);
Assert.notNull(channel, "通道不存在");
MediaServer newMediaServerItem = playService.getNewMediaServerItem(device);
RequestMessage requestMessage = new RequestMessage();
String key = DeferredResultHolder.CALLBACK_CMD_PLAY + deviceId + channelId;
requestMessage.setKey(key);
String uuid = UUID.randomUUID().toString();
requestMessage.setId(uuid);
DeferredResult<WVPResult<StreamContent>> result = new DeferredResult<>(userSetting.getPlayTimeout().longValue());
RequestMessage requestMessage = new RequestMessage();
String key = DeferredResultHolder.CALLBACK_CMD_PLAY + deviceId + channelId;
requestMessage.setKey(key);
String uuid = UUID.randomUUID().toString();
requestMessage.setId(uuid);
DeferredResult<WVPResult<StreamContent>> result = new DeferredResult<>(userSetting.getPlayTimeout().longValue());
result.onTimeout(()->{
log.info("[点播等待超时] deviceId{}, channelId{}, ", deviceId, channelId);
// 释放rtpserver
WVPResult<StreamInfo> wvpResult = new WVPResult<>();
wvpResult.setCode(ErrorCode.ERROR100.getCode());
wvpResult.setMsg("点播超时");
requestMessage.setData(wvpResult);
resultHolder.invokeAllResult(requestMessage);
inviteStreamService.removeInviteInfoByDeviceAndChannel(InviteSessionType.PLAY, channel.getId());
deviceChannelService.stopPlay(channel.getId());
});
result.onTimeout(() -> {
log.info("[点播等待超时] deviceId{}, channelId{}, ", deviceId, channelId);
// 释放rtpserver
WVPResult<StreamInfo> wvpResult = new WVPResult<>();
wvpResult.setCode(ErrorCode.ERROR100.getCode());
wvpResult.setMsg("点播超时");
requestMessage.setData(wvpResult);
resultHolder.invokeAllResult(requestMessage);
inviteStreamService.removeInviteInfoByDeviceAndChannel(InviteSessionType.PLAY, channel.getId());
deviceChannelService.stopPlay(channel.getId());
});
// 录像查询以channelId作为deviceId查询
resultHolder.put(key, uuid, result);
// 录像查询以channelId作为deviceId查询
resultHolder.put(key, uuid, result);
playService.play(newMediaServerItem, deviceId, channelId, null, (code, msg, streamInfo) -> {
WVPResult<StreamContent> wvpResult = new WVPResult<>();
if (code == InviteErrorCode.SUCCESS.getCode()) {
wvpResult.setCode(ErrorCode.SUCCESS.getCode());
wvpResult.setMsg(ErrorCode.SUCCESS.getMsg());
playService.play(newMediaServerItem, deviceId, channelId, null, (code, msg, streamInfo) -> {
WVPResult<StreamContent> wvpResult = new WVPResult<>();
if (code == InviteErrorCode.SUCCESS.getCode()) {
wvpResult.setCode(ErrorCode.SUCCESS.getCode());
wvpResult.setMsg(ErrorCode.SUCCESS.getMsg());
if (streamInfo != null) {
if (userSetting.getUseSourceIpAsStreamIp()) {
streamInfo=streamInfo.clone();//深拷贝
String host;
try {
URL url=new URL(request.getRequestURL().toString());
host=url.getHost();
} catch (MalformedURLException e) {
host=request.getLocalAddr();
}
streamInfo.channgeStreamIp(host);
}
if (!ObjectUtils.isEmpty(newMediaServerItem.getTranscodeSuffix()) && !"null".equalsIgnoreCase(newMediaServerItem.getTranscodeSuffix())) {
streamInfo.setStream(streamInfo.getStream() + "_" + newMediaServerItem.getTranscodeSuffix());
}
wvpResult.setData(new StreamContent(streamInfo));
}else {
wvpResult.setCode(code);
wvpResult.setMsg(msg);
}
}else {
wvpResult.setCode(code);
wvpResult.setMsg(msg);
}
requestMessage.setData(wvpResult);
// 此处必须释放所有请求
resultHolder.invokeAllResult(requestMessage);
});
return result;
}
if (streamInfo != null) {
if (userSetting.getUseSourceIpAsStreamIp()) {
streamInfo = streamInfo.clone();//深拷贝
String host;
try {
URL url = new URL(request.getRequestURL().toString());
host = url.getHost();
} catch (MalformedURLException e) {
host = request.getLocalAddr();
}
streamInfo.channgeStreamIp(host);
}
if (!ObjectUtils.isEmpty(newMediaServerItem.getTranscodeSuffix()) && !"null".equalsIgnoreCase(newMediaServerItem.getTranscodeSuffix())) {
streamInfo.setStream(streamInfo.getStream() + "_" + newMediaServerItem.getTranscodeSuffix());
}
wvpResult.setData(new StreamContent(streamInfo));
} else {
wvpResult.setCode(code);
wvpResult.setMsg(msg);
}
} else {
wvpResult.setCode(code);
wvpResult.setMsg(msg);
}
requestMessage.setData(wvpResult);
// 此处必须释放所有请求
resultHolder.invokeAllResult(requestMessage);
});
return result;
}
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
@Parameter(name = "channelId", description = "通道国标编号", required = true)
@GetMapping("/stop/{deviceId}/{channelId}")
public JSONObject playStop(@PathVariable String deviceId, @PathVariable String channelId) {
/**
* 停止点播
*
* @param deviceId 设备国标编号
* @param channelId 通道国标编号
* @return
*/
@GetMapping("/stop/{deviceId}/{channelId}")
public AjaxResult playStop(@PathVariable String deviceId, @PathVariable String channelId) {
log.debug(String.format("设备预览/回放停止API调用streamId%s_%s", deviceId, channelId));
if (deviceId == null || channelId == null) {
throw new ControllerException(ErrorCode.ERROR400);
}
log.debug(String.format("设备预览/回放停止API调用streamId%s_%s", deviceId, channelId ));
Device device = deviceService.getDeviceByDeviceId(deviceId);
DeviceChannel channel = deviceChannelService.getOneForSource(deviceId, channelId);
Assert.notNull(device, "设备不存在");
Assert.notNull(channel, "通道不存在");
String streamId = String.format("%s_%s", device.getDeviceId(), channel.getDeviceId());
playService.stop(InviteSessionType.PLAY, device, channel, streamId);
return success();
}
if (deviceId == null || channelId == null) {
throw new ControllerException(ErrorCode.ERROR400);
}
/**
* 结束转码
*/
@Parameter(name = "key", description = "视频流key", required = true)
@Parameter(name = "mediaServerId", description = "流媒体服务ID", required = true)
@PostMapping("/convertStop/{key}")
public void playConvertStop(@PathVariable String key, String mediaServerId) {
if (mediaServerId == null) {
throw new ControllerException(ErrorCode.ERROR400.getCode(), "流媒体:" + mediaServerId + "不存在");
}
MediaServer mediaInfo = mediaServerService.getOne(mediaServerId);
if (mediaInfo == null) {
throw new ControllerException(ErrorCode.ERROR100.getCode(), "使用的流媒体已经停止运行");
} else {
Boolean deleted = mediaServerService.delFFmpegSource(mediaInfo, key);
if (!deleted) {
throw new ControllerException(ErrorCode.ERROR100);
}
}
}
Device device = deviceService.getDeviceByDeviceId(deviceId);
DeviceChannel channel = deviceChannelService.getOneForSource(deviceId, channelId);
Assert.notNull(device, "设备不存在");
Assert.notNull(channel, "通道不存在");
String streamId = String.format("%s_%s", device.getDeviceId(), channel.getDeviceId());
playService.stop(InviteSessionType.PLAY, device, channel, streamId);
JSONObject json = new JSONObject();
json.put("deviceId", deviceId);
json.put("channelId", channelId);
return json;
}
/**
* 结束转码
*/
@Parameter(name = "key", description = "视频流key", required = true)
@Parameter(name = "mediaServerId", description = "流媒体服务ID", required = true)
@PostMapping("/convertStop/{key}")
public void playConvertStop(@PathVariable String key, String mediaServerId) {
if (mediaServerId == null) {
throw new ControllerException(ErrorCode.ERROR400.getCode(), "流媒体:" + mediaServerId + "不存在" );
}
MediaServer mediaInfo = mediaServerService.getOne(mediaServerId);
if (mediaInfo == null) {
throw new ControllerException(ErrorCode.ERROR100.getCode(), "使用的流媒体已经停止运行" );
}else {
Boolean deleted = mediaServerService.delFFmpegSource(mediaInfo, key);
if (!deleted) {
throw new ControllerException(ErrorCode.ERROR100 );
}
}
}
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
@Parameter(name = "deviceId", description = "通道国标编号", required = true)
@Parameter(name = "timeout", description = "推流超时时间(秒)", required = true)
@GetMapping("/broadcast/{deviceId}/{channelId}")
@PostMapping("/broadcast/{deviceId}/{channelId}")
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
@Parameter(name = "deviceId", description = "通道国标编号", required = true)
@Parameter(name = "timeout", description = "推流超时时间(秒)", required = true)
@GetMapping("/broadcast/{deviceId}/{channelId}")
@PostMapping("/broadcast/{deviceId}/{channelId}")
public AudioBroadcastResult broadcastApi(@PathVariable String deviceId, @PathVariable String channelId, Integer timeout, Boolean broadcastMode) {
if (log.isDebugEnabled()) {
log.debug("语音广播API调用");
}
Device device = deviceService.getDeviceByDeviceId(deviceId);
if (device == null) {
throw new ControllerException(ErrorCode.ERROR400.getCode(), "未找到设备: " + deviceId);
}
DeviceChannel channel = deviceChannelService.getOne(deviceId, channelId);
if (channel == null) {
throw new ControllerException(ErrorCode.ERROR400.getCode(), "未找到通道: " + channelId);
}
if (log.isDebugEnabled()) {
log.debug("语音广播API调用");
}
Device device = deviceService.getDeviceByDeviceId(deviceId);
if (device == null) {
throw new ControllerException(ErrorCode.ERROR400.getCode(), "未找到设备: " + deviceId);
}
DeviceChannel channel = deviceChannelService.getOne(deviceId, channelId);
if (channel == null) {
throw new ControllerException(ErrorCode.ERROR400.getCode(), "未找到通道: " + channelId);
}
return playService.audioBroadcast(device, channel, broadcastMode);
return playService.audioBroadcast(device, channel, broadcastMode);
}
}
@Operation(summary = "停止语音广播")
@Parameter(name = "deviceId", description = "设备Id", required = true)
@Parameter(name = "channelId", description = "通道Id", required = true)
@GetMapping("/broadcast/stop/{deviceId}/{channelId}")
@PostMapping("/broadcast/stop/{deviceId}/{channelId}")
public void stopBroadcast(@PathVariable String deviceId, @PathVariable String channelId) {
if (log.isDebugEnabled()) {
log.debug("停止语音广播API调用");
}
Device device = deviceService.getDeviceByDeviceId(deviceId);
Assert.notNull(device, "设备不存在");
DeviceChannel channel = deviceChannelService.getOne(deviceId, channelId);
Assert.notNull(channel, "通道不存在");
playService.stopAudioBroadcast(device, channel);
}
@Operation(summary = "停止语音广播")
@Parameter(name = "deviceId", description = "设备Id", required = true)
@Parameter(name = "channelId", description = "通道Id", required = true)
@GetMapping("/broadcast/stop/{deviceId}/{channelId}")
@PostMapping("/broadcast/stop/{deviceId}/{channelId}")
public void stopBroadcast(@PathVariable String deviceId, @PathVariable String channelId) {
if (log.isDebugEnabled()) {
log.debug("停止语音广播API调用");
}
Device device = deviceService.getDeviceByDeviceId(deviceId);
Assert.notNull(device, "设备不存在");
DeviceChannel channel = deviceChannelService.getOne(deviceId, channelId);
Assert.notNull(channel, "通道不存在");
playService.stopAudioBroadcast(device, channel);
}
@GetMapping("/ssrc")
public JSONObject getSSRC() {
if (log.isDebugEnabled()) {
log.debug("获取所有的ssrc");
}
JSONArray objects = new JSONArray();
List<SsrcTransaction> allSsrc = sessionManager.getAll();
for (SsrcTransaction transaction : allSsrc) {
JSONObject jsonObject = new JSONObject();
jsonObject.put("deviceId", transaction.getDeviceId());
jsonObject.put("channelId", transaction.getChannelId());
jsonObject.put("ssrc", transaction.getSsrc());
jsonObject.put("streamId", transaction.getStream());
objects.add(jsonObject);
}
@GetMapping("/ssrc")
public JSONObject getSSRC() {
if (log.isDebugEnabled()) {
log.debug("获取所有的ssrc");
}
JSONArray objects = new JSONArray();
List<SsrcTransaction> allSsrc = sessionManager.getAll();
for (SsrcTransaction transaction : allSsrc) {
JSONObject jsonObject = new JSONObject();
jsonObject.put("deviceId", transaction.getDeviceId());
jsonObject.put("channelId", transaction.getChannelId());
jsonObject.put("ssrc", transaction.getSsrc());
jsonObject.put("streamId", transaction.getStream());
objects.add(jsonObject);
}
JSONObject jsonObject = new JSONObject();
jsonObject.put("data", objects);
jsonObject.put("count", objects.size());
return jsonObject;
}
JSONObject jsonObject = new JSONObject();
jsonObject.put("data", objects);
jsonObject.put("count", objects.size());
return jsonObject;
}
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
@Parameter(name = "channelId", description = "通道国标编号", required = true)
@GetMapping("/snap")
public DeferredResult<String> getSnap(String deviceId, String channelId) {
if (log.isDebugEnabled()) {
log.debug("获取截图: {}/{}", deviceId, channelId);
}
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
@Parameter(name = "channelId", description = "通道国标编号", required = true)
@GetMapping("/snap")
public DeferredResult<String> getSnap(String deviceId, String channelId) {
if (log.isDebugEnabled()) {
log.debug("获取截图: {}/{}", deviceId, channelId);
}
DeferredResult<String> result = new DeferredResult<>(3 * 1000L);
String key = DeferredResultHolder.CALLBACK_CMD_SNAP + deviceId;
String uuid = UUID.randomUUID().toString();
resultHolder.put(key, uuid, result);
DeferredResult<String> result = new DeferredResult<>(3 * 1000L);
String key = DeferredResultHolder.CALLBACK_CMD_SNAP + deviceId;
String uuid = UUID.randomUUID().toString();
resultHolder.put(key, uuid, result);
RequestMessage message = new RequestMessage();
message.setKey(key);
message.setId(uuid);
RequestMessage message = new RequestMessage();
message.setKey(key);
message.setId(uuid);
String fileName = deviceId + "_" + channelId + "_" + DateUtil.getNowForUrl() + ".jpg";
playService.getSnap(deviceId, channelId, fileName, (code, msg, data) -> {
if (code == InviteErrorCode.SUCCESS.getCode()) {
message.setData(data);
}else {
message.setData(WVPResult.fail(code, msg));
}
resultHolder.invokeResult(message);
});
return result;
}
String fileName = deviceId + "_" + channelId + "_" + DateUtil.getNowForUrl() + ".jpg";
playService.getSnap(deviceId, channelId, fileName, (code, msg, data) -> {
if (code == InviteErrorCode.SUCCESS.getCode()) {
message.setData(data);
} else {
message.setData(WVPResult.fail(code, msg));
}
resultHolder.invokeResult(message);
});
return result;
}
}

View File

@@ -1,6 +1,8 @@
package com.ruoyi.wvp.gb28181.controller;
import com.github.pagehelper.PageInfo;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.wvp.conf.exception.ControllerException;
import com.ruoyi.wvp.gb28181.bean.Region;
import com.ruoyi.wvp.gb28181.bean.RegionTree;
@@ -21,7 +23,7 @@ import java.util.List;
@Tag(name = "区域管理")
@RestController
@RequestMapping("/api/region")
public class RegionController {
public class RegionController extends BaseController {
private final static Logger logger = LoggerFactory.getLogger(RegionController.class);
@@ -32,7 +34,7 @@ public class RegionController {
@Parameter(name = "region", description = "Region", required = true)
@ResponseBody
@PostMapping("/add")
public void add(@RequestBody Region region){
public void add(@RequestBody Region region) {
regionService.add(region);
}
@@ -46,31 +48,36 @@ public class RegionController {
@RequestParam(required = false) String query,
@RequestParam(required = true) int page,
@RequestParam(required = true) int count
){
) {
return regionService.query(query, page, count);
}
@Operation(summary = "查询区域")
@Parameter(name = "query", description = "要搜索的内容", required = true)
@Parameter(name = "parent", description = "所属行政区划编号", required = true)
/**
* 查询区域
*
* @param query 要搜索的内容
* @param parent 父节点
* @param hasChannel 是否包含通道
* @return
*/
@ResponseBody
@GetMapping("/tree/list")
public List<RegionTree> queryForTree(
public AjaxResult queryForTree(
@RequestParam(required = false) String query,
@RequestParam(required = false) Integer parent,
@RequestParam(required = false) Boolean hasChannel
){
) {
if (ObjectUtils.isEmpty(query)) {
query = null;
}
return regionService.queryForTree(query, parent, hasChannel);
return success(regionService.queryForTree(query, parent, hasChannel));
}
@Operation(summary = "更新区域")
@Parameter(name = "region", description = "Region", required = true)
@ResponseBody
@PostMapping("/update")
public void update(@RequestBody Region region){
public void update(@RequestBody Region region) {
regionService.update(region);
}
@@ -78,7 +85,7 @@ public class RegionController {
@Parameter(name = "id", description = "区域ID", required = true)
@ResponseBody
@DeleteMapping("/delete")
public void delete(Integer id){
public void delete(Integer id) {
Assert.notNull(id, "区域ID需要存在");
boolean result = regionService.deleteByDeviceId(id);
if (!result) {
@@ -92,36 +99,40 @@ public class RegionController {
@GetMapping("/one")
public Region queryRegionByDeviceId(
@RequestParam(required = true) String regionDeviceId
){
) {
if (ObjectUtils.isEmpty(regionDeviceId.trim())) {
throw new ControllerException(ErrorCode.ERROR400);
}
return regionService.queryRegionByDeviceId(regionDeviceId);
}
@Operation(summary = "获取所属的行政区划下的行政区划")
@Parameter(name = "parent", description = "所属的行政区划", required = false)
/**
* 获取所属的行政区划下的行政区划
*
* @param parent
* @return
*/
@ResponseBody
@GetMapping("/base/child/list")
public List<Region> getAllChild(@RequestParam(required = false) String parent){
public AjaxResult getAllChild(@RequestParam(required = false) String parent) {
if (ObjectUtils.isEmpty(parent)) {
parent = null;
}
return regionService.getAllChild(parent);
return success(regionService.getAllChild(parent));
}
@Operation(summary = "获取所属的行政区划下的行政区划")
@Parameter(name = "deviceId", description = "当前的行政区划", required = false)
@ResponseBody
@GetMapping("/path")
public List<Region> getPath(String deviceId){
public List<Region> getPath(String deviceId) {
return regionService.getPath(deviceId);
}
@Operation(summary = "从通道中同步行政区划")
@ResponseBody
@GetMapping("/sync")
public void sync(){
public void sync() {
regionService.syncFromChannel();
}
}

View File

@@ -97,11 +97,11 @@ public interface IDeviceChannelService {
boolean resetChannels(int deviceDbId, List<DeviceChannel> deviceChannels);
PageInfo<DeviceChannel> getSubChannels(int deviceDbId, String channelId, String query, Boolean channelType, Boolean online, int page, int count);
List<DeviceChannel> getSubChannels(int deviceDbId, String channelId, String query, Boolean channelType, Boolean online, int page, int count);
List<DeviceChannelExtend> queryChannelExtendsByDeviceId(String deviceId, List<String> channelIds, Boolean online);
PageInfo<DeviceChannel> queryChannelsByDeviceId(String deviceId, String query, Boolean channelType, Boolean online, int page, int count);
List<DeviceChannel> queryChannelsByDeviceId(String deviceId, String query, Boolean channelType, Boolean online, int pageNum, int pageSize);
List<Device> queryDeviceWithAsMessageChannel();

View File

@@ -12,10 +12,6 @@ import com.ruoyi.wvp.conf.UserSetting;
import com.ruoyi.wvp.conf.exception.ControllerException;
import com.ruoyi.wvp.gb28181.bean.*;
import com.ruoyi.wvp.gb28181.controller.bean.ChannelReduce;
import com.ruoyi.wvp.mapper.DeviceChannelMapper;
import com.ruoyi.wvp.mapper.DeviceMapper;
import com.ruoyi.wvp.mapper.DeviceMobilePositionMapper;
import com.ruoyi.wvp.mapper.PlatformChannelMapper;
import com.ruoyi.wvp.gb28181.dto.DeviceChannelExtend;
import com.ruoyi.wvp.gb28181.event.EventPublisher;
import com.ruoyi.wvp.gb28181.event.subscribe.catalog.CatalogEvent;
@@ -24,6 +20,10 @@ import com.ruoyi.wvp.gb28181.service.IInviteStreamService;
import com.ruoyi.wvp.gb28181.service.IPlatformChannelService;
import com.ruoyi.wvp.gb28181.transmit.cmd.ISIPCommander;
import com.ruoyi.wvp.gb28181.utils.SipUtils;
import com.ruoyi.wvp.mapper.DeviceChannelMapper;
import com.ruoyi.wvp.mapper.DeviceMapper;
import com.ruoyi.wvp.mapper.DeviceMobilePositionMapper;
import com.ruoyi.wvp.mapper.PlatformChannelMapper;
import com.ruoyi.wvp.service.bean.ErrorCallback;
import com.ruoyi.wvp.storager.IRedisCatchStorage;
import com.ruoyi.wvp.utils.DateUtil;
@@ -107,7 +107,7 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
channel.setCreateTime(now);
addChannels.add(channel);
}
}else {
} else {
for (DeviceChannel deviceChannel : channelList) {
channelsInStore.put(deviceChannel.getDataDeviceId() + deviceChannel.getDeviceId(), deviceChannel);
}
@@ -119,11 +119,11 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
String now = DateUtil.getNow();
channel.setUpdateTime(now);
DeviceChannel deviceChannelInDb = channelsInStore.get(channel.getDataDeviceId() + channel.getDeviceId());
if ( deviceChannelInDb != null) {
if (deviceChannelInDb != null) {
channel.setId(deviceChannelInDb.getId());
channel.setUpdateTime(now);
updateChannels.add(channel);
}else {
} else {
channel.setCreateTime(now);
channel.setUpdateTime(now);
addChannels.add(channel);
@@ -156,7 +156,7 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
}
result += channelMapper.batchAdd(addChannelList.subList(i, toIndex));
}
}else {
} else {
result += channelMapper.batchAdd(addChannelList);
}
}
@@ -169,7 +169,7 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
}
result += channelMapper.batchUpdate(updateChannelList.subList(i, toIndex));
}
}else {
} else {
result += channelMapper.batchUpdate(updateChannelList);
}
}
@@ -219,7 +219,7 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
}
result += channelMapper.batchDel(channels.subList(i, toIndex));
}
}else {
} else {
result += channelMapper.batchDel(channels);
}
}
@@ -240,7 +240,7 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
}
result += channelMapper.batchUpdateStatus(channels.subList(i, toIndex));
}
}else {
} else {
result += channelMapper.batchUpdateStatus(channels);
}
}
@@ -263,7 +263,7 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
}
@Override
public DeviceChannel getOne(String deviceId, String channelId){
public DeviceChannel getOne(String deviceId, String channelId) {
Device device = deviceMapper.getDeviceByDeviceId(deviceId);
if (device == null) {
throw new ControllerException(ErrorCode.ERROR100.getCode(), "未找到设备:" + deviceId);
@@ -272,7 +272,7 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
}
@Override
public DeviceChannel getOneForSource(String deviceId, String channelId){
public DeviceChannel getOneForSource(String deviceId, String channelId) {
Device device = deviceMapper.getDeviceByDeviceId(deviceId);
if (device == null) {
throw new ControllerException(ErrorCode.ERROR100.getCode(), "未找到设备:" + deviceId);
@@ -307,7 +307,7 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
}
channelMapper.batchUpdateForNotify(channels.subList(i, toIndex));
}
}else {
} else {
channelMapper.batchUpdateForNotify(channels);
}
}
@@ -331,7 +331,7 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
}
channelMapper.batchAdd(channels.subList(i, toIndex));
}
}else {
} else {
channelMapper.batchAdd(channels);
}
}
@@ -347,13 +347,12 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
Assert.hasLength(channel.getStreamIdentification(), "码流标识必须存在");
if (ObjectUtils.isEmpty(channel.getStreamIdentification())) {
log.info("[重置通道码流类型] 设备: {}, 码流: {}", channel.getDeviceId(), channel.getStreamIdentification());
}else {
log.info("[更新通道码流类型] 设备: {}, 通道:{} 码流: {}", channel.getDeviceId(), channel.getDeviceId(),
channel.getStreamIdentification());
} else {
log.info("[更新通道码流类型] 设备: {}, 通道:{} 码流: {}", channel.getDeviceId(), channel.getDeviceId(), channel.getStreamIdentification());
}
if (channel.getId() > 0) {
channelMapper.updateChannelStreamIdentification(channel);
}else {
} else {
channelMapper.updateAllChannelStreamIdentification(channel.getStreamIdentification());
}
}
@@ -391,20 +390,18 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
DeviceChannel deviceChannel = channelMapper.getOneForSource(gbId);
if (deviceChannel == null) {
log.warn("[deviceControl] 未找到设备原始通道, 设备: {}{}),通道编号:{}", device.getName(),
device.getDeviceId(), gbId);
log.warn("[deviceControl] 未找到设备原始通道, 设备: {}{}),通道编号:{}", device.getName(), device.getDeviceId(), gbId);
callback.run(Response.NOT_FOUND, "channel not found", null);
return;
}
log.info("[deviceControl] 命令: {}, 设备: {}{} 通道{}{}", type, device.getName(), device.getDeviceId(),
deviceChannel.getName(), deviceChannel.getDeviceId());
log.info("[deviceControl] 命令: {}, 设备: {}{} 通道{}{}", type, device.getName(), device.getDeviceId(), deviceChannel.getName(), deviceChannel.getDeviceId());
String cmdString = getText(rootElement, type.getVal());
try {
cmder.fronEndCmd(device, deviceChannel.getDeviceId(), cmdString, errorResult->{
callback.run(errorResult.statusCode, errorResult.msg, null);
}, errorResult->{
callback.run(errorResult.statusCode, errorResult.msg, null);
});
cmder.fronEndCmd(device, deviceChannel.getDeviceId(), cmdString, errorResult -> {
callback.run(errorResult.statusCode, errorResult.msg, null);
}, errorResult -> {
callback.run(errorResult.statusCode, errorResult.msg, null);
});
} catch (InvalidArgumentException | SipException | ParseException e) {
log.error("[命令发送失败] 云台/前端: {}", e.getMessage());
}
@@ -433,22 +430,21 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
// 有的设备这里上报的deviceId与通道Id是一样这种情况更新设备下的全部通道
List<DeviceChannel> deviceChannelsInDb = queryChaneListByDeviceId(device.getDeviceId());
deviceChannels.addAll(deviceChannelsInDb);
}else {
} else {
deviceChannels.add(deviceChannel);
}
if (deviceChannels.isEmpty()) {
return;
}
if (deviceChannels.size() > 100) {
log.warn("[更新通道位置信息后发送通知] 设备可能是平台,上报的位置信息未标明通道编号," +
"导致所有通道被更新位置, deviceId:{}", device.getDeviceId());
log.warn("[更新通道位置信息后发送通知] 设备可能是平台,上报的位置信息未标明通道编号," + "导致所有通道被更新位置, deviceId:{}", device.getDeviceId());
}
for (DeviceChannel channel : deviceChannels) {
// 向关联了该通道并且开启移动位置订阅的上级平台发送移动位置订阅消息
mobilePosition.setChannelId(channel.getId());
try {
eventPublisher.mobilePositionEventPublish(mobilePosition);
}catch (Exception e) {
} catch (Exception e) {
log.error("[向上级转发移动位置失败] ", e);
}
// 发送redis消息。 通知位置信息的变化
@@ -486,15 +482,15 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
}
int count = 1000;
if (channelList.size() > count) {
for (int i = 0; i < channelList.size(); i+=count) {
int toIndex = i+count;
if ( i + count > channelList.size()) {
for (int i = 0; i < channelList.size(); i += count) {
int toIndex = i + count;
if (i + count > channelList.size()) {
toIndex = channelList.size();
}
List<DeviceChannel> channels = channelList.subList(i, toIndex);
channelMapper.batchUpdatePosition(channels);
}
}else {
} else {
channelMapper.batchUpdatePosition(channelList);
}
}
@@ -530,7 +526,7 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
return false;
}
List<DeviceChannel> allChannels = channelMapper.queryAllChannelsForRefresh(deviceDbId);
Map<String,DeviceChannel> allChannelMap = new HashMap<>();
Map<String, DeviceChannel> allChannelMap = new HashMap<>();
if (!allChannels.isEmpty()) {
for (DeviceChannel deviceChannel : allChannels) {
allChannelMap.put(deviceChannel.getDataDeviceId() + deviceChannel.getDeviceId(), deviceChannel);
@@ -551,17 +547,17 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
deviceChannel.setStreamId(channelInDb.getStreamId());
deviceChannel.setHasAudio(channelInDb.isHasAudio());
deviceChannel.setId(channelInDb.getId());
if (channelInDb.getStatus() != null && channelInDb.getStatus().equalsIgnoreCase(deviceChannel.getStatus())){
if (channelInDb.getStatus() != null && channelInDb.getStatus().equalsIgnoreCase(deviceChannel.getStatus())) {
List<Platform> platformList = platformChannelMapper.queryParentPlatformByChannelId(deviceChannel.getDeviceId());
if (!CollectionUtils.isEmpty(platformList)){
platformList.forEach(platform->{
eventPublisher.catalogEventPublish(platform, deviceChannel, deviceChannel.getStatus().equals("ON")? CatalogEvent.ON:CatalogEvent.OFF);
if (!CollectionUtils.isEmpty(platformList)) {
platformList.forEach(platform -> {
eventPublisher.catalogEventPublish(platform, deviceChannel, deviceChannel.getStatus().equals("ON") ? CatalogEvent.ON : CatalogEvent.OFF);
});
}
}
deviceChannel.setUpdateTime(DateUtil.getNow());
updateChannels.add(deviceChannel);
}else {
} else {
deviceChannel.setCreateTime(DateUtil.getNow());
deviceChannel.setUpdateTime(DateUtil.getNow());
addChannels.add(deviceChannel);
@@ -571,7 +567,7 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
if (!ObjectUtils.isEmpty(deviceChannel.getParentId())) {
if (subContMap.get(deviceChannel.getParentId()) == null) {
subContMap.put(deviceChannel.getParentId(), 1);
}else {
} else {
Integer count = subContMap.get(deviceChannel.getParentId());
subContMap.put(deviceChannel.getParentId(), count++);
}
@@ -580,7 +576,7 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
deleteChannels.addAll(allChannelMap.values());
if (!channels.isEmpty()) {
for (DeviceChannel channel : channels) {
if (subContMap.get(channel.getDeviceId()) != null){
if (subContMap.get(channel.getDeviceId()) != null) {
Integer count = subContMap.get(channel.getDeviceId());
if (count > 0) {
channel.setSubCount(count);
@@ -591,10 +587,10 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
}
if (stringBuilder.length() > 0) {
log.info("[目录查询]收到的数据存在重复: {}" , stringBuilder);
log.info("[目录查询]收到的数据存在重复: {}", stringBuilder);
}
if(CollectionUtils.isEmpty(channels)){
log.info("通道重设,数据为空={}" , deviceChannelList);
if (CollectionUtils.isEmpty(channels)) {
log.info("通道重设,数据为空={}", deviceChannelList);
return false;
}
int limitCount = 500;
@@ -607,7 +603,7 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
}
channelMapper.batchAdd(addChannels.subList(i, toIndex));
}
}else {
} else {
channelMapper.batchAdd(addChannels);
}
}
@@ -620,7 +616,7 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
}
channelMapper.batchUpdate(updateChannels.subList(i, toIndex));
}
}else {
} else {
channelMapper.batchUpdate(updateChannels);
}
// 不对收到的通道做比较,已确定是否真的发生变化,所以不发送更新通知
@@ -634,7 +630,7 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
ids.add(deviceChannel.getId());
});
platformChannelService.removeChannels(ids);
}catch (Exception e) {
} catch (Exception e) {
log.error("[移除通道国标级联共享失败]", e);
}
if (deleteChannels.size() > limitCount) {
@@ -645,7 +641,7 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
}
channelMapper.batchDel(deleteChannels.subList(i, toIndex));
}
}else {
} else {
channelMapper.batchDel(deleteChannels);
}
}
@@ -654,18 +650,17 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
}
@Override
public PageInfo<DeviceChannel> getSubChannels(int deviceDbId, String channelId, String query, Boolean channelType, Boolean online, int page, int count) {
PageHelper.startPage(page, count);
public List<DeviceChannel> getSubChannels(int deviceDbId, String channelId, String query, Boolean channelType, Boolean online, int page, int count) {
String civilCode = null;
String parentId = null;
String businessGroupId = null;
if (channelId.length() <= 8) {
civilCode = channelId;
}else {
} else {
GbCode decode = GbCode.decode(channelId);
if (Integer.parseInt(decode.getTypeCode()) == 215) {
businessGroupId = channelId;
}else {
} else {
parentId = channelId;
}
}
@@ -674,17 +669,16 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
.replaceAll("%", "/%")
.replaceAll("_", "/_");
}
List<DeviceChannel> all = channelMapper.queryChannels(deviceDbId, civilCode, businessGroupId, parentId, query, channelType, online,null);
return new PageInfo<>(all);
return channelMapper.queryChannels(deviceDbId, civilCode, businessGroupId, parentId, query, channelType, online, null);
}
@Override
public List<DeviceChannelExtend> queryChannelExtendsByDeviceId(String deviceId, List<String> channelIds, Boolean online) {
return channelMapper.queryChannelsWithDeviceInfo(deviceId, null,null, null, online,channelIds);
return channelMapper.queryChannelsWithDeviceInfo(deviceId, null, null, null, online, channelIds);
}
@Override
public PageInfo queryChannelsByDeviceId(String deviceId, String query, Boolean hasSubChannel, Boolean online, int page, int count) {
public List<DeviceChannel> queryChannelsByDeviceId(String deviceId, String query, Boolean hasSubChannel, Boolean online, int pageNum, int pageSize) {
Device device = deviceMapper.getDeviceByDeviceId(deviceId);
if (device == null) {
throw new ControllerException(ErrorCode.ERROR100.getCode(), "未找到设备:" + deviceId);
@@ -694,9 +688,7 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
.replaceAll("%", "/%")
.replaceAll("_", "/_");
}
PageHelper.startPage(page, count);
List<DeviceChannel> all = channelMapper.queryChannels(device.getId(), null,null, null, query, hasSubChannel, online,null);
return new PageInfo<>(all);
return channelMapper.queryChannels(device.getId(), null, null, null, query, hasSubChannel, online, null);
}
@Override

View File

@@ -266,7 +266,7 @@ public interface DeviceChannelMapper {
" WHERE id=#{item.id}" +
"</foreach>" +
"</script>"})
int batchUpdate(List<DeviceChannel> updateChannels);
int batchUpdate(@Param("updateChannels") List<DeviceChannel> updateChannels);
@Update({"<script>" +

View File

@@ -68,19 +68,6 @@ public interface RegionMapper {
@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
int batchAdd(List<Region> regionList);
@Select(" <script>" +
" SELECT " +
" *, " +
" concat('region', id) as tree_id," +
" 0 as type," +
" 'ON' as status," +
" false as is_leaf" +
" from wvp_common_region " +
" where " +
" <if test='parentId != null'> parent_id = #{parentId} </if> " +
" <if test='parentId == null'> parent_id is null </if> " +
" <if test='query != null'> AND (device_id LIKE concat('%',#{query},'%') escape '/' OR name LIKE concat('%',#{query},'%') escape '/')</if> " +
" </script>")
List<RegionTree> queryForTree(@Param("query") String query, @Param("parentId") Integer parentId);
@Delete("<script>" +

View File

@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.wvp.mapper.RegionMapper">
<select id="queryForTree" resultType="com.ruoyi.wvp.gb28181.bean.RegionTree">
SELECT
*,
concat('region', id) as tree_id,
0 as type,
'ON' as status,
false as is_leaf
FROM wvp_common_region
<where>
<if test="parentId != null">
AND parent_id = #{parentId}
</if>
<if test="query != null">
AND (device_id LIKE concat('%', #{query}, '%') ESCAPE '/'
OR name LIKE concat('%', #{query}, '%') ESCAPE '/')
</if>
</where>
</select>
</mapper>