From 468e2b2ffbbb4e15dea11d1f9c7451a8097a3ab8 Mon Sep 17 00:00:00 2001 From: xiaoQQya <xiaoQQya@126.com> Date: 星期日, 09 七月 2023 20:22:40 +0800 Subject: [PATCH] fix(play): 修复作为上级平台点播截取快照问题 --- src/main/java/com/genersoft/iot/vmp/gb28181/utils/XmlUtil.java | 25 +++++++++++++++++-------- 1 files changed, 17 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 7914ffa..a08231c 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.DeviceChannel; import com.genersoft.iot.vmp.gb28181.event.subscribe.catalog.CatalogEvent; import com.genersoft.iot.vmp.utils.DateUtil; +import org.apache.commons.lang3.math.NumberUtils; import org.dom4j.Attribute; import org.dom4j.Document; import org.dom4j.DocumentException; @@ -317,7 +318,6 @@ deviceChannel.setBusinessGroupId(businessGroupID); } - if (!ObjectUtils.isEmpty(parentID)) { if (parentID.contains("/")) { String[] parentIdArray = parentID.split("/"); @@ -341,7 +341,11 @@ if (!ObjectUtils.isEmpty(owner)) { deviceChannel.setOwner(owner); } - if (!ObjectUtils.isEmpty(civilCode)) { + if (!ObjectUtils.isEmpty(civilCode) + && civilCode.length() <= 8 + && NumberUtils.isParsable(civilCode) + && Integer.parseInt(civilCode)%2 == 0 + ) { deviceChannel.setCivilCode(civilCode); } if (!ObjectUtils.isEmpty(businessGroupID)) { @@ -376,19 +380,24 @@ } } // 鐖惰澶�/鍖哄煙/绯荤粺ID - String realParentId = parentID; - if (!ObjectUtils.isEmpty(parentID)) { + + if (!ObjectUtils.isEmpty(parentID) ) { if (parentID.contains("/")) { String[] parentIdArray = parentID.split("/"); - realParentId = parentIdArray[parentIdArray.length - 1]; + deviceChannel.setParentId(parentIdArray[parentIdArray.length - 1]); + }else { + if (parentID.length()%2 == 0) { + deviceChannel.setParentId(parentID); + }else { + logger.warn("[xml瑙f瀽] 涓嶈鑼冪殑parentID锛歿}, 宸茶垗寮�", parentID); + } } - deviceChannel.setParentId(realParentId); }else { if (!ObjectUtils.isEmpty(businessGroupID)) { deviceChannel.setParentId(businessGroupID); }else { - if (!ObjectUtils.isEmpty(civilCode)) { - deviceChannel.setParentId(civilCode); + if (!ObjectUtils.isEmpty(deviceChannel.getCivilCode())) { + deviceChannel.setParentId(deviceChannel.getCivilCode()); } } } -- Gitblit v1.8.0