From 0770fc4f03196a27e8f4c899a44da63bb1a683e2 Mon Sep 17 00:00:00 2001
From: wjc <1243177876@qq.com>
Date: 星期四, 12 六月 2025 18:17:29 +0800
Subject: [PATCH] 2025年06月12日18:17:27

---
 app/src/main/java/com/hdl/photovoltaic/ui/powerstation/HouseAndDeviceFragment.java |   41 ++++++++++++++++++++++++++---------------
 1 files changed, 26 insertions(+), 15 deletions(-)

diff --git a/app/src/main/java/com/hdl/photovoltaic/ui/powerstation/HouseAndDeviceFragment.java b/app/src/main/java/com/hdl/photovoltaic/ui/powerstation/HouseAndDeviceFragment.java
index 8a8744c..c3f00bd 100644
--- a/app/src/main/java/com/hdl/photovoltaic/ui/powerstation/HouseAndDeviceFragment.java
+++ b/app/src/main/java/com/hdl/photovoltaic/ui/powerstation/HouseAndDeviceFragment.java
@@ -8,7 +8,7 @@
 import android.os.AsyncTask;
 import android.os.Bundle;
 import android.provider.Settings;
-import android.util.Log;
+import android.text.TextUtils;
 import android.view.View;
 import android.widget.ImageView;
 import android.widget.LinearLayout;
@@ -18,8 +18,6 @@
 import androidx.annotation.NonNull;
 import androidx.appcompat.content.res.AppCompatResources;
 import androidx.recyclerview.widget.LinearLayoutManager;
-import androidx.recyclerview.widget.RecyclerView;
-import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
 
 import com.google.gson.Gson;
 import com.hdl.linkpm.sdk.core.exception.HDLException;
