wjc
2024-11-27 36487596c9951571f376e3d181d46ee11174f8e2
app/src/main/java/com/hdl/photovoltaic/ui/powerstation/HouseAndDeviceFragment.java
@@ -4,8 +4,6 @@
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.appcompat.content.res.AppCompatResources;
@@ -18,10 +16,10 @@
import com.hdl.photovoltaic.R;
import com.hdl.photovoltaic.bean.PageNumberObject;
import com.hdl.photovoltaic.config.ConstantManage;
import com.hdl.photovoltaic.config.UserConfigManage;
import com.hdl.photovoltaic.databinding.FragmentHouseListBinding;
import com.hdl.photovoltaic.base.CustomBaseFragment;
import com.hdl.photovoltaic.enums.HomepageTitleTabSwitch;
import com.hdl.photovoltaic.enums.LowerTagType;
import com.hdl.photovoltaic.enums.PowerStationStatus;
import com.hdl.photovoltaic.enums.ShowErrorMode;
import com.hdl.photovoltaic.enums.SortType;
@@ -36,17 +34,20 @@
import com.hdl.photovoltaic.other.HdlUniLogic;
import com.hdl.photovoltaic.ui.adapter.DeviceInfoAdapter;
import com.hdl.photovoltaic.ui.adapter.HouseInfoAdapter;
import com.hdl.photovoltaic.ui.bean.DeviceBean;
import com.hdl.photovoltaic.ui.bean.CloudInverterDeviceBean;
import com.hdl.photovoltaic.ui.bean.HouseIdBean;
import com.hdl.photovoltaic.ui.bean.StatusOverviewBean;
import com.hdl.photovoltaic.uni.HDLUniMP;
import com.hdl.photovoltaic.utils.PermissionUtils;
import com.hdl.photovoltaic.utils.URLEncodingUtils;
import com.hdl.photovoltaic.widget.DefaultFilteringDialog;
import com.hdl.photovoltaic.widget.DelayedConfirmationCancelDialog;
import com.hdl.sdk.link.common.exception.HDLLinkException;
import com.hdl.sdk.link.core.bean.eventbus.BaseEventBus;
import com.hdl.sdk.link.core.bean.gateway.GatewayBean;
import com.hdl.sdk.link.core.config.HDLLinkConfig;
import com.hdl.sdk.link.core.utils.mqtt.MqttRecvClient;
import com.hdl.sdk.link.gateway.HDLLinkLocalGateway;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
@@ -67,7 +68,7 @@
    private DeviceInfoAdapter deviceInfoAdapter;
    private List<HouseIdBean> houseListBeanIDList;
    private List<DeviceBean> deviceInfoList;
    private List<CloudInverterDeviceBean> deviceInfoList;
    private int currentHouseListPage = 0; // 当前电站列表页码
    private int currentHouseListTotal = 0; // 电站列表总页码
    private boolean isHouseLoadingMore = false; // 标记电站列表正在加载更多数据
@@ -87,6 +88,17 @@
    private final long pageSize = 20;//页数
    /**
     * 还原条件的初始化状态
     */
    private void initializationState() {
        key = SortValue.all;
        value = SortValue.all;
        installedCapacityMinValue = "";
        installedCapacityMaxValue = "";
        gridTypeValue = "";
        powerStationStatusValue = PowerStationStatus.All;
    }
    @Override
    public Object getContentView() {
@@ -96,6 +108,7 @@
    @Override
    public void onBindView(Bundle savedInstanceState) {
        getStatusOverview();
        initData();
        //初始化
        initView();
@@ -113,17 +126,11 @@
                    return;
                }
                isClickPowerStationLabel = true;
                viewBinding.powerStationLabel.setTextAppearance(R.style.Text20Style);
                viewBinding.deviceLabel.setTextAppearance(R.style.Text16Style);
                viewBinding.editIv.setVisibility(View.VISIBLE);//编辑图标隐藏
                viewBinding.addIv.setVisibility(View.VISIBLE);//添加图标隐藏
                viewBinding.powerStationLabelParent.setVisibility(View.VISIBLE);//电站标签【父容器】显示
                viewBinding.deviceLabelParent.setVisibility(View.GONE);//设备标签【父容器】隐藏
                if (viewBinding.deviceNullDataIc.getRoot().getVisibility() == View.VISIBLE) {
                    viewBinding.deviceNullDataIc.getRoot().setVisibility(View.GONE);
                }
                loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, 1, true);
                selectedTitleLabelStyle();
                initializationState();
                getStatusOverview();
                loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, 1, true);
            }
        });
        //设备标签
