优化更新通道的civicode判断

pull/939/head
648540858 2023-06-29 17:10:14 +08:00
parent e8b766172e
commit 2d4bbbea8e
1 changed files with 8 additions and 4 deletions

View File

@ -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.bean.DeviceChannel;
import com.genersoft.iot.vmp.gb28181.event.subscribe.catalog.CatalogEvent; import com.genersoft.iot.vmp.gb28181.event.subscribe.catalog.CatalogEvent;
import com.genersoft.iot.vmp.utils.DateUtil; import com.genersoft.iot.vmp.utils.DateUtil;
import org.apache.commons.lang3.math.NumberUtils;
import org.dom4j.Attribute; import org.dom4j.Attribute;
import org.dom4j.Document; import org.dom4j.Document;
import org.dom4j.DocumentException; import org.dom4j.DocumentException;
@ -317,7 +318,6 @@ public class XmlUtil {
deviceChannel.setBusinessGroupId(businessGroupID); deviceChannel.setBusinessGroupId(businessGroupID);
} }
if (!ObjectUtils.isEmpty(parentID)) { if (!ObjectUtils.isEmpty(parentID)) {
if (parentID.contains("/")) { if (parentID.contains("/")) {
String[] parentIdArray = parentID.split("/"); String[] parentIdArray = parentID.split("/");
@ -341,7 +341,11 @@ public class XmlUtil {
if (!ObjectUtils.isEmpty(owner)) { if (!ObjectUtils.isEmpty(owner)) {
deviceChannel.setOwner(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); deviceChannel.setCivilCode(civilCode);
} }
if (!ObjectUtils.isEmpty(businessGroupID)) { if (!ObjectUtils.isEmpty(businessGroupID)) {
@ -387,8 +391,8 @@ public class XmlUtil {
if (!ObjectUtils.isEmpty(businessGroupID)) { if (!ObjectUtils.isEmpty(businessGroupID)) {
deviceChannel.setParentId(businessGroupID); deviceChannel.setParentId(businessGroupID);
}else { }else {
if (!ObjectUtils.isEmpty(civilCode)) { if (!ObjectUtils.isEmpty(deviceChannel.getCivilCode())) {
deviceChannel.setParentId(civilCode); deviceChannel.setParentId(deviceChannel.getCivilCode());
} }
} }
} }