فهرست منبع

Merge branch '648540858:wvp-28181-2.0' into wvp-28181-2.0

mk1990 3 سال پیش
والد
کامیت
a0537d74df
19فایلهای تغییر یافته به همراه189 افزوده شده و 80 حذف شده
  1. 1 1
      DOCKERFILE
  2. 6 3
      src/main/java/com/genersoft/iot/vmp/gb28181/event/subscribe/catalog/CatalogEventLister.java
  3. 25 16
      src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommanderFroPlatform.java
  4. 4 0
      src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/RegisterRequestProcessor.java
  5. 16 2
      src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/CatalogNotifyMessageHandler.java
  6. 15 3
      src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/query/cmd/CatalogQueryMessageHandler.java
  7. 6 4
      src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/response/impl/RegisterResponseProcessor.java
  8. 36 8
      src/main/java/com/genersoft/iot/vmp/gb28181/utils/XmlUtil.java
  9. 2 1
      src/main/java/com/genersoft/iot/vmp/service/IGbStreamService.java
  10. 8 4
      src/main/java/com/genersoft/iot/vmp/service/impl/GbStreamServiceImpl.java
  11. 1 1
      src/main/java/com/genersoft/iot/vmp/storager/IVideoManagerStorage.java
  12. 7 2
      src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStorageImpl.java
  13. 4 2
      src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/device/DeviceQuery.java
  14. 2 1
      web_src/src/components/channelList.vue
  15. 3 3
      web_src/src/components/common/DeviceTree.vue
  16. 14 7
      web_src/src/components/common/jessibuca.vue
  17. 13 6
      web_src/src/components/devicePosition.vue
  18. 18 9
      web_src/src/components/live.vue
  19. 8 7
      web_src/src/components/service/DeviceService.js

+ 1 - 1
DOCKERFILE

@@ -84,7 +84,7 @@ RUN     echo '#!/bin/bash' > run.sh && \
         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  && \

+ 6 - 3
src/main/java/com/genersoft/iot/vmp/gb28181/event/subscribe/catalog/CatalogEventLister.java

@@ -99,7 +99,7 @@ public class CatalogEventLister implements ApplicationListener<CatalogEvent> {
                     }
                     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 @@ public class CatalogEventLister implements ApplicationListener<CatalogEvent> {
                      }
                     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) { // 父节点是行政区划,则设置CivilCode使用此行政区划
+                                deviceChannelByStream.setCivilCode(deviceChannelByStream.getParentId());
+                            }
                             deviceChannelList.add(deviceChannelByStream);
                         }
                     }
@@ -159,7 +162,7 @@ public class CatalogEventLister implements ApplicationListener<CatalogEvent> {
                                 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);

+ 25 - 16
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommanderFroPlatform.java

@@ -259,28 +259,34 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform {
                 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 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform {
                 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");

+ 4 - 0
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/RegisterRequestProcessor.java

@@ -190,6 +190,10 @@ public class RegisterRequestProcessor extends SIPRequestProcessorParent implemen
 
     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();
     }

+ 16 - 2
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/CatalogNotifyMessageHandler.java

@@ -79,6 +79,11 @@ public class CatalogNotifyMessageHandler extends SIPRequestProcessorParent imple
                     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 @@ public class CatalogNotifyMessageHandler extends SIPRequestProcessorParent imple
                     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 @@ public class CatalogNotifyMessageHandler extends SIPRequestProcessorParent imple
                     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);

+ 15 - 3
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/query/cmd/CatalogQueryMessageHandler.java

@@ -93,7 +93,11 @@ public class CatalogQueryMessageHandler extends SIPRequestProcessorParent implem
                     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 @@ public class CatalogQueryMessageHandler extends SIPRequestProcessorParent implem
                     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 @@ public class CatalogQueryMessageHandler extends SIPRequestProcessorParent implem
                     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);

+ 6 - 4
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/response/impl/RegisterResponseProcessor.java

@@ -90,10 +90,12 @@ public class RegisterResponseProcessor extends SIPResponseProcessorAbstract {
 			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)) {

+ 36 - 8
src/main/java/com/genersoft/iot/vmp/gb28181/utils/XmlUtil.java

@@ -204,19 +204,47 @@ public class XmlUtil {
         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) { // 此时为行政区划, 上下级行政区划使用DeviceId关联
+                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) {
+                    // 设备, 无parentId的20位是使用CivilCode表示上级的设备,
+                    // 注:215 业务分组是需要有parentId的
+                    deviceChannel.setParentId(deviceChannel.getCivilCode());
+                }
+            }else {
+                deviceChannel.setParentId(deviceChannel.getDeviceId());
+            }
         }
 
         if (XmlUtil.getText(itemDevice, "SafetyWay") == null
@@ -277,4 +305,4 @@ public class XmlUtil {
         deviceChannel.setHasAudio(true); // 默认含有音频,播放时再检查是否有音频及是否AAC
         return deviceChannel;
     }
-}
+}

+ 2 - 1
src/main/java/com/genersoft/iot/vmp/service/IGbStreamService.java

@@ -2,6 +2,7 @@ package com.genersoft.iot.vmp.service;
 
 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 @@ public interface IGbStreamService {
      */
     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);

+ 8 - 4
src/main/java/com/genersoft/iot/vmp/service/impl/GbStreamServiceImpl.java

@@ -78,7 +78,7 @@ public class GbStreamServiceImpl implements IGbStreamService {
                 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 @@ public class GbStreamServiceImpl implements IGbStreamService {
     }
 
     @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) { // 父节点是行政区划,则设置CivilCode使用此行政区划
+            deviceChannel.setCivilCode(catalogId);
+        }else {
+            deviceChannel.setCivilCode(platform.getAdministrativeDivision());
+        }
         deviceChannel.setModel("live");
         deviceChannel.setOwner("wvp-pro");
         deviceChannel.setParental(0);

+ 1 - 1
src/main/java/com/genersoft/iot/vmp/storager/IVideoManagerStorage.java

@@ -89,7 +89,7 @@ public interface IVideoManagerStorage {
 	 * @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);
 

+ 7 - 2
src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStorageImpl.java

@@ -340,10 +340,15 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage {
 	}
 
 	@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);
 	}
 

+ 4 - 2
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/device/DeviceQuery.java

@@ -128,12 +128,14 @@ public class DeviceQuery {
 			@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 @@ public class DeviceQuery {
 			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);
 	}
 

+ 2 - 1
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)">设备录象

+ 3 - 3
web_src/src/components/common/DeviceTree.vue

@@ -89,8 +89,8 @@ export default {
           })
         }
         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 @@ export default {
           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;

+ 14 - 7
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 @@ export default {
   },
   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 @@ export default {
         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;

+ 13 - 6
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 @@ export default {
       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 @@ export default {
           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 @@ export default {
             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) {
                 // 点击子目录

+ 18 - 9
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 @@ export default {
 
   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: {

+ 8 - 7
web_src/src/components/service/DeviceService.js

@@ -45,20 +45,20 @@ class DeviceService{
   }
 
 
-  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 @@ class DeviceService{
       }
     }, 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 @@ class DeviceService{
         count: count,
         query: "",
         online: "",
-        channelType: isCatalog
+        channelType: isCatalog,
+        catalogUnderDevice: catalogUnderDevice
       }
     }).then((res) =>{
       if (typeof (callback) == "function") callback(res.data)