From ab491a079ba4ab85ffef35d14c0767eba01455d8 Mon Sep 17 00:00:00 2001
From: fuliqi <fuliqi@qq.com>
Date: 星期三, 15 一月 2025 09:18:36 +0800
Subject: [PATCH] 切正式服

---
 src/main/java/com/genersoft/iot/vmp/gb28181/utils/XmlUtil.java |   17 +++++++++--------
 1 files changed, 9 insertions(+), 8 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 41e0570..6596f53 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
@@ -3,10 +3,10 @@
 import com.alibaba.fastjson2.JSONArray;
 import com.alibaba.fastjson2.JSONObject;
 import com.genersoft.iot.vmp.common.CivilCodePo;
-import com.genersoft.iot.vmp.conf.CivilCodeFileConf;
 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.CivilCodeUtil;
 import com.genersoft.iot.vmp.utils.DateUtil;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.lang3.math.NumberUtils;
@@ -240,7 +240,7 @@
         CivilCode, BusinessGroup,VirtualOrganization,Other
     }
 
-    public static DeviceChannel channelContentHandler(Element itemDevice, Device device, String event, CivilCodeFileConf civilCodeFileConf){
+    public static DeviceChannel channelContentHandler(Element itemDevice, Device device, String event){
         DeviceChannel deviceChannel = new DeviceChannel();
         deviceChannel.setDeviceId(device.getDeviceId());
         Element channdelIdElement = itemDevice.element("DeviceID");
@@ -267,7 +267,7 @@
         }
         if(channelId.length() <= 8) {
             deviceChannel.setHasAudio(false);
-            CivilCodePo parentCode = civilCodeFileConf.getParentCode(channelId);
+            CivilCodePo parentCode = CivilCodeUtil.INSTANCE.getParentCode(channelId);
             if (parentCode != null) {
                 deviceChannel.setParentId(parentCode.getCode());
                 deviceChannel.setCivilCode(parentCode.getCode());
@@ -532,16 +532,17 @@
                     String status = getText(itemDevice, "Status");
                     if (status != null) {
                         // ONLINE OFFLINE HIKVISION DS-7716N-E4 NVR鐨勫吋瀹规�у鐞�
-                        if (status.equals("ON") || status.equals("On") || status.equals("ONLINE") || status.equals("OK")) {
+                        if (status.equalsIgnoreCase("ON") || status.equalsIgnoreCase("On") || status.equalsIgnoreCase("ONLINE") || status.equalsIgnoreCase("OK")) {
                             deviceChannel.setStatus(true);
                         }
-                        if (status.equals("OFF") || status.equals("Off") || status.equals("OFFLINE")) {
+                        if (status.equalsIgnoreCase("OFF") || status.equalsIgnoreCase("Off") || status.equalsIgnoreCase("OFFLINE")) {
                             deviceChannel.setStatus(false);
                         }
                     }else {
                         deviceChannel.setStatus(true);
                     }
-
+//                    logger.info("鐘舵�佸瓧绗︿覆锛� {}", status);
+//                    logger.info("鐘舵�佺粨鏋滐細 {}", deviceChannel.isStatus());
                     // 缁忓害
                     String longitude = getText(itemDevice, "Longitude");
                     if (NumericUtil.isDouble(longitude)) {
@@ -568,14 +569,14 @@
                         String ptzTypeFromInfo = XmlUtil.getText(info, "PTZType");
                         if(!ObjectUtils.isEmpty(ptzTypeFromInfo)){
                             try {
-                                deviceChannel.setPTZType(Integer.parseInt(ptzTypeFromInfo));
+                                deviceChannel.setPtzType(Integer.parseInt(ptzTypeFromInfo));
                             }catch (NumberFormatException e){
                                 logger.warn("[xml瑙f瀽] 浠庨�氶亾鏁版嵁info涓幏鍙朠TZType澶辫触锛� {}", ptzTypeFromInfo);
                             }
                         }
                     } else {
                         try {
-                            deviceChannel.setPTZType(Integer.parseInt(ptzType));
+                            deviceChannel.setPtzType(Integer.parseInt(ptzType));
                         }catch (NumberFormatException e){
                             logger.warn("[xml瑙f瀽] 浠庨�氶亾鏁版嵁涓幏鍙朠TZType澶辫触锛� {}", ptzType);
                         }

--
Gitblit v1.8.0