From a034e242fe844a1ca45d2a28710cb7face1f8fe6 Mon Sep 17 00:00:00 2001
From: mac <user@users-MacBook-Pro.local>
Date: 星期日, 28 四月 2024 19:07:56 +0800
Subject: [PATCH] 2024年04月28日19:07:49

---
 app/src/main/java/com/hdl/photovoltaic/ui/home/HomePageFragment.java |  472 +++++++++++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 445 insertions(+), 27 deletions(-)

diff --git a/app/src/main/java/com/hdl/photovoltaic/ui/home/HomePageFragment.java b/app/src/main/java/com/hdl/photovoltaic/ui/home/HomePageFragment.java
index 3bc0fa3..474231d 100644
--- a/app/src/main/java/com/hdl/photovoltaic/ui/home/HomePageFragment.java
+++ b/app/src/main/java/com/hdl/photovoltaic/ui/home/HomePageFragment.java
@@ -1,24 +1,49 @@
 package com.hdl.photovoltaic.ui.home;
 
 
-import android.content.Intent;
+import static com.hdl.photovoltaic.ui.home.CustomStyleChartComposer.configureColorfulColumnChart;
+
 import android.os.Bundle;
+import android.text.TextUtils;
 import android.view.View;
 
+import androidx.annotation.RequiresPermission;
+import androidx.appcompat.content.res.AppCompatResources;
+
+import com.bigkoo.pickerview.builder.TimePickerBuilder;
+import com.bigkoo.pickerview.listener.OnTimeSelectListener;
+import com.bigkoo.pickerview.view.TimePickerView;
 import com.github.AAChartModel.AAChartCore.AAChartCreator.AAChartModel;
 import com.github.AAChartModel.AAChartCore.AAChartCreator.AAChartView;
 import com.github.AAChartModel.AAChartCore.AAChartCreator.AAMoveOverEventMessageModel;
-import com.github.AAChartModel.AAChartCore.AAChartEnum.AAChartType;
+import com.hdl.linkpm.sdk.core.exception.HDLException;
+import com.hdl.photovoltaic.HDLApp;
+import com.hdl.photovoltaic.R;
 import com.hdl.photovoltaic.base.CustomBaseFragment;
 import com.hdl.photovoltaic.config.ConstantManage;
+import com.hdl.photovoltaic.config.UserConfigManage;
 import com.hdl.photovoltaic.databinding.FragmentHomePageBinding;
 import com.hdl.photovoltaic.enums.HomepageTitleTabSwitch;
+import com.hdl.photovoltaic.enums.TimeType;
+import com.hdl.photovoltaic.listener.CloudCallBeak;
+import com.hdl.photovoltaic.other.HdlDeviceLogic;
 import com.hdl.photovoltaic.other.HdlLogLogic;
+import com.hdl.photovoltaic.other.HdlPowerStationDataStatisticsLogic;
+import com.hdl.photovoltaic.other.HdlThreadLogic;
+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.utils.TimeUtils;
 import com.hdl.sdk.link.core.bean.eventbus.BaseEventBus;
 
 import org.greenrobot.eventbus.EventBus;
 import org.greenrobot.eventbus.Subscribe;
 import org.greenrobot.eventbus.ThreadMode;
