临时提交

pull/1642/head
648540858 2024-08-05 17:59:20 +08:00
parent 96bbd19e81
commit ce0f0c4ac8
13 changed files with 160 additions and 91 deletions

View File

@ -11,7 +11,7 @@ import lombok.Data;
public class GbCode { public class GbCode {
@Schema(description = "中心编码,由监控中心所在地的行政区划代码确定,符合GB/T2260—2007的要求") @Schema(description = "中心编码,由监控中心所在地的行政区划代码确定,符合GB/T2260—2007的要求")
private String civilCode; private String centerCode;
@Schema(description = "行业编码") @Schema(description = "行业编码")
private String industryCode; private String industryCode;
@ -34,7 +34,7 @@ public class GbCode {
} }
code = code.trim(); code = code.trim();
GbCode gbCode = new GbCode(); GbCode gbCode = new GbCode();
gbCode.setCivilCode(code.substring(0, 8)); gbCode.setCenterCode(code.substring(0, 8));
gbCode.setIndustryCode(code.substring(9, 10)); gbCode.setIndustryCode(code.substring(9, 10));
gbCode.setTypeCode(code.substring(11, 13)); gbCode.setTypeCode(code.substring(11, 13));
gbCode.setNetCode(code.substring(14, 15)); gbCode.setNetCode(code.substring(14, 15));
@ -43,6 +43,6 @@ public class GbCode {
} }
public String ecode(){ public String ecode(){
return civilCode + industryCode + typeCode + netCode + sn; return centerCode + industryCode + typeCode + netCode + sn;
} }
} }

View File

@ -94,11 +94,12 @@ public class CommonChannelController {
public PageInfo<CommonGBChannel> queryList(int page, int count, public PageInfo<CommonGBChannel> queryList(int page, int count,
@RequestParam(required = false) String query, @RequestParam(required = false) String query,
@RequestParam(required = false) Boolean online, @RequestParam(required = false) Boolean online,
@RequestParam(required = false) Boolean hasCivilCode){ @RequestParam(required = false) Boolean hasCivilCode,
@RequestParam(required = false) Boolean hasGroup){
if (ObjectUtils.isEmpty(query)){ if (ObjectUtils.isEmpty(query)){
query = null; 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)) @Operation(summary = "通道设置行政区划", security = @SecurityRequirement(name = JwtUtils.HEADER))

View File

@ -73,21 +73,21 @@ public class GroupController {
} }
} }
@Operation(summary = "根据分组Id查询分组") // @Operation(summary = "根据分组Id查询分组")
@Parameter(name = "groupDeviceId", description = "分组节点编号", required = true) // @Parameter(name = "groupDeviceId", description = "分组节点编号", required = true)
@ResponseBody // @ResponseBody
@GetMapping("/one") // @GetMapping("/one")
public Group queryGroupByDeviceId( // public Group queryGroupByDeviceId(
@RequestParam(required = true) String deviceId // @RequestParam(required = true) String deviceId
){ // ){
Assert.hasLength(deviceId, ""); // Assert.hasLength(deviceId, "");
return groupService.queryGroupByDeviceId(deviceId); // return groupService.queryGroupByDeviceId(deviceId);
} // }
@Operation(summary = "从通道中同步分组") // @Operation(summary = "从通道中同步分组")
@ResponseBody // @ResponseBody
@GetMapping("/sync") // @GetMapping("/sync")
public void sync(){ // public void sync(){
groupService.syncFromChannel(); // groupService.syncFromChannel();
} // }
} }

View File

