wjc
2026-03-23 70394b344e4c9aceb9e979eb4192bdbb28186deb
app/src/main/java/com/hdl/photovoltaic/ui/powerstation/HouseAndDeviceFragment.java
@@ -35,6 +35,7 @@
import com.hdl.photovoltaic.enums.LogoutType;
import com.hdl.photovoltaic.enums.LowerTagType;
import com.hdl.photovoltaic.enums.PowerStationStatus;
import com.hdl.photovoltaic.enums.PowerStationType;
import com.hdl.photovoltaic.enums.ProjectOperation;
import com.hdl.photovoltaic.enums.ShowErrorMode;
import com.hdl.photovoltaic.enums.SortType;
@@ -109,6 +110,7 @@
    private String installedCapacityMaxValue = "";//最大组串容量(装机容量)
    private String screeningConditionStatus = DebugStatus.All;//筛选条件状态
    private String powerStationStatusValue = PowerStationStatus.All;//电站状态(全部 不传该过滤参数,1:正常(运行),2:离线,3:待接入,4:故障)
    private String powerStationTypeValue = PowerStationType.All;//电站类型(INV = 逆变器电站;BMS = BMS电站)
    private final long pageSize = 100;//一页大小
@@ -122,6 +124,7 @@
        installedCapacityMaxValue = "";
        screeningConditionStatus = DebugStatus.All;
        powerStationStatusValue = PowerStationStatus.All;
        powerStationTypeValue = PowerStationType.All;
    }
    @Override
@@ -158,7 +161,7 @@
                selectedTitleLabelStyle();
                initializationState();
                getStatusOverview();
                loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, screeningConditionStatus, powerStationStatusValue, 1, true);
                loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, screeningConditionStatus, powerStationStatusValue, powerStationTypeValue, 1, true);
            }
        });
@@ -184,7 +187,7 @@
                powerStationStatusValue = PowerStationStatus.All;
                stationStatusStyle(viewBinding.allLl, viewBinding.allDesTv);
                getStatusOverview();
                loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, screeningConditionStatus, powerStationStatusValue, 1, true);
                loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, screeningConditionStatus, powerStationStatusValue, powerStationTypeValue, 1, true);
            }
        });
        //故障
@@ -197,7 +200,7 @@
                powerStationStatusValue = PowerStationStatus.malfunction;
                stationStatusStyle(viewBinding.faultsLl, viewBinding.faultsDesTv);
                getStatusOverview();
                loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, screeningConditionStatus, powerStationStatusValue, 1, true);
                loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, screeningConditionStatus, powerStationStatusValue, powerStationTypeValue, 1, true);
            }
        });
        //离线
@@ -210,7 +213,7 @@
                powerStationStatusValue = PowerStationStatus.off;
                stationStatusStyle(viewBinding.offlineLl, viewBinding.offlineDesTv);
                getStatusOverview();
                loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, screeningConditionStatus, powerStationStatusValue, 1, true);
                loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, screeningConditionStatus, powerStationStatusValue, powerStationTypeValue, 1, true);
            }
        });
        //待接入
@@ -223,7 +226,7 @@
                powerStationStatusValue = PowerStationStatus.connecting;
                stationStatusStyle(viewBinding.connectedLl, viewBinding.connectedDesTv);
                getStatusOverview();
                loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, screeningConditionStatus, powerStationStatusValue, 1, true);
                loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, screeningConditionStatus, powerStationStatusValue, powerStationTypeValue, 1, true);
            }
        });
@@ -286,15 +289,16 @@
            public void onClick(View v) {
                DefaultFilteringDialog defaultFilteringDialog = new DefaultFilteringDialog(_mActivity);
                defaultFilteringDialog.show();
                defaultFilteringDialog.initState(installedCapacityMinValue, installedCapacityMaxValue, screeningConditionStatus);
                defaultFilteringDialog.initState(installedCapacityMinValue, installedCapacityMaxValue, screeningConditionStatus, powerStationTypeValue);
                defaultFilteringDialog.setOnClickListener(new DefaultFilteringDialog.OnClickListener() {
                    @Override
                    public void confirm(String min, String max, String state) {
                    public void confirm(String min, String max, String state, String powerStationType) {
                        installedCapacityMinValue = min;//最小组串容量(装机容量)
                        installedCapacityMaxValue = max;//最大组串容量(装机容量)
                        screeningConditionStatus = state;//调试状态(全部;调试中;调试完成;已交付;授权调试)
                        powerStationTypeValue = powerStationType;//电站类型(INV = 逆变器电站;BMS = BMS电站)
                        getStatusOverview();
                        loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, screeningConditionStatus, powerStationStatusValue, 1, true);
                        loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, screeningConditionStatus, powerStationStatusValue, powerStationTypeValue, 1, true);
                    }
                });
            }
