From a0537d74df5b9c8ee65dba7c4e5bc6da7fc3d031 Mon Sep 17 00:00:00 2001
From: mk1990 <37614016+mk1990@users.noreply.github.com>
Date: 星期四, 28 四月 2022 16:32:09 +0800
Subject: [PATCH] Merge branch '648540858:wvp-28181-2.0' into wvp-28181-2.0

---
 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/service/DeviceService.js                                                                             |   15 +-
 src/main/java/com/genersoft/iot/vmp/gb28181/utils/XmlUtil.java                                                              |   44 +++++++-
 web_src/src/components/common/DeviceTree.vue                                                                                |    6 
 src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/device/DeviceQuery.java                                                |    6 
 web_src/src/components/live.vue                                                                                             |   27 +++-
 src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/RegisterRequestProcessor.java                       |    4 
 src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/CatalogNotifyMessageHandler.java |   18 +++
 web_src/src/components/devicePosition.vue                                                                                   |   19 ++-
 src/main/java/com/genersoft/iot/vmp/storager/IVideoManagerStorage.java                                                      |    2 
 src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStorageImpl.java                                              |    9 +
 web_src/src/components/channelList.vue                                                                                      |    3 
 web_src/src/components/common/jessibuca.vue                                                                                 |   21 ++-
 src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommanderFroPlatform.java                                  |   41 +++++---
 src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/response/impl/RegisterResponseProcessor.java                     |   10 +
 DOCKERFILE                                                                                                                  |    2 
 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 +
 19 files changed, 189 insertions(+), 80 deletions(-)

diff --git a/DOCKERFILE b/DOCKERFILE
index 6c4beb5..d55e06a 100644
--- a/DOCKERFILE
+++ b/DOCKERFILE
@@ -84,7 +84,7 @@
         echo 'nohup java -jar *.jar --userSettings.record=/opt/media/www/record/ &' >> run.sh && \
         echo 'nohup /opt/media/MediaServer -d -m 3 &' >> run.sh && \
         echo 'cd /opt/wvp' >> run.sh && \
-        echo 'if [${WVP_CONFIG}]; then' >> run.sh && \
+        echo 'if [-n "${WVP_CONFIG}"]; then' >> run.sh && \
         echo '        java -jar *.jar --spring.config.location=/opt/wvp/config/application.yml --media.record-assist-port=18081 ${WVP_CONFIG}' >> run.sh && \
         echo 'else' >> run.sh && \
         echo '        java -jar *.jar --spring.config.location=/opt/wvp/config/application.yml --media.record-assist-port=18081 --media.ip=127.0.0.1 --media.sdp-ip=${WVP_IP} --sip.ip=${WVP_IP} --media.stream-ip=${WVP_IP}' >> run.sh  && \
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/RegisterRequestProcessor.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/RegisterRequestProcessor.java
index f6a3af9..bc7365b 100644
--- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/RegisterRequestProcessor.java
+++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/RegisterRequestProcessor.java
@@ -190,6 +190,10 @@
 
     private void sendResponse(RequestEvent evt, Response response) throws InvalidArgumentException, SipException {
         ServerTransaction serverTransaction = getServerTransaction(evt);
+        if (serverTransaction == null) {
+            logger.warn("鍥炲澶辫触锛歿}", response);
+            return;
+        }
         serverTransaction.sendResponse(response);
         if (serverTransaction.getDialog() != null) serverTransaction.getDialog().delete();
     }
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/gb28181/transmit/event/response/impl/RegisterResponseProcessor.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/response/impl/RegisterResponseProcessor.java
index ed93774..02f5e1d 100644
--- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/response/impl/RegisterResponseProcessor.java
+++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/response/impl/RegisterResponseProcessor.java
@@ -90,10 +90,12 @@
 			redisCatchStorage.delPlatformCatchInfo(platformGBId);
 			// 鍙栧洖Expires璁剧疆锛岄伩鍏嶆敞閿�杩囩▼涓缃负0
 			ParentPlatform parentPlatformTmp = storager.queryParentPlatByServerGBId(platformGBId);
