package com.ruoyi.predict.api;

import cn.hutool.core.date.DateUnit;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.ObjectUtil;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.json.JSONObject;
import com.ruoyi.common.utils.DateTimeUtil;
import com.ruoyi.predict.domain.*;
import com.ruoyi.predict.service.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.*;
import java.util.stream.Collectors;

/**
 * @author hlf
 * @date 2022/8/31 9:23
 * 文件说明：统计汇总
 */
@Api(value = "统计汇总Controller", tags = {"统计汇总操作接口"})
@Controller
@RequestMapping("/predict/api/ssc")
public class StatisticalSummaryController extends BaseController {

    @Autowired
    private IWindplantService windplantService;

    @Autowired
    private IPvPowerStationService pvPowerStationService;

    @Autowired
    private IWfFileConfigService wfFileConfigService;

    @Autowired
    private IWpuspSvrParaService wpuspSvrParaService;

    @Autowired
    private IWfYcHistoryData2Service wfYcHistoryData2Service;

    @Autowired
    private IProjectplanService projectplanService;

    @Autowired
    private IPlanpowerDistributionService planpowerDistributionService;

    @Autowired
    private IWfDaPfMonthDataService wfDaPfMonthDataService;

    @Autowired
    private IWfUspMonthDataService wfUspMonthDataService;

    @Autowired
    private INoscaleWfDaPfPeriodDataService noscaleWfDaPfPeriodDataService;

