| | |
| | | import com.hdl.photovoltaic.other.HdlDeviceLogic; |
| | | import com.hdl.photovoltaic.other.HdlLogLogic; |
| | | import com.hdl.photovoltaic.other.HdlPowerStationDataStatisticsLogic; |
| | | import com.hdl.photovoltaic.other.HdlResidenceLogic; |
| | | import com.hdl.photovoltaic.other.HdlThreadLogic; |
| | | import com.hdl.photovoltaic.other.HdlUniLogic; |
| | | import com.hdl.photovoltaic.ui.bean.DataOverBean; |
| | | import com.hdl.photovoltaic.ui.bean.SocialContributionBean; |
| | | import com.hdl.photovoltaic.ui.bean.StatisticsBean; |
| | | import com.hdl.photovoltaic.ui.bean.StatusOverviewBean; |
| | | import com.hdl.photovoltaic.ui.home.aachart.BasicChartComposer; |
| | | import com.hdl.photovoltaic.uni.HDLUniMP; |
| | | import com.hdl.photovoltaic.utils.TimeUtils; |
| | | import com.hdl.sdk.link.core.bean.eventbus.BaseEventBus; |
| | | |
| | |
| | | HdlThreadLogic.runSubThread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | getStatusOverview(); |
| | | getDataOver(); |
| | | getStatistics(); |
| | | getSocialContribution(); |
| | |
| | | } |
| | | |
| | | private void initEvent() { |
| | | //电站添加 |
| | | viewBinding.homePageStationAddIv.setOnClickListener(new View.OnClickListener() { |
| | | @Override |
| | | public void onClick(View v) { |
| | | HdlUniLogic.getInstance().openUniMP(HDLUniMP.UNI_EVENT_OPEN_HOME_CREATION, null); |
| | | } |
| | | }); |
| | | //时间选择器 |
| | | viewBinding.yearMonthDayTv.setOnClickListener(new View.OnClickListener() { |
| | | @Override |
| | |
| | | viewBinding.dayTv.setTextColor(_mActivity.getColor(R.color.text_38C494)); |
| | | |
| | | viewBinding.monthTv.setBackground(AppCompatResources.getDrawable(_mActivity, R.color.text_00000000)); |
| | | viewBinding.monthTv.setTextColor(_mActivity.getColor(R.color.text_40000000)); |
| | | viewBinding.monthTv.setTextColor(_mActivity.getColor(R.color.text_66000000)); |
| | | |
| | | viewBinding.yearTv.setBackground(AppCompatResources.getDrawable(_mActivity, R.color.text_00000000)); |
| | | viewBinding.yearTv.setTextColor(_mActivity.getColor(R.color.text_40000000)); |
| | | viewBinding.yearTv.setTextColor(_mActivity.getColor(R.color.text_66000000)); |
| | | |
| | | viewBinding.lifeCycleTv.setBackground(AppCompatResources.getDrawable(_mActivity, R.color.text_00000000)); |
| | | viewBinding.lifeCycleTv.setTextColor(_mActivity.getColor(R.color.text_40000000)); |
| | | viewBinding.lifeCycleTv.setTextColor(_mActivity.getColor(R.color.text_66000000)); |
| | | |
| | | viewBinding.v1.setVisibility(View.GONE); |
| | | viewBinding.v2.setVisibility(View.VISIBLE); |
| | |
| | | } |
| | | timeType = TimeType.month; |
| | | viewBinding.dayTv.setBackground(AppCompatResources.getDrawable(_mActivity, R.color.text_00000000)); |
| | | viewBinding.dayTv.setTextColor(_mActivity.getColor(R.color.text_40000000)); |
| | | viewBinding.dayTv.setTextColor(_mActivity.getColor(R.color.text_66000000)); |
| | | |
| | | viewBinding.monthTv.setBackground(AppCompatResources.getDrawable(_mActivity, R.drawable.time_selected_38c494)); |
| | | viewBinding.monthTv.setTextColor(_mActivity.getColor(R.color.text_38C494)); |
| | | |
| | | viewBinding.yearTv.setBackground(AppCompatResources.getDrawable(_mActivity, R.color.text_00000000)); |
| | | viewBinding.yearTv.setTextColor(_mActivity.getColor(R.color.text_40000000)); |
| | | viewBinding.yearTv.setTextColor(_mActivity.getColor(R.color.text_66000000)); |
| | | |
| | | viewBinding.lifeCycleTv.setBackground(AppCompatResources.getDrawable(_mActivity, R.color.text_00000000)); |
| | | viewBinding.lifeCycleTv.setTextColor(_mActivity.getColor(R.color.text_40000000)); |
| | | viewBinding.lifeCycleTv.setTextColor(_mActivity.getColor(R.color.text_66000000)); |
| | | |
| | | viewBinding.v1.setVisibility(View.GONE); |
| | | viewBinding.v2.setVisibility(View.GONE); |
| | |
| | | } |
| | | timeType = TimeType.year; |
| | | viewBinding.dayTv.setBackground(AppCompatResources.getDrawable(_mActivity, R.color.text_00000000)); |
| | | viewBinding.dayTv.setTextColor(_mActivity.getColor(R.color.text_40000000)); |
| | | viewBinding.dayTv.setTextColor(_mActivity.getColor(R.color.text_66000000)); |
| | | |
| | | viewBinding.monthTv.setBackground(AppCompatResources.getDrawable(_mActivity, R.color.text_00000000)); |
| | | viewBinding.monthTv.setTextColor(_mActivity.getColor(R.color.text_40000000)); |
| | | viewBinding.monthTv.setTextColor(_mActivity.getColor(R.color.text_66000000)); |
| | | |
| | | viewBinding.yearTv.setBackground(AppCompatResources.getDrawable(_mActivity, R.drawable.time_selected_38c494)); |
| | | viewBinding.yearTv.setTextColor(_mActivity.getColor(R.color.text_38C494)); |
| | | |
| | | viewBinding.lifeCycleTv.setBackground(AppCompatResources.getDrawable(_mActivity, R.color.text_00000000)); |
| | | viewBinding.lifeCycleTv.setTextColor(_mActivity.getColor(R.color.text_40000000)); |
| | | viewBinding.lifeCycleTv.setTextColor(_mActivity.getColor(R.color.text_66000000)); |
| | | |
| | | viewBinding.v1.setVisibility(View.VISIBLE); |
| | | viewBinding.v2.setVisibility(View.GONE); |
| | |
| | | } |
| | | timeType = TimeType.all; |
| | | viewBinding.dayTv.setBackground(AppCompatResources.getDrawable(_mActivity, R.color.text_00000000)); |
| | | viewBinding.dayTv.setTextColor(_mActivity.getColor(R.color.text_40000000)); |
| | | viewBinding.dayTv.setTextColor(_mActivity.getColor(R.color.text_66000000)); |
| | | |
| | | viewBinding.monthTv.setBackground(AppCompatResources.getDrawable(_mActivity, R.color.text_00000000)); |
| | | viewBinding.monthTv.setTextColor(_mActivity.getColor(R.color.text_40000000)); |
| | | viewBinding.monthTv.setTextColor(_mActivity.getColor(R.color.text_66000000)); |
| | | |
| | | viewBinding.yearTv.setBackground(AppCompatResources.getDrawable(_mActivity, R.color.text_00000000)); |
| | | viewBinding.yearTv.setTextColor(_mActivity.getColor(R.color.text_40000000)); |
| | | viewBinding.yearTv.setTextColor(_mActivity.getColor(R.color.text_66000000)); |
| | | |
| | | viewBinding.lifeCycleTv.setBackground(AppCompatResources.getDrawable(_mActivity, R.drawable.time_selected_38c494)); |
| | | viewBinding.lifeCycleTv.setTextColor(_mActivity.getColor(R.color.text_38C494)); |
| | |
| | | .setTitleText(_mActivity.getString(R.string.time_selectd))//标题文字 |
| | | .setOutSideCancelable(true)//点击屏幕,点在控件外部范围时,是否取消显示 |
| | | .isCyclic(false)//是否循环滚动 |
| | | .setTitleColor(_mActivity.getColor(R.color.text_90000000))//标题文字颜色 |
| | | .setTitleColor(_mActivity.getColor(R.color.text_E6000000))//标题文字颜色 |
| | | .setSubmitColor(_mActivity.getColor(R.color.text_38C494))//确定按钮文字颜色 |
| | | .setCancelColor(_mActivity.getColor(R.color.text_40000000))//取消按钮文字颜色 |
| | | .setCancelColor(_mActivity.getColor(R.color.text_66000000))//取消按钮文字颜色 |
| | | .setTitleBgColor(_mActivity.getColor(R.color.text_FFFFFFFF))//标题背景颜色 Night mode |
| | | .setBgColor(_mActivity.getColor(R.color.text_FFFFFFFF))//滚轮背景颜色 Night mode |
| | | .setTextColorCenter(_mActivity.getColor(R.color.text_90000000)).setDate(selectedDate)// 如果不设置的话,默认是系统时间*/ |
| | | .setTextColorCenter(_mActivity.getColor(R.color.text_E6000000)).setDate(selectedDate)// 如果不设置的话,默认是系统时间*/ |
| | | .setRangDate(startDate, endDate)//起始终止年月日设定 |
| | | .setLabel(_mActivity.getString(R.string.year), _mActivity.getString(R.string.month), _mActivity.getString(R.string.day), _mActivity.getString(R.string.hour), _mActivity.getString(R.string.minute), _mActivity.getString(R.string.seconds))//默认设置为年月日时分秒 |
| | | .isCenterLabel(false) //是否只显示中间选中项的label文字,false则每项item全部都带有label。 |
| | |
| | | |
| | | private void initView() { |
| | | |
| | | |
| | | viewBinding.homeAllIl.stationTitleTv.setText(getString(R.string.message_all)); |
| | | viewBinding.homeFaultsIl.stationTitleTv.setText(getString(R.string.my_power_station_malfunction)); |
| | | viewBinding.homeOfflineIl.stationTitleTv.setText(getString(R.string.my_power_station_off_line)); |
| | | viewBinding.homeConnectedIl.stationTitleTv.setText(getString(R.string.to_be_added)); |
| | | |
| | | String dataStr = TimeUtils.getDateTimestamp(getCurrentTimestamp(), getTimeDateFormat()); |
| | | viewBinding.yearMonthDayTv.setText(dataStr); |
| | | |
| | |
| | | viewBinding.infoRl1Text2Tv.setText(installed_capacity); |
| | | String generated_power = getString(R.string.generated_power) + "(" + HdlDeviceLogic.kW + ")"; |
| | | viewBinding.infoRl1Text4Tv.setText(generated_power); |
| | | String generation = getString(R.string.generation) + "(" + HdlDeviceLogic.kWp + ")"; |
| | | String generation = getString(R.string.generation) + "(" + HdlDeviceLogic.kWh + ")"; |
| | | viewBinding.homePageStationInfoRl1TitleTv.setText(generation); |
| | | |
| | | viewBinding.homePageStationInfoRl2DayIc.dataTypeTv.setText(R.string.day_power_generation); |
| | |
| | | viewBinding.dayTv.setBackground(AppCompatResources.getDrawable(_mActivity, R.drawable.time_selected_38c494)); |
| | | viewBinding.dayTv.setTextColor(_mActivity.getColor(R.color.text_38C494)); |
| | | viewBinding.monthTv.setBackground(AppCompatResources.getDrawable(_mActivity, R.color.text_00000000)); |
| | | viewBinding.monthTv.setTextColor(_mActivity.getColor(R.color.text_40000000)); |
| | | viewBinding.monthTv.setTextColor(_mActivity.getColor(R.color.text_66000000)); |
| | | viewBinding.yearTv.setBackground(AppCompatResources.getDrawable(_mActivity, R.color.text_00000000)); |
| | | viewBinding.yearTv.setTextColor(_mActivity.getColor(R.color.text_40000000)); |
| | | viewBinding.yearTv.setTextColor(_mActivity.getColor(R.color.text_66000000)); |
| | | viewBinding.lifeCycleTv.setBackground(AppCompatResources.getDrawable(_mActivity, R.color.text_00000000)); |
| | | viewBinding.lifeCycleTv.setTextColor(_mActivity.getColor(R.color.text_40000000)); |
| | | viewBinding.lifeCycleTv.setTextColor(_mActivity.getColor(R.color.text_66000000)); |
| | | viewBinding.v1.setVisibility(View.GONE); |
| | | viewBinding.v2.setVisibility(View.VISIBLE); |
| | | viewBinding.v3.setVisibility(View.VISIBLE); |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 电站状态概览 |
| | | */ |
| | | private void getStatusOverview() { |
| | | HdlResidenceLogic.getInstance().getStatusOverview(new CloudCallBeak<StatusOverviewBean>() { |
| | | @Override |
| | | public void onSuccess(StatusOverviewBean statusOverviewBean) { |
| | | if (statusOverviewBean == null) { |
| | | return; |
| | | } |
| | | viewBinding.homeAllIl.stationTotalTv.setText(statusOverviewBean.getTotal() + ""); |
| | | viewBinding.homeFaultsIl.stationTotalTv.setText(statusOverviewBean.getFault() + ""); |
| | | viewBinding.homeOfflineIl.stationTotalTv.setText(statusOverviewBean.getOffline() + ""); |
| | | viewBinding.homeConnectedIl.stationTotalTv.setText(statusOverviewBean.getConnecting() + ""); |
| | | } |
| | | |
| | | @Override |
| | | public void onFailure(HDLException e) { |
| | | |
| | | } |
| | | }); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取统计概览数据(公司维度) |
| | |
| | | HdlPowerStationDataStatisticsLogic.getInstance().getDataOver(new CloudCallBeak<DataOverBean>() { |
| | | @Override |
| | | public void onSuccess(DataOverBean dataOverBean) { |
| | | if (dataOverBean == null) { |
| | | return; |
| | | } |
| | | viewBinding.infoRl1Text1Tv.setText(dataOverBean.getInstalledCapacity()); |
| | | viewBinding.infoRl1Text3Tv.setText(dataOverBean.getPower()); |
| | | viewBinding.infoRl1FText1Tv.setText(dataOverBean.getPowerRatio()); |
| | | HdlThreadLogic.runMainThread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | if (dataOverBean == null) { |
| | | return; |
| | | } |
| | | viewBinding.infoRl1Text1Tv.setText(HdlDeviceLogic.getConvertDoubleUnit(dataOverBean.getInstalledCapacity())); |
| | | viewBinding.infoRl1Text3Tv.setText(HdlDeviceLogic.getConvertDoubleUnit(dataOverBean.getPower())); |
| | | viewBinding.infoRl1FText1Tv.setText(dataOverBean.getPowerRatio()); |
| | | |
| | | viewBinding.homePageStationInfoRl2DayIc.dataTv.setText(dataOverBean.getTodayElectricity()); |
| | | viewBinding.homePageStationInfoRl2MonIc.dataTv.setText(dataOverBean.getMonthElectricity()); |
| | | viewBinding.homePageStationInfoRl2YearIc.dataTv.setText(dataOverBean.getYearElectricity()); |
| | | viewBinding.homePageStationInfoRl2CumulativeIc.dataTv.setText(dataOverBean.getTotalElectricity()); |
| | | viewBinding.homePageStationInfoRl2DayIc.dataTv.setText(HdlDeviceLogic.getConvertDoubleUnit(dataOverBean.getTodayElectricity())); |
| | | viewBinding.homePageStationInfoRl2MonIc.dataTv.setText(HdlDeviceLogic.getConvertDoubleUnit(dataOverBean.getMonthElectricity())); |
| | | viewBinding.homePageStationInfoRl2YearIc.dataTv.setText(HdlDeviceLogic.getConvertDoubleUnit(dataOverBean.getYearElectricity())); |
| | | viewBinding.homePageStationInfoRl2CumulativeIc.dataTv.setText(HdlDeviceLogic.getConvertDoubleUnit(dataOverBean.getTotalElectricity())); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | @Override |
| | |
| | | } |
| | | |
| | | /** |
| | | * 发电量统计(公司维度) |
| | | * 社会贡献(公司维度) |
| | | */ |
| | | private void getSocialContribution() { |
| | | HdlPowerStationDataStatisticsLogic.getInstance().getSocialContribution(new CloudCallBeak<SocialContributionBean>() { |