+
+import java.util.Calendar;
+import java.util.Date;
+import java.util.List;
+
 
 /**
  * 棣栭〉妯″潡
@@ -33,6 +58,13 @@
     AAChartModel aaChartModel;
 
 
+    private String[] fieldNames = {"00:00", "02:00", "05:00", "07:00", "09:00", "17:00", "22:00", "23:59"};//鍥炬爣X杞村潗鏍囧�肩殑鏁扮粍
+    private Object[] fieldValues = {35, 70.5, 150.5, 135, 170, 205, 222, 245};//鍥炬爣Y杞村潗鏍囧�肩殑鏁扮粍
+
+
+    private String timeType = TimeType.day;//鏃堕棿绫诲瀷(榛樿锛氬ぉ)
+
+
     @Override
     public Object getContentView() {
         viewBinding = FragmentHomePageBinding.inflate(getLayoutInflater());
@@ -41,48 +73,308 @@
 
     @Override
     public void onBindView(Bundle savedInstanceState) {
-        setUpAAChartView();
-        viewBinding.test.setOnClickListener(new View.OnClickListener() {
+        //鍒濆鍖�
+        initView();
+        //鍒濆鍖栫晫闈㈢洃鍚櫒
+        initEvent();
+        //璇诲彇鏁版嵁
+        readDate();
+
+    }
+
+    /**
+     * 璇诲彇鏁版嵁
+     */
+    private void readDate() {
+        HdlThreadLogic.runSubThread(new Runnable() {
             @Override
-            public void onClick(View v) {
+            public void run() {
+                getDataOver();
+                getStatistics();
+                getSocialContribution();
 
             }
         });
     }
 
+    private void initEvent() {
+        //鏃堕棿閫夋嫨鍣�
+        viewBinding.yearMonthDayTv.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                selectedTimePickerBuilder();
+
+            }
+        });
+        //鏃�
+        viewBinding.dayTv.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                if (timeType.equals(TimeType.day)) {
+                    //鐐瑰嚮鍚屼竴涓被鍨�
+                    return;
+                }
+                timeType = TimeType.day;
+
+                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.yearTv.setBackground(AppCompatResources.getDrawable(_mActivity, R.color.text_00000000));
+                viewBinding.yearTv.setTextColor(_mActivity.getColor(R.color.text_40000000));
+
+                viewBinding.lifeCycleTv.setBackground(AppCompatResources.getDrawable(_mActivity, R.color.text_00000000));
+                viewBinding.lifeCycleTv.setTextColor(_mActivity.getColor(R.color.text_40000000));
+
+                viewBinding.v1.setVisibility(View.GONE);
+                viewBinding.v2.setVisibility(View.VISIBLE);
+                viewBinding.v3.setVisibility(View.VISIBLE);
+                viewBinding.homePageStationSelectTimeLl.setVisibility(View.VISIBLE);
+
+                String dataStr = TimeUtils.getDateTimestamp(getCurrentTimestamp(), getTimeDateFormat());
+                viewBinding.yearMonthDayTv.setText(dataStr);
+                getStatistics();
+
+            }
+        });
+        //鏈�
+        viewBinding.monthTv.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                if (timeType.equals(TimeType.month)) {
+                    //鐐瑰嚮鍚屼竴涓被鍨�
+                    return;
+                }
+                timeType = TimeType.month;
+                viewBinding.dayTv.setBackground(AppCompatResources.getDrawable(_mActivity, R.color.text_00000000));
+                viewBinding.dayTv.setTextColor(_mActivity.getColor(R.color.text_40000000));
+
+                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.lifeCycleTv.setBackground(AppCompatResources.getDrawable(_mActivity, R.color.text_00000000));
+                viewBinding.lifeCycleTv.setTextColor(_mActivity.getColor(R.color.text_40000000));
+
+                viewBinding.v1.setVisibility(View.GONE);
+                viewBinding.v2.setVisibility(View.GONE);
+                viewBinding.v3.setVisibility(View.VISIBLE);
+                viewBinding.homePageStationSelectTimeLl.setVisibility(View.VISIBLE);
+                String dataStr = TimeUtils.getDateTimestamp(getCurrentTimestamp(), getTimeDateFormat());
+                viewBinding.yearMonthDayTv.setText(dataStr);
+                getStatistics();
+
+
+            }
+        });
+        //骞�
+        viewBinding.yearTv.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                if (timeType.equals(TimeType.year)) {
+                    //鐐瑰嚮鍚屼竴涓被鍨�
+                    return;
+                }
+                timeType = TimeType.year;
+                viewBinding.dayTv.setBackground(AppCompatResources.getDrawable(_mActivity, R.color.text_00000000));
+                viewBinding.dayTv.setTextColor(_mActivity.getColor(R.color.text_40000000));
+
+                viewBinding.monthTv.setBackground(AppCompatResources.getDrawable(_mActivity, R.color.text_00000000));
+                viewBinding.monthTv.setTextColor(_mActivity.getColor(R.color.text_40000000));
+
+                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.v1.setVisibility(View.VISIBLE);
+                viewBinding.v2.setVisibility(View.GONE);
+                viewBinding.v3.setVisibility(View.GONE);
+                viewBinding.homePageStationSelectTimeLl.setVisibility(View.VISIBLE);
+                String dataStr = TimeUtils.getDateTimestamp(getCurrentTimestamp(), getTimeDateFormat());
+                viewBinding.yearMonthDayTv.setText(dataStr);
+                getStatistics();
+            }
+        });
+        //鐢熷懡鏈�
+        viewBinding.lifeCycleTv.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                if (timeType.equals(TimeType.all)) {
+                    //鐐瑰嚮鍚屼竴涓被鍨�
+                    return;
+                }
+                timeType = TimeType.all;
+                viewBinding.dayTv.setBackground(AppCompatResources.getDrawable(_mActivity, R.color.text_00000000));
+                viewBinding.dayTv.setTextColor(_mActivity.getColor(R.color.text_40000000));
+
+                viewBinding.monthTv.setBackground(AppCompatResources.getDrawable(_mActivity, R.color.text_00000000));
+                viewBinding.monthTv.setTextColor(_mActivity.getColor(R.color.text_40000000));
+
+                viewBinding.yearTv.setBackground(AppCompatResources.getDrawable(_mActivity, R.color.text_00000000));
+                viewBinding.yearTv.setTextColor(_mActivity.getColor(R.color.text_40000000));
+
+                viewBinding.lifeCycleTv.setBackground(AppCompatResources.getDrawable(_mActivity, R.drawable.time_selected_38c494));
+                viewBinding.lifeCycleTv.setTextColor(_mActivity.getColor(R.color.text_38C494));
+
+                viewBinding.v1.setVisibility(View.VISIBLE);
+                viewBinding.v2.setVisibility(View.VISIBLE);
+                viewBinding.v3.setVisibility(View.GONE);
+                viewBinding.homePageStationSelectTimeLl.setVisibility(View.GONE);
+                getStatistics();
+
+            }
+        });
+        //涓婁竴姝�
+        viewBinding.lastStepClickLl.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                String currDate = viewBinding.yearMonthDayTv.getText().toString();
+                if (TextUtils.isEmpty(currDate)) {
+                    return;
+                }
+                String timeDateFormat = getTimeDateFormat();
+                Calendar calendar = TimeUtils.stringToCalendar(currDate, timeDateFormat);
+                String time = TimeUtils.subtractDayMonthYearFromDate(calendar, 1, timeDateFormat, timeType);
+                viewBinding.yearMonthDayTv.setText(time);
+
+
+            }
+        });
+        //涓嬩竴姝�
+        viewBinding.nextStepClickLl.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                String currDate = viewBinding.yearMonthDayTv.getText().toString();
+                if (TextUtils.isEmpty(currDate)) {
+                    return;
+                }
+                String timeDateFormat = getTimeDateFormat();
+                Calendar calendar = TimeUtils.stringToCalendar(currDate, timeDateFormat);
+                String time = TimeUtils.addDayMonthYearToDate(calendar, 1, timeDateFormat, timeType);
+                if (TimeUtils.stringDateToTimestamp(time, timeDateFormat) > getCurrentTimestamp()) {
+                    HdlThreadLogic.toast(_mActivity, getString(R.string.the_query_date_is_exceeded));
+
+                    return;
+                }
+                viewBinding.yearMonthDayTv.setText(time);
+            }
+        });
+    }
+    /**
+     * 鏃堕棿閫夋嫨鍣�
+     */
+    private void selectedTimePickerBuilder() {
+        String currDate = viewBinding.yearMonthDayTv.getText().toString();
+        //鏃堕棿閫夋嫨鍣�
+        Calendar selectedDate = TimeUtils.stringToCalendar(currDate, getTimeDateFormat());
+        Calendar startDate = Calendar.getInstance();
+        Calendar endDate = TimeUtils.timestampToCalendar(getCurrentTimestamp());
+        //璁剧疆鏃ユ湡銆愬紑濮嬨�戝拰銆愮粨鏉熴��
+        startDate.set(2023, 1, 1);
+        endDate.set(endDate.get(Calendar.YEAR), endDate.get(Calendar.MONTH), endDate.get(Calendar.DAY_OF_MONTH));
+        boolean day = true;
+        boolean month = true;
+        boolean year = true;
+        if (timeType.equals(TimeType.month)) {
+            day = false;
+        } else if (timeType.equals(TimeType.year)) {
+            day = false;
+            month = false;
+        }
+        TimePickerView pvTime = new TimePickerBuilder(_mActivity, new OnTimeSelectListener() {
+            @Override
+            public void onTimeSelect(Date date, View v) {//閫変腑浜嬩欢鍥炶皟
+                String timeDateFormat = getTimeDateFormat();
+                String time = TimeUtils.dateToString(date, timeDateFormat);
+                if (viewBinding.yearMonthDayTv.getText().toString().equals(time)) {
+                    //琛ㄧず鍚屼竴涓椂闂�
+                    return;
+                }
+                viewBinding.yearMonthDayTv.setText(time);
+                getStatistics();
+            }
+        }).setType(new boolean[]{year, month, day, false, false, false})// 榛樿鍏ㄩ儴鏄剧ず
+                .setCancelText(_mActivity.getString(R.string.loading_cancel))//鍙栨秷鎸夐挳鏂囧瓧
+                .setSubmitText(_mActivity.getString(R.string.loading_affirm))//纭鎸夐挳鏂囧瓧
+                .setContentTextSize(18)//婊氳疆鏂囧瓧澶у皬
+                .setTitleSize(18)//鏍囬鏂囧瓧澶у皬
+                .setTitleText(_mActivity.getString(R.string.time_selectd))//鏍囬鏂囧瓧
+                .setOutSideCancelable(true)//鐐瑰嚮灞忓箷锛岀偣鍦ㄦ帶浠跺閮ㄨ寖鍥存椂锛屾槸鍚﹀彇娑堟樉绀�
+                .isCyclic(false)//鏄惁寰幆婊氬姩
+                .setTitleColor(_mActivity.getColor(R.color.text_90000000))//鏍囬鏂囧瓧棰滆壊
+                .setSubmitColor(_mActivity.getColor(R.color.text_38C494))//纭畾鎸夐挳鏂囧瓧棰滆壊
+                .setCancelColor(_mActivity.getColor(R.color.text_40000000))//鍙栨秷鎸夐挳鏂囧瓧棰滆壊
+                .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)// 濡傛灉涓嶈缃殑璇濓紝榛樿鏄郴缁熸椂闂�*/
+                .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鏂囧瓧锛宖alse鍒欐瘡椤筰tem鍏ㄩ儴閮藉甫鏈塴abel銆�
+                .isDialog(false)//鏄惁鏄剧ず涓哄璇濇鏍峰紡
+                .setItemVisibleCount(7)//瀵硅瘽妗嗛珮搴�
+                .setDividerColor(_mActivity.getColor(R.color.text_E1E1E1)).setLineSpacingMultiplier(3f)//
+                .build();
+        pvTime.show();
+    }
+
+    /**
+     * 鍥捐〃鍔犺浇
+     */
     private void setUpAAChartView() {
         aaChartView = viewBinding.AAChartView;
         aaChartView.callBack = this;
-        aaChartModel = configureAAChartModel();
+        if (TimeType.day.equals(timeType)) {
+            aaChartModel = BasicChartComposer.configureAreaChart("Pv鍙戠數鍔熺巼", fieldNames, fieldValues);
+        } else if (TimeType.month.equals(timeType)
+                || TimeType.year.equals(timeType)
+                || TimeType.all.equals(timeType)) {
+            aaChartModel = configureColorfulColumnChart();
+        }
         aaChartView.aa_drawChartWithChartModel(aaChartModel);
     }
 