@ -305,7 +305,9 @@ public interface CommonGBChannelMapper {
CommonGBChannel queryByStreamProxyId(@Param("streamProxyId") Integer streamProxyId); CommonGBChannel queryByStreamProxyId(@Param("streamProxyId") Integer streamProxyId);
@SelectProvider(type = ChannelProvider.class, method = "queryList") @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("<script>" +
" select " + " select " +

View File

@ -99,8 +99,8 @@ public interface GroupMapper {
" false as is_leaf" + " false as is_leaf" +
" from wvp_common_group " + " from wvp_common_group " +
" where device_id=business_group" + " where device_id=business_group" +
" <if test='platformId != null'> platform_id = #{platformId} </if> " + " <if test='platformId != null'> AND platform_id = #{platformId} </if> " +
" <if test='platformId == null'> platform_id is null </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> " + " <if test='query != null'> AND (device_id LIKE concat('%',#{query},'%') OR name LIKE concat('%',#{query},'%'))</if> " +
" </script>") " </script>")
List<GroupTree> queryBusinessGroupForTree(String query, Integer platformId); List<GroupTree> queryBusinessGroupForTree(String query, Integer platformId);

View File

@ -94,6 +94,12 @@ public class ChannelProvider {
if (params.get("hasCivilCode") != null && !(Boolean)params.get("hasCivilCode")) { if (params.get("hasCivilCode") != null && !(Boolean)params.get("hasCivilCode")) {
sqlBuild.append(" AND gb_civil_code is null"); 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(); return sqlBuild.toString();
} }

View File

@ -42,7 +42,7 @@ public interface IGbChannelService {
void reset(int id); 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); void removeCivilCode(List<Region> allChildren);

View File

@ -322,9 +322,10 @@ public class GbChannelServiceImpl implements IGbChannelService {
} }
@Override @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); 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); return new PageInfo<>(all);
} }

View File

