diff --git a/DOCKERFILE b/DOCKERFILE index 6c4beb55..d55e06a7 100644 --- a/DOCKERFILE +++ b/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 && \ 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 019baf94..0ea5a184 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 @@ public class CatalogEventLister implements ApplicationListener { } 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 { } 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 { 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 66af757c..80669920 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,28 +259,34 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform { catalogXml.append("\r\n"); catalogXml.append("" + channel.getChannelId() + "\r\n"); catalogXml.append("" + channel.getName() + "\r\n"); - catalogXml.append("" + channel.getManufacture() + "\r\n"); catalogXml.append("" + channel.getParental() + "\r\n"); if (channel.getParentId() != null) { catalogXml.append("" + channel.getParentId() + "\r\n"); } - catalogXml.append("" + channel.getRegisterWay() + "\r\n"); - catalogXml.append("" + (channel.getStatus() == 0?"OFF":"ON") + "\r\n"); - catalogXml.append("" + channel.getSecrecy() + "\r\n"); - if (channel.getChannelType() != 2) { // 业务分组/虚拟组织/行政区划 不设置以下字段 - catalogXml.append("" + channel.getModel() + "\r\n"); - catalogXml.append("" + channel.getOwner() + "\r\n"); - catalogXml.append("" + channel.getCivilCode() + "\r\n"); - catalogXml.append("
" + channel.getAddress() + "
\r\n"); - catalogXml.append("" + channel.getLongitude() + "\r\n"); - catalogXml.append("" + channel.getLatitude() + "\r\n"); - catalogXml.append("" + channel.getIpAddress() + "\r\n"); - catalogXml.append("" + channel.getPort() + "\r\n"); - catalogXml.append("\r\n"); - catalogXml.append("" + channel.getPTZType() + "\r\n"); - catalogXml.append("\r\n"); + if (channel.getChannelId().length() == 20) { + if (Integer.parseInt(channel.getChannelId().substring(10, 13)) == 216) { // 虚拟组织增加BusinessGroupID字段 + catalogXml.append("" + channel.getParentId() + "\r\n"); + } + catalogXml.append("" + channel.getManufacture() + "\r\n"); + catalogXml.append("" + channel.getRegisterWay() + "\r\n"); + catalogXml.append("" + (channel.getStatus() == 0?"OFF":"ON") + "\r\n"); + if (channel.getChannelType() != 2) { // 业务分组/虚拟组织/行政区划 不设置以下字段 + catalogXml.append("" + channel.getSecrecy() + "\r\n"); + catalogXml.append("" + channel.getModel() + "\r\n"); + catalogXml.append("" + channel.getOwner() + "\r\n"); + catalogXml.append("" + channel.getCivilCode() + "\r\n"); + catalogXml.append("
" + channel.getAddress() + "
\r\n"); + catalogXml.append("" + channel.getLongitude() + "\r\n"); + catalogXml.append("" + channel.getLatitude() + "\r\n"); + catalogXml.append("" + channel.getIpAddress() + "\r\n"); + catalogXml.append("" + channel.getPort() + "\r\n"); + catalogXml.append("\r\n"); + catalogXml.append("" + channel.getPTZType() + "\r\n"); + catalogXml.append("\r\n"); + } } + catalogXml.append("
\r\n"); } } @@ -596,6 +602,9 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform { catalogXml.append("" + channel.getSecrecy() + "\r\n"); catalogXml.append("" + channel.getRegisterWay() + "\r\n"); catalogXml.append("" + (channel.getStatus() == 0 ? "OFF" : "ON") + "\r\n"); + if (channel.getChannelId().length() == 20 && Integer.parseInt(channel.getChannelId().substring(10, 13)) == 216) { // 虚拟组织增加BusinessGroupID字段 + catalogXml.append("" + channel.getParentId() + "\r\n"); + } if (channel.getChannelType() == 2) { // 业务分组/虚拟组织/行政区划 不设置以下属性 catalogXml.append("" + channel.getModel() + "\r\n"); catalogXml.append("0\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 f6a3af95..bc7365be 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 @@ 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(); } 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 d17920dc..d714ee4f 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 @@ 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); 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 cefee3fc..0e979619 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 @@ 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); 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 ed937744..02f5e1d0 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 @@ 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)) { 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 6ae09bda..7a46ee7d 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 @@ 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; } -} +} \ 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 1a851d70..abdde6de 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 @@ 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 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 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 bbf992f4..b65f8260 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 @@ 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); 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 d3a9ae9e..a29b7ae9 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 @@ 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 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 661a69b3..070e3124 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 @@ 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 all = deviceChannelMapper.queryChannels(deviceId, null, query, hasSubChannel, online); + List 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 ab153ad4..708008ed 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 @@ 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 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); } diff --git a/web_src/src/components/channelList.vue b/web_src/src/components/channelList.vue index 34f540df..8d065426 100644 --- a/web_src/src/components/channelList.vue +++ b/web_src/src/components/channelList.vue @@ -40,6 +40,7 @@