From ef58f29cfc501828d7a4cfc514c298aa9377e692 Mon Sep 17 00:00:00 2001 From: xiaoQQya Date: Tue, 19 Dec 2023 10:07:48 +0800 Subject: [PATCH] =?UTF-8?q?perf(catlog):=20=E4=BC=98=E5=8C=96=E5=90=8C?= =?UTF-8?q?=E6=AD=A5=E9=80=9A=E9=81=93=E6=97=B6=E9=80=9A=E9=81=93=E5=90=8D?= =?UTF-8?q?=E7=A7=B0=E7=9A=84=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 通道名称为空时,默认使用通道编码作为通道名称,避免级联时因通道名称为空导致上级接收通道失败 --- .../java/com/genersoft/iot/vmp/gb28181/utils/XmlUtil.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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 e614b9fd..14640d80 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 @@ -8,6 +8,7 @@ import com.genersoft.iot.vmp.gb28181.bean.Device; import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel; import com.genersoft.iot.vmp.gb28181.event.subscribe.catalog.CatalogEvent; import com.genersoft.iot.vmp.utils.DateUtil; +import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.math.NumberUtils; import org.dom4j.Attribute; import org.dom4j.Document; @@ -214,8 +215,11 @@ public class XmlUtil { return deviceChannel; } Element nameElement = itemDevice.element("Name"); - if (nameElement != null) { + // 当通道名称为空时,设置通道名称为通道编码,避免级联时因通道名称为空导致上级接收通道失败 + if (nameElement != null && StringUtils.isNotBlank(nameElement.getText())) { deviceChannel.setName(nameElement.getText()); + } else { + deviceChannel.setName(channelId); } if(channelId.length() <= 8) { deviceChannel.setHasAudio(false);