-			parentPlatformTmp.setStatus("娉ㄥ唽".equals(action));
-			redisCatchStorage.updatePlatformRegister(parentPlatformTmp);
-			redisCatchStorage.updatePlatformKeepalive(parentPlatformTmp);
-			parentPlatformCatch.setParentPlatform(parentPlatformTmp);
+			if (parentPlatformTmp != null) {
+				parentPlatformTmp.setStatus("娉ㄥ唽".equals(action));
+				redisCatchStorage.updatePlatformRegister(parentPlatformTmp);
+				redisCatchStorage.updatePlatformKeepalive(parentPlatformTmp);
+				parentPlatformCatch.setParentPlatform(parentPlatformTmp);
+			}
 			redisCatchStorage.updatePlatformCatchInfo(parentPlatformCatch);
 			storager.updateParentPlatformStatus(platformGBId, "娉ㄥ唽".equals(action));
 			if ("娉ㄩ攢".equals(action)) {
diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/utils/XmlUtil.java b/src/main/java/com/genersoft/iot/vmp/gb28181/utils/XmlUtil.java
index 6ae09bd..7a46ee7 100644
--- a/src/main/java/com/genersoft/iot/vmp/gb28181/utils/XmlUtil.java
+++ b/src/main/java/com/genersoft/iot/vmp/gb28181/utils/XmlUtil.java
@@ -204,19 +204,47 @@
         deviceChannel.setCivilCode(XmlUtil.getText(itemDevice, "CivilCode"));
         deviceChannel.setBlock(XmlUtil.getText(itemDevice, "Block"));
         deviceChannel.setAddress(XmlUtil.getText(itemDevice, "Address"));
+        String businessGroupID = XmlUtil.getText(itemDevice, "BusinessGroupID");
         if (XmlUtil.getText(itemDevice, "Parental") == null
-                || XmlUtil.getText(itemDevice, "Parental") == "") {
-            deviceChannel.setParental(0);
+                || XmlUtil.getText(itemDevice, "Parental").equals("")) {
+            if (deviceChannel.getChannelId().length() <= 10
+                    || (deviceChannel.getChannelId().length() == 20 && (
+                            Integer.parseInt(deviceChannel.getChannelId().substring(10, 13)) == 215
+                                    || Integer.parseInt(deviceChannel.getChannelId().substring(10, 13)) == 216
+                            )
+                        )
+            ) {
+                deviceChannel.setParental(1);
+            }else {
+                deviceChannel.setParental(0);
+            }
         } else {
-            deviceChannel.setParental(Integer.parseInt(XmlUtil.getText(itemDevice, "Parental")));
+            // 鐢变簬娴峰悍浼氶敊璇殑鍙戦��65535浣滀负杩欓噷鐨勫彇鍊�,鎵�浠ヨ繖閲岄櫎闈炴槸0鍚﹀垯璁や负鏄�1
+            deviceChannel.setParental(Integer.parseInt(XmlUtil.getText(itemDevice, "Parental")) == 1?1:0);
         }
         deviceChannel.setParentId(XmlUtil.getText(itemDevice, "ParentID"));
         String parentId = XmlUtil.getText(itemDevice, "ParentID");
-        if (parentId != null && parentId.contains("/")) {
-            String lastParentId = parentId.substring(parentId.lastIndexOf("/") + 1);
-            deviceChannel.setParentId(lastParentId);
+        if (parentId != null) {
+            if (parentId.contains("/")) {
+                String lastParentId = parentId.substring(parentId.lastIndexOf("/") + 1);
+                deviceChannel.setParentId(lastParentId);
+            }else {
+                deviceChannel.setParentId(parentId);
+            }
         }else {
-            deviceChannel.setParentId(parentId);
+            if (deviceChannel.getChannelId().length() <= 10) { // 姝ゆ椂涓鸿鏀垮尯鍒�, 涓婁笅绾ц鏀垮尯鍒掍娇鐢―eviceId鍏宠仈
+                deviceChannel.setParentId(deviceChannel.getChannelId().substring(0, deviceChannel.getChannelId().length() - 2));
+            }else if (deviceChannel.getChannelId().length() == 20) {
+                if (Integer.parseInt(deviceChannel.getChannelId().substring(10, 13)) == 216) { // 铏氭嫙缁勭粐
+                    deviceChannel.setParentId(businessGroupID);
+                }else if (deviceChannel.getCivilCode() != null) {
+                    // 璁惧锛� 鏃爌arentId鐨�20浣嶆槸浣跨敤CivilCode琛ㄧず涓婄骇鐨勮澶囷紝
+                    // 娉細215 涓氬姟鍒嗙粍鏄渶瑕佹湁parentId鐨�
+                    deviceChannel.setParentId(deviceChannel.getCivilCode());
+                }
+            }else {
+                deviceChannel.setParentId(deviceChannel.getDeviceId());
+            }
         }
 
         if (XmlUtil.getText(itemDevice, "SafetyWay") == null
@@ -277,4 +305,4 @@
         deviceChannel.setHasAudio(true); // 榛樿鍚湁闊抽锛屾挱鏀炬椂鍐嶆鏌ユ槸鍚︽湁闊抽鍙婃槸鍚AC
         return deviceChannel;
     }
-}
+}
\ No newline at end of file
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/src/main/java/com/genersoft/iot/vmp/storager/IVideoManagerStorage.java b/src/main/java/com/genersoft/iot/vmp/storager/IVideoManagerStorage.java
index d3a9ae9..a29b7ae 100644
--- a/src/main/java/com/genersoft/iot/vmp/storager/IVideoManagerStorage.java
+++ b/src/main/java/com/genersoft/iot/vmp/storager/IVideoManagerStorage.java
@@ -89,7 +89,7 @@
 	 * @param count 姣忛〉鏁伴噺
 	 * @return
 	 */
