mac
2024-07-02 d7ff801372431e64aee8f68ece4b8532cffb2207
app/src/main/java/com/hdl/photovoltaic/other/HdlPowerStationDataStatisticsLogic.java
@@ -6,6 +6,7 @@
import com.google.gson.JsonObject;
import com.google.gson.reflect.TypeToken;
import com.hdl.linkpm.sdk.core.exception.HDLException;
import com.hdl.photovoltaic.config.UserConfigManage;
import com.hdl.photovoltaic.enums.TimeType;
import com.hdl.photovoltaic.internet.HttpClient;
import com.hdl.photovoltaic.internet.api.HttpApi;
@@ -13,8 +14,11 @@
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 java.lang.reflect.Type;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.List;
/**
@@ -40,6 +44,7 @@
        return sHdlPowerStationDataStatisticsLogic;
    }
    /**
     * 获取统计概览数据(公司维度)
     *
@@ -52,15 +57,18 @@
        HttpClient.getInstance().requestHttp(requestUrl, json.toString(), new CloudCallBeak<String>() {
            @Override
            public void onSuccess(String jsonStr) {
                if (TextUtils.isEmpty(jsonStr)) {
                    if (cloudCallBeak != null) {
                        cloudCallBeak.onSuccess(null);
                try {
                    if (TextUtils.isEmpty(jsonStr)) {
                        if (cloudCallBeak != null) {
                            cloudCallBeak.onSuccess(new DataOverBean());
                        }
                    }
                }
                Gson gson = new Gson();
                DataOverBean dataOverBean = gson.fromJson(jsonStr, DataOverBean.class);
                if (cloudCallBeak != null) {
                    cloudCallBeak.onSuccess(dataOverBean);
                    Gson gson = new Gson();
                    DataOverBean dataOverBean = gson.fromJson(jsonStr, DataOverBean.class);
                    if (cloudCallBeak != null) {
                        cloudCallBeak.onSuccess(dataOverBean);
                    }
                } catch (Exception ignored) {
                }
            }
@@ -85,9 +93,23 @@
    public void getStatistics(String type, String time, CloudCallBeak<List<StatisticsBean>> cloudCallBeak) {
        String requestUrl = HttpApi.POST_Home_page_statistics;
        JsonObject json = new JsonObject();
        json.addProperty("dataType", "GE");//发电量
        if (TimeType.day.equals(type)) {
            json.addProperty("dataType", "POWER");//发电量(GE : 发电量 ;POWER : 发电功率)
        } else {
            json.addProperty("dataType", "GE");//发电量(GE : 发电量 ;POWER : 发电功率)
        }
        json.addProperty("type", type);//类型
        if (!TextUtils.isEmpty(time)) {
            if (!UserConfigManage.getInstance().isZh()) {
                //英文的时候需要日期格式
                if (TimeType.day.equals(type)) {
                    String[] ary = time.split("/");
                    time = ary[2] + "/" + ary[1] + "/" + ary[0];
                } else if (TimeType.month.equals(type)) {
                    String[] ary = time.split("/");
                    time = ary[1] + "/" + ary[0];
                }
            }
            json.addProperty("time", time);//时间
        }
        //json.addProperty("zoneType", "password");//区域