临时提交
parent
96bbd19e81
commit
ce0f0c4ac8
|
@ -11,7 +11,7 @@ import lombok.Data;
|
|||
public class GbCode {
|
||||
|
||||
@Schema(description = "中心编码,由监控中心所在地的行政区划代码确定,符合GB/T2260—2007的要求")
|
||||
private String civilCode;
|
||||
private String centerCode;
|
||||
|
||||
@Schema(description = "行业编码")
|
||||
private String industryCode;
|
||||
|
@ -34,7 +34,7 @@ public class GbCode {
|
|||
}
|
||||
code = code.trim();
|
||||
GbCode gbCode = new GbCode();
|
||||
gbCode.setCivilCode(code.substring(0, 8));
|
||||
gbCode.setCenterCode(code.substring(0, 8));
|
||||
gbCode.setIndustryCode(code.substring(9, 10));
|
||||
gbCode.setTypeCode(code.substring(11, 13));
|
||||
gbCode.setNetCode(code.substring(14, 15));
|
||||
|
@ -43,6 +43,6 @@ public class GbCode {
|
|||
}
|
||||
|
||||
public String ecode(){
|
||||
return civilCode + industryCode + typeCode + netCode + sn;
|
||||
return centerCode + industryCode + typeCode + netCode + sn;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -94,11 +94,12 @@ public class CommonChannelController {
|
|||
public PageInfo<CommonGBChannel> queryList(int page, int count,
|
||||
@RequestParam(required = false) String query,
|
||||
@RequestParam(required = false) Boolean online,
|
||||
@RequestParam(required = false) Boolean hasCivilCode){
|
||||
@RequestParam(required = false) Boolean hasCivilCode,
|
||||
@RequestParam(required = false) Boolean hasGroup){
|
||||
if (ObjectUtils.isEmpty(query)){
|
||||
query = null;
|
||||
}
|
||||
return channelService.queryList(page, count, query, online, hasCivilCode);
|
||||
return channelService.queryList(page, count, query, online, hasCivilCode, hasGroup);
|
||||
}
|
||||
|
||||
@Operation(summary = "通道设置行政区划", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
|
|
|
@ -73,21 +73,21 @@ public class GroupController {
|
|||
}
|
||||
}
|
||||
|
||||
@Operation(summary = "根据分组Id查询分组")
|
||||
@Parameter(name = "groupDeviceId", description = "分组节点编号", required = true)
|
||||
@ResponseBody
|
||||
@GetMapping("/one")
|
||||
public Group queryGroupByDeviceId(
|
||||
@RequestParam(required = true) String deviceId
|
||||
){
|
||||
Assert.hasLength(deviceId, "");
|
||||
return groupService.queryGroupByDeviceId(deviceId);
|
||||
}
|
||||
// @Operation(summary = "根据分组Id查询分组")
|
||||
// @Parameter(name = "groupDeviceId", description = "分组节点编号", required = true)
|
||||
// @ResponseBody
|
||||
// @GetMapping("/one")
|
||||
// public Group queryGroupByDeviceId(
|
||||
// @RequestParam(required = true) String deviceId
|
||||
// ){
|
||||
// Assert.hasLength(deviceId, "");
|
||||
// return groupService.queryGroupByDeviceId(deviceId);
|
||||
// }
|
||||
|
||||
@Operation(summary = "从通道中同步分组")
|
||||
@ResponseBody
|
||||
@GetMapping("/sync")
|
||||
public void sync(){
|
||||
groupService.syncFromChannel();
|
||||
}
|
||||
// @Operation(summary = "从通道中同步分组")
|
||||
// @ResponseBody
|
||||
// @GetMapping("/sync")
|
||||
// public void sync(){
|
||||
// groupService.syncFromChannel();
|
||||
// }
|
||||
}
|
||||
|
|
|
@ -305,7 +305,9 @@ public interface CommonGBChannelMapper {
|
|||
CommonGBChannel queryByStreamProxyId(@Param("streamProxyId") Integer streamProxyId);
|
||||
|
||||
@SelectProvider(type = ChannelProvider.class, method = "queryList")
|
||||
List<CommonGBChannel> queryList(@Param("query") String query, @Param("online") Boolean online, @Param("hasCivilCode") Boolean hasCivilCode);
|
||||
List<CommonGBChannel> queryList(@Param("query") String query, @Param("online") Boolean online,
|
||||
@Param("hasCivilCode") Boolean hasCivilCode,
|
||||
@Param("hasGroup") Boolean hasGroup);
|
||||
|
||||
@Select("<script>" +
|
||||
" select " +
|
||||
|
|
|
@ -99,8 +99,8 @@ public interface GroupMapper {
|
|||
" false as is_leaf" +
|
||||
" from wvp_common_group " +
|
||||
" where device_id=business_group" +
|
||||
" <if test='platformId != null'> platform_id = #{platformId} </if> " +
|
||||
" <if test='platformId == null'> platform_id is null </if> " +
|
||||
" <if test='platformId != null'> AND platform_id = #{platformId} </if> " +
|
||||
" <if test='platformId == null'> AND platform_id is null </if> " +
|
||||
" <if test='query != null'> AND (device_id LIKE concat('%',#{query},'%') OR name LIKE concat('%',#{query},'%'))</if> " +
|
||||
" </script>")
|
||||
List<GroupTree> queryBusinessGroupForTree(String query, Integer platformId);
|
||||
|
|
|
@ -94,6 +94,12 @@ public class ChannelProvider {
|
|||
if (params.get("hasCivilCode") != null && !(Boolean)params.get("hasCivilCode")) {
|
||||
sqlBuild.append(" AND gb_civil_code is null");
|
||||
}
|
||||
if (params.get("hasGroup") != null && (Boolean)params.get("hasGroup")) {
|
||||
sqlBuild.append(" AND gb_business_group_id is not null");
|
||||
}
|
||||
if (params.get("hasGroup") != null && !(Boolean)params.get("hasGroup")) {
|
||||
sqlBuild.append(" AND gb_business_group_id is null");
|
||||
}
|
||||
return sqlBuild.toString();
|
||||
}
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ public interface IGbChannelService {
|
|||
|
||||
void reset(int id);
|
||||
|
||||
PageInfo<CommonGBChannel> queryList(int page, int count, String query, Boolean online, Boolean hasCivilCode);
|
||||
PageInfo<CommonGBChannel> queryList(int page, int count, String query, Boolean online, Boolean hasCivilCode, Boolean hasGroup);
|
||||
|
||||
void removeCivilCode(List<Region> allChildren);
|
||||
|
||||
|
|
|
@ -322,9 +322,10 @@ public class GbChannelServiceImpl implements IGbChannelService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public PageInfo<CommonGBChannel> queryList(int page, int count, String query, Boolean online, Boolean hasCivilCode) {
|
||||
public PageInfo<CommonGBChannel> queryList(int page, int count, String query, Boolean online, Boolean hasCivilCode,
|
||||
Boolean hasGroup) {
|
||||
PageHelper.startPage(page, count);
|
||||
List<CommonGBChannel> all = commonGBChannelMapper.queryList(query, online, hasCivilCode);
|
||||
List<CommonGBChannel> all = commonGBChannelMapper.queryList(query, online, hasCivilCode, hasGroup);
|
||||
return new PageInfo<>(all);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,14 +1,15 @@
|
|||
package com.genersoft.iot.vmp.gb28181.service.impl;
|
||||
|
||||
import com.genersoft.iot.vmp.common.CivilCodePo;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.*;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.GbCode;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.Group;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.GroupTree;
|
||||
import com.genersoft.iot.vmp.gb28181.dao.CommonGBChannelMapper;
|
||||
import com.genersoft.iot.vmp.gb28181.dao.GroupMapper;
|
||||
import com.genersoft.iot.vmp.gb28181.event.EventPublisher;
|
||||
import com.genersoft.iot.vmp.gb28181.event.subscribe.catalog.CatalogEvent;
|
||||
import com.genersoft.iot.vmp.gb28181.service.IGbChannelService;
|
||||
import com.genersoft.iot.vmp.gb28181.service.IGroupService;
|
||||
import com.genersoft.iot.vmp.utils.CivilCodeUtil;
|
||||
import com.genersoft.iot.vmp.utils.DateUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -17,7 +18,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 区域管理类
|
||||
|
@ -149,45 +150,7 @@ public class GroupServiceImpl implements IGroupService {
|
|||
|
||||
@Override
|
||||
public void syncFromChannel() {
|
||||
// 获取未初始化的业务分组
|
||||
List<String> civilCodeList = regionMapper.getUninitializedCivilCode();
|
||||
if (civilCodeList.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
List<Region> regionList = new ArrayList<>();
|
||||
// 收集节点的父节点,用于验证哪些节点的父节点不存在,方便一并存入
|
||||
Map<String, Region> regionMapForVerification = new HashMap<>();
|
||||
civilCodeList.forEach(civilCode->{
|
||||
CivilCodePo civilCodePo = CivilCodeUtil.INSTANCE.getCivilCodePo(civilCode);
|
||||
if (civilCodePo != null) {
|
||||
Region region = Region.getInstance(civilCodePo);
|
||||
regionList.add(region);
|
||||
// 获取全部的父节点
|
||||
List<CivilCodePo> civilCodePoList = CivilCodeUtil.INSTANCE.getAllParentCode(civilCode);
|
||||
if (!civilCodePoList.isEmpty()) {
|
||||
for (CivilCodePo codePo : civilCodePoList) {
|
||||
regionMapForVerification.put(codePo.getCode(), Region.getInstance(codePo));
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
if (regionList.isEmpty()){
|
||||
return;
|
||||
}
|
||||
if (!regionMapForVerification.isEmpty()) {
|
||||
// 查询数据库中已经存在的.
|
||||
List<String> civilCodesInDb = regionMapper.queryInList(regionMapForVerification.keySet());
|
||||
if (!civilCodesInDb.isEmpty()) {
|
||||
for (String code : civilCodesInDb) {
|
||||
regionMapForVerification.remove(code);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (Region region : regionList) {
|
||||
regionMapForVerification.put(region.getDeviceId(), region);
|
||||
}
|
||||
|
||||
regionMapper.batchAdd(new ArrayList<>(regionMapForVerification.values()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -36,20 +36,20 @@
|
|||
</span>
|
||||
</vue-easy-tree>
|
||||
</div>
|
||||
<regionCode ref="regionCode"></regionCode>
|
||||
<groupEdit ref="groupEdit"></groupEdit>
|
||||
<gbDeviceSelect ref="gbDeviceSelect"></gbDeviceSelect>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import VueEasyTree from "@wchbrad/vue-easy-tree";
|
||||
import regionCode from './../dialog/regionCode'
|
||||
import groupEdit from './../dialog/groupEdit'
|
||||
import gbDeviceSelect from './../dialog/GbDeviceSelect'
|
||||
|
||||
export default {
|
||||
name: 'DeviceTree',
|
||||
components: {
|
||||
VueEasyTree, regionCode, gbDeviceSelect
|
||||
VueEasyTree, groupEdit, gbDeviceSelect
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
@ -77,7 +77,7 @@ export default {
|
|||
} else if (node.data.id.length <= 8) {
|
||||
this.$axios({
|
||||
method: 'get',
|
||||
url: `/api/region/tree/list`,
|
||||
url: `/api/group/tree/list`,
|
||||
params: {
|
||||
query: this.searchSrt,
|
||||
parent: node.data.id
|
||||
|
@ -112,7 +112,7 @@ export default {
|
|||
console.log(data)
|
||||
this.$axios({
|
||||
method: "post",
|
||||
url: `/api/common/channel/region/delete`,
|
||||
url: `/api/common/channel/group/delete`,
|
||||
data: {
|
||||
channelIds: [data.dbId]
|
||||
}
|
||||
|
@ -145,11 +145,11 @@ export default {
|
|||
}
|
||||
},
|
||||
{
|
||||
label: "新建节点",
|
||||
label: node.level === 1?"新建业务分组":"新建虚拟组织",
|
||||
icon: "el-icon-plus",
|
||||
disabled: false,
|
||||
onClick: () => {
|
||||
this.addRegion(data.id, node);
|
||||
this.addGroup(data.id, node);
|
||||
}
|
||||
},
|
||||
{
|
||||
|
@ -171,7 +171,7 @@ export default {
|
|||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.removeRegion(data.id, node)
|
||||
this.removeGroup(data.id, node)
|
||||
}).catch(() => {
|
||||
|
||||
});
|
||||
|
@ -222,10 +222,10 @@ export default {
|
|||
|
||||
return false;
|
||||
},
|
||||
removeRegion: function (id, node) {
|
||||
removeGroup: function (id, node) {
|
||||
this.$axios({
|
||||
method: "delete",
|
||||
url: `/api/region/delete`,
|
||||
url: `/api/group/delete`,
|
||||
params: {
|
||||
deviceId: id,
|
||||
}
|
||||
|
@ -247,7 +247,7 @@ export default {
|
|||
}
|
||||
this.$axios({
|
||||
method: 'post',
|
||||
url: `/api/common/channel/region/device/add`,
|
||||
url: `/api/common/channel/group/device/add`,
|
||||
data: {
|
||||
civilCode: node.data.id,
|
||||
deviceIds: deviceIds,
|
||||
|
@ -278,7 +278,7 @@ export default {
|
|||
}
|
||||
this.$axios({
|
||||
method: 'post',
|
||||
url: `/api/common/channel/region/device/delete`,
|
||||
url: `/api/common/channel/group/device/delete`,
|
||||
data: {
|
||||
deviceIds: deviceIds,
|
||||
}
|
||||
|
@ -310,11 +310,10 @@ export default {
|
|||
node.loaded = false
|
||||
node.expand();
|
||||
},
|
||||
addRegion: function (id, node) {
|
||||
|
||||
console.log(node)
|
||||
|
||||
this.$refs.regionCode.openDialog(form => {
|
||||
addGroup: function (id, node) {
|
||||
this.$refs.groupEdit.openDialog({
|
||||
id: null
|
||||
},form => {
|
||||
node.loaded = false
|
||||
node.expand();
|
||||
}, id);
|
||||
|
|
|
@ -0,0 +1,91 @@
|
|||
<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" :rules="rules" :model="group" label-width="140px" >
|
||||
<el-form-item label="节点编号" prop="id" >
|
||||
<el-input v-model="group.deviceId" clearable></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>
|
||||
<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>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
export default {
|
||||
name: "groupEdit",
|
||||
computed: {},
|
||||
props: [],
|
||||
created() {},
|
||||
data() {
|
||||
return {
|
||||
submitCallback: null,
|
||||
showDialog: false,
|
||||
loading: false,
|
||||
level: 0,
|
||||
group: {},
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
openDialog: function (group, callback) {
|
||||
console.log(group)
|
||||
this.group = group;
|
||||
this.showDialog = true;
|
||||
this.submitCallback = callback;
|
||||
},
|
||||
onSubmit: function () {
|
||||
|
||||
this.$axios({
|
||||
method:"post",
|
||||
url: this.group.id ? '/api/group/add':'/api/group/update',
|
||||
data: this.group
|
||||
}).then((res)=> {
|
||||
if (res.data.code === 0) {
|
||||
this.$message.success("保存成功")
|
||||
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",
|
||||
});
|
||||
});
|
||||
},
|
||||
close: function () {
|
||||
this.showDialog = false;
|
||||
console.log(this.group)
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
|
@ -21,7 +21,7 @@
|
|||
<el-option label="离线" value="false"></el-option>
|
||||
</el-select>
|
||||
添加状态:
|
||||
<el-select size="mini" style="width: 8rem; margin-right: 1rem;" @change="search" v-model="hasCivilCode" placeholder="请选择"
|
||||
<el-select size="mini" style="width: 8rem; margin-right: 1rem;" @change="search" v-model="hasGroup" placeholder="请选择"
|
||||
default-first-option>
|
||||
<el-option label="全部" value=""></el-option>
|
||||
<el-option label="已添加" value="true"></el-option>
|
||||
|
@ -64,8 +64,8 @@
|
|||
<el-table-column label="添加状态" min-width="100">
|
||||
<template slot-scope="scope">
|
||||
<div slot="reference" class="name-wrapper">
|
||||
<el-tag size="medium" :title="scope.row.gbCivilCode" v-if="scope.row.gbCivilCode">已添加</el-tag>
|
||||
<el-tag size="medium" type="info" v-if="!scope.row.gbCivilCode">未添加</el-tag>
|
||||
<el-tag size="medium" :title="scope.row.gbBusinessGroupId" v-if="scope.row.gbBusinessGroupId">已添加</el-tag>
|
||||
<el-tag size="medium" type="info" v-if="!scope.row.gbBusinessGroupId">未添加</el-tag>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
@ -103,7 +103,7 @@ export default {
|
|||
searchSrt: "",
|
||||
channelType: "",
|
||||
online: "",
|
||||
hasCivilCode: "false",
|
||||
hasGroup: "false",
|
||||
winHeight: window.innerHeight - 180,
|
||||
currentPage: 1,
|
||||
count: 15,
|
||||
|
@ -140,7 +140,7 @@ export default {
|
|||
count: this.count,
|
||||
query: this.searchSrt,
|
||||
online: this.online,
|
||||
hasCivilCode: this.hasCivilCode
|
||||
hasGroup: this.hasGroup
|
||||
}
|
||||
}).then((res)=> {
|
||||
if (res.data.code === 0) {
|
||||
|
|
|
@ -24,6 +24,7 @@ import userApiKeyManager from '../components/UserApiKeyManager.vue'
|
|||
import wasmPlayer from '../components/common/jessibuca.vue'
|
||||
import rtcPlayer from '../components/dialog/rtcPlayer.vue'
|
||||
import region from '../components/region.vue'
|
||||
import group from '../components/group.vue'
|
||||
|
||||
const originalPush = VueRouter.prototype.push
|
||||
VueRouter.prototype.push = function push(location) {
|
||||
|
@ -136,6 +137,11 @@ export default new VueRouter({
|
|||
path: '/channel/region',
|
||||
name: 'region',
|
||||
component: region,
|
||||
},
|
||||
{
|
||||
path: '/channel/group',
|
||||
name: 'group',
|
||||
component: group,
|
||||
}
|
||||
,
|
||||
]
|
||||
|
|
Loading…
Reference in New Issue