From 2d4bbbea8e40488ca07662a022c33bc36ee038fa Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: Thu, 29 Jun 2023 17:10:14 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=9B=B4=E6=96=B0=E9=80=9A?= =?UTF-8?q?=E9=81=93=E7=9A=84civicode=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/genersoft/iot/vmp/gb28181/utils/XmlUtil.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 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 7914ffac..a83e7c9f 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.math.NumberUtils; import org.dom4j.Attribute; import org.dom4j.Document; import org.dom4j.DocumentException; @@ -317,7 +318,6 @@ public class XmlUtil { deviceChannel.setBusinessGroupId(businessGroupID); } - if (!ObjectUtils.isEmpty(parentID)) { if (parentID.contains("/")) { String[] parentIdArray = parentID.split("/"); @@ -341,7 +341,11 @@ public class XmlUtil { 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)) { @@ -387,8 +391,8 @@ public class XmlUtil { if (!ObjectUtils.isEmpty(businessGroupID)) { deviceChannel.setParentId(businessGroupID); }else { - if (!ObjectUtils.isEmpty(civilCode)) { - deviceChannel.setParentId(civilCode); + if (!ObjectUtils.isEmpty(deviceChannel.getCivilCode())) { + deviceChannel.setParentId(deviceChannel.getCivilCode()); } } }