Commit 2d4bbbea8e40488ca07662a022c33bc36ee038fa
1 parent
e8b76617
优化更新通道的civicode判断
Showing
1 changed file
with
8 additions
and
4 deletions
src/main/java/com/genersoft/iot/vmp/gb28181/utils/XmlUtil.java
| @@ -8,6 +8,7 @@ import com.genersoft.iot.vmp.gb28181.bean.Device; | @@ -8,6 +8,7 @@ import com.genersoft.iot.vmp.gb28181.bean.Device; | ||
| 8 | import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel; | 8 | import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel; |
| 9 | import com.genersoft.iot.vmp.gb28181.event.subscribe.catalog.CatalogEvent; | 9 | import com.genersoft.iot.vmp.gb28181.event.subscribe.catalog.CatalogEvent; |
| 10 | import com.genersoft.iot.vmp.utils.DateUtil; | 10 | import com.genersoft.iot.vmp.utils.DateUtil; |
| 11 | +import org.apache.commons.lang3.math.NumberUtils; | ||
| 11 | import org.dom4j.Attribute; | 12 | import org.dom4j.Attribute; |
| 12 | import org.dom4j.Document; | 13 | import org.dom4j.Document; |
| 13 | import org.dom4j.DocumentException; | 14 | import org.dom4j.DocumentException; |
| @@ -317,7 +318,6 @@ public class XmlUtil { | @@ -317,7 +318,6 @@ public class XmlUtil { | ||
| 317 | deviceChannel.setBusinessGroupId(businessGroupID); | 318 | deviceChannel.setBusinessGroupId(businessGroupID); |
| 318 | } | 319 | } |
| 319 | 320 | ||
| 320 | - | ||
| 321 | if (!ObjectUtils.isEmpty(parentID)) { | 321 | if (!ObjectUtils.isEmpty(parentID)) { |
| 322 | if (parentID.contains("/")) { | 322 | if (parentID.contains("/")) { |
| 323 | String[] parentIdArray = parentID.split("/"); | 323 | String[] parentIdArray = parentID.split("/"); |
| @@ -341,7 +341,11 @@ public class XmlUtil { | @@ -341,7 +341,11 @@ public class XmlUtil { | ||
| 341 | if (!ObjectUtils.isEmpty(owner)) { | 341 | if (!ObjectUtils.isEmpty(owner)) { |
| 342 | deviceChannel.setOwner(owner); | 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 | deviceChannel.setCivilCode(civilCode); | 349 | deviceChannel.setCivilCode(civilCode); |
| 346 | } | 350 | } |
| 347 | if (!ObjectUtils.isEmpty(businessGroupID)) { | 351 | if (!ObjectUtils.isEmpty(businessGroupID)) { |
| @@ -387,8 +391,8 @@ public class XmlUtil { | @@ -387,8 +391,8 @@ public class XmlUtil { | ||
| 387 | if (!ObjectUtils.isEmpty(businessGroupID)) { | 391 | if (!ObjectUtils.isEmpty(businessGroupID)) { |
| 388 | deviceChannel.setParentId(businessGroupID); | 392 | deviceChannel.setParentId(businessGroupID); |
| 389 | }else { | 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 | } |