    @ApiOperation("月发电量报告")
    @GetMapping("/monthlyPowerGenerationReport")
    @ResponseBody
    @ApiImplicitParams({
            @ApiImplicitParam(name = "stationNumber", value = "场站编号(全域数据传-1,其他传主键)", required = true),
            @ApiImplicitParam(name = "itemVal", value = "场站类型", required = true),
    })
    public AjaxResult monthlyPowerGenerationReport(@RequestParam(value = "stationNumber") String stationNumber,
                                                   @RequestParam(value = "itemVal") int itemVal) {
        JSONObject json = new JSONObject();
        //当月开始时间
        Date beginOfMonth = DateUtil.beginOfMonth(DateUtil.date());
        //当月结束时间
        Date endOfMonth = DateUtil.endOfMonth(DateUtil.date());
        //获取所有时间
        List<Date> dateList = DateTimeUtil.getDayBetween(DateUtil.parse(DateUtil.formatDateTime(beginOfMonth)), DateUtil.parse(DateUtil.formatDateTime(endOfMonth)));
        //场站总数
        int modelCount = 0;
        //计划发电
        LinkedMultiValueMap<String, Double> mapJh = new LinkedMultiValueMap<String, Double>();
        //实际发电
        LinkedMultiValueMap<String, Double> mapSj = new LinkedMultiValueMap<String, Double>();
        Map<String, Object> params = new HashMap<>();
        params.put("beginDataTime", DateUtil.formatDateTime(beginOfMonth));
        params.put("endDataTime", DateUtil.formatDateTime(DateUtil.offsetDay(endOfMonth, 1)));
        if ("-1".equals(stationNumber)) {//全域数据
            List<Windplant> windplantList = windplantService.selectWindplantListByDlFlag();
            PlanpowerDistribution planpowerDistribution = planpowerDistributionService.selectPlanpowerDistributionById((long) -1);
            for (Windplant windplant : windplantList) {
                /*计划发电量开始*/
                WpuspSvrPara wpuspSvrPara = wpuspSvrParaService.selectWpuspSvrParaById(windplant.getWindplantNo());
                if (ObjectUtil.isNotNull(planpowerDistribution)) {
                    List<Projectplan> projectplanList = projectplanService.selectProjectplan(windplant.getWindplantNo(), (long) DateUtil.year(beginOfMonth), (long) DateUtil.month(endOfMonth) + 1);
                    if (projectplanList.size() > 0) {
                        double generatingcapacityCount = projectplanList.stream().mapToDouble(Projectplan::getGeneratingcapacity).sum();
                        if (planpowerDistribution.getType() == 1) {//1为按照去年同期实际发电量分配
                            WfFileConfig wfFileConfig = wfFileConfigService.selectWfFileConfigById(windplant.getWindplantNo());
                            if (ObjectUtil.isNotNull(wfFileConfig)) {
                                for (Date date : dateList) {
                                    Map<String, Object> params1 = new HashMap<>();
                                    params1.put("beginDataTime", DateUtil.formatDateTime(DateUtil.offsetDay(DateUtil.beginOfDay(date), 1)));
                                    params1.put("endDataTime", DateUtil.formatDateTime(DateUtil.offsetDay(DateUtil.beginOfDay(date), 14)));
                                    NoscaleWfDaPfPeriodData obj = new NoscaleWfDaPfPeriodData();
                                    obj.setWindplantNo(windplant.getWindplantNo());
                                    obj.setModelNo(wfFileConfig.getWpfmodelNo());
                                    obj.setParams(params1);
                                    obj.setCondition(1);
                                    List<NoscaleWfDaPfPeriodData> noscaleWfDaPfPeriodDataList = noscaleWfDaPfPeriodDataService.selectNoscaleWfDaPfPeriodDataList(obj);
                                    long betweenDay = DateUtil.between(DateUtil.beginOfMonth(date), DateUtil.endOfMonth(date), DateUnit.DAY) + 1;
                                    double a = (double) 13 / (double) betweenDay * generatingcapacityCount;
                                    NoscaleWfDaPfPeriodData noscaleWfDaPfPeriodData = noscaleWfDaPfPeriodDataService.selectNoscaleWfDaPfPeriodDataByJh(windplant.getWindplantNo(), wfFileConfig.getWpfmodelNo(), DateUtil.offsetDay(DateUtil.beginOfDay(date), 1));
                                    double value = 0;
                                    if (ObjectUtil.isNotNull(noscaleWfDaPfPeriodData)) {
                                        if (noscaleWfDaPfPeriodData.getValue() != null) {
                                            value = noscaleWfDaPfPeriodData.getValue();
                                        }
                                    }
                                    if (noscaleWfDaPfPeriodDataList.size() > 0) {
                                        double valueCount = noscaleWfDaPfPeriodDataList.stream().mapToDouble(NoscaleWfDaPfPeriodData::getValue).sum();
                                        double b = value / valueCount;
                                        double generatingcapacity = a * b;
                                        ShareController.addMapValue(mapJh, generatingcapacity, DateUtil.formatDate(date), modelCount, windplantList.size());
                                    }
                                }
                            }
                        } else if (planpowerDistribution.getType() == 2) {//2为平分
                            long betweenDay = DateUtil.between(beginOfMonth, endOfMonth, DateUnit.DAY) + 1;
                            double generatingcapacity = generatingcapacityCount / betweenDay;
                            for (Date date : dateList) {
                                ShareController.addMapValue(mapJh, generatingcapacity, DateUtil.formatDate(date), modelCount, windplantList.size());
                            }
                        }
                    }
                }
                /*计划发电量结束*/
                /*实际发电量开始*/
                if (ObjectUtil.isNotNull(wpuspSvrPara)) {
                    WfYcHistoryData2 wfYcHistoryData2 = new WfYcHistoryData2();
                    wfYcHistoryData2.setAnalogNo(wpuspSvrPara.geteYcNo());
                    wfYcHistoryData2.setParams(params);
                    List<WfYcHistoryData2> wfYcHistoryData2List = wfYcHistoryData2Service.selectWfYcHistoryData2List(wfYcHistoryData2);
                    if (wfYcHistoryData2List.size() > 0) {
                        for (Date date : dateList) {
                            WfYcHistoryData2 lastData = wfYcHistoryData2List.stream().filter(item -> DateUtil.formatDateTime(item.getDataTime()).equals(DateUtil.formatDateTime(DateUtil.offsetDay(date, 1)))).findAny().orElse(null);
                            double lastYcRawVal = 0;
                            if (ObjectUtil.isNotNull(lastData)) {
                                lastYcRawVal = lastData.getYcRawVal();
                            } else {
                                List<WfYcHistoryData2> list = wfYcHistoryData2List.stream().filter(item -> DateUtil.formatDate(item.getDataTime()).equals(DateUtil.formatDate(date))).collect(Collectors.toList());
                                if (list.size() > 0) {
                                    lastYcRawVal = list.get(list.size() - 1).getYcRawVal();
                                }
                            }
                            ShareController.addMapValue(mapSj, lastYcRawVal, DateUtil.formatDate(date), modelCount, windplantList.size());
                        }
                    }
                }
                /*实际发电量结束*/
                modelCount++;
            }
            List<PvPowerStation> pvPowerStationList = pvPowerStationService.selectPvPowerStationList(new PvPowerStation());
            for (PvPowerStation pvPowerStation : pvPowerStationList) {
                //暂无 后补
            }
        } else {//各个场站数据
            if (itemVal == 0) {//风电场
                /*计划发电量开始*/
                WpuspSvrPara wpuspSvrPara = wpuspSvrParaService.selectWpuspSvrParaById(Convert.toLong(stationNumber));
                PlanpowerDistribution planpowerDistribution = planpowerDistributionService.selectPlanpowerDistributionById(Convert.toLong(stationNumber));
                if (ObjectUtil.isNotNull(planpowerDistribution)) {
                    List<Projectplan> projectplanList = projectplanService.selectProjectplan(Convert.toLong(stationNumber), (long) DateUtil.year(beginOfMonth), (long) DateUtil.month(endOfMonth) + 1);
                    if (projectplanList.size() > 0) {
                        double generatingcapacityCount = projectplanList.stream().mapToDouble(Projectplan::getGeneratingcapacity).sum();
                        if (planpowerDistribution.getType() == 1) {//1为按照去年同期实际发电量分配
                            WfFileConfig wfFileConfig = wfFileConfigService.selectWfFileConfigById(Convert.toLong(stationNumber));
                            if (ObjectUtil.isNotNull(wfFileConfig)) {
                                for (Date date : dateList) {
                                    Map<String, Object> params1 = new HashMap<>();
                                    params1.put("beginDataTime", DateUtil.formatDateTime(DateUtil.offsetDay(DateUtil.beginOfDay(date), 1)));
                                    params1.put("endDataTime", DateUtil.formatDateTime(DateUtil.offsetDay(DateUtil.beginOfDay(date), 14)));
                                    NoscaleWfDaPfPeriodData obj = new NoscaleWfDaPfPeriodData();
                                    obj.setWindplantNo(Convert.toLong(stationNumber));
                                    obj.setModelNo(wfFileConfig.getWpfmodelNo());
                                    obj.setParams(params1);
                                    obj.setCondition(1);
                                    List<NoscaleWfDaPfPeriodData> noscaleWfDaPfPeriodDataList = noscaleWfDaPfPeriodDataService.selectNoscaleWfDaPfPeriodDataList(obj);
                                    long betweenDay = DateUtil.between(DateUtil.beginOfMonth(date), DateUtil.endOfMonth(date), DateUnit.DAY) + 1;
                                    double a = (double) 13 / (double) betweenDay * generatingcapacityCount;
                                    NoscaleWfDaPfPeriodData noscaleWfDaPfPeriodData = noscaleWfDaPfPeriodDataService.selectNoscaleWfDaPfPeriodDataByJh(Convert.toLong(stationNumber), wfFileConfig.getWpfmodelNo(), DateUtil.offsetDay(DateUtil.beginOfDay(date), 1));
                                    double value = 0;
                                    if (ObjectUtil.isNotNull(noscaleWfDaPfPeriodData)) {
                                        if (noscaleWfDaPfPeriodData.getValue() != null) {
                                            value = noscaleWfDaPfPeriodData.getValue();
                                        }
                                    }
                                    if (noscaleWfDaPfPeriodDataList.size() > 0) {
                                        double valueCount = noscaleWfDaPfPeriodDataList.stream().mapToDouble(NoscaleWfDaPfPeriodData::getValue).sum();
                                        double b = value / valueCount;
                                        double generatingcapacity = a * b;
                                        ShareController.addMapValue(mapJh, generatingcapacity, DateUtil.formatDate(date), 0, 1);
                                    }
                                }
                            }
                        } else if (planpowerDistribution.getType() == 2) {//2为平分
                            long betweenDay = DateUtil.between(beginOfMonth, endOfMonth, DateUnit.DAY) + 1;
                            double generatingcapacity = generatingcapacityCount / betweenDay;
                            for (Date date : dateList) {
                                ShareController.addMapValue(mapJh, generatingcapacity, DateUtil.formatDate(date), 0, 1);
                            }
                        }
                    }
                }
                /*计划发电量结束*/
                /*实际发电量开始*/
                if (ObjectUtil.isNotNull(wpuspSvrPara)) {
                    WfYcHistoryData2 wfYcHistoryData2 = new WfYcHistoryData2();
                    wfYcHistoryData2.setAnalogNo(wpuspSvrPara.geteYcNo());
                    wfYcHistoryData2.setParams(params);
                    List<WfYcHistoryData2> wfYcHistoryData2List = wfYcHistoryData2Service.selectWfYcHistoryData2List(wfYcHistoryData2);
                    if (wfYcHistoryData2List.size() > 0) {
                        for (Date date : dateList) {
                            WfYcHistoryData2 lastData = wfYcHistoryData2List.stream().filter(item -> DateUtil.formatDateTime(item.getDataTime()).equals(DateUtil.formatDateTime(DateUtil.offsetDay(date, 1)))).findAny().orElse(null);
                            double lastYcRawVal = 0;
                            if (ObjectUtil.isNotNull(lastData)) {
                                lastYcRawVal = lastData.getYcRawVal();
                            } else {
                                List<WfYcHistoryData2> list = wfYcHistoryData2List.stream().filter(item -> DateUtil.formatDate(item.getDataTime()).equals(DateUtil.formatDate(date))).collect(Collectors.toList());
                                if (list.size() > 0) {
                                    lastYcRawVal = list.get(list.size() - 1).getYcRawVal();
                                }
                            }
                            ShareController.addMapValue(mapSj, lastYcRawVal, DateUtil.formatDate(date), 0, 1);
                        }
                    }
                }
                /*实际发电量结束*/
            } else if (itemVal == 4) {//光伏场站
                //暂无 后补
            }
        }
        List<DataFormat> dataFormatList = new ArrayList<>();
        int count1 = dateList.size();
        Double[] dataJh = new Double[count1];
        Double[] dataSj = new Double[count1];
        for (int k = 0; k < count1; k++) {
            if ("-1".equals(stationNumber)) {//全域数据
                String dk1 = DateUtil.formatDate(dateList.get(k));
                List<Double> entryJh = mapJh.get(dk1);
                if (entryJh != null) {
                    double num = 0;
                    for (int i = 0; i < modelCount; i++) {
                        if (entryJh.size() > i && entryJh.get(i) != null) {
                            num += entryJh.get(i);
                        }
                    }
                    dataJh[k] = num;
                }
                List<Double> entrySj = mapSj.get(dk1);
                if (entrySj != null) {
                    double num = 0;
                    for (int i = 0; i < modelCount; i++) {
                        if (entrySj.size() > i && entrySj.get(i) != null) {
                            num += entrySj.get(i);
                        }
                    }
                    dataSj[k] = num;
                }
            } else {//各个场站数据
                String dk1 = DateUtil.formatDate(dateList.get(k));
                List<Double> entryJh = mapJh.get(dk1);
                if (entryJh != null) {
                    if (entryJh.size() > 0) {
                        dataJh[k] = entryJh.get(0);
                    }
                }
                List<Double> entrySj = mapSj.get(dk1);
                if (entrySj != null) {
                    if (entrySj.size() > 0) {
                        dataSj[k] = entrySj.get(0);
                    }
                }
            }
        }
        DataFormat dataFormatJh = new DataFormat();
        dataFormatJh.setName("计划发电");
        dataFormatJh.setData(dataJh);
        dataFormatList.add(dataFormatJh);
        DataFormat dataFormatSj = new DataFormat();
        dataFormatSj.setName("实际发电");
        dataFormatSj.setData(dataSj);
        dataFormatList.add(dataFormatSj);
        json.put("dataFormatList", dataFormatList);
        json.put("dateList", dateList);
        return AjaxResult.success(json);
    }

