| | |
| | | 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;
|
| | |
| | | }else {
|
| | | logger.warn("[xml解析] 无法确定行政区划{}的上级行政区划", channelId);
|
| | | }
|
| | | deviceChannel.setStatus(1);
|
| | | deviceChannel.setStatus(true);
|
| | | return deviceChannel;
|
| | | }else {
|
| | | if(channelId.length() != 20) {
|
| | |
| | | if (!ObjectUtils.isEmpty(address)) {
|
| | | deviceChannel.setAddress(address);
|
| | | }
|
| | | deviceChannel.setStatus(1);
|
| | | deviceChannel.setStatus(true);
|
| | | if (!ObjectUtils.isEmpty(registerWay)) {
|
| | | try {
|
| | | deviceChannel.setRegisterWay(Integer.parseInt(registerWay));
|
| | |
| | | return deviceChannel;
|
| | | case 215:
|
| | | // 业务分组
|
| | | deviceChannel.setStatus(1);
|
| | | deviceChannel.setStatus(true);
|
| | | if (!ObjectUtils.isEmpty(parentID)) {
|
| | | if (!parentID.trim().equalsIgnoreCase(device.getDeviceId())) {
|
| | | deviceChannel.setParentId(parentID);
|
| | |
| | | break;
|
| | | case 216:
|
| | | // 虚拟组织
|
| | | deviceChannel.setStatus(1);
|
| | | deviceChannel.setStatus(true);
|
| | | if (!ObjectUtils.isEmpty(businessGroupID)) {
|
| | | deviceChannel.setBusinessGroupId(businessGroupID);
|
| | | }
|
| | |
|
| | |
|
| | | if (!ObjectUtils.isEmpty(parentID)) {
|
| | | if (parentID.contains("/")) {
|
| | |
| | | if (!ObjectUtils.isEmpty(owner)) {
|
| | | deviceChannel.setOwner(owner);
|
| | | }
|
| | | if (!ObjectUtils.isEmpty(civilCode)) {
|
| | | if (!ObjectUtils.isEmpty(civilCode)
|
| | | && civilCode.length() <= 8
|
| | | && NumberUtils.isParsable(civilCode)
|
| | | && civilCode.length()%2 == 0
|
| | | ) {
|
| | | deviceChannel.setCivilCode(civilCode);
|
| | | }
|
| | | if (!ObjectUtils.isEmpty(businessGroupID)) {
|
| | |
| | | }
|
| | | }
|
| | | // 父设备/区域/系统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解析] 不规范的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());
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | if (status != null) {
|
| | | // ONLINE OFFLINE HIKVISION DS-7716N-E4 NVR的兼容性处理
|
| | | if (status.equals("ON") || status.equals("On") || status.equals("ONLINE") || status.equals("OK")) {
|
| | | deviceChannel.setStatus(1);
|
| | | deviceChannel.setStatus(true);
|
| | | }
|
| | | if (status.equals("OFF") || status.equals("Off") || status.equals("OFFLINE")) {
|
| | | deviceChannel.setStatus(0);
|
| | | deviceChannel.setStatus(false);
|
| | | }
|
| | | }else {
|
| | | deviceChannel.setStatus(1);
|
| | | deviceChannel.setStatus(true);
|
| | | }
|
| | |
|
| | | // 经度
|