-	public PageInfo queryChannelsByDeviceId(String deviceId, String query, Boolean hasSubChannel, Boolean online, int page, int count);
+	public PageInfo queryChannelsByDeviceId(String deviceId, String query, Boolean hasSubChannel, Boolean online, Boolean catalogUnderDevice, int page, int count);
 	
 	public List<DeviceChannel> queryChannelsByDeviceIdWithStartAndLimit(String deviceId, String query, Boolean hasSubChannel, Boolean online, int start, int limit);
 
diff --git a/src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStorageImpl.java b/src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStorageImpl.java
index 661a69b..070e312 100644
--- a/src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStorageImpl.java
+++ b/src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStorageImpl.java
@@ -340,10 +340,15 @@
 	}
 
 	@Override
-	public PageInfo queryChannelsByDeviceId(String deviceId, String query, Boolean hasSubChannel, Boolean online, int page, int count) {
+	public PageInfo queryChannelsByDeviceId(String deviceId, String query, Boolean hasSubChannel, Boolean online, Boolean catalogUnderDevice, int page, int count) {
 		// 鑾峰彇鍒版墍鏈夋鍦ㄦ挱鏀剧殑娴�
 		PageHelper.startPage(page, count);
-		List<DeviceChannel> all = deviceChannelMapper.queryChannels(deviceId, null, query, hasSubChannel, online);
+		List<DeviceChannel> all;
+		if (catalogUnderDevice != null && catalogUnderDevice) {
+			all = deviceChannelMapper.queryChannels(deviceId, deviceId, query, hasSubChannel, online);
+		}else {
+			all = deviceChannelMapper.queryChannels(deviceId, null, query, hasSubChannel, online);
+		}
 		return new PageInfo<>(all);
 	}
 
diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/device/DeviceQuery.java b/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/device/DeviceQuery.java
index ab153ad..708008e 100644
--- a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/device/DeviceQuery.java
+++ b/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/device/DeviceQuery.java
@@ -128,12 +128,14 @@
 			@ApiImplicitParam(name="query", value = "鏌ヨ鍐呭" ,dataTypeClass = String.class),
 			@ApiImplicitParam(name="online", value = "鏄惁鍦ㄧ嚎"  ,dataTypeClass = Boolean.class),
 			@ApiImplicitParam(name="channelType", value = "璁惧/瀛愮洰褰�-> false/true" ,dataTypeClass = Boolean.class),
+			@ApiImplicitParam(name="catalogUnderDevice", value = "鏄惁鐩村睘涓庤澶囩殑鐩綍" ,dataTypeClass = Boolean.class),
 	})
 	public ResponseEntity<PageInfo> channels(@PathVariable String deviceId,
 											   int page, int count,
 											   @RequestParam(required = false) String query,
 											   @RequestParam(required = false) Boolean online,
-											   @RequestParam(required = false) Boolean channelType) {
+											   @RequestParam(required = false) Boolean channelType,
+											   @RequestParam(required = false) Boolean catalogUnderDevice) {
 //		if (logger.isDebugEnabled()) {
 //			logger.debug("鏌ヨ瑙嗛璁惧閫氶亾API璋冪敤");
 //		}
@@ -141,7 +143,7 @@
 			query = null;
 		}
 
