wjc
2025-05-23 971a24a9e58a21bc306897fd3ad63012a399f7db
app/src/main/java/com/hdl/photovoltaic/ui/powerstation/HouseAndDeviceFragment.java
@@ -1,20 +1,16 @@
package com.hdl.photovoltaic.ui.powerstation;
import android.Manifest;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.location.LocationManager;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.SystemClock;
import android.provider.Settings;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.view.Window;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
@@ -49,7 +45,6 @@
import com.hdl.photovoltaic.other.HdlDeviceLogic;
import com.hdl.photovoltaic.other.HdlDialogLogic;
import com.hdl.photovoltaic.other.HdlLogLogic;
import com.hdl.photovoltaic.other.HdlOtaLogic;
import com.hdl.photovoltaic.other.HdlResidenceLogic;
import com.hdl.photovoltaic.other.HdlThreadLogic;
import com.hdl.photovoltaic.other.HdlUniLogic;
@@ -61,7 +56,6 @@
import com.hdl.photovoltaic.uni.HDLUniMP;
import com.hdl.photovoltaic.utils.GPSManagerUtils;
import com.hdl.photovoltaic.utils.PermissionUtils;
import com.hdl.photovoltaic.utils.ProcessManagerUtils;
import com.hdl.photovoltaic.utils.URLEncodingUtils;
import com.hdl.photovoltaic.widget.ConfirmationCancelDialog;
import com.hdl.photovoltaic.widget.DefaultFilteringDialog;
@@ -261,6 +255,7 @@
                        installedCapacityMinValue = min;//最小组串容量(装机容量)
                        installedCapacityMaxValue = max;//最大组串容量(装机容量)
                        screeningConditionStatus = state;//调试状态(全部;调试中;调试完成;已交付;授权调试)
                        getStatusOverview();
                        loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, screeningConditionStatus, powerStationStatusValue, 1, true);
                    }
                });
@@ -363,14 +358,7 @@
            }
        });
//        //电站编辑按钮
//        viewBinding.editIv.setOnClickListener(new View.OnClickListener() {
//            @Override
//            public void onClick(View v) {
//                startActivity(HouseListEditActivity.class);
//            }
//        });
        //电站名称筛选
        //PV筛选
        viewBinding.stationNameRl.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
@@ -378,10 +366,11 @@
                screeningConditionStyle(viewBinding.stationNameRl, viewBinding.stationNameIv, isSelected);
                key = SortType.installedCapacitySort;
                value = isSelected ? SortValue.ascending : SortValue.descending;
                getStatusOverview();
                loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, screeningConditionStatus, powerStationStatusValue, 1, true);
            }
        });
        //电站发电功率筛选
        //额定功率筛选
        viewBinding.stationPowerRl.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
@@ -413,17 +402,7 @@
                screeningConditionStyle(viewBinding.stationDayRl, viewBinding.stationDayIv, isSelected);
                key = SortType.todayElectricitySort;
                value = isSelected ? SortValue.ascending : SortValue.descending;
                loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, screeningConditionStatus, powerStationStatusValue, 1, true);
            }
        });
        //电站电池容量筛选
        viewBinding.stationMonthRl.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                boolean isSelected = !v.isSelected();
                screenIconState(viewBinding.stationMonthRl, viewBinding.stationMonthIv, isSelected);
                key = SortType.batteryCapacitySort;
                value = isSelected ? SortValue.ascending : SortValue.descending;
                getStatusOverview();
                loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, screeningConditionStatus, powerStationStatusValue, 1, true);
            }
        });
@@ -613,15 +592,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);
@@ -658,6 +640,7 @@
//                if (MqttRecvClient.getInstance() != null) {
//                    MqttRecvClient.getInstance().removeAllTopic();
//                }
                loadNextPageHouseList(false, key, value, installedCapacityMinValue, installedCapacityMaxValue, screeningConditionStatus, powerStationStatusValue, 1, true);
            }
        } else if (HDLUniMP.UNI_EVENT_REPLY_DEVICE_LIST.equals(eventBus.getType())) {
@@ -672,8 +655,8 @@
            }
            String homeId = eventBus.getData().toString();
            //进去住宅详情uni读取逆变器列表成功后通知
            for (int i = 0; i < HdlDeviceLogic.getInstance().getCurrentHomeGatewayList(homeId, null).size(); i++) {
                String gatewayId = HdlDeviceLogic.getInstance().getCurrentHomeGatewayList(homeId, null).get(i).getGatewayId();
            for (int i = 0; i < HdlDeviceLogic.getInstance().getCurrentHomeGatewayList(homeId).size(); i++) {
                String gatewayId = HdlDeviceLogic.getInstance().getCurrentHomeGatewayList(homeId).get(i).getGatewayId();
                //字符串是自己按规则拼接的,里面注册主题时会解析字符串,只拿getGatewayId()值;
                String topic = "/user/" + gatewayId + "/#";
                //进去住宅详情开始订阅主题
@@ -831,7 +814,7 @@
                        if (isRefreshing) {
                            hideLoading();
                        }
                        HdlThreadLogic.toast(_mActivity, e.getMsg() + "(" + e.getCode() + ")");
                    }
                }, _mActivity, ShowErrorMode.YES);
            }
@@ -900,6 +883,7 @@
                        if (isRefreshing) {
                            hideLoading();
                        }
                        HdlThreadLogic.toast(_mActivity, e.getMsg() + "(" + e.getCode() + ")");
                    }
                }, _mActivity, ShowErrorMode.YES);
            }
@@ -1211,4 +1195,4 @@
    }
}
}