From b1303ee6ba15d8202f7fe95037267feaa4520fc5 Mon Sep 17 00:00:00 2001
From: mac <user@users-MacBook-Pro.local>
Date: 星期日, 28 四月 2024 15:55:48 +0800
Subject: [PATCH] 2024年04月28日15:55:42

---
 app/src/main/java/com/hdl/photovoltaic/other/HdlDeviceLogic.java |   63 +++++++++++++++++++++++++++++++
 1 files changed, 62 insertions(+), 1 deletions(-)

diff --git a/app/src/main/java/com/hdl/photovoltaic/other/HdlDeviceLogic.java b/app/src/main/java/com/hdl/photovoltaic/other/HdlDeviceLogic.java
index d432bff..efd2bd2 100644
--- a/app/src/main/java/com/hdl/photovoltaic/other/HdlDeviceLogic.java
+++ b/app/src/main/java/com/hdl/photovoltaic/other/HdlDeviceLogic.java
@@ -67,6 +67,11 @@
         return sHdlDeviceLogic;
     }
 
+    public static final String kWp = "kWp";
+    public static final String kWh = "kW.h";
+
+    public static final String kW = "kW";
+
 
     /**
      * 鑾峰彇褰撳墠浣忓畢鐨勯�嗗彉鍣ㄥ垪琛�(鍖呮嫭浠庣殑閫嗗彉鍣�)
@@ -87,6 +92,62 @@
             }
         }
         return newList;
+    }
+
+    /**
+     * 娣诲姞閫嗗彉鍣ㄥ埌缂撳瓨鍒楄〃閲岄潰鍘�
+     *
+     * @param homeId         鐢电珯id
+     * @param newGatewayBean 閫嗗彉鍣ㄥ璞�
+     */
+    public void addGatewayToLocalCacheMemory(String homeId, GatewayBean newGatewayBean) {
+        if (newGatewayBean == null || TextUtils.isEmpty(homeId)) {
+            return;
+        }
+        List<GatewayBean> list = getCurrentHomeGatewayList(homeId);
+        if (list == null || list.size() == 0) {
+            return;
+        }
+        int index = -1;
+        for (int i = 0; i < list.size(); i++) {
+            GatewayBean gatewayBean = list.get(i);
+            if (gatewayBean.getDevice_mac().equals(newGatewayBean.getDevice_mac())) {
+                index = i;
+                break;
+            }
+        }
+        if (index > 0) {
+            list.remove(index);
+            list.add(index, newGatewayBean);
+
+        }
+    }
+
+    /**
+     * 绉婚櫎缂撳瓨鍒楄〃閲岄潰閫嗗彉鍣�
+     *
+     * @param homeId 鐢电珯id
+     * @param mac    閫嗗彉鍣╩ac
+     */
+    public void removeLocalCacheMemoryGateway(String homeId, String mac) {
+        if (TextUtils.isEmpty(mac)) {
+            return;
+        }
+        List<GatewayBean> list = getCurrentHomeGatewayList(homeId);
+        if (list == null || list.size() == 0) {
+            return;
+        }
+        int index = -1;
+        for (int i = 0; i < list.size(); i++) {
+            GatewayBean gatewayBean = list.get(i);
+            if (gatewayBean.getDevice_mac().equals(mac)) {
+                index = i;
+                break;
+            }
+        }
+        if (index > 0) {
+            list.remove(index);
+        }
     }
 
 
@@ -284,7 +345,7 @@
             public void onSuccess(String str) {
                 if (cloudCallBeak != null) {
                     cloudCallBeak.onSuccess(true);
-                    //涓存椂鐨勯�昏緫锛屼笂浼爋id鍒楄〃鍒颁簯绔紙鍘绘帀锛屽師鍥犳槸鎴戜笂浼犳垚鍔熷悗锛岀綉鍏冲啀娆″叏閲忎笂浼爋id鍒楄〃锛屼細鎶婁箣鍓峯id鍒楄〃瑕嗙洊鎺夛級
+                    //涓存椂鐨勯�昏緫锛屼笂浼爋id鍒楄〃鍒颁簯绔�
                     uploadOidDataToCloud(homeId, list, true, null);
                 }
             }

--
Gitblit v1.8.0