@@ -387,7 +391,7 @@
//                            if (houseIdBean.getDebugType().equals(DebugType.NORMAL)) {
                            //【常规方式】发起删除电站指令(搜索网关是考到网关没有连接到云端,使用本地发送初始化指令)
                            // 硬件那边叫新固件也发初始化 2025年10月14日10:55:18
                            HdlDeviceLogic.getInstance().getCurrentHomeLocalAndCloudGatewayList(houseIdBean.getHomeId(), new CloudCallBeak<List<GatewayBean>>() {
                            HdlDeviceLogic.getInstance().getCurrentHomeLocalAndCloudGatewayList(houseIdBean.getHomeId(), houseIdBean.getPowerStationType(), new CloudCallBeak<List<GatewayBean>>() {
                                @Override
                                public void onSuccess(List<GatewayBean> list) {
                                    //发起删除电站指令
@@ -426,7 +430,7 @@
                key = SortType.installedCapacitySort;
                value = isSelected ? SortValue.ascending : SortValue.descending;
                getStatusOverview();
                loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, screeningConditionStatus, powerStationStatusValue, 1, true);
                loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, screeningConditionStatus, powerStationStatusValue, powerStationTypeValue, 1, true);
            }
        });
        //额定功率筛选
@@ -438,7 +442,7 @@
                key = SortType.invPowerSort;
                value = isSelected ? SortValue.ascending : SortValue.descending;
                getStatusOverview();
                loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, screeningConditionStatus, powerStationStatusValue, 1, true);
                loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, screeningConditionStatus, powerStationStatusValue, powerStationTypeValue, 1, true);
            }
        });
        //电站电池容量筛选
@@ -450,7 +454,7 @@
                key = SortType.batteryCapacitySort;
                value = isSelected ? SortValue.ascending : SortValue.descending;
                getStatusOverview();
                loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, screeningConditionStatus, powerStationStatusValue, 1, true);
                loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, screeningConditionStatus, powerStationStatusValue, powerStationTypeValue, 1, true);
            }
        });
        //电站当日发电量筛选
@@ -462,7 +466,7 @@
                key = SortType.todayElectricitySort;
                value = isSelected ? SortValue.ascending : SortValue.descending;
                getStatusOverview();
                loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, screeningConditionStatus, powerStationStatusValue, 1, true);
                loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, screeningConditionStatus, powerStationStatusValue, powerStationTypeValue, 1, true);
            }
        });
        //设备点击