    @ApiOperation("年发电量报告")
    @GetMapping("/annualPowerGenerationReport")
    @ResponseBody
    @ApiImplicitParams({
            @ApiImplicitParam(name = "stationNumber", value = "场站编号(全域数据传-1,其他传主键)", required = true),
            @ApiImplicitParam(name = "itemVal", value = "场站类型", required = true),
    })
    public AjaxResult annualPowerGenerationReport(@RequestParam(value = "stationNumber") String stationNumber,
                                                  @RequestParam(value = "itemVal") int itemVal) {
        JSONObject json = new JSONObject();
        //获取所有时间
        List<Date> dateList = DateTimeUtil.getMonthBetween(DateUtil.beginOfYear(DateUtil.date()), DateUtil.endOfYear(DateUtil.date()));
        LinkedMultiValueMap<String, Double> map = new LinkedMultiValueMap<String, Double>();
        if ("-1".equals(stationNumber)) {//全域数据
            List<Windplant> windplantList = windplantService.selectWindplantListByDlFlag();
            for (int i = 0; i < dateList.size(); i++) {
                Map<String, Object> params = new HashMap<>();
                params.put("beginDataTime", DateUtil.formatDateTime(DateUtil.date(dateList.get(i).getTime() + 600000)));
                params.put("endDataTime", DateUtil.formatDateTime(DateUtil.offsetMonth(dateList.get(i), 1)));
                double generatingcapacityCount = 0;
                double ycRawValCount = 0;
                double accuracyRate = 0;
                double accuracyRateCqd = 0;
                for (Windplant windplant : windplantList) {
                    /*计划发电量开始*/
                    List<Projectplan> projectplanList = projectplanService.selectProjectplan(windplant.getWindplantNo(), (long) DateUtil.year(dateList.get(i)), (long) DateUtil.month(dateList.get(i)) + 1);
                    if (projectplanList.size() > 0) {
                        generatingcapacityCount += projectplanList.stream().mapToDouble(Projectplan::getGeneratingcapacity).sum();
                    }
                    /*计划发电量结束*/
                    /*实际发电量开始*/
                    WpuspSvrPara wpuspSvrPara = wpuspSvrParaService.selectWpuspSvrParaById(windplant.getWindplantNo());
                    if (ObjectUtil.isNotNull(wpuspSvrPara)) {
                        WfYcHistoryData2 wfYcHistoryData2 = new WfYcHistoryData2();
                        wfYcHistoryData2.setAnalogNo(wpuspSvrPara.geteYcNo());
                        wfYcHistoryData2.setParams(params);
                        wfYcHistoryData2.setCondition(1);
                        List<WfYcHistoryData2> wfYcHistoryData2List = wfYcHistoryData2Service.selectWfYcHistoryData2List(wfYcHistoryData2);
                        for (WfYcHistoryData2 w : wfYcHistoryData2List) {
                            ycRawValCount += w.getYcRawVal();
                        }
                    }
                    /*实际发电量结束*/
                    /*功率预测准确率开始*/
                    WfFileConfig wfFileConfig = wfFileConfigService.selectWfFileConfigById(windplant.getWindplantNo());
                    if (ObjectUtil.isNotNull(wfFileConfig)) {
                        WfDaPfMonthData wfDaPfMonthData = wfDaPfMonthDataService.selectWfDaPfMonthData(windplant.getWindplantNo(), wfFileConfig.getWpfmodelNo(), dateList.get(i));
                        if (ObjectUtil.isNotNull(wfDaPfMonthData)) {
                            accuracyRate += wfDaPfMonthData.getAccuracyRate();
                        }
                    }
                    /*功率预测准确率结束*/
                    /*超短期功率预测准确率开始*/
                    if (ObjectUtil.isNotNull(wfFileConfig)) {
                        WfUspMonthData wfUspMonthData = wfUspMonthDataService.selectWfUspMonthData(windplant.getWindplantNo(), wfFileConfig.getUwpfmodelNo(), (long) 0, dateList.get(i));
                        if (ObjectUtil.isNotNull(wfUspMonthData)) {
                            accuracyRateCqd += wfUspMonthData.getAccuracyRate();
                        }
                    }
                    /*超短期功率预测准确率结束*/
                }
                List<PvPowerStation> pvPowerStationList = pvPowerStationService.selectPvPowerStationList(new PvPowerStation());
                for (int j = 0; j < pvPowerStationList.size(); j++) {
                    //暂无 后补
                }
                ShareController.addMapValue(map, generatingcapacityCount, DateUtil.format(dateList.get(i), "yyyy-MM"), 0, dateList.size());
                ShareController.addMapValue(map, ycRawValCount, DateUtil.format(dateList.get(i), "yyyy-MM"), 1, dateList.size());
                ShareController.addMapValue(map, accuracyRate / windplantList.size(), DateUtil.format(dateList.get(i), "yyyy-MM"), 2, dateList.size());
                ShareController.addMapValue(map, accuracyRateCqd / windplantList.size(), DateUtil.format(dateList.get(i), "yyyy-MM"), 3, dateList.size());
            }
        } else {//各个场站数据
            if (itemVal == 0) {//风电场
                WpuspSvrPara wpuspSvrPara = wpuspSvrParaService.selectWpuspSvrParaById(Convert.toLong(stationNumber));
                WfFileConfig wfFileConfig = wfFileConfigService.selectWfFileConfigById(Convert.toLong(stationNumber));
                for (int i = 0; i < dateList.size(); i++) {
                    Map<String, Object> params = new HashMap<>();
                    params.put("beginDataTime", DateUtil.formatDateTime(DateUtil.date(dateList.get(i).getTime() + 600000)));
                    params.put("endDataTime", DateUtil.formatDateTime(DateUtil.offsetMonth(dateList.get(i), 1)));
                    /*计划发电量开始*/
                    List<Projectplan> projectplanList = projectplanService.selectProjectplan(Convert.toLong(stationNumber), (long) DateUtil.year(dateList.get(i)), (long) DateUtil.month(dateList.get(i)) + 1);
                    if (projectplanList.size() > 0) {
                        double generatingcapacityCount = projectplanList.stream().mapToDouble(Projectplan::getGeneratingcapacity).sum();
                        ShareController.addMapValue(map, generatingcapacityCount, DateUtil.format(dateList.get(i), "yyyy-MM"), 0, dateList.size());
                    }
                    /*计划发电量结束*/
                    /*实际发电量开始*/
                    if (ObjectUtil.isNotNull(wpuspSvrPara)) {
                        WfYcHistoryData2 wfYcHistoryData2 = new WfYcHistoryData2();
                        wfYcHistoryData2.setAnalogNo(wpuspSvrPara.geteYcNo());
                        wfYcHistoryData2.setParams(params);
                        wfYcHistoryData2.setCondition(1);
                        List<WfYcHistoryData2> wfYcHistoryData2List = wfYcHistoryData2Service.selectWfYcHistoryData2List(wfYcHistoryData2);
                        double ycRawValCount = 0;
                        for (WfYcHistoryData2 w : wfYcHistoryData2List) {
                            ycRawValCount += w.getYcRawVal();
                        }
                        ShareController.addMapValue(map, ycRawValCount, DateUtil.format(dateList.get(i), "yyyy-MM"), 1, dateList.size());
                    }
                    /*实际发电量结束*/
                    /*功率预测准确率开始*/
                    if (ObjectUtil.isNotNull(wfFileConfig)) {
                        WfDaPfMonthData wfDaPfMonthData = wfDaPfMonthDataService.selectWfDaPfMonthData(Convert.toLong(stationNumber), wfFileConfig.getWpfmodelNo(), dateList.get(i));
                        if (ObjectUtil.isNotNull(wfDaPfMonthData)) {
                            double accuracyRate = wfDaPfMonthData.getAccuracyRate();
                            ShareController.addMapValue(map, accuracyRate, DateUtil.format(dateList.get(i), "yyyy-MM"), 2, dateList.size());
                        }
                    }
                    /*功率预测准确率结束*/
                    /*超短期功率预测准确率开始*/
                    if (ObjectUtil.isNotNull(wfFileConfig)) {
                        WfUspMonthData wfUspMonthData = wfUspMonthDataService.selectWfUspMonthData(Convert.toLong(stationNumber), wfFileConfig.getUwpfmodelNo(), (long) 0, dateList.get(i));
                        if (ObjectUtil.isNotNull(wfUspMonthData)) {
                            double accuracyRate = wfUspMonthData.getAccuracyRate();
                            ShareController.addMapValue(map, accuracyRate, DateUtil.format(dateList.get(i), "yyyy-MM"), 3, dateList.size());
                        }
                    }
                    /*超短期功率预测准确率结束*/
                }
            } else if (itemVal == 4) {//光伏场站

            }
        }
        List<TableField> tableFieldList = new ArrayList<>();
        for (Map<String, Double> m : MapUtil.toMapList(map)) {
            TableField tableField = new TableField();
            for (int j = 0; j < dateList.size(); j++) {
                String stringDateTime = DateUtil.format(dateList.get(j), "yyyy-MM");
                if (m.get(stringDateTime) != null) {
                    Double value = m.get(stringDateTime);
                    ShareController.setTableField(value, j, tableField);
                }
            }
            tableFieldList.add(tableField);
        }
        json.put("list", tableFieldList);
        return AjaxResult.success(json);
    }
}