@@ -436,7 +434,17 @@
                 HdlDeviceLogic.getInstance().setDeviceRemoteInfo(newList, deviceBean.getHomeId(), new CloudCallBeak<List<GatewayBean>>() {
                     @Override
                     public void onSuccess(List<GatewayBean> obj) {
+
                         GatewayBean newGatewayBean = HDLLinkLocalGateway.getInstance().getLocalGateway(deviceBean.getOsn());
+                        if (newGatewayBean == null) {
+                            HdlThreadLogic.toast(_mActivity, getString(R.string.device_off));
+                            return;
+                        }
+                        if (TextUtils.isEmpty(newGatewayBean.getGatewayId()) || TextUtils.isEmpty(newGatewayBean.getAesKey())) {
+                            //杩欓噷鍙敮鎸佽繙绋嬭皟璇曪紝杩滅▼鎷夸笉鍒癿qtt閫氳绉橀挜浠ュ強gatewayId锛�
+                            HdlThreadLogic.toast(_mActivity, getString(R.string.device_failed_to_certificate) + "(124004)");
+                            return;
+                        }
                         String jsonEncryption = URLEncodingUtils.encodeURIComponent(new Gson().toJson(newGatewayBean));
                         String path = HDLUniMP.UNI_EVENT_OPEN_DEVICE_DETAILS + "?inverterInfo=" + jsonEncryption;
                         HdlUniLogic.getInstance().openUniMP(path, null);
@@ -581,15 +589,18 @@
             if (HDLUniMP.UNI_EVENT_REPLY_HOME_CREATION.equals(eventBus.getType())) {
                 // 鍙栨秷绮樻�т簨浠�
                 EventBus.getDefault().removeStickyEvent(eventBus);
-                //uin鍒涘缓鐢电珯鎴愬姛鍚庨�氱煡
-                loadNextPageHouseList(false, key, value, installedCapacityMinValue, installedCapacityMaxValue, screeningConditionStatus, powerStationStatusValue, 1, true);
-                if (eventBus.getData() != null) {
-                    Gson gson = new Gson();
-                    String json = eventBus.getData().toString();
-                    HouseIdBean houseIdBean = gson.fromJson(json, HouseIdBean.class);
-                    HdlResidenceLogic.getInstance().switchHouse(houseIdBean, true);
-
-                }
+//                HdlLogLogic.print("杩涙潵浜�---11111" + eventBus.getData().toString());
+//                //uin鍒涘缓鐢电珯鎴愬姛鍚庨�氱煡
+//                loadNextPageHouseList(false, key, value, installedCapacityMinValue, installedCapacityMaxValue, screeningConditionStatus, powerStationStatusValue, 1, true);
+//                if (eventBus.getData() != null) {
+//                    HdlLogLogic.print("杩涙潵浜�---" + eventBus.getData().toString());
+//                    Gson gson = new Gson();
+//                    String json = eventBus.getData().toString();
+//                    HouseIdBean houseIdBean = gson.fromJson(json, HouseIdBean.class);
+//                    HdlResidenceLogic.getInstance().switchHouse(houseIdBean, true);
+//                    HdlLogLogic.print("杩涙潵浜�---缁撴潫" + eventBus.getData().toString());
+//
+//                }
             } else if (HDLUniMP.UNI_EVENT_REPLY_HOME_EDIT.equals(eventBus.getType())) {
                 // 鍙栨秷绮樻�т簨浠�
                 EventBus.getDefault().removeStickyEvent(eventBus);
@@ -958,7 +969,7 @@
             @Override
             public void onSuccess(Boolean obj) {
                 hideLoading();
-                initializeInverter(list); //鍙戣捣鍒濆鍖栨寚浠ょ粰閫嗗彉鍣�;锛堟敞鎰�:鍙兘鏄湰鍦板彂閫佷簡(瑕佹悳绱㈠眬鍩熺綉閫嗗彉鍣ㄥ垪琛紝寤虹珛鏈湴閫氳閫氶亾),鍒犻櫎鐢电珯鎴愬姛鍚�,浜戠瑙g粦閫嗗彉鍣ㄧ殑鍏崇郴锛�
+                initializeInverter(list); //鍙戣捣鍒濆鍖栨寚浠ょ粰閫嗗彉鍣�;锛堟敞鎰�:鍓嶉潰宸插厛瑙g粦浜戠閫嗗彉鍣紝mqtt閫氶亾宸叉柇寮�锛屽垵濮嬪寲鍙兘鏄湰鍦板彂閫�(鍏堟悳绱㈠眬鍩熺綉閫嗗彉鍣ㄥ垪琛紝寤虹珛鏈湴閫氳閫氶亾)锛�
                 HdlResidenceLogic.getInstance().delHouseId(homeId);//鍒犻櫎鐢电珯缂撳瓨
                 initData();//鍒濆鍖栫紦瀛樻暟鎹�
                 houseInfoAdapter.setList(houseListBeanIDList, powerStationStatusValue);//閲嶆柊鍒锋柊鍒楄〃
@@ -1079,7 +1090,7 @@
                         // 鎵ц浠诲姟锛堝鏇存柊UI銆佽烦杞瓑锛�
                         viewBinding.fragmentHouseSrl.endRefreshing();
                         //鍔犺浇鏈�鏂版暟鎹畬鎴�
-                        loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, screeningConditionStatus, powerStationStatusValue, 1, true);
+                        loadNextPageHouseList(false, key, value, installedCapacityMinValue, installedCapacityMaxValue, screeningConditionStatus, powerStationStatusValue, 1, true);
                         getStatusOverview();
                     }
                 }.execute();
@@ -1142,7 +1153,7 @@
                     @Override
                     protected void onPostExecute(Void aVoid) {
                         viewBinding.fragmentDeviceSrl.endRefreshing();
-                        loadNextPageDeviceList(true, 1, true);
+                        loadNextPageDeviceList(false, 1, true);
                     }
                 }.execute();
             }

--
Gitblit v1.8.0