@@ -134,51 +141,55 @@
                    return;
                }
                isClickPowerStationLabel = false;
                viewBinding.deviceLabel.setTextAppearance(R.style.Text20Style);
                viewBinding.powerStationLabel.setTextAppearance(R.style.Text16Style);
                viewBinding.editIv.setVisibility(View.GONE);//编辑图标隐藏
                viewBinding.addIv.setVisibility(View.GONE);//添加图标隐藏
                viewBinding.powerStationLabelParent.setVisibility(View.GONE);//电站标签【父容器】隐藏
                viewBinding.deviceLabelParent.setVisibility(View.VISIBLE);//设备标签【父容器】显示
                if (viewBinding.homeNullDataIc.getRoot().getVisibility() == View.VISIBLE) {
                    viewBinding.homeNullDataIc.getRoot().setVisibility(View.GONE);
                }
                selectedTitleLabelStyle();
                loadNextPageDeviceList(true, 1, true);
            }
        });
        //全部
        viewBinding.powerStationAllIl.parentLl.setOnClickListener(new View.OnClickListener() {
        viewBinding.allLl.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                powerStationStatusValue = PowerStationStatus.All;
                selectedStationStyle(viewBinding.powerStationAllIl.parentLl, viewBinding.powerStationAllIl.stationTotalTv, viewBinding.powerStationAllIl.stationTitleTv, true);
                viewBinding.allLl.setBackground(AppCompatResources.getDrawable(_mActivity, R.drawable.station_status_yes_ffffff));
                viewBinding.faultsLl.setBackground(AppCompatResources.getDrawable(_mActivity, R.drawable.station_status_no_ffffff));
                viewBinding.offlineLl.setBackground(AppCompatResources.getDrawable(_mActivity, R.drawable.station_status_no_ffffff));
                viewBinding.connectedLl.setBackground(AppCompatResources.getDrawable(_mActivity, R.drawable.station_status_no_ffffff));
                loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, 1, true);
            }
        });
        //故障
        viewBinding.powerStationFaultsIl.parentLl.setOnClickListener(new View.OnClickListener() {
        viewBinding.faultsLl.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                powerStationStatusValue = PowerStationStatus.malfunction;
                selectedStationStyle(viewBinding.powerStationFaultsIl.parentLl, viewBinding.powerStationFaultsIl.stationTotalTv, viewBinding.powerStationFaultsIl.stationTitleTv, true);
                viewBinding.allLl.setBackground(AppCompatResources.getDrawable(_mActivity, R.drawable.station_status_no_ffffff));
                viewBinding.faultsLl.setBackground(AppCompatResources.getDrawable(_mActivity, R.drawable.station_status_yes_ffffff));
                viewBinding.offlineLl.setBackground(AppCompatResources.getDrawable(_mActivity, R.drawable.station_status_no_ffffff));
                viewBinding.connectedLl.setBackground(AppCompatResources.getDrawable(_mActivity, R.drawable.station_status_no_ffffff));
                loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, 1, true);
            }
        });
        //离线
        viewBinding.powerStationOfflineIl.parentLl.setOnClickListener(new View.OnClickListener() {
        viewBinding.offlineLl.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                powerStationStatusValue = PowerStationStatus.off;
                selectedStationStyle(viewBinding.powerStationOfflineIl.parentLl, viewBinding.powerStationOfflineIl.stationTotalTv, viewBinding.powerStationOfflineIl.stationTitleTv, true);
                viewBinding.allLl.setBackground(AppCompatResources.getDrawable(_mActivity, R.drawable.station_status_no_ffffff));
                viewBinding.faultsLl.setBackground(AppCompatResources.getDrawable(_mActivity, R.drawable.station_status_no_ffffff));
                viewBinding.offlineLl.setBackground(AppCompatResources.getDrawable(_mActivity, R.drawable.station_status_yes_ffffff));
                viewBinding.connectedLl.setBackground(AppCompatResources.getDrawable(_mActivity, R.drawable.station_status_no_ffffff));
                loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, 1, true);
            }
        });
        //待接入
        viewBinding.powerStationConnectedIl.parentLl.setOnClickListener(new View.OnClickListener() {
        viewBinding.connectedLl.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                powerStationStatusValue = PowerStationStatus.connecting;
                selectedStationStyle(viewBinding.powerStationConnectedIl.parentLl, viewBinding.powerStationConnectedIl.stationTotalTv, viewBinding.powerStationConnectedIl.stationTitleTv, true);
                viewBinding.allLl.setBackground(AppCompatResources.getDrawable(_mActivity, R.drawable.station_status_no_ffffff));
                viewBinding.faultsLl.setBackground(AppCompatResources.getDrawable(_mActivity, R.drawable.station_status_no_ffffff));
                viewBinding.offlineLl.setBackground(AppCompatResources.getDrawable(_mActivity, R.drawable.station_status_no_ffffff));
                viewBinding.connectedLl.setBackground(AppCompatResources.getDrawable(_mActivity, R.drawable.station_status_yes_ffffff));
                loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, 1, true);
            }
        });