@@ -499,7 +503,7 @@
                List<CloudInverterDeviceBean> newList = new ArrayList<>();
                newList.add(deviceBean);
                //目的是为了获取拿到网关ID,mqtt通讯秘钥等信息,拿到后缓存到本地逆变器列表里面,发送数据数据时自动去缓存列表里面去查找;
                HdlDeviceLogic.getInstance().setDeviceRemoteInfo(newList, deviceBean.getHomeId(), new CloudCallBeak<List<GatewayBean>>() {
                HdlDeviceLogic.getInstance().setDeviceRemoteInfo(newList, deviceBean.getHomeId(), PowerStationType.All, new CloudCallBeak<List<GatewayBean>>() {
                    @Override
                    public void onSuccess(List<GatewayBean> obj) {
@@ -720,7 +724,7 @@
//                    MqttRecvClient.getInstance().removeAllTopic();
//                }
                loadNextPageHouseList(false, key, value, installedCapacityMinValue, installedCapacityMaxValue, screeningConditionStatus, powerStationStatusValue, 1, true);
                loadNextPageHouseList(false, key, value, installedCapacityMinValue, installedCapacityMaxValue, screeningConditionStatus, powerStationStatusValue, powerStationTypeValue, 1, true);
            }
        } else if (HDLUniMP.UNI_EVENT_REPLY_DEVICE_LIST.equals(eventBus.getType())) {
            // 取消粘性事件
@@ -734,8 +738,8 @@
            }
            String homeId = eventBus.getData().toString();
            //进去住宅详情uni读取逆变器列表成功后通知
            for (int i = 0; i < HdlDeviceLogic.getInstance().getCurrentHomeGatewayList(homeId).size(); i++) {
                String gatewayId = HdlDeviceLogic.getInstance().getCurrentHomeGatewayList(homeId).get(i).getGatewayId();
            for (int i = 0; i < HdlDeviceLogic.getInstance().getCurrentHomeGatewayList(homeId,PowerStationType.All).size(); i++) {
                String gatewayId = HdlDeviceLogic.getInstance().getCurrentHomeGatewayList(homeId,PowerStationType.All).get(i).getGatewayId();
                //字符串是自己按规则拼接的,里面注册主题时会解析字符串,只拿getGatewayId()值;
                String topic = "/user/" + gatewayId + "/#";
                //进去住宅详情开始订阅主题
@@ -763,7 +767,7 @@
                initializationState();
                stationStatusStyle(viewBinding.allLl, viewBinding.allDesTv);
                getStatusOverview();
                loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, screeningConditionStatus, powerStationStatusValue, 1, true);
                loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, screeningConditionStatus, powerStationStatusValue, powerStationTypeValue, 1, true);
            } else if (eventBus.getType().equals(ConstantManage.station_page)) {
                // 取消粘性事件
                EventBus.getDefault().removeStickyEvent(eventBus);
@@ -781,7 +785,7 @@
                    stationStatusStyle(viewBinding.connectedLl, viewBinding.connectedDesTv);
                }
                getStatusOverview();
                loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, screeningConditionStatus, powerStationStatusValue, 1, true);
                loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, screeningConditionStatus, powerStationStatusValue, powerStationTypeValue, 1, true);
            } else if (eventBus.getType().equals(ConstantManage.station_edit)) {
                //编辑后更新一下住宅列表
                //loadNextPageHouseList(false, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, 1, true);
@@ -800,7 +804,7 @@
     * 电站状态概览
     */
    private void getStatusOverview() {
        HdlResidenceLogic.getInstance().getStatusOverview(screeningConditionStatus, installedCapacityMinValue, installedCapacityMaxValue, new CloudCallBeak<StatusOverviewBean>() {
        HdlResidenceLogic.getInstance().getStatusOverview(screeningConditionStatus, installedCapacityMinValue, installedCapacityMaxValue, powerStationTypeValue, new CloudCallBeak<StatusOverviewBean>() {
            @Override
            public void onSuccess(StatusOverviewBean statusOverviewBean) {
                if (statusOverviewBean == null) {
@@ -834,10 +838,11 @@
     * @param installedCapacityMax 最大组串容量(装机容量)
     * @param gridType             调试状态(全部;调试中;调试完成;已交付;授权调试)
     * @param powerStationStatus   电站状态 (全部  :"";1 : 正常;2 : 离线; 3 : 待接入;4 : 故障)
     * @param powerStationType     电站类型(INV = 逆变器电站;BMS = BMS电站)
     * @param pageNo               页码
     * @param isClear              是否清除数据
     */
    private void loadNextPageHouseList(boolean isRefreshing, String key, String keyValue, String installedCapacityMin, String installedCapacityMax, String gridType, String powerStationStatus, long pageNo, boolean isClear) {
    private void loadNextPageHouseList(boolean isRefreshing, String key, String keyValue, String installedCapacityMin, String installedCapacityMax, String gridType, String powerStationStatus, String powerStationType, long pageNo, boolean isClear) {
        isReadData = true;
        if (isClear) {
            clearData();
@@ -854,7 +859,7 @@
        }
        //获取住宅(电站)ID列表
        HdlResidenceLogic.getInstance().getResidenceIdList(key, keyValue, installedCapacityMin, installedCapacityMax, gridType, powerStationStatus, pageNo, pageSize, new CloudCallBeak<HdlResidenceLogic.HouseBeanClass>() {
        HdlResidenceLogic.getInstance().getResidenceIdList(key, keyValue, installedCapacityMin, installedCapacityMax, gridType, powerStationStatus, powerStationType, pageNo, pageSize, new CloudCallBeak<HdlResidenceLogic.HouseBeanClass>() {
            @Override
            public void onSuccess(HdlResidenceLogic.HouseBeanClass houseBeanClass) {
                HdlThreadLogic.runMainThread(new Runnable() {
@@ -1191,7 +1196,7 @@
                        // 执行任务(如更新UI、跳转等)
                        viewBinding.fragmentHouseSrl.endRefreshing();
                        //加载最新数据完成
                        loadNextPageHouseList(false, key, value, installedCapacityMinValue, installedCapacityMaxValue, screeningConditionStatus, powerStationStatusValue, 1, true);
                        loadNextPageHouseList(false, key, value, installedCapacityMinValue, installedCapacityMaxValue, screeningConditionStatus, powerStationStatusValue, powerStationTypeValue, 1, true);
                        getStatusOverview();
                    }
                }.execute();
@@ -1218,7 +1223,7 @@
                        viewBinding.fragmentHouseSrl.endLoadingMore();
                        if (!isHouseLoadingMore) {
                            // 滑动到了底部,执行相应的操作
                            loadNextPageHouseList(false, key, value, installedCapacityMinValue, installedCapacityMaxValue, screeningConditionStatus, powerStationStatusValue, ++currentHouseListPage, false);
                            loadNextPageHouseList(false, key, value, installedCapacityMinValue, installedCapacityMaxValue, screeningConditionStatus, powerStationStatusValue, powerStationTypeValue, ++currentHouseListPage, false);
                        }
                    }
                }.execute();