-    private AAChartModel configureAAChartModel() {
-//        Intent intent = getIntent();
-//        String chartType = intent.getStringExtra("chartType");
-//        int position = intent.getIntExtra("position", 0);
+    private void initView() {
 
-        aaChartModel = BasicChartComposer.configureAreaChart();
-//        configureTheStyleForDifferentTypeChart(chartType, position);
-//        configureViewsVisibility(chartType);
+        String dataStr = TimeUtils.getDateTimestamp(getCurrentTimestamp(), getTimeDateFormat());
+        viewBinding.yearMonthDayTv.setText(dataStr);
 
-        return aaChartModel;
+        String installed_capacity = getString(R.string.installed_capacity) + "(" + HdlDeviceLogic.kWp + ")";
+        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 + ")";
+        viewBinding.homePageStationInfoRl1TitleTv.setText(generation);
+
+        viewBinding.homePageStationInfoRl2DayIc.dataTypeTv.setText(R.string.day_power_generation);
+        viewBinding.homePageStationInfoRl2MonIc.dataTypeTv.setText(R.string.month_power_generation);
+        viewBinding.homePageStationInfoRl2YearIc.dataTypeTv.setText(R.string.year_power_generation);
+        viewBinding.homePageStationInfoRl2CumulativeIc.dataTypeTv.setText(R.string.cumulative_power_generation);
+
+        viewBinding.unitTv.setText(HdlDeviceLogic.kW);
+        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.yearTv.setBackground(AppCompatResources.getDrawable(_mActivity, R.color.text_00000000));
+        viewBinding.yearTv.setTextColor(_mActivity.getColor(R.color.text_40000000));
+        viewBinding.lifeCycleTv.setBackground(AppCompatResources.getDrawable(_mActivity, R.color.text_00000000));
+        viewBinding.lifeCycleTv.setTextColor(_mActivity.getColor(R.color.text_40000000));
+        viewBinding.v1.setVisibility(View.GONE);
+        viewBinding.v2.setVisibility(View.VISIBLE);
+        viewBinding.v3.setVisibility(View.VISIBLE);
+        viewBinding.homePageStationSelectTimeLl.setVisibility(View.VISIBLE);
+        setUpAAChartView();//鍥捐〃鍔犺浇
     }
 
-    private void configureTheStyleForDifferentTypeChart(String chartType, int position) {
-        if ((chartType.equals(AAChartType.Area) || chartType.equals(AAChartType.Line))
-                && (position == 4 || position == 5)) {
-            aaChartModel = BasicChartComposer.configureStepAreaChartAndStepLineChart();
-        } else if (chartType.equals(AAChartType.Column) || chartType.equals(AAChartType.Bar)) {
 
-            aaChartModel = BasicChartComposer.configureColumnChartAndBarChart();
-        } else if (chartType.equals(AAChartType.Area) || chartType.equals(AAChartType.Areaspline)) {
-            aaChartModel = BasicChartComposer.configureAreaChartAndAreasplineChartStyle(chartType);
-        } else if (chartType.equals(AAChartType.Line) || chartType.equals(AAChartType.Spline)) {
-            aaChartModel = BasicChartComposer.configureLineChartAndSplineChartStyle(chartType);
-        }
-        aaChartModel.chartType = chartType;
-    }
+
+
 
     @Override
     public void chartViewDidFinishLoad(AAChartView aaChartView) {
@@ -111,4 +403,130 @@
             }
         }
     }
