Commit 26ca854db578b11d2dbcc475cf475c314cb08ba6
1 parent
2bb7e236
bugfix:去掉目录订阅通知处理重复逻辑代码
Showing
1 changed file
with
0 additions
and
109 deletions
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/NotifyRequestProcessor.java
| @@ -132,7 +132,6 @@ public class NotifyRequestProcessor extends SIPRequestProcessorParent implements | @@ -132,7 +132,6 @@ public class NotifyRequestProcessor extends SIPRequestProcessorParent implements | ||
| 132 | 132 | ||
| 133 | if (CmdType.CATALOG.equals(cmd)) { | 133 | if (CmdType.CATALOG.equals(cmd)) { |
| 134 | logger.info("接收到Catalog通知"); | 134 | logger.info("接收到Catalog通知"); |
| 135 | - processNotifyCatalogList(take.getEvt()); | ||
| 136 | notifyRequestForCatalogProcessor.process(take.getEvt()); | 135 | notifyRequestForCatalogProcessor.process(take.getEvt()); |
| 137 | } else if (CmdType.ALARM.equals(cmd)) { | 136 | } else if (CmdType.ALARM.equals(cmd)) { |
| 138 | logger.info("接收到Alarm通知"); | 137 | logger.info("接收到Alarm通知"); |
| @@ -371,114 +370,6 @@ public class NotifyRequestProcessor extends SIPRequestProcessorParent implements | @@ -371,114 +370,6 @@ public class NotifyRequestProcessor extends SIPRequestProcessorParent implements | ||
| 371 | } | 370 | } |
| 372 | } | 371 | } |
| 373 | 372 | ||
| 374 | - /*** | ||
| 375 | - * 处理catalog设备目录列表Notify | ||
| 376 | - * | ||
| 377 | - * @param evt | ||
| 378 | - */ | ||
| 379 | - private void processNotifyCatalogList(RequestEvent evt) { | ||
| 380 | - try { | ||
| 381 | - FromHeader fromHeader = (FromHeader) evt.getRequest().getHeader(FromHeader.NAME); | ||
| 382 | - String deviceId = SipUtils.getUserIdFromFromHeader(fromHeader); | ||
| 383 | - | ||
| 384 | - Device device = redisCatchStorage.getDevice(deviceId); | ||
| 385 | - if (device == null || !device.isOnLine()) { | ||
| 386 | - logger.warn("[收到目录订阅]:{}, 但是设备已经离线", (device != null ? device.getDeviceId():"" )); | ||
| 387 | - return; | ||
| 388 | - } | ||
| 389 | - Element rootElement = getRootElement(evt, device.getCharset()); | ||
| 390 | - if (rootElement == null) { | ||
| 391 | - logger.warn("[ 收到目录订阅 ] content cannot be null, {}", evt.getRequest()); | ||
| 392 | - return; | ||
| 393 | - } | ||
| 394 | - Element deviceListElement = rootElement.element("DeviceList"); | ||
| 395 | - if (deviceListElement == null) { | ||
| 396 | - return; | ||
| 397 | - } | ||
| 398 | - Iterator<Element> deviceListIterator = deviceListElement.elementIterator(); | ||
| 399 | - if (deviceListIterator != null) { | ||
| 400 | - | ||
| 401 | - // 遍历DeviceList | ||
| 402 | - while (deviceListIterator.hasNext()) { | ||
| 403 | - Element itemDevice = deviceListIterator.next(); | ||
| 404 | - Element channelDeviceElement = itemDevice.element("DeviceID"); | ||
| 405 | - if (channelDeviceElement == null) { | ||
| 406 | - continue; | ||
| 407 | - } | ||
| 408 | - Element eventElement = itemDevice.element("Event"); | ||
| 409 | - String event; | ||
| 410 | - if (eventElement == null) { | ||
| 411 | - logger.warn("[收到目录订阅]:{}, 但是Event为空, 设为默认值 ADD", (device != null ? device.getDeviceId():"" )); | ||
| 412 | - event = CatalogEvent.ADD; | ||
| 413 | - }else { | ||
| 414 | - event = eventElement.getText().toUpperCase(); | ||
| 415 | - } | ||
| 416 | - DeviceChannel channel = XmlUtil.channelContentHandler(itemDevice, device, event, civilCodeFileConf); | ||
| 417 | - if (channel == null) { | ||
| 418 | - logger.info("[收到目录订阅]:但是解析失败 {}", new String(evt.getRequest().getRawContent())); | ||
| 419 | - continue; | ||
| 420 | - } | ||
| 421 | - if (channel.getParentId() != null && channel.getParentId().equals(sipConfig.getId())) { | ||
| 422 | - channel.setParentId(null); | ||
| 423 | - } | ||
| 424 | - channel.setDeviceId(device.getDeviceId()); | ||
| 425 | - logger.info("[收到目录订阅]:{}/{}", device.getDeviceId(), channel.getChannelId()); | ||
| 426 | - switch (event) { | ||
| 427 | - case CatalogEvent.ON: | ||
| 428 | - // 上线 | ||
| 429 | - logger.info("[收到通道上线通知] 来自设备: {}, 通道 {}", device.getDeviceId(), channel.getChannelId()); | ||
| 430 | - storager.deviceChannelOnline(deviceId, channel.getChannelId()); | ||
| 431 | - break; | ||
| 432 | - case CatalogEvent.OFF : | ||
| 433 | - // 离线 | ||
| 434 | - logger.info("[收到通道离线通知] 来自设备: {}, 通道 {}", device.getDeviceId(), channel.getChannelId()); | ||
| 435 | - if (userSetting.getRefuseChannelStatusChannelFormNotify()) { | ||
| 436 | - storager.deviceChannelOffline(deviceId, channel.getChannelId()); | ||
| 437 | - }else { | ||
| 438 | - logger.info("[收到通道离线通知] 但是平台已配置拒绝此消息,来自设备: {}, 通道 {}", device.getDeviceId(), channel.getChannelId()); | ||
| 439 | - } | ||
| 440 | - break; | ||
| 441 | - case CatalogEvent.VLOST: | ||
| 442 | - // 视频丢失 | ||
| 443 | - logger.info("[收到通道视频丢失通知] 来自设备: {}, 通道 {}", device.getDeviceId(), channel.getChannelId()); | ||
| 444 | - if (userSetting.getRefuseChannelStatusChannelFormNotify()) { | ||
| 445 | - storager.deviceChannelOffline(deviceId, channel.getChannelId()); | ||
| 446 | - }else { | ||
| 447 | - logger.info("[收到通道视频丢失通知] 但是平台已配置拒绝此消息,来自设备: {}, 通道 {}", device.getDeviceId(), channel.getChannelId()); | ||
| 448 | - } | ||
| 449 | - break; | ||
| 450 | - case CatalogEvent.DEFECT: | ||
| 451 | - // 故障 | ||
| 452 | - break; | ||
| 453 | - case CatalogEvent.ADD: | ||
| 454 | - // 增加 | ||
| 455 | - logger.info("[收到增加通道通知] 来自设备: {}, 通道 {}", device.getDeviceId(), channel.getChannelId()); | ||
| 456 | - deviceChannelService.updateChannel(deviceId, channel); | ||
| 457 | - break; | ||
| 458 | - case CatalogEvent.DEL: | ||
| 459 | - // 删除 | ||
| 460 | - logger.info("[收到删除通道通知] 来自设备: {}, 通道 {}", device.getDeviceId(), channel.getChannelId()); | ||
| 461 | - storager.delChannel(deviceId, channel.getChannelId()); | ||
| 462 | - break; | ||
| 463 | - case CatalogEvent.UPDATE: | ||
| 464 | - // 更新 | ||
| 465 | - logger.info("[收到更新通道通知] 来自设备: {}, 通道 {}", device.getDeviceId(), channel.getChannelId()); | ||
| 466 | - deviceChannelService.updateChannel(deviceId, channel); | ||
| 467 | - break; | ||
| 468 | - default: | ||
| 469 | - logger.warn("[ NotifyCatalog ] event not found : {}", event ); | ||
| 470 | - | ||
| 471 | - } | ||
| 472 | - // 转发变化信息 | ||
| 473 | - eventPublisher.catalogEventPublish(null, channel, event); | ||
| 474 | - | ||
| 475 | - } | ||
| 476 | - } | ||
| 477 | - } catch (DocumentException e) { | ||
| 478 | - logger.error("未处理的异常 ", e); | ||
| 479 | - } | ||
| 480 | - } | ||
| 481 | - | ||
| 482 | public void setCmder(SIPCommander cmder) { | 373 | public void setCmder(SIPCommander cmder) { |
| 483 | } | 374 | } |
| 484 | 375 |