Commit 2d4bbbea8e40488ca07662a022c33bc36ee038fa

Authored by 648540858
1 parent e8b76617

优化更新通道的civicode判断

src/main/java/com/genersoft/iot/vmp/gb28181/utils/XmlUtil.java
... ... @@ -8,6 +8,7 @@ import com.genersoft.iot.vmp.gb28181.bean.Device;
8 8 import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
9 9 import com.genersoft.iot.vmp.gb28181.event.subscribe.catalog.CatalogEvent;
10 10 import com.genersoft.iot.vmp.utils.DateUtil;
  11 +import org.apache.commons.lang3.math.NumberUtils;
11 12 import org.dom4j.Attribute;
12 13 import org.dom4j.Document;
13 14 import org.dom4j.DocumentException;
... ... @@ -317,7 +318,6 @@ public class XmlUtil {
317 318 deviceChannel.setBusinessGroupId(businessGroupID);
318 319 }
319 320  
320   -
321 321 if (!ObjectUtils.isEmpty(parentID)) {
322 322 if (parentID.contains("/")) {
323 323 String[] parentIdArray = parentID.split("/");
... ... @@ -341,7 +341,11 @@ public class XmlUtil {
341 341 if (!ObjectUtils.isEmpty(owner)) {
342 342 deviceChannel.setOwner(owner);
343 343 }
344   - if (!ObjectUtils.isEmpty(civilCode)) {
  344 + if (!ObjectUtils.isEmpty(civilCode)
  345 + && civilCode.length() <= 8
  346 + && NumberUtils.isParsable(civilCode)
  347 + && Integer.parseInt(civilCode)%2 == 0
  348 + ) {
345 349 deviceChannel.setCivilCode(civilCode);
346 350 }
347 351 if (!ObjectUtils.isEmpty(businessGroupID)) {
... ... @@ -387,8 +391,8 @@ public class XmlUtil {
387 391 if (!ObjectUtils.isEmpty(businessGroupID)) {
388 392 deviceChannel.setParentId(businessGroupID);
389 393 }else {
390   - if (!ObjectUtils.isEmpty(civilCode)) {
391   - deviceChannel.setParentId(civilCode);
  394 + if (!ObjectUtils.isEmpty(deviceChannel.getCivilCode())) {
  395 + deviceChannel.setParentId(deviceChannel.getCivilCode());
392 396 }
393 397 }
394 398 }
... ...