Commit a0537d74df5b9c8ee65dba7c4e5bc6da7fc3d031

Authored by mk1990
Committed by GitHub
2 parents c88b0a8b f6fa1eed

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

DOCKERFILE
... ... @@ -84,7 +84,7 @@ RUN echo '#!/bin/bash' > run.sh && \
84 84 echo 'nohup java -jar *.jar --userSettings.record=/opt/media/www/record/ &' >> run.sh && \
85 85 echo 'nohup /opt/media/MediaServer -d -m 3 &' >> run.sh && \
86 86 echo 'cd /opt/wvp' >> run.sh && \
87   - echo 'if [${WVP_CONFIG}]; then' >> run.sh && \
  87 + echo 'if [-n "${WVP_CONFIG}"]; then' >> run.sh && \
88 88 echo ' java -jar *.jar --spring.config.location=/opt/wvp/config/application.yml --media.record-assist-port=18081 ${WVP_CONFIG}' >> run.sh && \
89 89 echo 'else' >> run.sh && \
90 90 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 && \
... ...
src/main/java/com/genersoft/iot/vmp/gb28181/event/subscribe/catalog/CatalogEventLister.java
... ... @@ -99,7 +99,7 @@ public class CatalogEventLister implements ApplicationListener<CatalogEvent> {
99 99 }
100 100 if (event.getGbStreams() != null && event.getGbStreams().size() > 0){
101 101 for (GbStream gbStream : event.getGbStreams()) {
102   - DeviceChannel deviceChannelByStream = gbStreamService.getDeviceChannelListByStream(gbStream, gbStream.getCatalogId(), parentPlatform.getDeviceGBId());
  102 + DeviceChannel deviceChannelByStream = gbStreamService.getDeviceChannelListByStream(gbStream, gbStream.getCatalogId(), parentPlatform);
103 103 deviceChannelList.add(deviceChannelByStream);
104 104 }
105 105 }
... ... @@ -138,7 +138,10 @@ public class CatalogEventLister implements ApplicationListener<CatalogEvent> {
138 138 }
139 139 if (event.getGbStreams() != null && event.getGbStreams().size() > 0){
140 140 for (GbStream gbStream : event.getGbStreams()) {
141   - DeviceChannel deviceChannelByStream = gbStreamService.getDeviceChannelListByStream(gbStream, gbStream.getCatalogId(), parentPlatform.getDeviceGBId());
  141 + DeviceChannel deviceChannelByStream = gbStreamService.getDeviceChannelListByStream(gbStream, gbStream.getCatalogId(), parentPlatform);
  142 + if (deviceChannelByStream.getParentId().length() <= 10) { // 父节点是行政区划,则设置CivilCode使用此行政区划
  143 + deviceChannelByStream.setCivilCode(deviceChannelByStream.getParentId());
  144 + }
142 145 deviceChannelList.add(deviceChannelByStream);
143 146 }
144 147 }
... ... @@ -159,7 +162,7 @@ public class CatalogEventLister implements ApplicationListener&lt;CatalogEvent&gt; {
159 162 deviceChannelList.add(deviceChannel);
160 163 GbStream gbStream = storager.queryStreamInParentPlatform(platform.getServerGBId(), gbId);
161 164 if(gbStream != null){
162   - DeviceChannel deviceChannelByStream = gbStreamService.getDeviceChannelListByStream(gbStream, gbStream.getCatalogId(), platform.getDeviceGBId());
  165 + DeviceChannel deviceChannelByStream = gbStreamService.getDeviceChannelListByStream(gbStream, gbStream.getCatalogId(), platform);
163 166 deviceChannelList.add(deviceChannelByStream);
164 167 }
165 168 sipCommanderFroPlatform.sendNotifyForCatalogAddOrUpdate(event.getType(), platform, deviceChannelList, subscribeInfo, null);
... ...
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommanderFroPlatform.java
... ... @@ -259,28 +259,34 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform {
259 259 catalogXml.append("<Item>\r\n");
260 260 catalogXml.append("<DeviceID>" + channel.getChannelId() + "</DeviceID>\r\n");
261 261 catalogXml.append("<Name>" + channel.getName() + "</Name>\r\n");
262   - catalogXml.append("<Manufacturer>" + channel.getManufacture() + "</Manufacturer>\r\n");
263 262 catalogXml.append("<Parental>" + channel.getParental() + "</Parental>\r\n");
264 263 if (channel.getParentId() != null) {
265 264 catalogXml.append("<ParentID>" + channel.getParentId() + "</ParentID>\r\n");
266 265 }
267   - catalogXml.append("<RegisterWay>" + channel.getRegisterWay() + "</RegisterWay>\r\n");
268   - catalogXml.append("<Status>" + (channel.getStatus() == 0?"OFF":"ON") + "</Status>\r\n");
269   - catalogXml.append("<Secrecy>" + channel.getSecrecy() + "</Secrecy>\r\n");
270   - if (channel.getChannelType() != 2) { // 业务分组/虚拟组织/行政区划 不设置以下字段
271   - catalogXml.append("<Model>" + channel.getModel() + "</Model>\r\n");
272   - catalogXml.append("<Owner>" + channel.getOwner() + "</Owner>\r\n");
273   - catalogXml.append("<CivilCode>" + channel.getCivilCode() + "</CivilCode>\r\n");
274   - catalogXml.append("<Address>" + channel.getAddress() + "</Address>\r\n");
275   - catalogXml.append("<Longitude>" + channel.getLongitude() + "</Longitude>\r\n");
276   - catalogXml.append("<Latitude>" + channel.getLatitude() + "</Latitude>\r\n");
277   - catalogXml.append("<IPAddress>" + channel.getIpAddress() + "</IPAddress>\r\n");
278   - catalogXml.append("<Port>" + channel.getPort() + "</Port>\r\n");
279   - catalogXml.append("<Info>\r\n");
280   - catalogXml.append("<PTZType>" + channel.getPTZType() + "</PTZType>\r\n");
281   - catalogXml.append("</Info>\r\n");
  266 + if (channel.getChannelId().length() == 20) {
  267 + if (Integer.parseInt(channel.getChannelId().substring(10, 13)) == 216) { // 虚拟组织增加BusinessGroupID字段
  268 + catalogXml.append("<BusinessGroupID>" + channel.getParentId() + "</BusinessGroupID>\r\n");
  269 + }
  270 + catalogXml.append("<Manufacturer>" + channel.getManufacture() + "</Manufacturer>\r\n");
  271 + catalogXml.append("<RegisterWay>" + channel.getRegisterWay() + "</RegisterWay>\r\n");
  272 + catalogXml.append("<Status>" + (channel.getStatus() == 0?"OFF":"ON") + "</Status>\r\n");
  273 + if (channel.getChannelType() != 2) { // 业务分组/虚拟组织/行政区划 不设置以下字段
  274 + catalogXml.append("<Secrecy>" + channel.getSecrecy() + "</Secrecy>\r\n");
  275 + catalogXml.append("<Model>" + channel.getModel() + "</Model>\r\n");
  276 + catalogXml.append("<Owner>" + channel.getOwner() + "</Owner>\r\n");
  277 + catalogXml.append("<CivilCode>" + channel.getCivilCode() + "</CivilCode>\r\n");
  278 + catalogXml.append("<Address>" + channel.getAddress() + "</Address>\r\n");
  279 + catalogXml.append("<Longitude>" + channel.getLongitude() + "</Longitude>\r\n");
  280 + catalogXml.append("<Latitude>" + channel.getLatitude() + "</Latitude>\r\n");
  281 + catalogXml.append("<IPAddress>" + channel.getIpAddress() + "</IPAddress>\r\n");
  282 + catalogXml.append("<Port>" + channel.getPort() + "</Port>\r\n");
  283 + catalogXml.append("<Info>\r\n");
  284 + catalogXml.append("<PTZType>" + channel.getPTZType() + "</PTZType>\r\n");
  285 + catalogXml.append("</Info>\r\n");
  286 + }
282 287 }
283 288  
  289 +
284 290 catalogXml.append("</Item>\r\n");
285 291 }
286 292 }
... ... @@ -596,6 +602,9 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform {
596 602 catalogXml.append("<Secrecy>" + channel.getSecrecy() + "</Secrecy>\r\n");
597 603 catalogXml.append("<RegisterWay>" + channel.getRegisterWay() + "</RegisterWay>\r\n");
598 604 catalogXml.append("<Status>" + (channel.getStatus() == 0 ? "OFF" : "ON") + "</Status>\r\n");
  605 + if (channel.getChannelId().length() == 20 && Integer.parseInt(channel.getChannelId().substring(10, 13)) == 216) { // 虚拟组织增加BusinessGroupID字段
  606 + catalogXml.append("<BusinessGroupID>" + channel.getParentId() + "</BusinessGroupID>\r\n");
  607 + }
599 608 if (channel.getChannelType() == 2) { // 业务分组/虚拟组织/行政区划 不设置以下属性
600 609 catalogXml.append("<Model>" + channel.getModel() + "</Model>\r\n");
601 610 catalogXml.append("<Owner>0</Owner>\r\n");
... ...
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/RegisterRequestProcessor.java
... ... @@ -190,6 +190,10 @@ public class RegisterRequestProcessor extends SIPRequestProcessorParent implemen
190 190  
191 191 private void sendResponse(RequestEvent evt, Response response) throws InvalidArgumentException, SipException {
192 192 ServerTransaction serverTransaction = getServerTransaction(evt);
  193 + if (serverTransaction == null) {
  194 + logger.warn("回复失败:{}", response);
  195 + return;
  196 + }
193 197 serverTransaction.sendResponse(response);
194 198 if (serverTransaction.getDialog() != null) serverTransaction.getDialog().delete();
195 199 }
... ...
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
79 79 deviceChannel.setParental(1);
80 80 deviceChannel.setParentId(catalog.getParentId());
81 81 deviceChannel.setRegisterWay(1);
  82 + if (catalog.getParentId() != null && catalog.getParentId().length() <= 10) {
  83 + deviceChannel.setCivilCode(catalog.getParentId());
  84 + }else {
  85 + deviceChannel.setCivilCode(parentPlatform.getAdministrativeDivision());
  86 + }
82 87 deviceChannel.setCivilCode(parentPlatform.getAdministrativeDivision());
83 88 deviceChannel.setModel("live");
84 89 deviceChannel.setOwner("wvp-pro");
... ... @@ -95,7 +100,12 @@ public class CatalogNotifyMessageHandler extends SIPRequestProcessorParent imple
95 100 DeviceChannel deviceChannel = storage.queryChannel(channel.getDeviceId(), channel.getChannelId());
96 101 deviceChannel.setParental(0);
97 102 deviceChannel.setParentId(channel.getCatalogId());
98   - deviceChannel.setCivilCode(parentPlatform.getDeviceGBId().substring(0, 6));
  103 + if (channel.getCatalogId() != null && channel.getCatalogId().length() <= 10) {
  104 + channel.setCivilCode(channel.getCatalogId());
  105 + }else {
  106 + deviceChannel.setCivilCode(parentPlatform.getAdministrativeDivision());
  107 + }
  108 +
99 109 allChannels.add(deviceChannel);
100 110 }
101 111 }
... ... @@ -116,7 +126,11 @@ public class CatalogNotifyMessageHandler extends SIPRequestProcessorParent imple
116 126 deviceChannel.setStatus(1);
117 127 deviceChannel.setParentId(gbStream.getCatalogId());
118 128 deviceChannel.setRegisterWay(1);
119   - deviceChannel.setCivilCode(parentPlatform.getAdministrativeDivision());
  129 + if (gbStream.getCatalogId() != null && gbStream.getCatalogId().length() <= 10) {
  130 + deviceChannel.setCivilCode(gbStream.getCatalogId());
  131 + }else {
  132 + deviceChannel.setCivilCode(parentPlatform.getAdministrativeDivision());
  133 + }
120 134 deviceChannel.setModel("live");
121 135 deviceChannel.setOwner("wvp-pro");
122 136 deviceChannel.setParental(0);
... ...
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
93 93 deviceChannel.setParental(1);
94 94 deviceChannel.setParentId(catalog.getParentId());
95 95 deviceChannel.setRegisterWay(1);
96   - deviceChannel.setCivilCode(parentPlatform.getAdministrativeDivision());
  96 + if (catalog.getParentId() != null && catalog.getParentId().length() < 10) {
  97 + deviceChannel.setCivilCode(catalog.getParentId());
  98 + }else {
  99 + deviceChannel.setCivilCode(parentPlatform.getAdministrativeDivision());
  100 + }
97 101 allChannels.add(deviceChannel);
98 102 }
99 103 }
... ... @@ -108,7 +112,11 @@ public class CatalogQueryMessageHandler extends SIPRequestProcessorParent implem
108 112 deviceChannel.setChannelType(0);
109 113 deviceChannel.setParental(0);
110 114 deviceChannel.setParentId(channel.getCatalogId());
111   - deviceChannel.setCivilCode(parentPlatform.getDeviceGBId().substring(0, 6));
  115 + if (channel.getCatalogId() != null && channel.getCatalogId().length() < 10) {
  116 + deviceChannel.setCivilCode(channel.getCatalogId());
  117 + }else {
  118 + deviceChannel.setCivilCode(parentPlatform.getAdministrativeDivision());
  119 + }
