From 324fef2908ae1e74842135f5c8453ef0c980bcec Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: Mon, 1 Jul 2024 17:59:14 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=B4=E6=97=B6=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../iot/vmp/gb28181/bean/CommonGBChannel.java | 15 +++++++++++++++ .../iot/vmp/gb28181/bean/DeviceChannel.java | 2 ++ .../cmd/impl/SIPCommanderFroPlatform.java | 14 +++++++------- 3 files changed, 24 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/CommonGBChannel.java b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/CommonGBChannel.java index 58fc471f..026b999a 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/CommonGBChannel.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/CommonGBChannel.java @@ -1,5 +1,6 @@ package com.genersoft.iot.vmp.gb28181.bean; +import com.genersoft.iot.vmp.gb28181.event.subscribe.catalog.CatalogEvent; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; @@ -202,5 +203,19 @@ public class CommonGBChannel { @Schema(description = "关联的拉流代理Id(流来源是拉流代理时有效)") private Integer streamProxyId; + public String encode(CatalogEvent event){ + String content; + if (event.getType().equals(CatalogEvent.DEL) + || event.getType().equals(CatalogEvent.DEFECT) + || event.getType().equals(CatalogEvent.VLOST)) { + content = "\n" + + "" + this.getGbDeviceId() + "\n" + + "" + event + "\r\n" + + ""; + } + + + return content; + } } diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/DeviceChannel.java b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/DeviceChannel.java index 09f28785..52696661 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/DeviceChannel.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/DeviceChannel.java @@ -230,4 +230,6 @@ public class DeviceChannel extends CommonGBChannel { deviceChannel.setDeviceId(deviceElement.getText()); return deviceChannel; } + + } 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 6a6bfcf5..d42d4ddf 100755 --- 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 @@ -223,19 +223,19 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform { } catalogXml.append("\r\n"); // 行政区划分组只需要这两项就可以 - catalogXml.append("" + channel.getChannelId() + "\r\n"); + catalogXml.append("" + channel.getGbDeviceId() + "\r\n"); catalogXml.append("" + channel.getName() + "\r\n"); - if (channel.getChannelId().length() <= 8) { + if (channel.getGbDeviceId().length() <= 8) { catalogXml.append("\r\n"); continue; }else { - if (channel.getChannelId().length() != 20) { + if (channel.getGbDeviceId().length() != 20) { catalogXml.append("\r\n"); - logger.warn("[编号长度异常] {} 长度错误,请使用20位长度的国标编号,当前长度:{}", channel.getChannelId(), channel.getChannelId().length()); + logger.warn("[编号长度异常] {} 长度错误,请使用20位长度的国标编号,当前长度:{}", channel.getGbDeviceId(), channel.getChannelId().length()); catalogXml.append("\r\n"); continue; } - switch (Integer.parseInt(channel.getChannelId().substring(10, 13))){ + switch (Integer.parseInt(channel.getGbDeviceId().substring(10, 13))){ case 200: // catalogXml.append("三永华通\r\n"); // GitUtil gitUtil = SpringBeanFactory.getBean("gitUtil"); @@ -271,8 +271,8 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform { break; default: // 通道项 - if (channel.getManufacture() != null) { - catalogXml.append("" + channel.getManufacture() + "\r\n"); + if (channel.getManufacturer() != null) { + catalogXml.append("" + channel.getManufacturer() + "\r\n"); }else { catalogXml.append("\r\n"); }