From a59bbb7890e107a681f677765f2600e278c06a0d Mon Sep 17 00:00:00 2001
From: mac <user@users-MacBook-Pro.local>
Date: 星期一, 09 十月 2023 10:16:37 +0800
Subject: [PATCH] 2023年10月09日10:16:35

---
 app/src/main/java/com/hdl/photovoltaic/other/HdlDeviceLogic.java |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 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 89a07ba..6462ac8 100644
--- a/app/src/main/java/com/hdl/photovoltaic/other/HdlDeviceLogic.java
+++ b/app/src/main/java/com/hdl/photovoltaic/other/HdlDeviceLogic.java
@@ -54,6 +54,9 @@
         if (list.size() > 0) {
             for (int i = 0; i < list.size(); i++) {
                 GatewayBean gatewayBean = list.get(i);
+                if (TextUtils.isEmpty(gatewayBean.getDevice_mac())) {
+                    continue;
+                }
                 if (gatewayBean.getMaster().equals("true")
                         && gatewayBean.getHomeId().equals(UserConfigManage.getInstance().getHomeId())) {
 //                    if ("0101050217BBC400".equals(gatewayBean.getOid()))//娴嬭瘯鏃惰繃婊ゆ帀鏃犳晥鐨勶紝杩欒鍚庨潰浠g爜瑕佸垹闄�
@@ -271,7 +274,7 @@
             JsonObject jsonObject = new JsonObject();
             jsonObject.addProperty("protocolType", oidBean.getProtocolType());
             jsonObject.addProperty("deviceType", oidBean.getDeviceType());
-            jsonObject.addProperty("mac", oidBean.getMac());
+            jsonObject.addProperty("mac", oidBean.getDevice_mac());
             jsonObject.addProperty("oid", oidBean.getOid());
             jsonObject.addProperty("device_name", oidBean.getDevice_name());
             jsonObject.addProperty("device_model", oidBean.getDevice_model());
@@ -538,7 +541,7 @@
                             }
                         }
                         for (int i = 0; i < removeSidList.size(); i++) {
-                            //鑾峰彇鏈湴鐨勯�嗗彉鍣�
+                            //鍒犻櫎鏈湴鐨勯�嗗彉鍣�
                             removeInverter(removeSidList.get(i));
                         }
 
@@ -567,14 +570,14 @@
                 HdlDeviceLogic.getInstance().getCloudInverterDeviceList(UserConfigManage.getInstance().getHomeId(), new CloudCallBeak<List<CloudInverterDeviceBean>>() {
                     @Override
                     public void onSuccess(List<CloudInverterDeviceBean> list) {
+                        //娓呮鏈湴缃戝叧鍒楄〃
+                        HDLLinkLocalGateway.getInstance().getGatewayList().clear();
                         if (list == null || list.size() == 0) {
                             if (cloudCallBeak != null) {
                                 cloudCallBeak.onSuccess(true);
                             }
                             return;
                         }
-                        //娓呮鏈湴缃戝叧鍒楄〃
-                        HDLLinkLocalGateway.getInstance().getGatewayList().clear();
                         for (int i = 0; i < list.size(); i++) {
                             CloudInverterDeviceBean cloudInverterDeviceBean = list.get(i);
                             //浜戠瀵硅薄鏁版嵁浜ゆ崲鍒版湰鍦板璞�
@@ -607,7 +610,6 @@
      * @param sid 璁惧sid
      */
     private void removeInverter(String sid) {
-        //鑾峰彇鏈湴鐨勬绫虫尝
         GatewayBean gatewayBean = HDLLinkLocalGateway.getInstance().getLocalGateway(sid);
         if (gatewayBean != null) {
             HDLLinkLocalGateway.getInstance().getGatewayList().remove(gatewayBean);

--
Gitblit v1.8.0