From 363606d8453c027429ea66a6036c62b01ff8e06c Mon Sep 17 00:00:00 2001
From: 648540858 <456panlinlin>
Date: 星期二, 26 四月 2022 18:29:47 +0800
Subject: [PATCH] 优化级联目录发送
---
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/query/cmd/CatalogQueryMessageHandler.java | 18 +++++++-
src/main/java/com/genersoft/iot/vmp/service/IGbStreamService.java | 3 +
web_src/src/components/channelList.vue | 3 +
web_src/src/components/common/DeviceTree.vue | 2
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommanderFroPlatform.java | 41 ++++++++++++--------
src/main/java/com/genersoft/iot/vmp/service/impl/GbStreamServiceImpl.java | 12 ++++--
src/main/java/com/genersoft/iot/vmp/gb28181/event/subscribe/catalog/CatalogEventLister.java | 9 +++-
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/CatalogNotifyMessageHandler.java | 18 ++++++++-
8 files changed, 75 insertions(+), 31 deletions(-)
diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/event/subscribe/catalog/CatalogEventLister.java b/src/main/java/com/genersoft/iot/vmp/gb28181/event/subscribe/catalog/CatalogEventLister.java
index 019baf9..0ea5a18 100644
--- a/src/main/java/com/genersoft/iot/vmp/gb28181/event/subscribe/catalog/CatalogEventLister.java
+++ b/src/main/java/com/genersoft/iot/vmp/gb28181/event/subscribe/catalog/CatalogEventLister.java
@@ -99,7 +99,7 @@
}
if (event.getGbStreams() != null && event.getGbStreams().size() > 0){
for (GbStream gbStream : event.getGbStreams()) {
- DeviceChannel deviceChannelByStream = gbStreamService.getDeviceChannelListByStream(gbStream, gbStream.getCatalogId(), parentPlatform.getDeviceGBId());
+ DeviceChannel deviceChannelByStream = gbStreamService.getDeviceChannelListByStream(gbStream, gbStream.getCatalogId(), parentPlatform);
deviceChannelList.add(deviceChannelByStream);
}
}
@@ -138,7 +138,10 @@
}
if (event.getGbStreams() != null && event.getGbStreams().size() > 0){
for (GbStream gbStream : event.getGbStreams()) {
- DeviceChannel deviceChannelByStream = gbStreamService.getDeviceChannelListByStream(gbStream, gbStream.getCatalogId(), parentPlatform.getDeviceGBId());
+ DeviceChannel deviceChannelByStream = gbStreamService.getDeviceChannelListByStream(gbStream, gbStream.getCatalogId(), parentPlatform);
+ if (deviceChannelByStream.getParentId().length() <= 10) { // 鐖惰妭鐐规槸琛屾斂鍖哄垝,鍒欒缃瓹ivilCode浣跨敤姝よ鏀垮尯鍒�
+ deviceChannelByStream.setCivilCode(deviceChannelByStream.getParentId());
+ }
deviceChannelList.add(deviceChannelByStream);
}
}
@@ -159,7 +162,7 @@
deviceChannelList.add(deviceChannel);
GbStream gbStream = storager.queryStreamInParentPlatform(platform.getServerGBId(), gbId);
if(gbStream != null){
- DeviceChannel deviceChannelByStream = gbStreamService.getDeviceChannelListByStream(gbStream, gbStream.getCatalogId(), platform.getDeviceGBId());
+ DeviceChannel deviceChannelByStream = gbStreamService.getDeviceChannelListByStream(gbStream, gbStream.getCatalogId(), platform);
deviceChannelList.add(deviceChannelByStream);
}
sipCommanderFroPlatform.sendNotifyForCatalogAddOrUpdate(event.getType(), platform, deviceChannelList, subscribeInfo, null);
diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommanderFroPlatform.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommanderFroPlatform.java
index 66af757..8066992 100644
--- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommanderFroPlatform.java
+++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommanderFroPlatform.java
@@ -259,27 +259,33 @@
catalogXml.append("<Item>\r\n");
catalogXml.append("<DeviceID>" + channel.getChannelId() + "</DeviceID>\r\n");
catalogXml.append("<Name>" + channel.getName() + "</Name>\r\n");
- catalogXml.append("<Manufacturer>" + channel.getManufacture() + "</Manufacturer>\r\n");
catalogXml.append("<Parental>" + channel.getParental() + "</Parental>\r\n");
if (channel.getParentId() != null) {
catalogXml.append("<ParentID>" + channel.getParentId() + "</ParentID>\r\n");
}
- catalogXml.append("<RegisterWay>" + channel.getRegisterWay() + "</RegisterWay>\r\n");
- catalogXml.append("<Status>" + (channel.getStatus() == 0?"OFF":"ON") + "</Status>\r\n");
- catalogXml.append("<Secrecy>" + channel.getSecrecy() + "</Secrecy>\r\n");
- if (channel.getChannelType() != 2) { // 涓氬姟鍒嗙粍/铏氭嫙缁勭粐/琛屾斂鍖哄垝 涓嶈缃互涓嬪瓧娈�
- catalogXml.append("<Model>" + channel.getModel() + "</Model>\r\n");
- catalogXml.append("<Owner>" + channel.getOwner() + "</Owner>\r\n");
- catalogXml.append("<CivilCode>" + channel.getCivilCode() + "</CivilCode>\r\n");
- catalogXml.append("<Address>" + channel.getAddress() + "</Address>\r\n");
- catalogXml.append("<Longitude>" + channel.getLongitude() + "</Longitude>\r\n");
- catalogXml.append("<Latitude>" + channel.getLatitude() + "</Latitude>\r\n");
- catalogXml.append("<IPAddress>" + channel.getIpAddress() + "</IPAddress>\r\n");
- catalogXml.append("<Port>" + channel.getPort() + "</Port>\r\n");
- catalogXml.append("<Info>\r\n");
- catalogXml.append("<PTZType>" + channel.getPTZType() + "</PTZType>\r\n");
- catalogXml.append("</Info>\r\n");
+ if (channel.getChannelId().length() == 20) {
+ if (Integer.parseInt(channel.getChannelId().substring(10, 13)) == 216) { // 铏氭嫙缁勭粐澧炲姞BusinessGroupID瀛楁
+ catalogXml.append("<BusinessGroupID>" + channel.getParentId() + "</BusinessGroupID>\r\n");
+ }
+ catalogXml.append("<Manufacturer>" + channel.getManufacture() + "</Manufacturer>\r\n");
+ catalogXml.append("<RegisterWay>" + channel.getRegisterWay() + "</RegisterWay>\r\n");
+ catalogXml.append("<Status>" + (channel.getStatus() == 0?"OFF":"ON") + "</Status>\r\n");
+ if (channel.getChannelType() != 2) { // 涓氬姟鍒嗙粍/铏氭嫙缁勭粐/琛屾斂鍖哄垝 涓嶈缃互涓嬪瓧娈�
+ catalogXml.append("<Secrecy>" + channel.getSecrecy() + "</Secrecy>\r\n");
+ catalogXml.append("<Model>" + channel.getModel() + "</Model>\r\n");
+ catalogXml.append("<Owner>" + channel.getOwner() + "</Owner>\r\n");
+ catalogXml.append("<CivilCode>" + channel.getCivilCode() + "</CivilCode>\r\n");
+ catalogXml.append("<Address>" + channel.getAddress() + "</Address>\r\n");
+ catalogXml.append("<Longitude>" + channel.getLongitude() + "</Longitude>\r\n");
+ catalogXml.append("<Latitude>" + channel.getLatitude() + "</Latitude>\r\n");
+ catalogXml.append("<IPAddress>" + channel.getIpAddress() + "</IPAddress>\r\n");
+ catalogXml.append("<Port>" + channel.getPort() + "</Port>\r\n");
+ catalogXml.append("<Info>\r\n");
+ catalogXml.append("<PTZType>" + channel.getPTZType() + "</PTZType>\r\n");
+ catalogXml.append("</Info>\r\n");
+ }
}
+
catalogXml.append("</Item>\r\n");
}
@@ -596,6 +602,9 @@
catalogXml.append("<Secrecy>" + channel.getSecrecy() + "</Secrecy>\r\n");
catalogXml.append("<RegisterWay>" + channel.getRegisterWay() + "</RegisterWay>\r\n");
catalogXml.append("<Status>" + (channel.getStatus() == 0 ? "OFF" : "ON") + "</Status>\r\n");
+ if (channel.getChannelId().length() == 20 && Integer.parseInt(channel.getChannelId().substring(10, 13)) == 216) { // 铏氭嫙缁勭粐澧炲姞BusinessGroupID瀛楁
+ catalogXml.append("<BusinessGroupID>" + channel.getParentId() + "</BusinessGroupID>\r\n");
+ }
if (channel.getChannelType() == 2) { // 涓氬姟鍒嗙粍/铏氭嫙缁勭粐/琛屾斂鍖哄垝 涓嶈缃互涓嬪睘鎬�
catalogXml.append("<Model>" + channel.getModel() + "</Model>\r\n");
catalogXml.append("<Owner>0</Owner>\r\n");
diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/CatalogNotifyMessageHandler.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/CatalogNotifyMessageHandler.java
index d17920d..d714ee4 100644
--- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/CatalogNotifyMessageHandler.java
+++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/CatalogNotifyMessageHandler.java
@@ -79,6 +79,11 @@
deviceChannel.setParental(1);
deviceChannel.setParentId(catalog.getParentId());
deviceChannel.setRegisterWay(1);
+ if (catalog.getParentId() != null && catalog.getParentId().length() <= 10) {
+ deviceChannel.setCivilCode(catalog.getParentId());
+ }else {
+ deviceChannel.setCivilCode(parentPlatform.getAdministrativeDivision());
+ }
deviceChannel.setCivilCode(parentPlatform.getAdministrativeDivision());
deviceChannel.setModel("live");
deviceChannel.setOwner("wvp-pro");
@@ -95,7 +100,12 @@
DeviceChannel deviceChannel = storage.queryChannel(channel.getDeviceId(), channel.getChannelId());
deviceChannel.setParental(0);
deviceChannel.setParentId(channel.getCatalogId());
- deviceChannel.setCivilCode(parentPlatform.getDeviceGBId().substring(0, 6));
+ if (channel.getCatalogId() != null && channel.getCatalogId().length() <= 10) {
+ channel.setCivilCode(channel.getCatalogId());
+ }else {
+ deviceChannel.setCivilCode(parentPlatform.getAdministrativeDivision());
+ }
+
allChannels.add(deviceChannel);
}
}
@@ -116,7 +126,11 @@
deviceChannel.setStatus(1);
deviceChannel.setParentId(gbStream.getCatalogId());
deviceChannel.setRegisterWay(1);
- deviceChannel.setCivilCode(parentPlatform.getAdministrativeDivision());
+ if (gbStream.getCatalogId() != null && gbStream.getCatalogId().length() <= 10) {
+ deviceChannel.setCivilCode(gbStream.getCatalogId());
+ }else {
+ deviceChannel.setCivilCode(parentPlatform.getAdministrativeDivision());
+ }
deviceChannel.setModel("live");
deviceChannel.setOwner("wvp-pro");
deviceChannel.setParental(0);
diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/query/cmd/CatalogQueryMessageHandler.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/query/cmd/CatalogQueryMessageHandler.java
index cefee3f..0e97961 100644
--- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/query/cmd/CatalogQueryMessageHandler.java
+++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/query/cmd/CatalogQueryMessageHandler.java
@@ -93,7 +93,11 @@
deviceChannel.setParental(1);
deviceChannel.setParentId(catalog.getParentId());
deviceChannel.setRegisterWay(1);
- deviceChannel.setCivilCode(parentPlatform.getAdministrativeDivision());
+ if (catalog.getParentId() != null && catalog.getParentId().length() < 10) {
+ deviceChannel.setCivilCode(catalog.getParentId());
+ }else {
+ deviceChannel.setCivilCode(parentPlatform.getAdministrativeDivision());
+ }
allChannels.add(deviceChannel);
}
}
@@ -108,7 +112,11 @@
deviceChannel.setChannelType(0);
deviceChannel.setParental(0);
deviceChannel.setParentId(channel.getCatalogId());
- deviceChannel.setCivilCode(parentPlatform.getDeviceGBId().substring(0, 6));
+ if (channel.getCatalogId() != null && channel.getCatalogId().length() < 10) {
+ deviceChannel.setCivilCode(channel.getCatalogId());
+ }else {
+ deviceChannel.setCivilCode(parentPlatform.getAdministrativeDivision());
+ }
allChannels.add(deviceChannel);
}
}
@@ -131,7 +139,11 @@
deviceChannel.setStatus(1);
deviceChannel.setParentId(gbStream.getCatalogId());
deviceChannel.setRegisterWay(1);
- deviceChannel.setCivilCode(parentPlatform.getAdministrativeDivision());
+ if (gbStream.getCatalogId() != null && gbStream.getCatalogId().length() < 10) {
+ deviceChannel.setCivilCode(gbStream.getCatalogId());
+ }else {
+ deviceChannel.setCivilCode(parentPlatform.getAdministrativeDivision());
+ }
deviceChannel.setModel("live");
deviceChannel.setOwner("wvp-pro");
deviceChannel.setParental(0);
diff --git a/src/main/java/com/genersoft/iot/vmp/service/IGbStreamService.java b/src/main/java/com/genersoft/iot/vmp/service/IGbStreamService.java
index 1a851d7..abdde6d 100644
--- a/src/main/java/com/genersoft/iot/vmp/service/IGbStreamService.java
+++ b/src/main/java/com/genersoft/iot/vmp/service/IGbStreamService.java
@@ -2,6 +2,7 @@
import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
import com.genersoft.iot.vmp.gb28181.bean.GbStream;
+import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
import com.github.pagehelper.PageInfo;
import java.util.List;
@@ -40,7 +41,7 @@
*/
boolean delPlatformInfo(String platformId, List<GbStream> gbStreams);
- DeviceChannel getDeviceChannelListByStream(GbStream gbStream, String catalogId, String deviceGBId);
+ DeviceChannel getDeviceChannelListByStream(GbStream gbStream, String catalogId, ParentPlatform platform);
void sendCatalogMsg(GbStream gbStream, String type);
void sendCatalogMsgs(List<GbStream> gbStreams, String type);
diff --git a/src/main/java/com/genersoft/iot/vmp/service/impl/GbStreamServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/service/impl/GbStreamServiceImpl.java
index bbf992f..b65f826 100644
--- a/src/main/java/com/genersoft/iot/vmp/service/impl/GbStreamServiceImpl.java
+++ b/src/main/java/com/genersoft/iot/vmp/service/impl/GbStreamServiceImpl.java
@@ -78,7 +78,7 @@
gbStream.setPlatformId(platformId);
// TODO 淇敼涓烘壒閲忔彁浜�
platformGbStreamMapper.add(gbStream);
- DeviceChannel deviceChannelListByStream = getDeviceChannelListByStream(gbStream, catalogId, parentPlatform.getDeviceGBId());
+ DeviceChannel deviceChannelListByStream = getDeviceChannelListByStream(gbStream, catalogId, parentPlatform);
deviceChannelList.add(deviceChannelListByStream);
}
dataSourceTransactionManager.commit(transactionStatus); //鎵嬪姩鎻愪氦
@@ -92,19 +92,23 @@
}
@Override
- public DeviceChannel getDeviceChannelListByStream(GbStream gbStream, String catalogId, String deviceGBId) {
+ public DeviceChannel getDeviceChannelListByStream(GbStream gbStream, String catalogId, ParentPlatform platform) {
DeviceChannel deviceChannel = new DeviceChannel();
deviceChannel.setChannelId(gbStream.getGbId());
deviceChannel.setName(gbStream.getName());
deviceChannel.setLongitude(gbStream.getLongitude());
deviceChannel.setLatitude(gbStream.getLatitude());
- deviceChannel.setDeviceId(deviceGBId);
+ deviceChannel.setDeviceId(platform.getDeviceGBId());
deviceChannel.setManufacture("wvp-pro");
// deviceChannel.setStatus(gbStream.isStatus()?1:0);
deviceChannel.setStatus(1);
deviceChannel.setParentId(catalogId ==null?gbStream.getCatalogId():catalogId);
deviceChannel.setRegisterWay(1);
- deviceChannel.setCivilCode(deviceGBId.substring(0, 6));
+ if (catalogId.length() <= 10) { // 鐖惰妭鐐规槸琛屾斂鍖哄垝,鍒欒缃瓹ivilCode浣跨敤姝よ鏀垮尯鍒�
+ deviceChannel.setCivilCode(catalogId);
+ }else {
+ deviceChannel.setCivilCode(platform.getAdministrativeDivision());
+ }
deviceChannel.setModel("live");
deviceChannel.setOwner("wvp-pro");
deviceChannel.setParental(0);
diff --git a/web_src/src/components/channelList.vue b/web_src/src/components/channelList.vue
index 34f540d..8d06542 100644
--- a/web_src/src/components/channelList.vue
+++ b/web_src/src/components/channelList.vue
@@ -40,6 +40,7 @@
<el-table-column label="蹇収" width="80" align="center">
<template slot-scope="scope">
<img style="max-height: 3rem;max-width: 4rem;"
+ v-if="scope.row.subCount === 0 && scope.row.parental === 0"
:id="scope.row.deviceId + '_' + scope.row.channelId"
:src="getSnap(scope.row)"
@error="getSnapErrorEvent($event.target.id)"
@@ -89,7 +90,7 @@
<el-button size="mini" icon="el-icon-switch-button" type="danger" v-if="!!scope.row.streamId"
@click="stopDevicePush(scope.row)">鍋滄
</el-button>
- <el-button size="mini" icon="el-icon-s-open" type="primary" v-if="scope.row.subCount > 0"
+ <el-button size="mini" icon="el-icon-s-open" type="primary" v-if="scope.row.subCount > 0 || scope.row.parental === 1"
@click="changeSubchannel(scope.row)">鏌ョ湅
</el-button>
<el-button size="mini" icon="el-icon-video-camera" type="primary" @click="queryRecords(scope.row)">璁惧褰曡薄
diff --git a/web_src/src/components/common/DeviceTree.vue b/web_src/src/components/common/DeviceTree.vue
index 31e49bd..066c344 100644
--- a/web_src/src/components/common/DeviceTree.vue
+++ b/web_src/src/components/common/DeviceTree.vue
@@ -109,7 +109,7 @@
let nodeList = []
for (let i = 0; i < data.length; i++) {
let type = 3;
- if (data[i].subCount > 0) {
+ if (data[i].subCount > 0 || data[i].parental === 1) {
type = 2;
}else if (data[i].ptztype === 1 ) { // 1-鐞冩満;2-鍗婄悆;3-鍥哄畾鏋満;4-閬ユ帶鏋満
type = 4;
--
Gitblit v1.8.0