+
+
+    /**
+     * 鑾峰彇缁熻姒傝鏁版嵁(鍏徃缁村害)
+     */
+    private void getDataOver() {
+        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());
+
+                viewBinding.homePageStationInfoRl2DayIc.dataTv.setText(dataOverBean.getTodayElectricity());
+                viewBinding.homePageStationInfoRl2MonIc.dataTv.setText(dataOverBean.getMonthElectricity());
+                viewBinding.homePageStationInfoRl2YearIc.dataTv.setText(dataOverBean.getYearElectricity());
+                viewBinding.homePageStationInfoRl2CumulativeIc.dataTv.setText(dataOverBean.getTotalElectricity());
+            }
+
+            @Override
+            public void onFailure(HDLException e) {
+
+            }
+        });
+    }
+
+    /**
+     * 鍙戠數閲忕粺璁�(鍏徃缁村害)
+     */
+    private void getStatistics() {
+        String currDate = viewBinding.yearMonthDayTv.getText().toString();
+        HdlPowerStationDataStatisticsLogic.getInstance().getStatistics(currDate, timeType, new CloudCallBeak<List<StatisticsBean>>() {
+            @Override
+            public void onSuccess(List<StatisticsBean> list) {
+                if (list == null || list.size() == 0) {
+                    return;
+                }
+                String[] keys = new String[list.size()];
+                Object[] values = new Object[list.size()];
+                for (int i = 0; i < list.size(); i++) {
+                    keys[i] = list.get(i).getFieldName();
+                    values[i] = list.get(i).getFieldValue();
+                }
+                fieldNames = keys;
+                fieldValues = values;
+                setUpAAChartView();
+            }
+
+            @Override
+            public void onFailure(HDLException e) {
+
+            }
+        });
+    }
+
+    /**
+     * 鍙戠數閲忕粺璁�(鍏徃缁村害)
+     */
+    private void getSocialContribution() {
+        HdlPowerStationDataStatisticsLogic.getInstance().getSocialContribution(new CloudCallBeak<SocialContributionBean>() {
+            @Override
+            public void onSuccess(SocialContributionBean socialContributionBean) {
+                if (socialContributionBean == null) {
+                    return;
+                }
+                viewBinding.socialContributionData1Tv.setText(socialContributionBean.getCoal());
+                viewBinding.socialContributionData2Tv.setText(socialContributionBean.getCo2());
+                viewBinding.socialContributionData3Tv.setText(socialContributionBean.getTreePlanting());
+            }
+
+            @Override
+            public void onFailure(HDLException e) {
+
+            }
+        });
+    }
+
+
+    /**
+     * 鑾峰彇褰撳墠绯荤粺鏃ユ湡鏃堕棿鎴�
+     *
+     * @return 鏃堕棿鎴�
+     */
+    private long getCurrentTimestamp() {
+        return new Date().getTime();
+    }
+
+    /**
+     * 鑾峰彇鏃ユ湡鏍煎紡 (2024/2/09,yyyy/DD/dd)
+     *
+     * @return 鏃ユ湡鏍煎紡 (2024/2/09,yyyy/DD/dd)
+     */
+    private String getTimeDateFormat() {
+        String timeDateFormat = TimeUtils.zhDateYearMonthDayFormat;
+        switch (timeType) {
+            case TimeType.day: {
+                timeDateFormat = TimeUtils.zhDateYearMonthDayFormat;
+                if (!UserConfigManage.getInstance().isZh()) {
+                    timeDateFormat = TimeUtils.enDateYearMonthDayFormat;
+                }
+            }
+            break;
+            case TimeType.month: {
+                timeDateFormat = TimeUtils.zhDateYearMonthFormat;
+                if (!UserConfigManage.getInstance().isZh()) {
+                    timeDateFormat = TimeUtils.enDateYearMonthFormat;
+                }
+            }
+            break;
+            case TimeType.year:
+            case TimeType.all: {
+                timeDateFormat = TimeUtils.zhDateYearFormat;
+                if (!UserConfigManage.getInstance().isZh()) {
+                    timeDateFormat = TimeUtils.enDateYearFormat;
+                }
+            }
+            break;
+
+        }
+        return timeDateFormat;
+    }
+
+
 }
\ No newline at end of file

--
Gitblit v1.8.0