@@ -258,7 +269,7 @@
            public void onClick(int position, HouseIdBean houseIdBean) {
                //点击住宅详情
                HdlLogLogic.print("点击住宅详情---" + new Gson().toJson(houseIdBean), false);
                HdlResidenceLogic.getInstance().switchHouse(houseIdBean);
                HdlResidenceLogic.getInstance().switchHouse(houseIdBean, true);
                String path = HDLUniMP.UNI_EVENT_OPEN_HOME_DETAILS + "?homeId=" + houseIdBean.getHomeId() + "&homeName=" + houseIdBean.getHomeName() + "&powerStationStatus=" + houseIdBean.getPowerStationStatus();
                HdlUniLogic.getInstance().openUniMP(path, null);
@@ -280,7 +291,7 @@
                        //移动电站位置
                        HdlResidenceLogic.getInstance().moveHouseId(houseIdBean.getHomeId());
                        initData();//初始化缓存数据
                        houseInfoAdapter.setList(houseListBeanIDList);//重新刷新列表
                        houseInfoAdapter.setList(houseListBeanIDList, powerStationStatusValue);//重新刷新列表
                        nullDataUpdateUi();//检测数据是否为空
                    }
@@ -297,10 +308,11 @@
            public void onDelClick(int position, HouseIdBean houseIdBean) {
                DelayedConfirmationCancelDialog delayedConfirmationCancelDialog = new DelayedConfirmationCancelDialog(_mActivity);
                delayedConfirmationCancelDialog.setTitleContent(getString(R.string.loading_title_tip));
                delayedConfirmationCancelDialog.show();
                delayedConfirmationCancelDialog.isHideTitle(true);
                String homeName = "\"" + houseIdBean.getHomeName() + "\"";
                delayedConfirmationCancelDialog.setContent(getString(R.string.delete_power_station).replace("%s", homeName));
                delayedConfirmationCancelDialog.show();
                delayedConfirmationCancelDialog.startCountdown(4);
                delayedConfirmationCancelDialog.setYesOnclickListener(new DelayedConfirmationCancelDialog.onYesOnclickListener() {
                    @Override
@@ -406,8 +418,45 @@
        //设备点击
        deviceInfoAdapter.setOnclickListener(new DeviceInfoAdapter.OnClickListener() {
            @Override
            public void onClick(int position, DeviceBean deviceBean) {
            public void onClick(int position, CloudInverterDeviceBean deviceBean) {
//                GatewayBean gatewayBean = new GatewayBean();
//                gatewayBean.setCategorySecondName(deviceBean.getCategorySecondName());
//                gatewayBean.setDevice_mac(deviceBean.getOsn());
//                gatewayBean.setDevice_model(deviceBean.getOmodel());
//                gatewayBean.setOid(deviceBean.getOid());
//                gatewayBean.setGatewayId(deviceBean.getGatewayId());
//                gatewayBean.setAddresses(deviceBean.getAddresses());
//                gatewayBean.setSid(deviceBean.getSid());
//                gatewayBean.setDeviceId(deviceBean.getDeviceId());
//                gatewayBean.setDevice_name(deviceBean.getName());
//                gatewayBean.setDeviceStatus(deviceBean.getDeviceStatus());
//                gatewayBean.setHomeId(deviceBean.getHomeId());
//                gatewayBean.setSpk(deviceBean.getSpk());
//                gatewayBean.setDeviceType(deviceBean.getDeviceType());
                if (deviceBean.getDeviceStatus() == 4) {
                    HdlThreadLogic.toast(_mActivity, R.string.device_off);
                    return;
                }
                //配置本地通信的信息
                HDLLinkConfig.getInstance().setHomeId(deviceBean.getHomeId());
                HDLLinkConfig.getInstance().setLocalSecret(deviceBean.getLocalSecret());
                List<CloudInverterDeviceBean> newList = new ArrayList<>();
                newList.add(deviceBean);
                //目的是为了获取拿到网关ID,mqtt通讯秘钥等信息,拿到后缓存到本地逆变器列表里面,发送数据数据时自动去缓存列表里面去查找;
                HdlDeviceLogic.getInstance().setDeviceRemoteInfo(newList, deviceBean.getHomeId(), new CloudCallBeak<List<GatewayBean>>() {
                    @Override
                    public void onSuccess(List<GatewayBean> obj) {
                        GatewayBean newGatewayBean = HDLLinkLocalGateway.getInstance().getLocalGateway(deviceBean.getOsn());
                        String jsonEncryption = URLEncodingUtils.encodeURIComponent(new Gson().toJson(newGatewayBean));
                        String path = HDLUniMP.UNI_EVENT_OPEN_DEVICE_DETAILS + "?inverterInfo=" + jsonEncryption;
                        HdlUniLogic.getInstance().openUniMP(path, null);
                    }
                    @Override
                    public void onFailure(HDLException e) {
                    }
                });
            }
        });
        //设备设置下拉箭头颜色
@@ -457,18 +506,15 @@
    private void initView() {
        viewBinding.powerStationLabelParent.setVisibility(View.VISIBLE);
        viewBinding.deviceLabelParent.setVisibility(View.GONE);
        viewBinding.powerStationAllIl.stationTitleTv.setText(getString(R.string.message_all));
        viewBinding.powerStationFaultsIl.stationTitleTv.setText(getString(R.string.my_power_station_malfunction));
        viewBinding.powerStationOfflineIl.stationTitleTv.setText(getString(R.string.my_power_station_off_line));
        viewBinding.powerStationConnectedIl.stationTitleTv.setText(getString(R.string.to_be_added));
        selectedStationStyle(viewBinding.powerStationAllIl.parentLl, viewBinding.powerStationAllIl.stationTotalTv, viewBinding.powerStationAllIl.stationTitleTv, true);
        viewBinding.allLl.setBackground(AppCompatResources.getDrawable(_mActivity, R.drawable.station_status_yes_ffffff));
        viewBinding.faultsLl.setBackground(AppCompatResources.getDrawable(_mActivity, R.drawable.station_status_no_ffffff));
        viewBinding.offlineLl.setBackground(AppCompatResources.getDrawable(_mActivity, R.drawable.station_status_no_ffffff));
        viewBinding.connectedLl.setBackground(AppCompatResources.getDrawable(_mActivity, R.drawable.station_status_no_ffffff));
        //电站标签
        houseInfoAdapter = new HouseInfoAdapter(_mActivity);
        viewBinding.fragmentHouseSrlListRc.setLayoutManager(new LinearLayoutManager(_mActivity));
        viewBinding.fragmentHouseSrlListRc.setAdapter(houseInfoAdapter);
        houseInfoAdapter.setList(this.houseListBeanIDList);
        houseInfoAdapter.setList(this.houseListBeanIDList, powerStationStatusValue);
        //设备标签
        deviceInfoAdapter = new DeviceInfoAdapter(_mActivity);
@@ -476,43 +522,36 @@
        viewBinding.fragmentDeviceSrlListRc.setAdapter(deviceInfoAdapter);
        this.nullDataUpdateUi();
    }
    /**
     * 显示选中状态样式
     *
     * @param linearLayout         组件
     * @param numberTv             组件
     * @param titleTv              组件
     * @param isShowSelectedStatus 是否显示状态样式
     * 电站和设备标签样式
     */
    private void selectedStationStyle(LinearLayout linearLayout, TextView numberTv, TextView titleTv, boolean isShowSelectedStatus) {
        viewBinding.powerStationAllIl.parentLl.setBackground(AppCompatResources.getDrawable(_mActivity, R.drawable.station_status_no_ffffff));
        viewBinding.powerStationFaultsIl.parentLl.setBackground(AppCompatResources.getDrawable(_mActivity, R.drawable.station_status_no_ffffff));
        viewBinding.powerStationOfflineIl.parentLl.setBackground(AppCompatResources.getDrawable(_mActivity, R.drawable.station_status_no_ffffff));
        viewBinding.powerStationConnectedIl.parentLl.setBackground(AppCompatResources.getDrawable(_mActivity, R.drawable.station_status_no_ffffff));
        viewBinding.powerStationAllIl.stationTotalTv.setTextColor(getResources().getColor(R.color.text_E6000000, null));
        viewBinding.powerStationAllIl.stationTitleTv.setTextColor(getResources().getColor(R.color.text_66000000, null));
        viewBinding.powerStationFaultsIl.stationTotalTv.setTextColor(getResources().getColor(R.color.text_E6000000, null));
        viewBinding.powerStationFaultsIl.stationTitleTv.setTextColor(getResources().getColor(R.color.text_66000000, null));
        viewBinding.powerStationOfflineIl.stationTotalTv.setTextColor(getResources().getColor(R.color.text_E6000000, null));
        viewBinding.powerStationOfflineIl.stationTitleTv.setTextColor(getResources().getColor(R.color.text_66000000, null));
        viewBinding.powerStationConnectedIl.stationTotalTv.setTextColor(getResources().getColor(R.color.text_E6000000, null));
        viewBinding.powerStationConnectedIl.stationTitleTv.setTextColor(getResources().getColor(R.color.text_66000000, null));
        if (isShowSelectedStatus) {
            linearLayout.setBackground(AppCompatResources.getDrawable(_mActivity, R.drawable.selected_8_38c494));
            numberTv.setTextColor(getResources().getColor(R.color.text_FFFFFFFF, null));
            titleTv.setTextColor(getResources().getColor(R.color.text_FFFFFFFF, null));
    private void selectedTitleLabelStyle() {
        if (isClickPowerStationLabel) {
            viewBinding.powerStationLabel.setTextAppearance(R.style.Text18Style);
            viewBinding.deviceLabel.setTextAppearance(R.style.Text14Style);
//            viewBinding.editIv.setVisibility(View.VISIBLE);//编辑图标隐藏
            viewBinding.addIv.setVisibility(View.VISIBLE);//添加图标隐藏
            viewBinding.powerStationLabelParent.setVisibility(View.VISIBLE);//电站标签【父容器】显示
            viewBinding.deviceLabelParent.setVisibility(View.GONE);//设备标签【父容器】隐藏
            if (viewBinding.deviceNullDataIc.getRoot().getVisibility() == View.VISIBLE) {
                viewBinding.deviceNullDataIc.getRoot().setVisibility(View.GONE);
            }
        } else {
            viewBinding.deviceLabel.setTextAppearance(R.style.Text18Style);
            viewBinding.powerStationLabel.setTextAppearance(R.style.Text14Style);
//            viewBinding.editIv.setVisibility(View.GONE);//编辑图标隐藏
            viewBinding.addIv.setVisibility(View.GONE);//添加图标隐藏
            viewBinding.powerStationLabelParent.setVisibility(View.GONE);//电站标签【父容器】隐藏
            viewBinding.deviceLabelParent.setVisibility(View.VISIBLE);//设备标签【父容器】显示
            if (viewBinding.homeNullDataIc.getRoot().getVisibility() == View.VISIBLE) {
                viewBinding.homeNullDataIc.getRoot().setVisibility(View.GONE);
            }
        }
    }
    private void initData() {
        if (isClickPowerStationLabel) {
@@ -544,7 +583,7 @@
                    Gson gson = new Gson();
                    String json = eventBus.getData().toString();
                    HouseIdBean houseIdBean = gson.fromJson(json, HouseIdBean.class);
                    HdlResidenceLogic.getInstance().switchHouse(houseIdBean);
                    HdlResidenceLogic.getInstance().switchHouse(houseIdBean, true);
                }
            } else if (HDLUniMP.UNI_EVENT_REPLY_HOME_EDIT.equals(eventBus.getType())) {
@@ -573,48 +612,87 @@
//                    }
//                }
            }
        } else if (HDLUniMP.UNI_EVENT_REPLY_HOME_CLOSE_HOME_DETAILS_PAGE.equals(eventBus.getType())) {
        } else if (HDLUniMP.UNI_EVENT_REPLY_HOME_CLOSE_HOME_DETAILS_PAGE.equals(eventBus.getTopic())) {
            // 取消粘性事件
            EventBus.getDefault().removeStickyEvent(eventBus);
            //uin关闭住宅详情界面通知
            if (MqttRecvClient.getInstance() != null) {
                MqttRecvClient.getInstance().removeAllTopic();
            //是在(电站)模块且在(电站)标签页才进来这里
            if (HdlCommonLogic.lowerTagType == LowerTagType.power_station && isClickPowerStationLabel) {
//                //uin关闭住宅详情界面通知
//                if (MqttRecvClient.getInstance() != null) {
//                    MqttRecvClient.getInstance().removeAllTopic();
//                }
                loadNextPageHouseList(false, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, 1, true);
            }
            loadNextPageHouseList(false, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, 1, true);
        } else if (HDLUniMP.UNI_EVENT_REPLY_DEVICE_LIST.equals(eventBus.getType())) {
            // 取消粘性事件
            EventBus.getDefault().removeStickyEvent(eventBus);
//            if (!isClickPowerStationLabel) {
//                return;
//            }
            //先清空订阅主题
            if (MqttRecvClient.getInstance() != null) {
                MqttRecvClient.getInstance().removeAllTopic();
            }
            String homeId = eventBus.getData().toString();
            //进去住宅详情uni读取逆变器列表成功后通知
            for (int i = 0; i < HdlDeviceLogic.getInstance().getCurrentHomeGatewayList(UserConfigManage.getInstance().getHomeId()).size(); i++) {
                String gatewayId = HdlDeviceLogic.getInstance().getCurrentHomeGatewayList(UserConfigManage.getInstance().getHomeId()).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 + "/#";
                //进去住宅详情开始订阅主题
                MqttRecvClient.getInstance().checkAndsubscribeAllTopics(topic);
                MqttRecvClient.getInstance().checkAndsubscribeAllTopics(topic);//订阅【逆变器】消息
            }
            String topicHome = "/user/" + homeId + "/#";
            MqttRecvClient.getInstance().checkAndsubscribeAllTopics(topicHome);//订阅【电站】消息
        } else if (eventBus.getTopic().equals(ConstantManage.homepage_title_tab_switch)) {
            // 取消粘性事件
            EventBus.getDefault().removeStickyEvent(eventBus);
            //接收外部点击事件
            if (eventBus.getType().equals(HomepageTitleTabSwitch.powerstation.toString())) {
                // 取消粘性事件
                EventBus.getDefault().removeStickyEvent(eventBus);
                HdlLogLogic.print("正在点击【电站】");
                if (!isReadData) {
                    //1,从首页-故障-进来-电站(不读取)
                    //1,从电站-进来-电站(读取一次,后面进来不在读取)
                    loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, 1, true);
                    getStatusOverview();
//                if (!isReadData) {
//                    //1,从首页-故障-进来-电站(不读取)
//                    //2,从电站-进来-电站(读取一次,后面进来不在读取)
//                    loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, 1, true);
//                    getStatusOverview();
//                }
                //2024年06月24日14:34:01 产品经理要求进去电站列表都要读取 且默认进去都是默认电站标签
                isClickPowerStationLabel = true;
                selectedTitleLabelStyle();
                initializationState();
                getStatusOverview();
                loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, 1, true);
            } else if (eventBus.getType().equals(ConstantManage.station_page)) {
                //通过首页电站进来的
                if (eventBus.getData().equals(PowerStationStatus.All)) {
                    isClickPowerStationLabel = true;
                    selectedTitleLabelStyle();
                    viewBinding.allLl.performClick();
                } else if (eventBus.getData().equals(PowerStationStatus.malfunction)) {
                    isClickPowerStationLabel = true;
                    selectedTitleLabelStyle();
                    viewBinding.faultsLl.performClick();
                } else if (eventBus.getData().equals(PowerStationStatus.off)) {
                    isClickPowerStationLabel = true;
                    selectedTitleLabelStyle();
                    viewBinding.offlineLl.performClick();
                } else if (eventBus.getData().equals(PowerStationStatus.connecting)) {
                    isClickPowerStationLabel = true;
                    selectedTitleLabelStyle();
                    viewBinding.connectedLl.performClick();
                }
            } 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();
            } else if (eventBus.getType().equals(ConstantManage.station_edit)) {
                //编辑后更新一下住宅列表
                //loadNextPageHouseList(false, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, 1, true);
//                getStatusOverview();
                if (houseInfoAdapter != null) {
                    initData();
                    //更新UI
                    houseInfoAdapter.setList(houseListBeanIDList, powerStationStatusValue);
                }
            }
        }
    }
@@ -630,10 +708,10 @@
                if (statusOverviewBean == null) {
                    return;
                }
                viewBinding.powerStationAllIl.stationTotalTv.setText(HdlCommonLogic.convertString(statusOverviewBean.getTotal()));
                viewBinding.powerStationFaultsIl.stationTotalTv.setText(HdlCommonLogic.convertString(statusOverviewBean.getFault()));
                viewBinding.powerStationOfflineIl.stationTotalTv.setText(HdlCommonLogic.convertString(statusOverviewBean.getOffline()));
                viewBinding.powerStationConnectedIl.stationTotalTv.setText(HdlCommonLogic.convertString(statusOverviewBean.getConnecting()));
                viewBinding.allTotalTv.setText(HdlCommonLogic.convertString(statusOverviewBean.getTotal()));
                viewBinding.faultsTotalTv.setText(HdlCommonLogic.convertString(statusOverviewBean.getFault()));
                viewBinding.offlineTotalTv.setText(HdlCommonLogic.convertString(statusOverviewBean.getOffline()));
                viewBinding.connectedTotalTv.setText(HdlCommonLogic.convertString(statusOverviewBean.getConnecting()));
            }
            @Override
@@ -673,7 +751,7 @@
        }
        isHouseLoadingMore = true;//标记读取状态
        if (isRefreshing) {
            showLoading();
            showLoading(getString(R.string.device_loading));
        }
        //获取住宅(电站)ID列表
@@ -695,7 +773,7 @@
                            if (houseInfoAdapter != null) {
                                initData();
                                //更新UI
                                houseInfoAdapter.setList(houseListBeanIDList);
                                houseInfoAdapter.setList(houseListBeanIDList, powerStationStatusValue);
                            }
                        }
                        nullDataUpdateUi();