-		PageInfo pageResult = storager.queryChannelsByDeviceId(deviceId, query, channelType, online, page, count);
+		PageInfo pageResult = storager.queryChannelsByDeviceId(deviceId, query, channelType, online, catalogUnderDevice, page, count);
 		return new ResponseEntity<>(pageResult,HttpStatus.OK);
 	}
 
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 fab895f..066c344 100644
--- a/web_src/src/components/common/DeviceTree.vue
+++ b/web_src/src/components/common/DeviceTree.vue
@@ -89,8 +89,8 @@
           })
         }
         if (node.level === 1) {
-          this.deviceService.getAllChannel(true, node.data.id, (catalogData) => {
-            this.deviceService.getAllChannel(false, node.data.id, (channelData) => {
+          this.deviceService.getAllChannel(true, true, node.data.id, (catalogData) => {
+            this.deviceService.getAllChannel(false, true, node.data.id, (channelData) => {
               let data = catalogData.concat(channelData)
               this.channelDataHandler(data, resolve)
             })
@@ -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;
diff --git a/web_src/src/components/common/jessibuca.vue b/web_src/src/components/common/jessibuca.vue
index d05890b..ebf5bef 100644
--- a/web_src/src/components/common/jessibuca.vue
+++ b/web_src/src/components/common/jessibuca.vue
@@ -1,5 +1,5 @@
 <template>
-  <div id="container" ref="containerId" @dblclick="fullscreenSwich" style="width: 100%">
+  <div ref="container" @dblclick="fullscreenSwich" style="width:100%;height:100%;background-color: #eee;margin:0 auto;">
     <div class="buttons-box" id="buttonsBox">
       <div class="buttons-box-left">
         <i v-if="!playing" class="iconfont icon-play jessibuca-btn" @click="playBtnClick"></i>
@@ -71,19 +71,26 @@
   },
   methods: {
     updatePlayerDomSize() {
-      let dom = document.getElementById('container');
-      const width = dom.parentNode.clientWidth
+      let dom = this.$refs.container;
+      let width = dom.parentNode.clientWidth
+      let height = (9 / 16) * width
+
+      const clientHeight = Math.min(document.body.clientHeight, document.documentElement.clientHeight)
+      if (height > clientHeight) {
+        height = clientHeight
+        width = (16 / 9) * height
+      }
+
       dom.style.width = width + 'px';
-      dom.style.height = (9 / 16) * width + "px";
+      dom.style.height = height + "px";
     },
     create() {
       let options = {};
-      console.log(this.$refs.containerId)
       console.log("hasAudio  " + this.hasAudio)
 
       this.jessibuca = new window.Jessibuca(Object.assign(
         {
-          container: this.$refs.containerId,
+          container: this.$refs.container,
           videoBuffer: 0.2, // 鏈�澶х紦鍐叉椂闀匡紝鍗曚綅绉�
           isResize: true,
           decoder: "static/js/jessibuca/decoder.js",
@@ -240,7 +247,7 @@
         this.jessibuca.destroy();
       }
       if (document.getElementById("buttonsBox") == null) {
-        document.getElementById("container").appendChild(this.btnDom)
+        this.$refs.container.appendChild(this.btnDom)
       }
       this.jessibuca = null;
       this.playing = false;
diff --git a/web_src/src/components/devicePosition.vue b/web_src/src/components/devicePosition.vue
index a807363..16675c9 100644
--- a/web_src/src/components/devicePosition.vue
+++ b/web_src/src/components/devicePosition.vue
@@ -14,13 +14,14 @@
       <div ref="infobox" v-if="channel != null " >
         <div v-if="channel != null" class="infobox-content">
           <el-descriptions class="margin-top" :title="channel.name" :column="1" :colon="true" size="mini" :labelStyle="labelStyle" >
-            <el-descriptions-item label="鐢熶骇鍘傚晢">{{channel.manufacture}}</el-descriptions-item>
+            <el-descriptions-item label="缂栧彿" >{{channel.channelId}}</el-descriptions-item>
             <el-descriptions-item label="鍨嬪彿">{{channel.model}}</el-descriptions-item>
-            <el-descriptions-item label="璁惧褰掑睘" >{{channel.owner}}</el-descriptions-item>
+            <el-descriptions-item label="缁忕含搴�" >{{channel.longitude}},{{channel.latitude}}</el-descriptions-item>
+            <el-descriptions-item label="鐢熶骇鍘傚晢">{{channel.manufacture}}</el-descriptions-item>
             <el-descriptions-item label="琛屾斂鍖哄煙" >{{channel.civilCode}}</el-descriptions-item>
+            <el-descriptions-item label="璁惧褰掑睘" >{{channel.owner}}</el-descriptions-item>
             <el-descriptions-item label="瀹夎鍦板潃" >{{channel.address == null?'鏈煡': channel.address}}</el-descriptions-item>
             <el-descriptions-item label="浜戝彴绫诲瀷" >{{channel.ptztypeText}}</el-descriptions-item>
-            <el-descriptions-item label="缁忕含搴�" >{{channel.longitude}},{{channel.latitude}}</el-descriptions-item>
             <el-descriptions-item label="鐘舵��">
               <el-tag size="small" v-if="channel.status === 1">鍦ㄧ嚎</el-tag>
               <el-tag size="small" type="info" v-if="channel.status === 0">绂荤嚎</el-tag>
@@ -75,7 +76,7 @@
       console.log(this.$route.query.deviceId)
       // this.$refs.deviceTree.openByDeivceId(this.$route.query.deivceId)
       setTimeout(()=>{ // 寤惰繜浠ョ瓑寰呭湴鍥惧姞杞藉畬鎴� TODO 鍚庣画淇敼涓洪�氳繃鏄疄闄呰繖锛涚姸鎬佸姞鍥炶皟瀹屾垚
-        this.deviceService.getAllChannel(false, this.$route.query.deviceId, this.channelsHandler)
+        this.deviceService.getAllChannel(false, false, this.$route.query.deviceId, this.channelsHandler)
       }, 1000)
 
     }
@@ -141,7 +142,13 @@
           zIndex: 3000, // 鑿滃崟鏍峰紡 z-index
         });
       } else {
-        this.deviceOrSubChannelMenu(event, data)
+        if (typeof data.channelId === "undefined") {
+          this.deviceOrSubChannelMenu(event, data)
+        }else {
+          // TODO 瀛愮洰褰曟殏鏃朵笉鏀寔鏌ヨ浠栦笅闈㈡墍鏈夎澶�, 鏀寔鏀寔鏌ヨ鐩村睘浜庤繖涓洰褰曠殑璁惧
+          this.deviceOrSubChannelMenu(event, data)
+        }
+
       }
 
     },
@@ -155,7 +162,7 @@
             disabled: false,
             onClick: () => {
               if (!data.channelId) {
-                this.deviceService.getAllChannel(false, data.deviceId, this.channelsHandler)
+                this.deviceService.getAllChannel(false, false, data.deviceId, this.channelsHandler)
               }
               if (data.channelId && data.subCount > 0) {
                 // 鐐瑰嚮瀛愮洰褰�
diff --git a/web_src/src/components/live.vue b/web_src/src/components/live.vue
index f6edcdf..797be84 100644
--- a/web_src/src/components/live.vue
+++ b/web_src/src/components/live.vue
@@ -15,10 +15,10 @@
           <div style="width: 99%;height: 85vh;display: flex;flex-wrap: wrap;background-color: #000;">
             <div v-for="i in spilt" :key="i" class="play-box"
                  :style="liveStyle" :class="{redborder:playerIdx == (i-1)}"
-                 @click="playerIdx = (i-1)"
-            >
+                 @click="playerIdx = (i-1)">
               <div v-if="!videoUrl[i-1]" style="color: #ffffff;font-size: 30px;font-weight: bold;">{{ i }}</div>
-              <player v-else :videoUrl="videoUrl[i-1]" fluent autoplay @screenshot="shot" @destroy="destroy"/>
+              <player ref="player" v-else :videoUrl="videoUrl[i-1]" fluent autoplay @screenshot="shot"
+                      @destroy="destroy"/>
             </div>
           </div>
         </el-main>
@@ -60,13 +60,22 @@
 
   computed: {
     liveStyle() {
-      if (this.spilt == 1) {
-        return {width: '100%', height: '100%'}
-      } else if (this.spilt == 4) {
-        return {width: '49%', height: '49%'}
-      } else if (this.spilt == 9) {
-        return {width: '32%', height: '32%'}
+      let style = {width: '100%', height: '100%'}
+      switch (this.spilt) {
+        case 4:
+          style = {width: '49%', height: '49%'}
+          break
+        case 9:
+          style = {width: '32%', height: '32%'}
+          break
       }
+      this.$nextTick(() => {
+        for (let i = 0; i < this.spilt; i++) {
+          const player = this.$refs.player
+          player && player[i] && player[i].updatePlayerDomSize()
+        }
+      })
+      return style
     }
   },
   watch: {
diff --git a/web_src/src/components/service/DeviceService.js b/web_src/src/components/service/DeviceService.js
index 6149579..dbe10d1 100644
--- a/web_src/src/components/service/DeviceService.js
+++ b/web_src/src/components/service/DeviceService.js
@@ -45,20 +45,20 @@
   }
 
 
-  getAllChannel(isCatalog, deviceId, callback, errorCallback) {
+  getAllChannel(isCatalog, catalogUnderDevice, deviceId, callback, errorCallback) {
     let currentPage = 1;
     let count = 100;
     let catalogList = []
-    this.getAllChannelIteration(isCatalog, deviceId, catalogList, currentPage, count, callback, errorCallback)
+    this.getAllChannelIteration(isCatalog, catalogUnderDevice, deviceId, catalogList, currentPage, count, callback, errorCallback)
   }
 
-  getAllChannelIteration(isCatalog, deviceId, catalogList, currentPage, count, callback, errorCallback) {
-    this.getChanel(isCatalog, deviceId, currentPage, count, (data) => {
+  getAllChannelIteration(isCatalog, catalogUnderDevice, deviceId, catalogList, currentPage, count, callback, errorCallback) {
+    this.getChanel(isCatalog, catalogUnderDevice, deviceId, currentPage, count, (data) => {
       if (data.list) {
         catalogList = catalogList.concat(data.list);
         if (catalogList.length < data.total) {
           currentPage ++
-          this.getAllChannelIteration(isCatalog, deviceId, catalogList, currentPage, count, callback, errorCallback)
+          this.getAllChannelIteration(isCatalog,catalogUnderDevice, deviceId, catalogList, currentPage, count, callback, errorCallback)
         }else {
           console.log(1)
           if (typeof (callback) == "function") callback(catalogList)
@@ -66,7 +66,7 @@
       }
     }, errorCallback)
   }
-  getChanel(isCatalog, deviceId, currentPage, count, callback, errorCallback) {
+  getChanel(isCatalog, catalogUnderDevice, deviceId, currentPage, count, callback, errorCallback) {
     this.$axios({
       method: 'get',
       url: `/api/device/query/devices/${deviceId}/channels`,
@@ -75,7 +75,8 @@
         count: count,
         query: "",
         online: "",
-        channelType: isCatalog
+        channelType: isCatalog,
+        catalogUnderDevice: catalogUnderDevice
       }
     }).then((res) =>{
       if (typeof (callback) == "function") callback(res.data)

--
Gitblit v1.8.0