From 9542b72d7f7faab8781e14bc8006f3df3f9a3f10 Mon Sep 17 00:00:00 2001
From: wjc <1243177876@qq.com>
Date: 星期五, 13 十二月 2024 18:04:12 +0800
Subject: [PATCH] 2024年12月13日18:04:10

---
 app/src/main/java/com/hdl/photovoltaic/other/HdlUniLogic.java |   35 +++++++++++++++++++++++++++++++++--
 1 files changed, 33 insertions(+), 2 deletions(-)

diff --git a/app/src/main/java/com/hdl/photovoltaic/other/HdlUniLogic.java b/app/src/main/java/com/hdl/photovoltaic/other/HdlUniLogic.java
index 1d0295e..b4bb9f3 100644
--- a/app/src/main/java/com/hdl/photovoltaic/other/HdlUniLogic.java
+++ b/app/src/main/java/com/hdl/photovoltaic/other/HdlUniLogic.java
@@ -13,6 +13,7 @@
 import android.os.SystemClock;
 import android.provider.Settings;
 import android.text.TextUtils;
+import android.util.Log;
 
 import androidx.core.app.ActivityCompat;
 
@@ -141,6 +142,8 @@
             if (!HDLUniMP.UNI_APP_ID.equals(appId)) {
                 return;
             }
+            long startTime = System.currentTimeMillis();
+            Log.d("===寮�濮嬫椂闂�===", String.valueOf(startTime));
             String type = getKeyValue("type", data);//灏忕被
             String logTag = getKeyValue("logTag", data);//鏍囪uni鎸囦护
             String mode_type = "澶х被-" + topic + "---" + "灏忕被-" + type;//鐢ㄦ潵鎵撳嵃鐨�
@@ -764,6 +767,8 @@
                                 } catch (Exception e) {
                                     uniSuccessCallback(type, json, callback);
                                 }
+                                long endTime = System.currentTimeMillis() - startTime;
+                                Log.d("====鑰楁椂鏃堕棿====", String.valueOf(endTime));
                             }
                         }
                     }
@@ -2365,8 +2370,9 @@
         HdlDeviceLogic.getInstance().getCurrentHomeLocalAndCloudGatewayList(homeId, new CloudCallBeak<List<GatewayBean>>() {
             @Override
             public void onSuccess(List<GatewayBean> list) {
+                List<GatewayBean> newList = sortLogic(list);
                 if (callback != null) {
-                    uniSuccessCallback(type, list, callback);
+                    uniSuccessCallback(type, newList, callback);
                 }
                 //EventBus浜嬩欢鍒嗗彂,杩涘叆浣忓畢寮�濮嬭闃呬富棰�
                 BaseEventBus baseEventBus = new BaseEventBus();
@@ -2375,7 +2381,7 @@
                 baseEventBus.setData(homeId);
                 EventBus.getDefault().post(baseEventBus);
                 //杩涙潵浣忓畢璇︽儏閮借涓婁紶涓�娆id鍒楄〃鍒颁簯绔�;
-                HdlDeviceLogic.getInstance().uploadOidDataToCloud(homeId, list, false, null);
+                HdlDeviceLogic.getInstance().uploadOidDataToCloud(homeId, newList, false, null);
             }
 
             @Override
@@ -2389,6 +2395,31 @@
     }
 
     /**
+     * 杩涜鎺掑簭锛堥�嗗彉鍣�-璐熻浇涓績锛�
+     *
+     * @param list 婧愭暟鎹�
+     * @return 杩斿洖鍒楄〃
+     */
+    private List<GatewayBean> sortLogic(List<GatewayBean> list) {
+        if (list == null || list.size() == 0) {
+            return new ArrayList<>();
+        }
+        List<GatewayBean> newList = new ArrayList<>();
+        List<GatewayBean> inverterList = new ArrayList<>();
+        List<GatewayBean> lcList = new ArrayList<>();
+        for (int i = 0; i < list.size(); i++) {
+            if (list.get(i).getSpk().equals(HdlDeviceLogic.getInstance().INVERTER_DEVICE_SPK)) {
+                inverterList.add(list.get(i));
+            } else {
+                lcList.add(list.get(i));
+            }
+        }
+        newList.addAll(inverterList);
+        newList.addAll(lcList);
+        return newList;
+    }
+
+    /**
      * link spk 灞炴�х紪杈�
      *
      * @param data     uni鏁版嵁

--
Gitblit v1.8.0