@@ -742,12 +820,12 @@
        }
        isDeviceLoadingMore = true;//标记读取状态
        if (isRefreshing) {
            showLoading();
            showLoading(getString(R.string.device_loading));
        }
        //获取住宅(电站)ID列表
        HdlDeviceLogic.getInstance().getPowerStationDeviceList("", pageNo, pageSize, new CloudCallBeak<PageNumberObject<DeviceBean>>() {
        HdlDeviceLogic.getInstance().getPowerStationDeviceList("", pageNo, pageSize, new CloudCallBeak<PageNumberObject<CloudInverterDeviceBean>>() {
            @Override
            public void onSuccess(PageNumberObject<DeviceBean> pageNumberObject) {
            public void onSuccess(PageNumberObject<CloudInverterDeviceBean> pageNumberObject) {
                HdlThreadLogic.runMainThread(new Runnable() {
                    @Override
                    public void run() {
@@ -876,7 +954,8 @@
                initializeInverter(list); //发起初始化指令给逆变器;(注意:只能是本地发送了(要搜索局域网逆变器列表,建立本地通讯通道),删除电站成功后,云端解绑逆变器的关系)
                HdlResidenceLogic.getInstance().delHouseId(homeId);//删除电站缓存
                initData();//初始化缓存数据
                houseInfoAdapter.setList(houseListBeanIDList);//重新刷新列表
                houseInfoAdapter.setList(houseListBeanIDList, powerStationStatusValue);//重新刷新列表
                getStatusOverview();//删除成功后刷新电站状态概览
                nullDataUpdateUi();//检测数据是否为空
            }