| | |
| | | import com.hdl.photovoltaic.ui.bean.HouseIdBean; |
| | | import com.hdl.photovoltaic.uni.HDLUniMP; |
| | | import com.hdl.photovoltaic.utils.PermissionUtils; |
| | | 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; |
| | |
| | | |
| | | private String key = SortValue.all; |
| | | private String value = SortValue.all;//descending:降序,ascending:升序 |
| | | |
| | | |
| | | private String installedCapacityMinKey = SortType.installedCapacityMin; |
| | | private int installedCapacityMinValue;//最小组串容量(装机容量) |
| | | private String installedCapacityMaxKey = SortType.installedCapacityMax; |
| | | private int installedCapacityMaxValue;//最大组串容量(装机容量) |
| | | private String gridTypeKey = SortType.gridType; |
| | | private String gridTypeValue;//并网状态(全部 不传该过滤参数,FULL_GRID:并网,OFFLINE:离网) |
| | | private String powerStationStatusKey = SortType.powerStationStatus; |
| | | private int powerStationStatusValue;//电站状态(全部 不传该过滤参数,1:正常(运行),2:离线,3:待接入,4:故障) |
| | | private String installedCapacityMinValue = "";//最小组串容量(装机容量) |
| | | private String installedCapacityMaxValue = "";//最大组串容量(装机容量) |
| | | private String gridTypeValue = "";//并网状态(全部 不传该过滤参数,FULL_GRID:并网,OFFLINE:离网) |
| | | private String powerStationStatusValue = "";//电站状态(全部 不传该过滤参数,1:正常(运行),2:离线,3:待接入,4:故障) |
| | | |
| | | private final long pageSize = 20;//页数 |
| | | |
| | |
| | | isClickPowerStationLabel = true; |
| | | viewBinding.powerStationLabel.setTextAppearance(R.style.Text20Style); |
| | | viewBinding.deviceLabel.setTextAppearance(R.style.Text16Style); |
| | | viewBinding.powerStationLabelParent.setVisibility(View.VISIBLE); |
| | | viewBinding.deviceLabelParent.setVisibility(View.GONE);//设备标签隐藏 |
| | | loadNextPageHouseList(true, 1, true); |
| | | viewBinding.powerStationLabelParent.setVisibility(View.VISIBLE);//电站标签【父容器】显示 |
| | | viewBinding.deviceLabelParent.setVisibility(View.GONE);//设备标签【父容器】隐藏 |
| | | loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, 1, true); |
| | | } |
| | | }); |
| | | //设备标签 |
| | |
| | | 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); |
| | | viewBinding.powerStationLabelParent.setVisibility(View.GONE);//电站标签【父容器】隐藏 |
| | | viewBinding.deviceLabelParent.setVisibility(View.VISIBLE);//设备标签【父容器】显示 |
| | | loadNextPageDeviceList(true, 1, true); |
| | | } |
| | | }); |
| | |
| | | |
| | | } |
| | | }); |
| | | //电站添搜索 |
| | | //电站搜索 |
| | | viewBinding.powerStationSearchClickCl.setOnClickListener(new View.OnClickListener() { |
| | | @Override |
| | | public void onClick(View v) { |
| | |
| | | startActivity(intent); |
| | | } |
| | | }); |
| | | //默认选择参数图标 |
| | | viewBinding.powerStationDefaultConditionIv.setOnClickListener(new View.OnClickListener() { |
| | | @Override |
| | | public void onClick(View v) { |
| | | DefaultFilteringDialog defaultFilteringDialog = new DefaultFilteringDialog(_mActivity); |
| | | defaultFilteringDialog.show(); |
| | | defaultFilteringDialog.initState(installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue); |
| | | defaultFilteringDialog.setOnClickListener(new DefaultFilteringDialog.OnClickListener() { |
| | | @Override |
| | | public void confirm(String min, String max, String state) { |
| | | installedCapacityMinValue = min;//最小组串容量(装机容量) |
| | | installedCapacityMaxValue = max;//最大组串容量(装机容量) |
| | | gridTypeValue = state;//并网状态(全部 不传该过滤参数,FULL_GRID:并网,OFFLINE:离网) |
| | | loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, 1, true); |
| | | } |
| | | }); |
| | | } |
| | | }); |
| | | |
| | | //电站设置下拉箭头颜色 |
| | | viewBinding.fragmentHouseSrl.setColorSchemeResources(R.color.text_FF245EC3); |
| | | //电站下拉读取 |
| | |
| | | @Override |
| | | public void onRefresh() { |
| | | viewBinding.fragmentHouseSrl.setRefreshing(false); |
| | | loadNextPageHouseList(true, 1, true); |
| | | loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, 1, true); |
| | | } |
| | | }); |
| | | //电站上拉读取 |
| | |
| | | if (!isHouseLoadingMore) { |
| | | // 滑动到了底部,执行相应的操作 |
| | | HdlLogLogic.print("--->滑动到了底部"); |
| | | loadNextPageHouseList(false, ++currentHouseListPage, false); |
| | | loadNextPageHouseList(false, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, ++currentHouseListPage, false); |
| | | } |
| | | } |
| | | } |
| | |
| | | if (HDLUniMP.UNI_EVENT_REPLY_HOME_MODEL.equals(eventBus.getTopic())) { |
| | | if (HDLUniMP.UNI_EVENT_REPLY_HOME_CREATION.equals(eventBus.getType())) { |
| | | //uin创建电站成功后通知 |
| | | loadNextPageHouseList(false, 1, true); |
| | | loadNextPageHouseList(false, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, 1, true); |
| | | if (eventBus.getData() != null) { |
| | | Gson gson = new Gson(); |
| | | String json = eventBus.getData().toString(); |
| | |
| | | if (MqttRecvClient.getInstance() != null) { |
| | | MqttRecvClient.getInstance().removeAllTopic(); |
| | | } |
| | | loadNextPageHouseList(false, 1, true); |
| | | loadNextPageHouseList(false, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, 1, true); |
| | | |
| | | } else if (HDLUniMP.UNI_EVENT_REPLY_DEVICE_LIST.equals(eventBus.getType())) { |
| | | //进去住宅详情uni读取逆变器列表成功后通知 |
| | |
| | | //接收外部点击事件 |
| | | if (eventBus.getType().equals(HomepageTitleTabSwitch.powerstation.toString())) { |
| | | HdlLogLogic.print("正在点击【电站】"); |
| | | loadNextPageHouseList(true, 1, true); |
| | | loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, 1, true); |
| | | } |
| | | } |
| | | } |
| | |
| | | /** |
| | | * 刷新UI(电站) |
| | | * |
| | | * @param isRefreshing 表示是下拉刷新的 |
| | | * @param isRefreshing 表示是下拉刷新的 |
| | | * @param key 发电功率排序(powerSort); |
| | | * 今日发电量排序(todayElectricitySort); |
| | | * 创建时间排序(createTimeSort); |
| | | * @param keyValue (descending:降序 |
| | | * ascending:升序), |
| | | * @param installedCapacityMin 最小组串容量(装机容量) |
| | | * @param installedCapacityMax 最大组串容量(装机容量) |
| | | * @param gridType 并网状态 (全部 :"";FULL_GRID : 并网;OFFLINE :离网) |
| | | * @param powerStationStatus 电站状态 (全部 :"";1 : 正常;2 : 离线; 3 : 待接入;4 : 故障) |
| | | * @param pageNo 页码 |
| | | * @param isClear 是否清除数据 |
| | | */ |
| | | private void loadNextPageHouseList(boolean isRefreshing, long pageNo, boolean isClear) { |
| | | private void loadNextPageHouseList(boolean isRefreshing, |
| | | String key, |
| | | String keyValue, |
| | | String installedCapacityMin, |
| | | String installedCapacityMax, |
| | | String gridType, |
| | | String powerStationStatus, |
| | | long pageNo, |
| | | boolean isClear) { |
| | | if (isClear) { |
| | | clearData(); |
| | | } |
| | |
| | | } |
| | | |
| | | //获取住宅(电站)ID列表 |
| | | HdlResidenceLogic.getInstance().getResidenceIdList(key, value, pageNo, pageSize, new CloudCallBeak<HdlResidenceLogic.HouseBeanClass>() { |
| | | @Override |
| | | public void onSuccess(HdlResidenceLogic.HouseBeanClass houseBeanClass) { |
| | | HdlThreadLogic.runMainThread(new Runnable() { |
| | | HdlResidenceLogic.getInstance().getResidenceIdList( |
| | | key, |
| | | keyValue, |
| | | installedCapacityMin, |
| | | installedCapacityMax, |
| | | gridType, |
| | | powerStationStatus, |
| | | pageNo, pageSize, new CloudCallBeak<HdlResidenceLogic.HouseBeanClass>() { |
| | | @Override |
| | | public void run() { |
| | | if (isRefreshing) { |
| | | hideLoading(); |
| | | } |
| | | isHouseLoadingMore = false; |
| | | if (houseBeanClass != null) { |
| | | currentHouseListTotal = (int) houseBeanClass.getTotalPage(); |
| | | currentHouseListPage = (int) houseBeanClass.getPageNo(); |
| | | //更新缓存 |
| | | HdlResidenceLogic.getInstance().setHouseIdList(houseBeanClass.getList()); |
| | | if (houseInfoAdapter != null) { |
| | | initData(); |
| | | //更新UI |
| | | houseInfoAdapter.setList(houseListBeanIDList); |
| | | public void onSuccess(HdlResidenceLogic.HouseBeanClass houseBeanClass) { |
| | | HdlThreadLogic.runMainThread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | if (isRefreshing) { |
| | | hideLoading(); |
| | | } |
| | | isHouseLoadingMore = false; |
| | | if (houseBeanClass != null) { |
| | | currentHouseListTotal = (int) houseBeanClass.getTotalPage(); |
| | | currentHouseListPage = (int) houseBeanClass.getPageNo(); |
| | | //更新缓存 |
| | | HdlResidenceLogic.getInstance().setHouseIdList(houseBeanClass.getList()); |
| | | if (houseInfoAdapter != null) { |
| | | initData(); |
| | | //更新UI |
| | | houseInfoAdapter.setList(houseListBeanIDList); |
| | | } |
| | | } |
| | | nullDataUpdateUi(); |
| | | } |
| | | } |
| | | nullDataUpdateUi(); |
| | | }, _mActivity, ShowErrorMode.YES); |
| | | |
| | | } |
| | | }, _mActivity, ShowErrorMode.YES); |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onFailure(HDLException e) { |
| | | HdlThreadLogic.runMainThread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | if (currentHouseListPage > 1) { |
| | | --currentHouseListPage; |
| | | } |
| | | isHouseLoadingMore = false; |
| | | if (isRefreshing) { |
| | | hideLoading(); |
| | | } |
| | | public void onFailure(HDLException e) { |
| | | HdlThreadLogic.runMainThread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | if (currentHouseListPage > 1) { |
| | | --currentHouseListPage; |
| | | } |
| | | isHouseLoadingMore = false; |
| | | if (isRefreshing) { |
| | | hideLoading(); |
| | | } |
| | | |
| | | } |
| | | }, _mActivity, ShowErrorMode.YES); |
| | | } |
| | | }, _mActivity, ShowErrorMode.YES); |
| | | } |
| | | }); |
| | | }); |
| | | } |
| | | |
| | | /** |