112 120 allChannels.add(deviceChannel);
113 121 }
114 122 }
... ... @@ -131,7 +139,11 @@ public class CatalogQueryMessageHandler extends SIPRequestProcessorParent implem
131 139 deviceChannel.setStatus(1);
132 140 deviceChannel.setParentId(gbStream.getCatalogId());
133 141 deviceChannel.setRegisterWay(1);
134   - deviceChannel.setCivilCode(parentPlatform.getAdministrativeDivision());
  142 + if (gbStream.getCatalogId() != null && gbStream.getCatalogId().length() < 10) {
  143 + deviceChannel.setCivilCode(gbStream.getCatalogId());
  144 + }else {
  145 + deviceChannel.setCivilCode(parentPlatform.getAdministrativeDivision());
  146 + }
135 147 deviceChannel.setModel("live");
136 148 deviceChannel.setOwner("wvp-pro");
137 149 deviceChannel.setParental(0);
... ...
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/response/impl/RegisterResponseProcessor.java
... ... @@ -90,10 +90,12 @@ public class RegisterResponseProcessor extends SIPResponseProcessorAbstract {
90 90 redisCatchStorage.delPlatformCatchInfo(platformGBId);
91 91 // 取回Expires设置,避免注销过程中被置为0
92 92 ParentPlatform parentPlatformTmp = storager.queryParentPlatByServerGBId(platformGBId);
93   - parentPlatformTmp.setStatus("注册".equals(action));
94   - redisCatchStorage.updatePlatformRegister(parentPlatformTmp);
95   - redisCatchStorage.updatePlatformKeepalive(parentPlatformTmp);
96   - parentPlatformCatch.setParentPlatform(parentPlatformTmp);
  93 + if (parentPlatformTmp != null) {
  94 + parentPlatformTmp.setStatus("注册".equals(action));
  95 + redisCatchStorage.updatePlatformRegister(parentPlatformTmp);
  96 + redisCatchStorage.updatePlatformKeepalive(parentPlatformTmp);
  97 + parentPlatformCatch.setParentPlatform(parentPlatformTmp);
  98 + }
97 99 redisCatchStorage.updatePlatformCatchInfo(parentPlatformCatch);
98 100 storager.updateParentPlatformStatus(platformGBId, "注册".equals(action));
99 101 if ("注销".equals(action)) {
... ...
src/main/java/com/genersoft/iot/vmp/gb28181/utils/XmlUtil.java
... ... @@ -204,19 +204,47 @@ public class XmlUtil {
204 204 deviceChannel.setCivilCode(XmlUtil.getText(itemDevice, "CivilCode"));
205 205 deviceChannel.setBlock(XmlUtil.getText(itemDevice, "Block"));
206 206 deviceChannel.setAddress(XmlUtil.getText(itemDevice, "Address"));
  207 + String businessGroupID = XmlUtil.getText(itemDevice, "BusinessGroupID");
207 208 if (XmlUtil.getText(itemDevice, "Parental") == null
208   - || XmlUtil.getText(itemDevice, "Parental") == "") {
209   - deviceChannel.setParental(0);
  209 + || XmlUtil.getText(itemDevice, "Parental").equals("")) {
  210 + if (deviceChannel.getChannelId().length() <= 10
  211 + || (deviceChannel.getChannelId().length() == 20 && (
  212 + Integer.parseInt(deviceChannel.getChannelId().substring(10, 13)) == 215
  213 + || Integer.parseInt(deviceChannel.getChannelId().substring(10, 13)) == 216
  214 + )
  215 + )
  216 + ) {
  217 + deviceChannel.setParental(1);
  218 + }else {
  219 + deviceChannel.setParental(0);
  220 + }
210 221 } else {
211   - deviceChannel.setParental(Integer.parseInt(XmlUtil.getText(itemDevice, "Parental")));
  222 + // 由于海康会错误的发送65535作为这里的取值,所以这里除非是0否则认为是1
  223 + deviceChannel.setParental(Integer.parseInt(XmlUtil.getText(itemDevice, "Parental")) == 1?1:0);
212 224 }
213 225 deviceChannel.setParentId(XmlUtil.getText(itemDevice, "ParentID"));
214 226 String parentId = XmlUtil.getText(itemDevice, "ParentID");
215   - if (parentId != null && parentId.contains("/")) {
216   - String lastParentId = parentId.substring(parentId.lastIndexOf("/") + 1);
217   - deviceChannel.setParentId(lastParentId);
  227 + if (parentId != null) {
  228 + if (parentId.contains("/")) {
  229 + String lastParentId = parentId.substring(parentId.lastIndexOf("/") + 1);
  230 + deviceChannel.setParentId(lastParentId);
  231 + }else {
  232 + deviceChannel.setParentId(parentId);
  233 + }
218 234 }else {
219   - deviceChannel.setParentId(parentId);
  235 + if (deviceChannel.getChannelId().length() <= 10) { // 此时为行政区划, 上下级行政区划使用DeviceId关联
  236 + deviceChannel.setParentId(deviceChannel.getChannelId().substring(0, deviceChannel.getChannelId().length() - 2));
  237 + }else if (deviceChannel.getChannelId().length() == 20) {
  238 + if (Integer.parseInt(deviceChannel.getChannelId().substring(10, 13)) == 216) { // 虚拟组织
  239 + deviceChannel.setParentId(businessGroupID);
  240 + }else if (deviceChannel.getCivilCode() != null) {
  241 + // 设备, 无parentId的20位是使用CivilCode表示上级的设备,
  242 + // 注:215 业务分组是需要有parentId的
  243 + deviceChannel.setParentId(deviceChannel.getCivilCode());
  244 + }
  245 + }else {
  246 + deviceChannel.setParentId(deviceChannel.getDeviceId());
  247 + }
220 248 }
221 249  
222 250 if (XmlUtil.getText(itemDevice, "SafetyWay") == null
... ... @@ -277,4 +305,4 @@ public class XmlUtil {
277 305 deviceChannel.setHasAudio(true); // 默认含有音频,播放时再检查是否有音频及是否AAC
278 306 return deviceChannel;
279 307 }
280   -}
  308 +}
281 309 \ No newline at end of file
... ...
src/main/java/com/genersoft/iot/vmp/service/IGbStreamService.java
... ... @@ -2,6 +2,7 @@ package com.genersoft.iot.vmp.service;
2 2  
3 3 import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
4 4 import com.genersoft.iot.vmp.gb28181.bean.GbStream;
  5 +import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
5 6 import com.github.pagehelper.PageInfo;
6 7  
7 8 import java.util.List;
... ... @@ -40,7 +41,7 @@ public interface IGbStreamService {
40 41 */
41 42 boolean delPlatformInfo(String platformId, List<GbStream> gbStreams);
42 43  
43   - DeviceChannel getDeviceChannelListByStream(GbStream gbStream, String catalogId, String deviceGBId);
  44 + DeviceChannel getDeviceChannelListByStream(GbStream gbStream, String catalogId, ParentPlatform platform);
44 45  
45 46 void sendCatalogMsg(GbStream gbStream, String type);
46 47 void sendCatalogMsgs(List<GbStream> gbStreams, String type);
... ...
src/main/java/com/genersoft/iot/vmp/service/impl/GbStreamServiceImpl.java
... ... @@ -78,7 +78,7 @@ public class GbStreamServiceImpl implements IGbStreamService {
78 78 gbStream.setPlatformId(platformId);
79 79 // TODO 修改为批量提交
80 80 platformGbStreamMapper.add(gbStream);
81   - DeviceChannel deviceChannelListByStream = getDeviceChannelListByStream(gbStream, catalogId, parentPlatform.getDeviceGBId());
  81 + DeviceChannel deviceChannelListByStream = getDeviceChannelListByStream(gbStream, catalogId, parentPlatform);
82 82 deviceChannelList.add(deviceChannelListByStream);
83 83 }
84 84 dataSourceTransactionManager.commit(transactionStatus); //手动提交
... ... @@ -92,19 +92,23 @@ public class GbStreamServiceImpl implements IGbStreamService {
92 92 }
93 93  
94 94 @Override
95   - public DeviceChannel getDeviceChannelListByStream(GbStream gbStream, String catalogId, String deviceGBId) {
  95 + public DeviceChannel getDeviceChannelListByStream(GbStream gbStream, String catalogId, ParentPlatform platform) {
96 96 DeviceChannel deviceChannel = new DeviceChannel();
97 97 deviceChannel.setChannelId(gbStream.getGbId());
98 98 deviceChannel.setName(gbStream.getName());
99 99 deviceChannel.setLongitude(gbStream.getLongitude());
100 100 deviceChannel.setLatitude(gbStream.getLatitude());
101   - deviceChannel.setDeviceId(deviceGBId);
  101 + deviceChannel.setDeviceId(platform.getDeviceGBId());
102 102 deviceChannel.setManufacture("wvp-pro");
103 103 // deviceChannel.setStatus(gbStream.isStatus()?1:0);
104 104 deviceChannel.setStatus(1);
105 105 deviceChannel.setParentId(catalogId ==null?gbStream.getCatalogId():catalogId);
106 106 deviceChannel.setRegisterWay(1);
107   - deviceChannel.setCivilCode(deviceGBId.substring(0, 6));
  107 + if (catalogId.length() <= 10) { // 父节点是行政区划,则设置CivilCode使用此行政区划
  108 + deviceChannel.setCivilCode(catalogId);
  109 + }else {
  110 + deviceChannel.setCivilCode(platform.getAdministrativeDivision());
  111 + }
108 112 deviceChannel.setModel("live");
109 113 deviceChannel.setOwner("wvp-pro");
110 114 deviceChannel.setParental(0);
... ...
src/main/java/com/genersoft/iot/vmp/storager/IVideoManagerStorage.java
... ... @@ -89,7 +89,7 @@ public interface IVideoManagerStorage {
89 89 * @param count 每页数量
90 90 * @return
91 91 */
92   - public PageInfo queryChannelsByDeviceId(String deviceId, String query, Boolean hasSubChannel, Boolean online, int page, int count);
  92 + public PageInfo queryChannelsByDeviceId(String deviceId, String query, Boolean hasSubChannel, Boolean online, Boolean catalogUnderDevice, int page, int count);
93 93  
94 94 public List<DeviceChannel> queryChannelsByDeviceIdWithStartAndLimit(String deviceId, String query, Boolean hasSubChannel, Boolean online, int start, int limit);
95 95  
... ...
src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStorageImpl.java
... ... @@ -340,10 +340,15 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage {
340 340 }
341 341  
342 342 @Override
343   - public PageInfo queryChannelsByDeviceId(String deviceId, String query, Boolean hasSubChannel, Boolean online, int page, int count) {
  343 + public PageInfo queryChannelsByDeviceId(String deviceId, String query, Boolean hasSubChannel, Boolean online, Boolean catalogUnderDevice, int page, int count) {
344 344 // 获取到所有正在播放的流
345 345 PageHelper.startPage(page, count);
346   - List<DeviceChannel> all = deviceChannelMapper.queryChannels(deviceId, null, query, hasSubChannel, online);
  346 + List<DeviceChannel> all;
  347 + if (catalogUnderDevice != null && catalogUnderDevice) {
  348 + all = deviceChannelMapper.queryChannels(deviceId, deviceId, query, hasSubChannel, online);
  349 + }else {
  350 + all = deviceChannelMapper.queryChannels(deviceId, null, query, hasSubChannel, online);
  351 + }
347 352 return new PageInfo<>(all);
348 353 }
349 354  
... ...
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/device/DeviceQuery.java
... ... @@ -128,12 +128,14 @@ public class DeviceQuery {
128 128 @ApiImplicitParam(name="query", value = "查询内容" ,dataTypeClass = String.class),
129 129 @ApiImplicitParam(name="online", value = "是否在线" ,dataTypeClass = Boolean.class),
130 130 @ApiImplicitParam(name="channelType", value = "设备/子目录-> false/true" ,dataTypeClass = Boolean.class),
  131 + @ApiImplicitParam(name="catalogUnderDevice", value = "是否直属与设备的目录" ,dataTypeClass = Boolean.class),
131 132 })
132 133 public ResponseEntity<PageInfo> channels(@PathVariable String deviceId,
133 134 int page, int count,
134 135 @RequestParam(required = false) String query,
135 136 @RequestParam(required = false) Boolean online,
136   - @RequestParam(required = false) Boolean channelType) {
  137 + @RequestParam(required = false) Boolean channelType,
  138 + @RequestParam(required = false) Boolean catalogUnderDevice) {
137 139 // if (logger.isDebugEnabled()) {
138 140 // logger.debug("查询视频设备通道API调用");
139 141 // }
... ... @@ -141,7 +143,7 @@ public class DeviceQuery {
141 143 query = null;
142 144 }
143 145  
144   - PageInfo pageResult = storager.queryChannelsByDeviceId(deviceId, query, channelType, online, page, count);
  146 + PageInfo pageResult = storager.queryChannelsByDeviceId(deviceId, query, channelType, online, catalogUnderDevice, page, count);
145 147 return new ResponseEntity<>(pageResult,HttpStatus.OK);
146 148 }
147 149  
... ...
web_src/src/components/channelList.vue
... ... @@ -40,6 +40,7 @@
40 40 <el-table-column label="快照" width="80" align="center">
41 41 <template slot-scope="scope">
42 42 <img style="max-height: 3rem;max-width: 4rem;"
  43 + v-if="scope.row.subCount === 0 && scope.row.parental === 0"
43 44 :id="scope.row.deviceId + '_' + scope.row.channelId"
44 45 :src="getSnap(scope.row)"
45 46 @error="getSnapErrorEvent($event.target.id)"
... ... @@ -89,7 +90,7 @@
89 90 <el-button size="mini" icon="el-icon-switch-button" type="danger" v-if="!!scope.row.streamId"
90 91 @click="stopDevicePush(scope.row)">停止
91 92 </el-button>
92   - <el-button size="mini" icon="el-icon-s-open" type="primary" v-if="scope.row.subCount > 0"
  93 + <el-button size="mini" icon="el-icon-s-open" type="primary" v-if="scope.row.subCount > 0 || scope.row.parental === 1"
93 94 @click="changeSubchannel(scope.row)">查看
94 95 </el-button>
95 96 <el-button size="mini" icon="el-icon-video-camera" type="primary" @click="queryRecords(scope.row)">设备录象
... ...
web_src/src/components/common/DeviceTree.vue
... ... @@ -89,8 +89,8 @@ export default {
89 89 })
90 90 }
91 91 if (node.level === 1) {
92   - this.deviceService.getAllChannel(true, node.data.id, (catalogData) => {
93   - this.deviceService.getAllChannel(false, node.data.id, (channelData) => {
  92 + this.deviceService.getAllChannel(true, true, node.data.id, (catalogData) => {
  93 + this.deviceService.getAllChannel(false, true, node.data.id, (channelData) => {
94 94 let data = catalogData.concat(channelData)
95 95 this.channelDataHandler(data, resolve)
96 96 })
... ... @@ -109,7 +109,7 @@ export default {
109 109 let nodeList = []
110 110 for (let i = 0; i < data.length; i++) {
111 111 let type = 3;
112   - if (data[i].subCount > 0) {
  112 + if (data[i].subCount > 0 || data[i].parental === 1) {
113 113 type = 2;
114 114 }else if (data[i].ptztype === 1 ) { // 1-球机;2-半球;3-固定枪机;4-遥控枪机
115 115 type = 4;
... ...
web_src/src/components/common/jessibuca.vue
1 1 <template>
2   - <div id="container" ref="containerId" @dblclick="fullscreenSwich" style="width: 100%">
  2 + <div ref="container" @dblclick="fullscreenSwich" style="width:100%;height:100%;background-color: #eee;margin:0 auto;">
3 3 <div class="buttons-box" id="buttonsBox">
4 4 <div class="buttons-box-left">
5 5 <i v-if="!playing" class="iconfont icon-play jessibuca-btn" @click="playBtnClick"></i>
... ... @@ -71,19 +71,26 @@ export default {
71 71 },
72 72 methods: {
73 73 updatePlayerDomSize() {
74   - let dom = document.getElementById('container');
75   - const width = dom.parentNode.clientWidth
  74 + let dom = this.$refs.container;
  75 + let width = dom.parentNode.clientWidth
  76 + let height = (9 / 16) * width
  77 +
  78 + const clientHeight = Math.min(document.body.clientHeight, document.documentElement.clientHeight)
  79 + if (height > clientHeight) {
  80 + height = clientHeight
  81 + width = (16 / 9) * height
  82 + }
  83 +
76 84 dom.style.width = width + 'px';
77   - dom.style.height = (9 / 16) * width + "px";
  85 + dom.style.height = height + "px";
78 86 },
79 87 create() {
80 88 let options = {};
81   - console.log(this.$refs.containerId)
82 89 console.log("hasAudio " + this.hasAudio)
83 90  
84 91 this.jessibuca = new window.Jessibuca(Object.assign(
85 92 {
86   - container: this.$refs.containerId,
  93 + container: this.$refs.container,
87 94 videoBuffer: 0.2, // 最大缓冲时长,单位秒
88 95 isResize: true,
89 96 decoder: "static/js/jessibuca/decoder.js",
... ... @@ -240,7 +247,7 @@ export default {
240 247 this.jessibuca.destroy();
241 248 }
242 249 if (document.getElementById("buttonsBox") == null) {
243   - document.getElementById("container").appendChild(this.btnDom)
  250 + this.$refs.container.appendChild(this.btnDom)
244 251 }
245 252 this.jessibuca = null;
246 253 this.playing = false;
... ...
web_src/src/components/devicePosition.vue
... ... @@ -14,13 +14,14 @@
14 14 <div ref="infobox" v-if="channel != null " >
15 15 <div v-if="channel != null" class="infobox-content">
16 16 <el-descriptions class="margin-top" :title="channel.name" :column="1" :colon="true" size="mini" :labelStyle="labelStyle" >
17   - <el-descriptions-item label="生产厂商">{{channel.manufacture}}</el-descriptions-item>
  17 + <el-descriptions-item label="编号" >{{channel.channelId}}</el-descriptions-item>
18 18 <el-descriptions-item label="型号">{{channel.model}}</el-descriptions-item>
19   - <el-descriptions-item label="设备归属" >{{channel.owner}}</el-descriptions-item>
  19 + <el-descriptions-item label="经纬度" >{{channel.longitude}},{{channel.latitude}}</el-descriptions-item>
  20 + <el-descriptions-item label="生产厂商">{{channel.manufacture}}</el-descriptions-item>
20 21 <el-descriptions-item label="行政区域" >{{channel.civilCode}}</el-descriptions-item>
  22 + <el-descriptions-item label="设备归属" >{{channel.owner}}</el-descriptions-item>
21 23 <el-descriptions-item label="安装地址" >{{channel.address == null?'未知': channel.address}}</el-descriptions-item>
22 24 <el-descriptions-item label="云台类型" >{{channel.ptztypeText}}</el-descriptions-item>
23   - <el-descriptions-item label="经纬度" >{{channel.longitude}},{{channel.latitude}}</el-descriptions-item>
24 25 <el-descriptions-item label="状态">
25 26 <el-tag size="small" v-if="channel.status === 1">在线</el-tag>
26 27 <el-tag size="small" type="info" v-if="channel.status === 0">离线</el-tag>
... ... @@ -75,7 +76,7 @@ export default {
75 76 console.log(this.$route.query.deviceId)
76 77 // this.$refs.deviceTree.openByDeivceId(this.$route.query.deivceId)
77 78 setTimeout(()=>{ // 延迟以等待地图加载完成 TODO 后续修改为通过是实际这;状态加回调完成
78   - this.deviceService.getAllChannel(false, this.$route.query.deviceId, this.channelsHandler)
  79 + this.deviceService.getAllChannel(false, false, this.$route.query.deviceId, this.channelsHandler)
79 80 }, 1000)
80 81  
81 82 }
... ... @@ -141,7 +142,13 @@ export default {
141 142 zIndex: 3000, // 菜单样式 z-index
142 143 });
143 144 } else {
144   - this.deviceOrSubChannelMenu(event, data)
  145 + if (typeof data.channelId === "undefined") {
  146 + this.deviceOrSubChannelMenu(event, data)
  147 + }else {
  148 + // TODO 子目录暂时不支持查询他下面所有设备, 支持支持查询直属于这个目录的设备
  149 + this.deviceOrSubChannelMenu(event, data)
  150 + }
  151 +
145 152 }
146 153  
147 154 },
... ... @@ -155,7 +162,7 @@ export default {
155 162 disabled: false,
156 163 onClick: () => {
157 164 if (!data.channelId) {
158   - this.deviceService.getAllChannel(false, data.deviceId, this.channelsHandler)
  165 + this.deviceService.getAllChannel(false, false, data.deviceId, this.channelsHandler)
159 166 }
160 167 if (data.channelId && data.subCount > 0) {
161 168 // 点击子目录
... ...
web_src/src/components/live.vue
... ... @@ -15,10 +15,10 @@
15 15 <div style="width: 99%;height: 85vh;display: flex;flex-wrap: wrap;background-color: #000;">
16 16 <div v-for="i in spilt" :key="i" class="play-box"
17 17 :style="liveStyle" :class="{redborder:playerIdx == (i-1)}"
18   - @click="playerIdx = (i-1)"
19   - >
  18 + @click="playerIdx = (i-1)">
20 19 <div v-if="!videoUrl[i-1]" style="color: #ffffff;font-size: 30px;font-weight: bold;">{{ i }}</div>
21   - <player v-else :videoUrl="videoUrl[i-1]" fluent autoplay @screenshot="shot" @destroy="destroy"/>
  20 + <player ref="player" v-else :videoUrl="videoUrl[i-1]" fluent autoplay @screenshot="shot"
  21 + @destroy="destroy"/>
22 22 </div>
23 23 </div>
24 24 </el-main>
... ... @@ -60,13 +60,22 @@ export default {
60 60  
61 61 computed: {
62 62 liveStyle() {
63   - if (this.spilt == 1) {
64   - return {width: '100%', height: '100%'}
65   - } else if (this.spilt == 4) {
66   - return {width: '49%', height: '49%'}
67   - } else if (this.spilt == 9) {
68   - return {width: '32%', height: '32%'}
  63 + let style = {width: '100%', height: '100%'}
  64 + switch (this.spilt) {
  65 + case 4:
  66 + style = {width: '49%', height: '49%'}
  67 + break
  68 + case 9:
  69 + style = {width: '32%', height: '32%'}
  70 + break
69 71 }
  72 + this.$nextTick(() => {
  73 + for (let i = 0; i < this.spilt; i++) {
  74 + const player = this.$refs.player
  75 + player && player[i] && player[i].updatePlayerDomSize()
  76 + }
  77 + })
  78 + return style
70 79 }
71 80 },
72 81 watch: {
... ...
web_src/src/components/service/DeviceService.js
... ... @@ -45,20 +45,20 @@ class DeviceService{
45 45 }
46 46  
47 47  
48   - getAllChannel(isCatalog, deviceId, callback, errorCallback) {
  48 + getAllChannel(isCatalog, catalogUnderDevice, deviceId, callback, errorCallback) {
49 49 let currentPage = 1;
50 50 let count = 100;
51 51 let catalogList = []
52   - this.getAllChannelIteration(isCatalog, deviceId, catalogList, currentPage, count, callback, errorCallback)
  52 + this.getAllChannelIteration(isCatalog, catalogUnderDevice, deviceId, catalogList, currentPage, count, callback, errorCallback)
53 53 }
54 54  
55   - getAllChannelIteration(isCatalog, deviceId, catalogList, currentPage, count, callback, errorCallback) {
56   - this.getChanel(isCatalog, deviceId, currentPage, count, (data) => {
  55 + getAllChannelIteration(isCatalog, catalogUnderDevice, deviceId, catalogList, currentPage, count, callback, errorCallback) {
  56 + this.getChanel(isCatalog, catalogUnderDevice, deviceId, currentPage, count, (data) => {
57 57 if (data.list) {
58 58 catalogList = catalogList.concat(data.list);
59 59 if (catalogList.length < data.total) {
60 60 currentPage ++
61   - this.getAllChannelIteration(isCatalog, deviceId, catalogList, currentPage, count, callback, errorCallback)
  61 + this.getAllChannelIteration(isCatalog,catalogUnderDevice, deviceId, catalogList, currentPage, count, callback, errorCallback)
62 62 }else {
63 63 console.log(1)
64 64 if (typeof (callback) == "function") callback(catalogList)
... ... @@ -66,7 +66,7 @@ class DeviceService{
66 66 }
67 67 }, errorCallback)
68 68 }
69   - getChanel(isCatalog, deviceId, currentPage, count, callback, errorCallback) {
  69 + getChanel(isCatalog, catalogUnderDevice, deviceId, currentPage, count, callback, errorCallback) {
70 70 this.$axios({
71 71 method: 'get',
72 72 url: `/api/device/query/devices/${deviceId}/channels`,
... ... @@ -75,7 +75,8 @@ class DeviceService{
75 75 count: count,
76 76 query: "",
77 77 online: "",
78   - channelType: isCatalog
  78 + channelType: isCatalog,
  79 + catalogUnderDevice: catalogUnderDevice
79 80 }
80 81 }).then((res) =>{
81 82 if (typeof (callback) == "function") callback(res.data)
... ...