From 1484c141302c32bf0caf3fda140f72cfa062ccaf Mon Sep 17 00:00:00 2001 From: TouXin <itouxin@outlook.com> Date: 星期二, 26 四月 2022 14:32:02 +0800 Subject: [PATCH] Update DOCKERFILE --- src/main/java/com/genersoft/iot/vmp/gb28181/utils/XmlUtil.java | 24 ++++++++++++++++-------- 1 files changed, 16 insertions(+), 8 deletions(-) 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 ba6eed5..6ae09bd 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 @@ -20,8 +20,8 @@ /** * 鍩轰簬dom4j鐨勫伐鍏峰寘 - * - * + * + * */ public class XmlUtil { /** @@ -31,9 +31,9 @@ /** * 瑙f瀽XML涓篋ocument瀵硅薄 - * + * * @param xml 琚В鏋愮殑XMl - * + * * @return Document */ public static Element parseXml(String xml) { @@ -51,7 +51,7 @@ /** * 鑾峰彇element瀵硅薄鐨則ext鐨勫�� - * + * * @param em 鑺傜偣鐨勫璞� * @param tag 鑺傜偣鐨則ag * @return 鑺傜偣 @@ -62,12 +62,12 @@ } Element e = em.element(tag); // - return null == e ? null : e.getText(); + return null == e ? null : e.getText().trim(); } /** * 閫掑綊瑙f瀽xml鑺傜偣锛岄�傜敤浜� 澶氳妭鐐规暟鎹� - * + * * @param node node * @param nodeName nodeName * @return List<Map<String, Object>> @@ -106,7 +106,7 @@ /** * xml杞琷son - * + * * @param element * @param json */ @@ -211,6 +211,14 @@ deviceChannel.setParental(Integer.parseInt(XmlUtil.getText(itemDevice, "Parental"))); } 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); + }else { + deviceChannel.setParentId(parentId); + } + if (XmlUtil.getText(itemDevice, "SafetyWay") == null || XmlUtil.getText(itemDevice, "SafetyWay") == "") { deviceChannel.setSafetyWay(0); -- Gitblit v1.8.0