From 64efb660b2c119c00432434c0f651f8996483f18 Mon Sep 17 00:00:00 2001
From: fuliqi <fuliqi@qq.com>
Date: 星期五, 21 二月 2025 15:51:13 +0800
Subject: [PATCH] OSD大华数据格式+数据中心重点标签统计数

---
 ycl-server/src/main/java/com/ycl/api/HK/HKApi.java |   44 ++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 42 insertions(+), 2 deletions(-)

diff --git a/ycl-server/src/main/java/com/ycl/api/HK/HKApi.java b/ycl-server/src/main/java/com/ycl/api/HK/HKApi.java
index 4afd313..b6c5c17 100644
--- a/ycl-server/src/main/java/com/ycl/api/HK/HKApi.java
+++ b/ycl-server/src/main/java/com/ycl/api/HK/HKApi.java
@@ -3,6 +3,7 @@
 import com.ycl.platform.domain.result.OSDResult;
 import com.ycl.utils.StringUtils;
 import constant.ApiConstants;
+import enumeration.DeviceType;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.http.HttpResponse;
 import org.apache.http.auth.AuthScope;
@@ -32,12 +33,50 @@
 
 @Slf4j
 public class HKApi {
-    public static OSDResult getOsdByIP(String ip, String userName, String password) {
+    public static OSDResult getOsdByIP(String serialNumber, String ip, String userName, String password) {
         OSDResult osdResult = new OSDResult();
         String hostUrl = "http://" + ip;
         try {
             //鑾峰彇OSD
-            String OSDString = getHttpResponse(hostUrl + ApiConstants.HK_OSD_PATH, userName, password);
+            /**
+             * 閫氳繃鍥芥爣鍊掓暟绗竷浣嶅垽鏂�氶亾 0/鍏ㄦ櫙 1/缁嗚妭
+             * 瀵逛簬娴峰悍鏉ヨ锛� 鍥芥爣鍊�7 0/鍏ㄦ櫙/閫氶亾2 1/缁嗚妭/閫氶亾1
+             * 瀵逛簬澶у崕鏉ヨ锛� 鍥芥爣鍊�7 0/鍏ㄦ櫙/閫氶亾1 1/缁嗚妭/閫氶亾2
+             * 瀹囪鍗曢�氶亾涓嶈�冭檻
+             */
+            String OSDString = null;
+            if(StringUtils.isEmpty(serialNumber)) return null;
+            if(serialNumber.charAt(ApiConstants.SerialNumber_Channel) == ApiConstants.SerialNumber_All ) {
+                OSDString = getHttpResponse(hostUrl + ApiConstants.HK_OSD_PATH_2, userName, password);
+            }else if(serialNumber.charAt(ApiConstants.SerialNumber_Channel) == ApiConstants.SerialNumber_Detail){
+                OSDString = getHttpResponse(hostUrl + ApiConstants.HK_OSD_PATH_1, userName, password);
+            }
+            //閫氳繃璁惧绫诲瀷鍒ゆ柇锛堝純鐢級
+//            if(serialNumber.charAt(ApiConstants.SerialNumber_Category) == 1 ){
+//                //鏋満
+//                if(serialNumber.charAt(ApiConstants.SerialNumber_Channel) == 1){
+//                    OSDString = getHttpResponse(hostUrl + ApiConstants.HK_OSD_PATH_1, userName, password);
+//                }else if(serialNumber.charAt(ApiConstants.SerialNumber_Channel) == 0){
+//                    OSDString = getHttpResponse(hostUrl + ApiConstants.HK_OSD_PATH_2, userName, password);
+//                }
+//            }else if(serialNumber.charAt(ApiConstants.SerialNumber_Category) == 2){
+//                //鐞冩満
+//                if(serialNumber.charAt(ApiConstants.SerialNumber_Channel) == 0){
+//                    OSDString = getHttpResponse(hostUrl + ApiConstants.HK_OSD_PATH_1, userName, password);
+//                }else if(serialNumber.charAt(ApiConstants.SerialNumber_Channel) == 1){
+//                    OSDString = getHttpResponse(hostUrl + ApiConstants.HK_OSD_PATH_2, userName, password);
+//                }
+//            }else if(serialNumber.charAt(ApiConstants.SerialNumber_Category) == 3){
+//                //鍗″彛 鍗曢�氶亾
+//                OSDString = getHttpResponse(hostUrl + ApiConstants.HK_OSD_PATH_1, userName, password);
+//            }else if(serialNumber.charAt(ApiConstants.SerialNumber_Category) == 4){
+//                //楂樼┖
+//                if(serialNumber.charAt(ApiConstants.SerialNumber_Channel) == 0){
+//                    OSDString = getHttpResponse(hostUrl + ApiConstants.HK_OSD_PATH_1, userName, password);
+//                }else if(serialNumber.charAt(ApiConstants.SerialNumber_Channel) == 1){
+//                    OSDString = getHttpResponse(hostUrl + ApiConstants.HK_OSD_PATH_2, userName, password);
+//                }
+//            }
             if (OSDString == null) return null;
 
             //瑙f瀽xml
@@ -49,6 +88,7 @@
             Date date = new Date();
             //瑙f瀽xml
             parseXMl(timeString, "Time", "localTime", osdResult, date, ip);
+            osdResult.setDeviceBrand(DeviceType.HK.getType());
         } catch (Exception e) {
             return null;
         }

--
Gitblit v1.8.0