From 125b1775618a0e6c650d76be051b6f16a559bb1a Mon Sep 17 00:00:00 2001
From: mac <user@users-MacBook-Pro.local>
Date: 星期二, 21 五月 2024 16:00:38 +0800
Subject: [PATCH] 2024年05月21日16:00:32

---
 app/src/main/java/com/hdl/photovoltaic/ui/powerstation/HouseAndDeviceFragment.java |   32 +++++++++++++++++++-------------
 1 files changed, 19 insertions(+), 13 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 61965cc..9040eac 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
@@ -59,6 +59,8 @@
  * 鐢电珯鍜岃澶�-鐣岄潰
  */
 public class HouseAndDeviceFragment extends CustomBaseFragment {
+
+    private boolean isReadData = false;
     private FragmentHouseListBinding viewBinding;
     private HouseInfoAdapter houseInfoAdapter;
 
@@ -66,8 +68,6 @@
 
     private List<HouseIdBean> houseListBeanIDList;
     private List<DeviceBean> deviceInfoList;
-
-
     private int currentHouseListPage = 0; // 褰撳墠鐢电珯鍒楄〃椤电爜
     private int currentHouseListTotal = 0; // 鐢电珯鍒楄〃鎬婚〉鐮�
     private boolean isHouseLoadingMore = false; // 鏍囪鐢电珯鍒楄〃姝e湪鍔犺浇鏇村鏁版嵁
@@ -96,9 +96,6 @@
 
     @Override
     public void onBindView(Bundle savedInstanceState) {
-        //鏀惧湪杩欓噷涔熷锛岃繖閲屽彧鏄鍒涘缓涓�娆�
-//        loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, 1, true);
-//        getStatusOverview();
         initData();
         //鍒濆鍖�
         initView();
@@ -126,6 +123,7 @@
                     viewBinding.deviceNullDataIc.getRoot().setVisibility(View.GONE);
                 }
                 loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, 1, true);
+                getStatusOverview();
             }
         });
         //璁惧鏍囩
@@ -229,6 +227,7 @@
             public void onRefresh() {
                 viewBinding.fragmentHouseSrl.setRefreshing(false);
                 loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, 1, true);
+                getStatusOverview();
             }
         });
         //鐢电珯涓婃媺璇诲彇
@@ -602,14 +601,20 @@
                 // 鍙栨秷绮樻�т簨浠�
                 EventBus.getDefault().removeStickyEvent(eventBus);
                 HdlLogLogic.print("姝e湪鐐瑰嚮銆愮數绔欍��");
-//                HdlThreadLogic.runSubThread(new Runnable() {
-//                    @Override
-//                    public void run() {
-                loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, 1, true);
-                getStatusOverview();
-//                    }
-//                });
-
+                if (!isReadData) {
+                    //1锛屼粠棣栭〉-鏁呴殰-杩涙潵-鐢电珯锛堜笉璇诲彇锛�
+                    //1锛屼粠鐢电珯-杩涙潵-鐢电珯锛堣鍙栦竴娆�,鍚庨潰杩涙潵涓嶅湪璇诲彇锛�
+                    loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, 1, true);
+                    getStatusOverview();
+                }
+            } else if (eventBus.getType().equals(PowerStationStatus.All)) {
+                viewBinding.powerStationAllIl.parentLl.performClick();
+            } else if (eventBus.getType().equals(PowerStationStatus.malfunction)) {
+                viewBinding.powerStationFaultsIl.parentLl.performClick();
+            } else if (eventBus.getType().equals(PowerStationStatus.off)) {
+                viewBinding.powerStationOfflineIl.parentLl.performClick();
+            } else if (eventBus.getType().equals(PowerStationStatus.connecting)) {
+                viewBinding.powerStationConnectedIl.parentLl.performClick();
             }
         }
     }
@@ -656,6 +661,7 @@
      * @param isClear              鏄惁娓呴櫎鏁版嵁
      */
     private void loadNextPageHouseList(boolean isRefreshing, String key, String keyValue, String installedCapacityMin, String installedCapacityMax, String gridType, String powerStationStatus, long pageNo, boolean isClear) {
+        isReadData = true;
         if (isClear) {
             clearData();
         }

--
Gitblit v1.8.0