@ -1,14 +1,15 @@
package com.genersoft.iot.vmp.gb28181.service.impl; package com.genersoft.iot.vmp.gb28181.service.impl;
import com.genersoft.iot.vmp.common.CivilCodePo; import com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel;
import com.genersoft.iot.vmp.gb28181.bean.*; import com.genersoft.iot.vmp.gb28181.bean.GbCode;
import com.genersoft.iot.vmp.gb28181.bean.Group;
import com.genersoft.iot.vmp.gb28181.bean.GroupTree;
import com.genersoft.iot.vmp.gb28181.dao.CommonGBChannelMapper; import com.genersoft.iot.vmp.gb28181.dao.CommonGBChannelMapper;
import com.genersoft.iot.vmp.gb28181.dao.GroupMapper; import com.genersoft.iot.vmp.gb28181.dao.GroupMapper;
import com.genersoft.iot.vmp.gb28181.event.EventPublisher; import com.genersoft.iot.vmp.gb28181.event.EventPublisher;
import com.genersoft.iot.vmp.gb28181.event.subscribe.catalog.CatalogEvent; 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.IGbChannelService;
import com.genersoft.iot.vmp.gb28181.service.IGroupService; import com.genersoft.iot.vmp.gb28181.service.IGroupService;
import com.genersoft.iot.vmp.utils.CivilCodeUtil;
import com.genersoft.iot.vmp.utils.DateUtil; import com.genersoft.iot.vmp.utils.DateUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; 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.Assert;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import java.util.*; import java.util.List;
/** /**
* *
@ -149,45 +150,7 @@ public class GroupServiceImpl implements IGroupService {
@Override @Override
public void syncFromChannel() { 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 @Override

View File

@ -36,20 +36,20 @@
</span> </span>
</vue-easy-tree> </vue-easy-tree>
</div> </div>
<regionCode ref="regionCode"></regionCode> <groupEdit ref="groupEdit"></groupEdit>
<gbDeviceSelect ref="gbDeviceSelect"></gbDeviceSelect> <gbDeviceSelect ref="gbDeviceSelect"></gbDeviceSelect>
</div> </div>
</template> </template>
<script> <script>
import VueEasyTree from "@wchbrad/vue-easy-tree"; import VueEasyTree from "@wchbrad/vue-easy-tree";
import regionCode from './../dialog/regionCode' import groupEdit from './../dialog/groupEdit'
import gbDeviceSelect from './../dialog/GbDeviceSelect' import gbDeviceSelect from './../dialog/GbDeviceSelect'
export default { export default {
name: 'DeviceTree', name: 'DeviceTree',
components: { components: {
VueEasyTree, regionCode, gbDeviceSelect VueEasyTree, groupEdit, gbDeviceSelect
}, },
data() { data() {
return { return {
@ -77,7 +77,7 @@ export default {
} else if (node.data.id.length <= 8) { } else if (node.data.id.length <= 8) {
this.$axios({ this.$axios({
method: 'get', method: 'get',
url: `/api/region/tree/list`, url: `/api/group/tree/list`,
params: { params: {
query: this.searchSrt, query: this.searchSrt,
parent: node.data.id parent: node.data.id
@ -112,7 +112,7 @@ export default {
console.log(data) console.log(data)
this.$axios({ this.$axios({
method: "post", method: "post",
url: `/api/common/channel/region/delete`, url: `/api/common/channel/group/delete`,
data: { data: {
channelIds: [data.dbId] channelIds: [data.dbId]
} }
@ -145,11 +145,11 @@ export default {
} }
}, },
{ {
label: "新建节点", label: node.level === 1?"新建业务分组":"新建虚拟组织",
icon: "el-icon-plus", icon: "el-icon-plus",
disabled: false, disabled: false,
onClick: () => { onClick: () => {
this.addRegion(data.id, node); this.addGroup(data.id, node);
} }
}, },
{ {
@ -171,7 +171,7 @@ export default {
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
this.removeRegion(data.id, node) this.removeGroup(data.id, node)
}).catch(() => { }).catch(() => {
}); });
@ -222,10 +222,10 @@ export default {
return false; return false;
}, },
removeRegion: function (id, node) { removeGroup: function (id, node) {
this.$axios({ this.$axios({
method: "delete", method: "delete",
url: `/api/region/delete`, url: `/api/group/delete`,
params: { params: {
deviceId: id, deviceId: id,
} }
@ -247,7 +247,7 @@ export default {
} }
this.$axios({ this.$axios({
method: 'post', method: 'post',
url: `/api/common/channel/region/device/add`, url: `/api/common/channel/group/device/add`,
data: { data: {
civilCode: node.data.id, civilCode: node.data.id,
deviceIds: deviceIds, deviceIds: deviceIds,
@ -278,7 +278,7 @@ export default {
} }
this.$axios({ this.$axios({
method: 'post', method: 'post',
url: `/api/common/channel/region/device/delete`, url: `/api/common/channel/group/device/delete`,
data: { data: {
deviceIds: deviceIds, deviceIds: deviceIds,
} }
@ -310,11 +310,10 @@ export default {
node.loaded = false node.loaded = false
node.expand(); node.expand();
}, },
addRegion: function (id, node) { addGroup: function (id, node) {
this.$refs.groupEdit.openDialog({
console.log(node) id: null
},form => {
this.$refs.regionCode.openDialog(form => {
node.loaded = false node.loaded = false
node.expand(); node.expand();
}, id); }, id);

View File

@ -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>

View File

@ -21,7 +21,7 @@
<el-option label="离线" value="false"></el-option> <el-option label="离线" value="false"></el-option>
</el-select> </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> default-first-option>
<el-option label="全部" value=""></el-option> <el-option label="全部" value=""></el-option>
<el-option label="已添加" value="true"></el-option> <el-option label="已添加" value="true"></el-option>
@ -64,8 +64,8 @@
<el-table-column label="添加状态" min-width="100"> <el-table-column label="添加状态" min-width="100">
<template slot-scope="scope"> <template slot-scope="scope">
<div slot="reference" class="name-wrapper"> <div slot="reference" class="name-wrapper">
<el-tag size="medium" :title="scope.row.gbCivilCode" 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.gbCivilCode"></el-tag> <el-tag size="medium" type="info" v-if="!scope.row.gbBusinessGroupId"></el-tag>
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
@ -103,7 +103,7 @@ export default {
searchSrt: "", searchSrt: "",
channelType: "", channelType: "",
online: "", online: "",
hasCivilCode: "false", hasGroup: "false",
winHeight: window.innerHeight - 180, winHeight: window.innerHeight - 180,
currentPage: 1, currentPage: 1,
count: 15, count: 15,
@ -140,7 +140,7 @@ export default {
count: this.count, count: this.count,
query: this.searchSrt, query: this.searchSrt,
online: this.online, online: this.online,
hasCivilCode: this.hasCivilCode hasGroup: this.hasGroup
} }
}).then((res)=> { }).then((res)=> {
if (res.data.code === 0) { if (res.data.code === 0) {

View File

@ -24,6 +24,7 @@ import userApiKeyManager from '../components/UserApiKeyManager.vue'
import wasmPlayer from '../components/common/jessibuca.vue' import wasmPlayer from '../components/common/jessibuca.vue'
import rtcPlayer from '../components/dialog/rtcPlayer.vue' import rtcPlayer from '../components/dialog/rtcPlayer.vue'
import region from '../components/region.vue' import region from '../components/region.vue'
import group from '../components/group.vue'
const originalPush = VueRouter.prototype.push const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) { VueRouter.prototype.push = function push(location) {
@ -136,6 +137,11 @@ export default new VueRouter({
path: '/channel/region', path: '/channel/region',
name: 'region', name: 'region',
component: region, component: region,
},
{
path: '/channel/group',
name: 'group',
component: group,
} }
, ,
] ]