package com.gyee.frame.service.compare;

import com.gyee.frame.common.conf.AjaxStatus;
import com.gyee.frame.common.domain.AjaxResult;
import com.gyee.frame.model.auto.Windturbineanalysisday;
import com.gyee.frame.model.auto.Windturbinecurvefitting;
import com.gyee.frame.model.auto.Windturbinecurvefittingmonth;
import com.gyee.frame.model.auto.Windturbinethewindinfo;
import com.gyee.frame.model.custom.DataVo;
import com.gyee.frame.model.custom.GoodCompareVo;
import com.gyee.frame.model.custom.ValueVo;
import com.gyee.frame.service.WindturbineanalysisdayService;
import com.gyee.frame.service.WindturbinecurvefittingService;
import com.gyee.frame.service.WindturbinecurvefittingmonthService;
import com.gyee.frame.service.WindturbinethewindinfoService;
import com.gyee.frame.util.DateUtils;
import com.gyee.frame.util.StringUtils;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.*;


@Service
public class CompareService {

    @Resource
    private WindturbineanalysisdayService windturbineanalysisdayService;
    @Resource
    private WindturbinethewindinfoService windturbinethewindinfoService;
    @Resource
    private WindturbinecurvefittingService windturbinecurvefittingService;
    @Resource
    private WindturbinecurvefittingmonthService windturbinecurvefittingmonthService;

    public AjaxResult compareDayList(String windturbineid,Date date)  {

        List<GoodCompareVo> gcvos =new ArrayList<>();
        if (StringUtils.notEmp(windturbineid) && StringUtils.notEmp(date) ) {

            List<Windturbineanalysisday> vos = windturbineanalysisdayService.comparelist(windturbineid, date);

            gcvos =setDayListInfo(vos, true);

        }

        if (null != gcvos && !gcvos.isEmpty()) {

            return AjaxResult.successData(AjaxStatus.success.code, gcvos);
        } else {
            gcvos = new ArrayList<GoodCompareVo>();
            GoodCompareVo gc60 = new GoodCompareVo();
            gc60.setName("风资源");
            gc60.setValue1("<div id='fzy1' name='fzy1'></div>");
            gc60.setValue2("<div id='fzy2' name='fzy2'></div>");
            gc60.setValue3("<div id='fzy3' name='fzy3'></div>");
            gc60.setValue4("<div id='fzy4' name='fzy4'></div>");
            gc60.setValue5("<div id='fzy5' name='fzy5'></div>");
            gcvos.add(gc60);
            return AjaxResult.successData(AjaxStatus.success.code, gcvos);
        }
    }

    public AjaxResult compareMonthList(String windturbineid,Date date)  {

        List<GoodCompareVo> gcvos =new ArrayList<>();
        if (StringUtils.notEmp(windturbineid) && StringUtils.notEmp(date) ) {

            List<Windturbineanalysisday> vos = windturbineanalysisdayService.comparelist(windturbineid, date);

            gcvos =setMonthListInfo(vos, true);

        }

        if (null != gcvos && !gcvos.isEmpty()) {

            return AjaxResult.successData(AjaxStatus.success.code, gcvos);
        } else {
            gcvos = new ArrayList<GoodCompareVo>();
            GoodCompareVo gc60 = new GoodCompareVo();
            gc60.setName("风资源");
            gc60.setValue1("<div id='fzy1' name='fzy1'></div>");
            gc60.setValue2("<div id='fzy2' name='fzy2'></div>");
            gc60.setValue3("<div id='fzy3' name='fzy3'></div>");
            gc60.setValue4("<div id='fzy4' name='fzy4'></div>");
            gc60.setValue5("<div id='fzy5' name='fzy5'></div>");
            gcvos.add(gc60);
            return AjaxResult.successData(AjaxStatus.success.code, gcvos);
        }
    }
    public AjaxResult compareYearList(String windturbineid,Date date)  {

        List<GoodCompareVo> gcvos =new ArrayList<>();
        if (StringUtils.notEmp(windturbineid) && StringUtils.notEmp(date) ) {

            List<Windturbineanalysisday> vos = windturbineanalysisdayService.comparelist(windturbineid, date);

            gcvos =setYearListInfo(vos, true);

        }

        if (null != gcvos && !gcvos.isEmpty()) {

            return AjaxResult.successData(AjaxStatus.success.code, gcvos);
        } else {
            gcvos = new ArrayList<GoodCompareVo>();
            GoodCompareVo gc60 = new GoodCompareVo();
            gc60.setName("风资源");
            gc60.setValue1("<div id='fzy1' name='fzy1'></div>");
            gc60.setValue2("<div id='fzy2' name='fzy2'></div>");
            gc60.setValue3("<div id='fzy3' name='fzy3'></div>");
            gc60.setValue4("<div id='fzy4' name='fzy4'></div>");
            gc60.setValue5("<div id='fzy5' name='fzy5'></div>");
            gcvos.add(gc60);
            return AjaxResult.successData(AjaxStatus.success.code, gcvos);
        }
    }
    private  List<GoodCompareVo> setDayListInfo(List<Windturbineanalysisday> vos, boolean ischart) {

        List<GoodCompareVo> gcvos = new ArrayList<GoodCompareVo>();
        GoodCompareVo gc0 = new GoodCompareVo();
        gc0.setName("风电机");
        gc0.setValue1("");
        gc0.setValue2("");
        gc0.setValue3("");
        gc0.setValue4("");
        gc0.setValue5("");
        GoodCompareVo gc1 = new GoodCompareVo();
        gc1.setName("日发电量");
        gc1.setValue1("");
        gc1.setValue2("");
        gc1.setValue3("");
        gc1.setValue4("");
        gc1.setValue5("");
        GoodCompareVo gc4 = new GoodCompareVo();
        gc4.setName("日应发电量");
        gc4.setValue1("");
        gc4.setValue2("");
        gc4.setValue3("");
        gc4.setValue4("");
        gc4.setValue5("");
        GoodCompareVo gc7 = new GoodCompareVo();
        gc7.setName("日平均功率");
        gc7.setValue1("");
        gc7.setValue2("");
        gc7.setValue3("");
        gc7.setValue4("");
        gc7.setValue5("");
        GoodCompareVo gc10 = new GoodCompareVo();
        gc10.setName("日平均风速");
        gc10.setValue1("");
        gc10.setValue2("");
        gc10.setValue3("");
        gc10.setValue4("");
        gc10.setValue5("");
        GoodCompareVo gc13 = new GoodCompareVo();
        gc13.setName("日运行小时");
        gc13.setValue1("");
        gc13.setValue2("");
        gc13.setValue3("");
        gc13.setValue4("");
        gc13.setValue5("");
        GoodCompareVo gc16 = new GoodCompareVo();
        gc16.setName("日待机小时");
        gc16.setValue1("");
        gc16.setValue2("");
        gc16.setValue3("");
        gc16.setValue4("");
        gc16.setValue5("");
        GoodCompareVo gc19 = new GoodCompareVo();
        gc19.setName("日故障小时");
        gc19.setValue1("");
        gc19.setValue2("");
        gc19.setValue3("");
        gc19.setValue4("");
        gc19.setValue5("");
        GoodCompareVo gc22 = new GoodCompareVo();
        gc22.setName("日维护小时");
        gc22.setValue1("");
        gc22.setValue2("");
        gc22.setValue3("");
        gc22.setValue4("");
        gc22.setValue5("");
        GoodCompareVo gc25 = new GoodCompareVo();
        gc25.setName("日中断小时");
        gc25.setValue1("");
        gc25.setValue2("");
        gc25.setValue3("");
        gc25.setValue4("");
        gc25.setValue5("");
        GoodCompareVo gc28 = new GoodCompareVo();
        gc28.setName("日有效风时");
        gc28.setValue1("");
        gc28.setValue2("");
        gc28.setValue3("");
        gc28.setValue4("");
        gc28.setValue5("");
        GoodCompareVo gc31 = new GoodCompareVo();
        gc31.setName("日损失电量");
        gc31.setValue1("");
        gc31.setValue2("");
        gc31.setValue3("");
        gc31.setValue4("");
        gc31.setValue5("");
        GoodCompareVo gc34 = new GoodCompareVo();
        gc34.setName("日报警次数");
        gc34.setValue1("");
        gc34.setValue2("");
        gc34.setValue3("");
        gc34.setValue4("");
        gc34.setValue5("");
        GoodCompareVo gc37 = new GoodCompareVo();
        gc37.setName("日停机次数");
        gc37.setValue1("");
        gc37.setValue2("");
        gc37.setValue3("");
        gc37.setValue4("");
        gc37.setValue5("");
        GoodCompareVo gc40 = new GoodCompareVo();
        gc40.setName("日不饱和次数");
        gc40.setValue1("");
        gc40.setValue2("");
        gc40.setValue3("");
        gc40.setValue4("");
        gc40.setValue5("");
        GoodCompareVo gc43 = new GoodCompareVo();
        gc43.setName("日设备可利用率");
        gc43.setValue1("");
        gc43.setValue2("");
        gc43.setValue3("");
        gc43.setValue4("");
        gc43.setValue5("");
        GoodCompareVo gc46 = new GoodCompareVo();
        gc46.setName("日平均温度");
        gc46.setValue1("");
        gc46.setValue2("");
        gc46.setValue3("");
        gc46.setValue4("");
        gc46.setValue5("");
        GoodCompareVo gc49 = new GoodCompareVo();
        gc49.setName("日平均湿度");
        gc49.setValue1("");
        gc49.setValue2("");
        gc49.setValue3("");
        gc49.setValue4("");
        gc49.setValue5("");
        GoodCompareVo gc52 = new GoodCompareVo();
        gc52.setName("日平均压强");
        gc52.setValue1("");
        gc52.setValue2("");
        gc52.setValue3("");
        gc52.setValue4("");
        gc52.setValue5("");
        GoodCompareVo gc55 = new GoodCompareVo();
        gc55.setName("日拟合优度");
        gc55.setValue1("");
        gc55.setValue2("");
        gc55.setValue3("");
        gc55.setValue4("");
        gc55.setValue5("");
        GoodCompareVo gc58 = new GoodCompareVo();
        gc58.setName("日实际/保证");
        gc58.setValue1("");
        gc58.setValue2("");
        gc58.setValue3("");
        gc58.setValue4("");
        gc58.setValue5("");

        GoodCompareVo gc60 = new GoodCompareVo();
        gc60.setName("风资源");
        gc60.setValue1("<div id='fzy1' name='fzy1'></div>");
        gc60.setValue2("<div id='fzy2' name='fzy2'></div>");
        gc60.setValue3("<div id='fzy3' name='fzy3'></div>");
        gc60.setValue4("<div id='fzy4' name='fzy4'></div>");
        gc60.setValue5("<div id='fzy5' name='fzy5'></div>");
        if (!vos.isEmpty()) {
            for (int i = 0; i < vos.size(); i++) {
                Windturbineanalysisday vo = (Windturbineanalysisday) vos.get(i);
                if (i == 0) {
                    gc1.setValue1(String.valueOf(vo.getC1()));
                    gc4.setValue1(String.valueOf(vo.getC4()));
                    gc7.setValue1(String.valueOf(vo.getC7()));
                    gc10.setValue1(String.valueOf(vo.getC10()));
                    gc13.setValue1(String.valueOf(vo.getC13()));
                    gc16.setValue1(String.valueOf(vo.getC16()));
                    gc19.setValue1(String.valueOf(vo.getC19()));
                    gc22.setValue1(String.valueOf(vo.getC22()));
                    gc25.setValue1(String.valueOf(vo.getC25()));
                    gc28.setValue1(String.valueOf(vo.getC28()));
                    gc31.setValue1(String.valueOf(vo.getC31()));
                    gc34.setValue1(String.valueOf(vo.getC34()));
                    gc37.setValue1(String.valueOf(vo.getC37()));
                    gc40.setValue1(String.valueOf(vo.getC40()));
                    gc43.setValue1(String.valueOf(vo.getC43()));
                    gc46.setValue1(String.valueOf(vo.getC46()));
                    gc49.setValue1(String.valueOf(vo.getC49()));
                    gc52.setValue1(String.valueOf(vo.getC52()));
                    gc55.setValue1(String.valueOf(vo.getC55()));
                    gc58.setValue1(String.valueOf(vo.getC58()));
                    gc0.setValue1(vo.getWindturbineid());

                } else if (i == 1) {
                    gc1.setValue2(String.valueOf(vo.getC1()));
                    gc4.setValue2(String.valueOf(vo.getC4()));
                    gc7.setValue2(String.valueOf(vo.getC7()));
                    gc10.setValue2(String.valueOf(vo.getC10()));
                    gc13.setValue2(String.valueOf(vo.getC13()));
                    gc16.setValue2(String.valueOf(vo.getC16()));
                    gc19.setValue2(String.valueOf(vo.getC19()));
                    gc22.setValue2(String.valueOf(vo.getC22()));
                    gc25.setValue2(String.valueOf(vo.getC25()));
                    gc28.setValue2(String.valueOf(vo.getC28()));
                    gc31.setValue2(String.valueOf(vo.getC31()));
                    gc34.setValue2(String.valueOf(vo.getC34()));
                    gc37.setValue2(String.valueOf(vo.getC37()));
                    gc40.setValue2(String.valueOf(vo.getC40()));
                    gc43.setValue2(String.valueOf(vo.getC43()));
                    gc46.setValue2(String.valueOf(vo.getC46()));
                    gc49.setValue2(String.valueOf(vo.getC49()));
                    gc52.setValue2(String.valueOf(vo.getC52()));
                    gc55.setValue2(String.valueOf(vo.getC55()));
                    gc58.setValue2(String.valueOf(vo.getC58()));
                    gc0.setValue2(vo.getWindturbineid());

                } else if (i == 2) {
                    gc1.setValue3(String.valueOf(vo.getC1()));
                    gc4.setValue3(String.valueOf(vo.getC4()));
                    gc7.setValue3(String.valueOf(vo.getC7()));
                    gc10.setValue3(String.valueOf(vo.getC10()));
                    gc13.setValue3(String.valueOf(vo.getC13()));
                    gc16.setValue3(String.valueOf(vo.getC16()));
                    gc19.setValue3(String.valueOf(vo.getC19()));
                    gc22.setValue3(String.valueOf(vo.getC22()));
                    gc25.setValue3(String.valueOf(vo.getC25()));
                    gc28.setValue3(String.valueOf(vo.getC28()));
                    gc31.setValue3(String.valueOf(vo.getC31()));
                    gc34.setValue3(String.valueOf(vo.getC34()));
                    gc37.setValue3(String.valueOf(vo.getC37()));
                    gc40.setValue3(String.valueOf(vo.getC40()));
                    gc43.setValue3(String.valueOf(vo.getC43()));
                    gc46.setValue3(String.valueOf(vo.getC46()));
                    gc49.setValue3(String.valueOf(vo.getC49()));
                    gc52.setValue3(String.valueOf(vo.getC52()));
                    gc55.setValue3(String.valueOf(vo.getC55()));
                    gc58.setValue3(String.valueOf(vo.getC58()));
                    gc0.setValue3(vo.getWindturbineid());

                } else if (i == 3) {
                    gc1.setValue4(String.valueOf(vo.getC1()));
                    gc4.setValue4(String.valueOf(vo.getC4()));
                    gc7.setValue4(String.valueOf(vo.getC7()));
                    gc10.setValue4(String.valueOf(vo.getC10()));
                    gc13.setValue4(String.valueOf(vo.getC13()));
                    gc16.setValue4(String.valueOf(vo.getC16()));
                    gc19.setValue4(String.valueOf(vo.getC19()));
                    gc22.setValue4(String.valueOf(vo.getC22()));
                    gc25.setValue4(String.valueOf(vo.getC25()));
                    gc28.setValue4(String.valueOf(vo.getC28()));
                    gc31.setValue4(String.valueOf(vo.getC31()));
                    gc34.setValue4(String.valueOf(vo.getC34()));
                    gc37.setValue4(String.valueOf(vo.getC37()));
                    gc40.setValue4(String.valueOf(vo.getC40()));
                    gc43.setValue4(String.valueOf(vo.getC43()));
                    gc46.setValue4(String.valueOf(vo.getC46()));
                    gc49.setValue4(String.valueOf(vo.getC49()));
                    gc52.setValue4(String.valueOf(vo.getC52()));
                    gc55.setValue4(String.valueOf(vo.getC55()));
                    gc58.setValue4(String.valueOf(vo.getC58()));
                    gc0.setValue4(vo.getWindturbineid());

                } else if (i == 4) {
                    gc1.setValue5(String.valueOf(vo.getC1()));
                    gc4.setValue5(String.valueOf(vo.getC4()));
                    gc7.setValue5(String.valueOf(vo.getC7()));
                    gc10.setValue5(String.valueOf(vo.getC10()));
                    gc13.setValue5(String.valueOf(vo.getC13()));
                    gc16.setValue5(String.valueOf(vo.getC16()));
                    gc19.setValue5(String.valueOf(vo.getC19()));
                    gc22.setValue5(String.valueOf(vo.getC22()));
                    gc25.setValue5(String.valueOf(vo.getC25()));
                    gc28.setValue5(String.valueOf(vo.getC28()));
                    gc31.setValue5(String.valueOf(vo.getC31()));
                    gc34.setValue5(String.valueOf(vo.getC34()));
                    gc37.setValue5(String.valueOf(vo.getC37()));
                    gc40.setValue5(String.valueOf(vo.getC40()));
                    gc43.setValue5(String.valueOf(vo.getC43()));
                    gc46.setValue5(String.valueOf(vo.getC46()));
                    gc49.setValue5(String.valueOf(vo.getC49()));
                    gc52.setValue5(String.valueOf(vo.getC52()));
                    gc55.setValue5(String.valueOf(vo.getC55()));
                    gc58.setValue5(String.valueOf(vo.getC58()));
                    gc0.setValue5(vo.getWindturbineid());
                }

            }

        }
        gcvos.add(gc0);
        gcvos.add(gc1);
        gcvos.add(gc4);
        gcvos.add(gc7);
        gcvos.add(gc10);
        gcvos.add(gc13);
        gcvos.add(gc16);
        gcvos.add(gc19);
        gcvos.add(gc22);
        gcvos.add(gc25);
        gcvos.add(gc28);
        gcvos.add(gc31);
        gcvos.add(gc34);
        gcvos.add(gc37);
        gcvos.add(gc40);
        gcvos.add(gc43);
        gcvos.add(gc46);
        gcvos.add(gc49);
        gcvos.add(gc52);
        gcvos.add(gc55);
        gcvos.add(gc58);

        if (ischart) {
            gcvos.add(gc60);
        }
        return gcvos;
    }


    private  List<GoodCompareVo> setMonthListInfo(List<Windturbineanalysisday> vos, boolean ischart) {
        List<GoodCompareVo> gcvos = new ArrayList<GoodCompareVo>();
        GoodCompareVo gc0 = new GoodCompareVo();
        gc0.setName("风电机");
        gc0.setValue1("");
        gc0.setValue2("");
        gc0.setValue3("");
        gc0.setValue4("");
        gc0.setValue5("");
        GoodCompareVo gc2 = new GoodCompareVo();
        gc2.setName("月发电量");
        gc2.setValue1("");
        gc2.setValue2("");
        gc2.setValue3("");
        gc2.setValue4("");
        gc2.setValue5("");
        GoodCompareVo gc5 = new GoodCompareVo();
        gc5.setName("月应发电量");
        gc5.setValue1("");
        gc5.setValue2("");
        gc5.setValue3("");
        gc5.setValue4("");
        gc5.setValue5("");
        GoodCompareVo gc8 = new GoodCompareVo();
        gc8.setName("月平均功率");
        gc8.setValue1("");
        gc8.setValue2("");
        gc8.setValue3("");
        gc8.setValue4("");
        gc8.setValue5("");
        GoodCompareVo gc11 = new GoodCompareVo();
        gc11.setName("月平均风速");
        gc11.setValue1("");
        gc11.setValue2("");
        gc11.setValue3("");
        gc11.setValue4("");
        gc11.setValue5("");
        GoodCompareVo gc14 = new GoodCompareVo();
        gc14.setName("月运行小时");
        gc14.setValue1("");
        gc14.setValue2("");
        gc14.setValue3("");
        gc14.setValue4("");
        gc14.setValue5("");
        GoodCompareVo gc17 = new GoodCompareVo();
        gc17.setName("月待机小时");
        gc17.setValue1("");
        gc17.setValue2("");
        gc17.setValue3("");
        gc17.setValue4("");
        gc17.setValue5("");
        GoodCompareVo gc20 = new GoodCompareVo();
        gc20.setName("月故障小时");
        gc20.setValue1("");
        gc20.setValue2("");
        gc20.setValue3("");
        gc20.setValue4("");
        gc20.setValue5("");
        GoodCompareVo gc23 = new GoodCompareVo();
        gc23.setName("月维护小时");
        gc23.setValue1("");
        gc23.setValue2("");
        gc23.setValue3("");
        gc23.setValue4("");
        gc23.setValue5("");
        GoodCompareVo gc26 = new GoodCompareVo();
        gc26.setName("月中断小时");
        gc26.setValue1("");
        gc26.setValue2("");
        gc26.setValue3("");
        gc26.setValue4("");
        gc26.setValue5("");
        GoodCompareVo gc29 = new GoodCompareVo();
        gc29.setName("月有效风时");
        gc29.setValue1("");
        gc29.setValue2("");
        gc29.setValue3("");
        gc29.setValue4("");
        gc29.setValue5("");
        GoodCompareVo gc32 = new GoodCompareVo();
        gc32.setName("月损失电量");
        gc32.setValue1("");
        gc32.setValue2("");
        gc32.setValue3("");
        gc32.setValue4("");
        gc32.setValue5("");
        GoodCompareVo gc35 = new GoodCompareVo();
        gc35.setName("月报警次数");
        gc35.setValue1("");
        gc35.setValue2("");
        gc35.setValue3("");
        gc35.setValue4("");
        gc35.setValue5("");
        GoodCompareVo gc38 = new GoodCompareVo();
        gc38.setName("月停机次数");
        gc38.setValue1("");
        gc38.setValue2("");
        gc38.setValue3("");
        gc38.setValue4("");
        gc38.setValue5("");
        GoodCompareVo gc41 = new GoodCompareVo();
        gc41.setName("月不饱和次数");
        gc41.setValue1("");
        gc41.setValue2("");
        gc41.setValue3("");
        gc41.setValue4("");
        gc41.setValue5("");
        GoodCompareVo gc44 = new GoodCompareVo();
        gc44.setName("月设备可利用率");
        gc44.setValue1("");
        gc44.setValue2("");
        gc44.setValue3("");
        gc44.setValue4("");
        gc44.setValue5("");
        GoodCompareVo gc47 = new GoodCompareVo();
        gc47.setName("月平均温度");
        gc47.setValue1("");
        gc47.setValue2("");
        gc47.setValue3("");
        gc47.setValue4("");
        gc47.setValue5("");
        GoodCompareVo gc50 = new GoodCompareVo();
        gc50.setName("月平均湿度");
        gc50.setValue1("");
        gc50.setValue2("");
        gc50.setValue3("");
        gc50.setValue4("");
        gc50.setValue5("");
        GoodCompareVo gc53 = new GoodCompareVo();
        gc53.setName("月平均压强");
        gc53.setValue1("");
        gc53.setValue2("");
        gc53.setValue3("");
        gc53.setValue4("");
        gc53.setValue5("");
        GoodCompareVo gc56 = new GoodCompareVo();
        gc56.setName("月拟合优度");
        gc56.setValue1("");
        gc56.setValue2("");
        gc56.setValue3("");
        gc56.setValue4("");
        gc56.setValue5("");
        GoodCompareVo gc59 = new GoodCompareVo();
        gc59.setName("月实际/保证");
        gc59.setValue1("");
        gc59.setValue2("");
        gc59.setValue3("");
        gc59.setValue4("");
        gc59.setValue5("");

        GoodCompareVo gc60 = new GoodCompareVo();
        gc60.setName("风资源");
        gc60.setValue1("<div id='fzy1' name='fzy1'></div>");
        gc60.setValue2("<div id='fzy2' name='fzy2'></div>");
        gc60.setValue3("<div id='fzy3' name='fzy3'></div>");
        gc60.setValue4("<div id='fzy4' name='fzy4'></div>");
        gc60.setValue5("<div id='fzy5' name='fzy5'></div>");
        if (!vos.isEmpty()) {
            for (int i = 0; i < vos.size(); i++) {
                Windturbineanalysisday vo = (Windturbineanalysisday) vos.get(i);
                if (i == 0) {
                    gc2.setValue1(String.valueOf(vo.getC2()));
                    gc5.setValue1(String.valueOf(vo.getC5()));
                    gc8.setValue1(String.valueOf(vo.getC8()));
                    gc11.setValue1(String.valueOf(vo.getC11()));
                    gc14.setValue1(String.valueOf(vo.getC14()));
                    gc17.setValue1(String.valueOf(vo.getC17()));
                    gc20.setValue1(String.valueOf(vo.getC20()));
                    gc23.setValue1(String.valueOf(vo.getC23()));
                    gc26.setValue1(String.valueOf(vo.getC26()));
                    gc29.setValue1(String.valueOf(vo.getC29()));
                    gc32.setValue1(String.valueOf(vo.getC32()));
                    gc35.setValue1(String.valueOf(vo.getC35()));
                    gc38.setValue1(String.valueOf(vo.getC38()));
                    gc41.setValue1(String.valueOf(vo.getC41()));
                    gc44.setValue1(String.valueOf(vo.getC44()));
                    gc47.setValue1(String.valueOf(vo.getC47()));
                    gc50.setValue1(String.valueOf(vo.getC50()));
                    gc53.setValue1(String.valueOf(vo.getC53()));
                    gc56.setValue1(String.valueOf(vo.getC56()));
                    gc59.setValue1(String.valueOf(vo.getC59()));
                    gc0.setValue1(vo.getWindturbineid());

                } else if (i == 1) {
                    gc2.setValue2(String.valueOf(vo.getC2()));
                    gc5.setValue2(String.valueOf(vo.getC5()));
                    gc8.setValue2(String.valueOf(vo.getC8()));
                    gc11.setValue2(String.valueOf(vo.getC11()));
                    gc14.setValue2(String.valueOf(vo.getC14()));
                    gc17.setValue2(String.valueOf(vo.getC17()));
                    gc20.setValue2(String.valueOf(vo.getC20()));
                    gc23.setValue2(String.valueOf(vo.getC23()));
                    gc26.setValue2(String.valueOf(vo.getC26()));
                    gc29.setValue2(String.valueOf(vo.getC29()));
                    gc32.setValue2(String.valueOf(vo.getC32()));
                    gc35.setValue2(String.valueOf(vo.getC35()));
                    gc38.setValue2(String.valueOf(vo.getC38()));
                    gc41.setValue2(String.valueOf(vo.getC41()));
                    gc44.setValue2(String.valueOf(vo.getC44()));
                    gc47.setValue2(String.valueOf(vo.getC47()));
                    gc50.setValue2(String.valueOf(vo.getC50()));
                    gc53.setValue2(String.valueOf(vo.getC53()));
                    gc56.setValue2(String.valueOf(vo.getC56()));
                    gc59.setValue2(String.valueOf(vo.getC59()));
                    gc0.setValue2(vo.getWindturbineid());

                } else if (i == 2) {
                    gc2.setValue3(String.valueOf(vo.getC2()));
                    gc5.setValue3(String.valueOf(vo.getC5()));
                    gc8.setValue3(String.valueOf(vo.getC8()));
                    gc11.setValue3(String.valueOf(vo.getC11()));
                    gc14.setValue3(String.valueOf(vo.getC14()));
                    gc17.setValue3(String.valueOf(vo.getC17()));
                    gc20.setValue3(String.valueOf(vo.getC20()));
                    gc23.setValue3(String.valueOf(vo.getC23()));
                    gc26.setValue3(String.valueOf(vo.getC26()));
                    gc29.setValue3(String.valueOf(vo.getC29()));
                    gc32.setValue3(String.valueOf(vo.getC32()));
                    gc35.setValue3(String.valueOf(vo.getC35()));
                    gc38.setValue3(String.valueOf(vo.getC38()));
                    gc41.setValue3(String.valueOf(vo.getC41()));
                    gc44.setValue3(String.valueOf(vo.getC44()));
                    gc47.setValue3(String.valueOf(vo.getC47()));
                    gc50.setValue3(String.valueOf(vo.getC50()));
                    gc53.setValue3(String.valueOf(vo.getC53()));
                    gc56.setValue3(String.valueOf(vo.getC56()));
                    gc59.setValue3(String.valueOf(vo.getC59()));
                    gc0.setValue3(vo.getWindturbineid());

                } else if (i == 3) {
                    gc2.setValue4(String.valueOf(vo.getC2()));
                    gc5.setValue4(String.valueOf(vo.getC5()));
                    gc8.setValue4(String.valueOf(vo.getC8()));
                    gc11.setValue4(String.valueOf(vo.getC11()));
                    gc14.setValue4(String.valueOf(vo.getC14()));
                    gc17.setValue4(String.valueOf(vo.getC17()));
                    gc20.setValue4(String.valueOf(vo.getC20()));
                    gc23.setValue4(String.valueOf(vo.getC23()));
                    gc26.setValue4(String.valueOf(vo.getC26()));
                    gc29.setValue4(String.valueOf(vo.getC29()));
                    gc32.setValue4(String.valueOf(vo.getC32()));
                    gc35.setValue4(String.valueOf(vo.getC35()));
                    gc38.setValue4(String.valueOf(vo.getC38()));
                    gc41.setValue4(String.valueOf(vo.getC41()));
                    gc44.setValue4(String.valueOf(vo.getC44()));
                    gc47.setValue4(String.valueOf(vo.getC47()));
                    gc50.setValue4(String.valueOf(vo.getC50()));
                    gc53.setValue4(String.valueOf(vo.getC53()));
                    gc56.setValue4(String.valueOf(vo.getC56()));
                    gc59.setValue4(String.valueOf(vo.getC59()));
                    gc0.setValue4(vo.getWindturbineid());

                } else if (i == 4) {
                    gc2.setValue5(String.valueOf(vo.getC2()));
                    gc5.setValue5(String.valueOf(vo.getC5()));
                    gc8.setValue5(String.valueOf(vo.getC8()));
                    gc11.setValue5(String.valueOf(vo.getC11()));
                    gc14.setValue5(String.valueOf(vo.getC14()));
                    gc17.setValue5(String.valueOf(vo.getC17()));
                    gc20.setValue5(String.valueOf(vo.getC20()));
                    gc23.setValue5(String.valueOf(vo.getC23()));
                    gc26.setValue5(String.valueOf(vo.getC26()));
                    gc29.setValue5(String.valueOf(vo.getC29()));
                    gc32.setValue5(String.valueOf(vo.getC32()));
                    gc35.setValue5(String.valueOf(vo.getC35()));
                    gc38.setValue5(String.valueOf(vo.getC38()));
                    gc41.setValue5(String.valueOf(vo.getC41()));
                    gc44.setValue5(String.valueOf(vo.getC44()));
                    gc47.setValue5(String.valueOf(vo.getC47()));
                    gc50.setValue5(String.valueOf(vo.getC50()));
                    gc53.setValue5(String.valueOf(vo.getC53()));
                    gc56.setValue5(String.valueOf(vo.getC56()));
                    gc59.setValue5(String.valueOf(vo.getC59()));
                    gc0.setValue5(vo.getWindturbineid());
                }

            }

        }
        gcvos.add(gc0);
        gcvos.add(gc2);
        gcvos.add(gc5);
        gcvos.add(gc8);
        gcvos.add(gc11);
        gcvos.add(gc14);
        gcvos.add(gc17);
        gcvos.add(gc20);
        gcvos.add(gc23);
        gcvos.add(gc26);
        gcvos.add(gc29);
        gcvos.add(gc32);
        gcvos.add(gc35);
        gcvos.add(gc38);
        gcvos.add(gc41);
        gcvos.add(gc44);
        gcvos.add(gc47);
        gcvos.add(gc50);
        gcvos.add(gc53);
        gcvos.add(gc56);
        gcvos.add(gc59);
        if(ischart)
        {
            gcvos.add(gc60);
        }
        return  gcvos;
    }


    private  List<GoodCompareVo> setYearListInfo(List<Windturbineanalysisday> vos, boolean ischart) {
        List<GoodCompareVo> gcvos = new ArrayList<GoodCompareVo>();
        GoodCompareVo gc0 = new GoodCompareVo();
        gc0.setName("风电机");
        gc0.setValue1("");
        gc0.setValue2("");
        gc0.setValue3("");
        gc0.setValue4("");
        gc0.setValue5("");
        GoodCompareVo gc3 = new GoodCompareVo();
        gc3.setName("年发电量");
        gc3.setValue1("");
        gc3.setValue2("");
        gc3.setValue3("");
        gc3.setValue4("");
        gc3.setValue5("");
        GoodCompareVo gc6 = new GoodCompareVo();
        gc6.setName("年应发电量");
        gc6.setValue1("");
        gc6.setValue2("");
        gc6.setValue3("");
        gc6.setValue4("");
        gc6.setValue5("");
        GoodCompareVo gc9 = new GoodCompareVo();
        gc9.setName("年平均功率");
        gc9.setValue1("");
        gc9.setValue2("");
        gc9.setValue3("");
        gc9.setValue4("");
        gc9.setValue5("");
        GoodCompareVo gc12 = new GoodCompareVo();
        gc12.setName("年平均风速");
        gc12.setValue1("");
        gc12.setValue2("");
        gc12.setValue3("");
        gc12.setValue4("");
        gc12.setValue5("");
        GoodCompareVo gc15 = new GoodCompareVo();
        gc15.setName("年运行小时");
        gc15.setValue1("");
        gc15.setValue2("");
        gc15.setValue3("");
        gc15.setValue4("");
        gc15.setValue5("");
        GoodCompareVo gc18 = new GoodCompareVo();
        gc18.setName("年待机小时");
        gc18.setValue1("");
        gc18.setValue2("");
        gc18.setValue3("");
        gc18.setValue4("");
        gc18.setValue5("");
        GoodCompareVo gc21 = new GoodCompareVo();
        gc21.setName("年故障小时");
        gc21.setValue1("");
        gc21.setValue2("");
        gc21.setValue3("");
        gc21.setValue4("");
        gc21.setValue5("");
        GoodCompareVo gc24 = new GoodCompareVo();
        gc24.setName("年维护小时");
        gc24.setValue1("");
        gc24.setValue2("");
        gc24.setValue3("");
        gc24.setValue4("");
        gc24.setValue5("");
        GoodCompareVo gc27 = new GoodCompareVo();
        gc27.setName("年中断小时");
        gc27.setValue1("");
        gc27.setValue2("");
        gc27.setValue3("");
        gc27.setValue4("");
        gc27.setValue5("");
        GoodCompareVo gc30 = new GoodCompareVo();
        gc30.setName("年有效风时");
        gc30.setValue1("");
        gc30.setValue2("");
        gc30.setValue3("");
        gc30.setValue4("");
        gc30.setValue5("");
        GoodCompareVo gc33 = new GoodCompareVo();
        gc33.setName("年损失电量");
        gc33.setValue1("");
        gc33.setValue2("");
        gc33.setValue3("");
        gc33.setValue4("");
        gc33.setValue5("");
        GoodCompareVo gc36 = new GoodCompareVo();
        gc36.setName("年报警次数");
        gc36.setValue1("");
        gc36.setValue2("");
        gc36.setValue3("");
        gc36.setValue4("");
        gc36.setValue5("");
        GoodCompareVo gc39 = new GoodCompareVo();
        gc39.setName("年停机次数");
        gc39.setValue1("");
        gc39.setValue2("");
        gc39.setValue3("");
        gc39.setValue4("");
        gc39.setValue5("");
        GoodCompareVo gc42 = new GoodCompareVo();
        gc42.setName("年不饱和次数");
        gc42.setValue1("");
        gc42.setValue2("");
        gc42.setValue3("");
        gc42.setValue4("");
        gc42.setValue5("");
        GoodCompareVo gc45 = new GoodCompareVo();
        gc45.setName("年设备可利用率");
        gc45.setValue1("");
        gc45.setValue2("");
        gc45.setValue3("");
        gc45.setValue4("");
        gc45.setValue5("");
        GoodCompareVo gc48 = new GoodCompareVo();
        gc48.setName("年平均温度");
        gc48.setValue1("");
        gc48.setValue2("");
        gc48.setValue3("");
        gc48.setValue4("");
        gc48.setValue5("");
        GoodCompareVo gc51 = new GoodCompareVo();
        gc51.setName("年平均湿度");
        gc51.setValue1("");
        gc51.setValue2("");
        gc51.setValue3("");
        gc51.setValue4("");
        gc51.setValue5("");
        GoodCompareVo gc54 = new GoodCompareVo();
        gc54.setName("年平均压强");
        gc54.setValue1("");
        gc54.setValue2("");
        gc54.setValue3("");
        gc54.setValue4("");
        gc54.setValue5("");
        GoodCompareVo gc57 = new GoodCompareVo();
        gc57.setName("年拟合优度");
        gc57.setValue1("");
        gc57.setValue2("");
        gc57.setValue3("");
        gc57.setValue4("");
        gc57.setValue5("");
        GoodCompareVo gc60 = new GoodCompareVo();
        gc60.setName("年实际/保证");
        gc60.setValue1("");
        gc60.setValue2("");
        gc60.setValue3("");
        gc60.setValue4("");
        gc60.setValue5("");

        GoodCompareVo gc61 = new GoodCompareVo();
        gc61.setName("风资源");
        gc61.setValue1("<div id='fzy1' name='fzy1'></div>");
        gc61.setValue2("<div id='fzy2' name='fzy2'></div>");
        gc61.setValue3("<div id='fzy3' name='fzy3'></div>");
        gc61.setValue4("<div id='fzy4' name='fzy4'></div>");
        gc61.setValue5("<div id='fzy5' name='fzy5'></div>");
        if (!vos.isEmpty()) {
            for (int i = 0; i < vos.size(); i++) {
                Windturbineanalysisday vo = (Windturbineanalysisday) vos.get(i);
                if (i == 0) {
                    gc3.setValue1(String.valueOf(vo.getC3()));
                    gc6.setValue1(String.valueOf(vo.getC6()));
                    gc9.setValue1(String.valueOf(vo.getC9()));
                    gc12.setValue1(String.valueOf(vo.getC12()));
                    gc15.setValue1(String.valueOf(vo.getC15()));
                    gc18.setValue1(String.valueOf(vo.getC18()));
                    gc21.setValue1(String.valueOf(vo.getC21()));
                    gc24.setValue1(String.valueOf(vo.getC24()));
                    gc27.setValue1(String.valueOf(vo.getC27()));
                    gc30.setValue1(String.valueOf(vo.getC30()));
                    gc33.setValue1(String.valueOf(vo.getC33()));
                    gc36.setValue1(String.valueOf(vo.getC36()));
                    gc39.setValue1(String.valueOf(vo.getC39()));
                    gc42.setValue1(String.valueOf(vo.getC42()));
                    gc45.setValue1(String.valueOf(vo.getC45()));
                    gc48.setValue1(String.valueOf(vo.getC48()));
                    gc51.setValue1(String.valueOf(vo.getC51()));
                    gc54.setValue1(String.valueOf(vo.getC54()));
                    gc57.setValue1(String.valueOf(vo.getC57()));
                    gc60.setValue1(String.valueOf(vo.getC60()));
                    gc0.setValue1(vo.getWindturbineid());

                } else if (i == 1) {
                    gc3.setValue2(String.valueOf(vo.getC3()));
                    gc6.setValue2(String.valueOf(vo.getC6()));
                    gc9.setValue2(String.valueOf(vo.getC9()));
                    gc12.setValue2(String.valueOf(vo.getC12()));
                    gc15.setValue2(String.valueOf(vo.getC15()));
                    gc18.setValue2(String.valueOf(vo.getC18()));
                    gc21.setValue2(String.valueOf(vo.getC21()));
                    gc24.setValue2(String.valueOf(vo.getC24()));
                    gc27.setValue2(String.valueOf(vo.getC27()));
                    gc30.setValue2(String.valueOf(vo.getC30()));
                    gc33.setValue2(String.valueOf(vo.getC33()));
                    gc36.setValue2(String.valueOf(vo.getC36()));
                    gc39.setValue2(String.valueOf(vo.getC39()));
                    gc42.setValue2(String.valueOf(vo.getC42()));
                    gc45.setValue2(String.valueOf(vo.getC45()));
                    gc48.setValue2(String.valueOf(vo.getC48()));
                    gc51.setValue2(String.valueOf(vo.getC51()));
                    gc54.setValue2(String.valueOf(vo.getC54()));
                    gc57.setValue2(String.valueOf(vo.getC57()));
                    gc60.setValue2(String.valueOf(vo.getC60()));
                    gc0.setValue2(vo.getWindturbineid());

                } else if (i == 2) {
                    gc3.setValue3(String.valueOf(vo.getC3()));
                    gc6.setValue3(String.valueOf(vo.getC6()));
                    gc9.setValue3(String.valueOf(vo.getC9()));
                    gc12.setValue3(String.valueOf(vo.getC12()));
                    gc15.setValue3(String.valueOf(vo.getC15()));
                    gc18.setValue3(String.valueOf(vo.getC18()));
                    gc21.setValue3(String.valueOf(vo.getC21()));
                    gc24.setValue3(String.valueOf(vo.getC24()));
                    gc27.setValue3(String.valueOf(vo.getC27()));
                    gc30.setValue3(String.valueOf(vo.getC30()));
                    gc33.setValue3(String.valueOf(vo.getC33()));
                    gc36.setValue3(String.valueOf(vo.getC36()));
                    gc39.setValue3(String.valueOf(vo.getC39()));
                    gc42.setValue3(String.valueOf(vo.getC42()));
                    gc45.setValue3(String.valueOf(vo.getC45()));
                    gc48.setValue3(String.valueOf(vo.getC48()));
                    gc51.setValue3(String.valueOf(vo.getC51()));
                    gc54.setValue3(String.valueOf(vo.getC54()));
                    gc57.setValue3(String.valueOf(vo.getC57()));
                    gc60.setValue3(String.valueOf(vo.getC60()));
                    gc0.setValue3(vo.getWindturbineid());

                } else if (i == 3) {
                    gc3.setValue4(String.valueOf(vo.getC3()));
                    gc6.setValue4(String.valueOf(vo.getC6()));
                    gc9.setValue4(String.valueOf(vo.getC9()));
                    gc12.setValue4(String.valueOf(vo.getC12()));
                    gc15.setValue4(String.valueOf(vo.getC15()));
                    gc18.setValue4(String.valueOf(vo.getC18()));
                    gc21.setValue4(String.valueOf(vo.getC21()));
                    gc24.setValue4(String.valueOf(vo.getC24()));
                    gc27.setValue4(String.valueOf(vo.getC27()));
                    gc30.setValue4(String.valueOf(vo.getC30()));
                    gc33.setValue4(String.valueOf(vo.getC33()));
                    gc36.setValue4(String.valueOf(vo.getC36()));
                    gc39.setValue4(String.valueOf(vo.getC39()));
                    gc42.setValue4(String.valueOf(vo.getC42()));
                    gc45.setValue4(String.valueOf(vo.getC45()));
                    gc48.setValue4(String.valueOf(vo.getC48()));
                    gc51.setValue4(String.valueOf(vo.getC51()));
                    gc54.setValue4(String.valueOf(vo.getC54()));
                    gc57.setValue4(String.valueOf(vo.getC57()));
                    gc60.setValue4(String.valueOf(vo.getC60()));
                    gc0.setValue4(vo.getWindturbineid());

                } else if (i == 4) {
                    gc3.setValue5(String.valueOf(vo.getC3()));
                    gc6.setValue5(String.valueOf(vo.getC6()));
                    gc9.setValue5(String.valueOf(vo.getC9()));
                    gc12.setValue5(String.valueOf(vo.getC12()));
                    gc15.setValue5(String.valueOf(vo.getC15()));
                    gc18.setValue5(String.valueOf(vo.getC18()));
                    gc21.setValue5(String.valueOf(vo.getC21()));
                    gc24.setValue5(String.valueOf(vo.getC24()));
                    gc27.setValue5(String.valueOf(vo.getC27()));
                    gc30.setValue5(String.valueOf(vo.getC30()));
                    gc33.setValue5(String.valueOf(vo.getC33()));
                    gc36.setValue5(String.valueOf(vo.getC36()));
                    gc39.setValue5(String.valueOf(vo.getC39()));
                    gc42.setValue5(String.valueOf(vo.getC42()));
                    gc45.setValue5(String.valueOf(vo.getC45()));
                    gc48.setValue5(String.valueOf(vo.getC48()));
                    gc51.setValue5(String.valueOf(vo.getC51()));
                    gc54.setValue5(String.valueOf(vo.getC54()));
                    gc57.setValue5(String.valueOf(vo.getC57()));
                    gc60.setValue5(String.valueOf(vo.getC60()));
                    gc0.setValue5(vo.getWindturbineid());
                }

            }

        }
        gcvos.add(gc0);
        gcvos.add(gc3);
        gcvos.add(gc6);
        gcvos.add(gc9);
        gcvos.add(gc12);
        gcvos.add(gc15);
        gcvos.add(gc18);
        gcvos.add(gc21);
        gcvos.add(gc24);
        gcvos.add(gc27);
        gcvos.add(gc30);
        gcvos.add(gc33);
        gcvos.add(gc36);
        gcvos.add(gc39);
        gcvos.add(gc42);
        gcvos.add(gc45);
        gcvos.add(gc48);
        gcvos.add(gc51);
        gcvos.add(gc54);
        gcvos.add(gc57);
        gcvos.add(gc60);
        if(ischart)
        {
            gcvos.add(gc61);
        }
        return gcvos;
    }

    public AjaxResult fzyDay(String windturbineid,Date date) {

        Map<String, Object> map = new HashMap<String, Object>();

        if (StringUtils.notEmp(windturbineid) && StringUtils.notEmp(date)) {


            String[] strs=windturbineid.split(",");
            for(int j=0;j<strs.length;j++)
            {
                List<ValueVo> vos = new ArrayList<ValueVo>();

                String wtId=strs[j];
                List<Windturbinethewindinfo> wtdls = windturbinethewindinfoService.fzy(wtId, DateUtils.truncate(date));

                if (!wtdls.isEmpty()) {

                    Windturbinethewindinfo winfo = wtdls.get(0);

                    for (int i = 0; i < 16; i++) {
                        ValueVo vo = new ValueVo();

                        switch (i) {
                            case 0:
                                // vo.setName("N("+winfo.getN4()+"/"+winfo.getN()+")");
                                vo.setName("N");
                                vo.setData1(winfo.getN4());
                                break;
                            case 1:
                                // vo.setName("NNE("+winfo.getNne4()+"/"+winfo.getNne()+")");
                                vo.setName("NNE");
                                vo.setData1(winfo.getNne4());
                                break;
                            case 2:
                                // vo.setName("NE("+winfo.getNe4()+"/"+winfo.getNe()+")");
                                vo.setName("NE");
                                vo.setData1(winfo.getNe4());
                                break;
                            case 3:
                                // vo.setName("ENE("+winfo.getEne4()+"/"+winfo.getEne()+")");
                                vo.setName("ENE");
                                vo.setData1(winfo.getEne4());

                                break;
                            case 4:
                                // vo.setName("E("+winfo.getE4()+"/"+winfo.getE()+")");
                                vo.setName("E");
                                vo.setData1(winfo.getE4());
                                break;
                            case 5:
                                // vo.setName("ESE("+winfo.getEse()+"/"+winfo.getEse()+")");
                                vo.setName("ESE");
                                vo.setData1(winfo.getEse4());
                                break;
                            case 6:
                                // vo.setName("SE("+winfo.getSe4()+"/"+winfo.getSe()+")");
                                vo.setName("SE");
                                vo.setData1(winfo.getSe4());
                                break;
                            case 7:
                                // vo.setName("SSE("+winfo.getSse4()+"/"+winfo.getSse()+")");
                                vo.setName("SSE");
                                vo.setData1(winfo.getSse4());
                                break;
                            case 8:
                                // vo.setName("S("+winfo.getS4()+"/"+winfo.getS()+")");
                                vo.setName("S");
                                vo.setData1(winfo.getS4());
                                break;
                            case 9:
                                // vo.setName("SSW("+winfo.getSsw4()+"/"+winfo.getSsw()+")");
                                vo.setName("SSW");
                                vo.setData1(winfo.getSsw4());
                                break;
                            case 10:
                                // vo.setName("SW("+winfo.getSw4()+"/"+winfo.getSw()+")");
                                vo.setName("SW");
                                vo.setData1(winfo.getSw4());
                                break;
                            case 11:
                                // vo.setName("WSW("+winfo.getWsw4()+"/"+winfo.getWsw()+")");
                                vo.setName("WSW");
                                vo.setData1(winfo.getWsw4());

                                break;
                            case 12:
                                // vo.setName("W("+winfo.getW4()+"/"+winfo.getW()+")");
                                vo.setName("W");
                                vo.setData1(winfo.getW4());
                                break;
                            case 13:
                                // vo.setName("WNW("+winfo.getWnw4()+"/"+winfo.getWnw()+")");
                                vo.setName("WNW");
                                vo.setData1(winfo.getWnw4());
                                break;
                            case 14:
                                // vo.setName("NW("+winfo.getNw4()+"/"+winfo.getNw()+")");
                                vo.setName("NW");
                                vo.setData1(winfo.getNw4());
                                break;
                            case 15:
                                // vo.setName("NNW("+winfo.getNnw4()+"/"+winfo.getNnw()+")");
                                vo.setName("NNW");
                                vo.setData1(winfo.getNnw4());
                                break;

                            default:
                                break;
                        }

                        vos.add(vo);
                    }

                }

                String jfpl=null;

                if (!wtdls.isEmpty()) {
                    // jfpl="静风频率为"+wtdls.get(0).getCb();

                    int c = (int) wtdls.get(0).getCb().intValue();

                    jfpl = "静风频率为" + c;
                } else {
                    jfpl = "静风频率为1";
                }

                map.put("jfpl"+j, jfpl);
                map.put("data"+j, vos);

            }



        }

        if (!map.isEmpty()) {

            return AjaxResult.successData(AjaxStatus.success.code, map);
        } else {
            return AjaxResult.successData(AjaxStatus.success.code, map);
        }

    }

    public AjaxResult fzyMonth(String windturbineid,Date date) {

        Map<String, Object> map = new HashMap<String, Object>();

        if (StringUtils.notEmp(windturbineid) && StringUtils.notEmp(date)) {
            List<ValueVo> vos = new ArrayList<ValueVo>();

            String[] strs=windturbineid.split(",");
            for(int j=0;j<strs.length;j++)
            {
                String wtId=strs[j];
                List<Windturbinethewindinfo> wtdls = windturbinethewindinfoService.fzy(wtId, DateUtils.truncate(date));

                if (!wtdls.isEmpty()) {

                    Windturbinethewindinfo winfo = wtdls.get(0);

                    for (int i = 0; i < 16; i++) {
                        ValueVo vo = new ValueVo();

                        switch (i) {
                            case 0:
                                // vo.setName("N("+winfo.getN4()+"/"+winfo.getN()+")");
                                vo.setName("N");
                                vo.setData1(winfo.getN10());
                                break;
                            case 1:
                                // vo.setName("NNE("+winfo.getNne4()+"/"+winfo.getNne()+")");
                                vo.setName("NNE");
                                vo.setData1(winfo.getNne10());
                                break;
                            case 2:
                                // vo.setName("NE("+winfo.getNe4()+"/"+winfo.getNe()+")");
                                vo.setName("NE");
                                vo.setData1(winfo.getNe10());
                                break;
                            case 3:
                                // vo.setName("ENE("+winfo.getEne4()+"/"+winfo.getEne()+")");
                                vo.setName("ENE");
                                vo.setData1(winfo.getEne10());

                                break;

                            case 4:
                                // vo.setName("E("+winfo.getE4()+"/"+winfo.getE()+")");
                                vo.setName("E");
                                vo.setData1(winfo.getE10());
                                break;
                            case 5:
                                // vo.setName("ESE("+winfo.getEse()+"/"+winfo.getEse()+")");
                                vo.setName("ESE");
                                vo.setData1(winfo.getEse10());
                                break;
                            case 6:
                                // vo.setName("SE("+winfo.getSe4()+"/"+winfo.getSe()+")");
                                vo.setName("SE");
                                vo.setData1(winfo.getSe10());
                                break;
                            case 7:
                                // vo.setName("SSE("+winfo.getSse4()+"/"+winfo.getSse()+")");
                                vo.setName("SSE");
                                vo.setData1(winfo.getSse10());
                                break;
                            case 8:
                                // vo.setName("S("+winfo.getS4()+"/"+winfo.getS()+")");
                                vo.setName("S");
                                vo.setData1(winfo.getS10());
                                break;
                            case 9:
                                // vo.setName("SSW("+winfo.getSsw4()+"/"+winfo.getSsw()+")");
                                vo.setName("SSW");
                                vo.setData1(winfo.getSsw10());
                                break;
                            case 10:
                                // vo.setName("SW("+winfo.getSw4()+"/"+winfo.getSw()+")");
                                vo.setName("SW");
                                vo.setData1(winfo.getSw10());
                                break;
                            case 11:
                                // vo.setName("WSW("+winfo.getWsw4()+"/"+winfo.getWsw()+")");
                                vo.setName("WSW");
                                vo.setData1(winfo.getWsw10());

                                break;
                            case 12:
                                // vo.setName("W("+winfo.getW4()+"/"+winfo.getW()+")");
                                vo.setName("W");
                                vo.setData1(winfo.getW10());
                                break;
                            case 13:
                                // vo.setName("WNW("+winfo.getWnw4()+"/"+winfo.getWnw()+")");
                                vo.setName("WNW");
                                vo.setData1(winfo.getWnw10());
                                break;
                            case 14:
                                // vo.setName("NW("+winfo.getNw4()+"/"+winfo.getNw()+")");
                                vo.setName("NW");
                                vo.setData1(winfo.getNw10());
                                break;
                            case 15:
                                // vo.setName("NNW("+winfo.getNnw4()+"/"+winfo.getNnw()+")");
                                vo.setName("NNW");
                                vo.setData1(winfo.getNnw10());
                                break;

                            default:
                                break;
                        }

                        vos.add(vo);
                    }

                }

                String jfpl=null;

                if (!wtdls.isEmpty()) {
                    // jfpl="静风频率为"+wtdls.get(0).getCb();

                    int c = (int) wtdls.get(0).getCb().intValue();

                    jfpl = "静风频率为" + c;
                } else {
                    jfpl = "静风频率为1";
                }

                map.put("jfpl"+j, jfpl);
                map.put("data"+j, vos);
            }


        }

        if (!map.isEmpty()) {

            return AjaxResult.successData(AjaxStatus.success.code, map);
        } else {
            return AjaxResult.successData(AjaxStatus.success.code, map);
        }

    }


    public AjaxResult fzyYear(String windturbineid,Date date) {

        Map<String, Object> map = new HashMap<String, Object>();

        if (StringUtils.notEmp(windturbineid) && StringUtils.notEmp(date)) {
            List<ValueVo> vos = new ArrayList<ValueVo>();

            String[] strs=windturbineid.split(",");
            for(int j=0;j<strs.length;j++)
            {
                String wtId=strs[j];
                List<Windturbinethewindinfo> wtdls = windturbinethewindinfoService.fzy(wtId, DateUtils.truncate(date));

                if (!wtdls.isEmpty()) {

                    Windturbinethewindinfo winfo = wtdls.get(0);

                    for (int i = 0; i < 16; i++) {
                        ValueVo vo = new ValueVo();

                        switch (i) {
                            case 0:
                                // vo.setName("N("+winfo.getN4()+"/"+winfo.getN()+")");
                                vo.setName("N");
                                vo.setData1(winfo.getN16());
                                break;
                            case 1:
                                // vo.setName("NNE("+winfo.getNne4()+"/"+winfo.getNne()+")");
                                vo.setName("NNE");
                                vo.setData1(winfo.getNne16());
                                break;
                            case 2:
                                // vo.setName("NE("+winfo.getNe4()+"/"+winfo.getNe()+")");
                                vo.setName("NE");
                                vo.setData1(winfo.getNe16());
                                break;
                            case 3:
                                // vo.setName("ENE("+winfo.getEne4()+"/"+winfo.getEne()+")");
                                vo.setName("ENE");
                                vo.setData1(winfo.getEne16());

                                break;
                            case 4:
                                // vo.setName("E("+winfo.getE4()+"/"+winfo.getE()+")");
                                vo.setName("E");
                                vo.setData1(winfo.getE16());
                                break;
                            case 5:
                                // vo.setName("ESE("+winfo.getEse()+"/"+winfo.getEse()+")");
                                vo.setName("ESE");
                                vo.setData1(winfo.getEse16());
                                break;
                            case 6:
                                // vo.setName("SE("+winfo.getSe4()+"/"+winfo.getSe()+")");
                                vo.setName("SE");
                                vo.setData1(winfo.getSe16());
                                break;
                            case 7:
                                // vo.setName("SSE("+winfo.getSse4()+"/"+winfo.getSse()+")");
                                vo.setName("SSE");
                                vo.setData1(winfo.getSse16());
                                break;
                            case 8:
                                // vo.setName("S("+winfo.getS4()+"/"+winfo.getS()+")");
                                vo.setName("S");
                                vo.setData1(winfo.getS16());
                                break;
                            case 9:
                                // vo.setName("SSW("+winfo.getSsw4()+"/"+winfo.getSsw()+")");
                                vo.setName("SSW");
                                vo.setData1(winfo.getSsw16());
                                break;
                            case 10:
                                // vo.setName("SW("+winfo.getSw4()+"/"+winfo.getSw()+")");
                                vo.setName("SW");
                                vo.setData1(winfo.getSw16());
                                break;
                            case 11:
                                // vo.setName("WSW("+winfo.getWsw4()+"/"+winfo.getWsw()+")");
                                vo.setName("WSW");
                                vo.setData1(winfo.getWsw16());

                                break;
                            case 12:
                                // vo.setName("W("+winfo.getW4()+"/"+winfo.getW()+")");
                                vo.setName("W");
                                vo.setData1(winfo.getW16());
                                break;
                            case 13:
                                // vo.setName("WNW("+winfo.getWnw4()+"/"+winfo.getWnw()+")");
                                vo.setName("WNW");
                                vo.setData1(winfo.getWnw16());
                                break;
                            case 14:
                                // vo.setName("NW("+winfo.getNw4()+"/"+winfo.getNw()+")");
                                vo.setName("NW");
                                vo.setData1(winfo.getNw16());
                                break;
                            case 15:
                                // vo.setName("NNW("+winfo.getNnw4()+"/"+winfo.getNnw()+")");
                                vo.setName("NNW");
                                vo.setData1(winfo.getNnw16());
                                break;


                            default:
                                break;
                        }

                        vos.add(vo);
                    }

                }

                String jfpl=null;

                if (!wtdls.isEmpty()) {
                    // jfpl="静风频率为"+wtdls.get(0).getCb();

                    int c = (int) wtdls.get(0).getCb().intValue();

                    jfpl = "静风频率为" + c;
                } else {
                    jfpl = "静风频率为1";
                }

                map.put("jfpl"+j, jfpl);
                map.put("data"+j, vos);
            }


        }

        if (!map.isEmpty()) {

            return AjaxResult.successData(AjaxStatus.success.code, map);
        } else {
            return AjaxResult.successData(AjaxStatus.success.code, map);
        }

    }



    public AjaxResult jfplinfo(String windturbineid,Date date) {

        List<Windturbinethewindinfo> wtdls =new ArrayList<>();
        if (StringUtils.notEmp(windturbineid) && StringUtils.notEmp(date)) {
            List<ValueVo> vos = new ArrayList<ValueVo>();


           wtdls = windturbinethewindinfoService.fzy(windturbineid, DateUtils.truncate(date));
        }


        if (!wtdls.isEmpty()) {
            // jfpl="静风频率为"+wtdls.get(0).getCb();

            int c = (int) wtdls.get(0).getCb().intValue();

            return AjaxResult.successData(AjaxStatus.success.code, c);
        } else {
            return AjaxResult.successData(AjaxStatus.success.code, 0);
        }

    }

    public AjaxResult compareDayChat(String windturbineid,Date date) {

        List<DataVo> datavos = new ArrayList<DataVo>();

        if (StringUtils.notEmp(date) && StringUtils.notEmp(windturbineid)) {

            String[] strs = windturbineid.split(",");
            List<Windturbinecurvefitting> wcls = windturbinecurvefittingService.comparechatAjax(windturbineid,date);

            for (int i = 0; i < strs.length; i++) {

                if (!wcls.isEmpty()) {

                    switch (i) {
                        case 0:
                            for (Windturbinecurvefitting wc : wcls) {

                                DataVo vo = new DataVo();

                                if (strs[i].equals(wc.getWindturbineid())) {
                                    int c = (int) wc.getSpeed().intValue();
                                    if (c == wc.getSpeed()) {
                                        vo.setSpeed(wc.getSpeed());
                                        vo.setValue1(wc.getActualpower());
                                        datavos.add(vo);

                                    }
                                }

                            }
                            break;
                        case 1:
                            for (Windturbinecurvefitting wc : wcls) {
                                if (strs[i].equals(wc.getWindturbineid())) {
                                    for (DataVo vo : datavos) {
                                        int c = (int) vo.getSpeed().intValue();
                                        if (c == wc.getSpeed()) {
                                            vo.setValue2(wc.getActualpower());

                                        }
                                    }
                                }

                            }
                            break;
                        case 2:
                            for (Windturbinecurvefitting wc : wcls) {
                                if (strs[i].equals(wc.getWindturbineid())) {
                                    for (DataVo vo : datavos) {
                                        int c = (int) vo.getSpeed().intValue();
                                        if (c == wc.getSpeed()) {
                                            vo.setValue3(wc.getActualpower());

                                        }
                                    }
                                }

                            }
                            break;
                        case 3:
                            for (Windturbinecurvefitting wc : wcls) {
                                if (strs[i].equals(wc.getWindturbineid())) {
                                    for (DataVo vo : datavos) {
                                        int c = (int) vo.getSpeed().intValue();
                                        if (c == wc.getSpeed()) {
                                            vo.setValue4(wc.getActualpower());

                                        }
                                    }
                                }

                            }
                            break;
                        case 4:
                            for (Windturbinecurvefitting wc : wcls) {
                                if (strs[i].equals(wc.getWindturbineid())) {
                                    for (DataVo vo : datavos) {
                                        int c = (int) vo.getSpeed().intValue();
                                        if (c == wc.getSpeed()) {
                                            vo.setValue5(wc.getActualpower());

                                        }
                                    }
                                }

                            }
                            break;
                        default:
                            break;
                    }

                }

            }

        }

        if (!datavos.isEmpty()) {

            return AjaxResult.successData(AjaxStatus.success.code, datavos);
        } else {
            return AjaxResult.successData(AjaxStatus.success.code, datavos);
        }
    }


    public AjaxResult compareMonthChat(String windturbineid,Date date) {

        List<DataVo> datavos = new ArrayList<DataVo>();

        if (StringUtils.notEmp(date) && StringUtils.notEmp(windturbineid)) {

            String[] strs = windturbineid.split(",");
            List<Windturbinecurvefittingmonth> wcls = windturbinecurvefittingmonthService.compareMonthChat(windturbineid, date);

            for (int i = 0; i < strs.length; i++) {


                if (!wcls.isEmpty()) {

                    switch (i) {
                        case 0:
                            for (Windturbinecurvefittingmonth wc : wcls) {
                                if (strs[i].equals(wc.getWindturbineid())) {
                                    DataVo vo = new DataVo();
                                    int c = (int) wc.getSpeed().intValue();
                                    if (c == wc.getSpeed()) {
                                        vo.setSpeed(wc.getSpeed());
                                        vo.setValue1(wc.getActualpower());
                                        datavos.add(vo);

                                    }
                                }

                            }
                            break;
                        case 1:
                            for (Windturbinecurvefittingmonth wc : wcls) {
                                if (strs[i].equals(wc.getWindturbineid())) {
                                    for (DataVo vo : datavos) {
                                        int c = (int) vo.getSpeed().intValue();
                                        if (c == wc.getSpeed()) {
                                            vo.setValue2(wc.getActualpower());

                                        }
                                    }
                                }

                            }
                            break;
                        case 2:
                            for (Windturbinecurvefittingmonth wc : wcls) {
                                if (strs[i].equals(wc.getWindturbineid())) {
                                    for (DataVo vo : datavos) {
                                        int c = (int) vo.getSpeed().intValue();
                                        if (c == wc.getSpeed()) {
                                            vo.setValue3(wc.getActualpower());

                                        }
                                    }
                                }


                            }
                            break;
                        case 3:
                            for (Windturbinecurvefittingmonth wc : wcls) {
                                if (strs[i].equals(wc.getWindturbineid())) {
                                    for (DataVo vo : datavos) {
                                        int c = (int) vo.getSpeed().intValue();
                                        if (c == wc.getSpeed()) {
                                            vo.setValue4(wc.getActualpower());

                                        }
                                    }
                                }


                            }
                            break;
                        case 4:
                            for (Windturbinecurvefittingmonth wc : wcls) {
                                if (strs[i].equals(wc.getWindturbineid())) {
                                    for (DataVo vo : datavos) {
                                        int c = (int) vo.getSpeed().intValue();
                                        if (c == wc.getSpeed()) {
                                            vo.setValue5(wc.getActualpower());

                                        }
                                    }
                                }


                            }
                            break;
                        default:
                            break;
                    }

                }

            }
        }

            if (!datavos.isEmpty()) {

            return AjaxResult.successData(AjaxStatus.success.code, datavos);
        } else {
            return AjaxResult.successData(AjaxStatus.success.code, datavos);
        }
    }


    public AjaxResult compareYearChat(String windturbineid,Date date) {

        List<DataVo> datavos = new ArrayList<DataVo>();

        if (StringUtils.notEmp(date) && StringUtils.notEmp(windturbineid)) {

            String[] strs = windturbineid.split(",");
            List<Windturbinecurvefittingmonth> templs = windturbinecurvefittingmonthService.compareYearChat(windturbineid, date);

            for (int i = 0; i < strs.length; i++) {

                if (!templs.isEmpty()) {
                    Map<String, String> monthmap = new HashMap<String, String>();
                    Map<Double, Windturbinecurvefittingmonth> map = new HashMap<Double, Windturbinecurvefittingmonth>();
                    for (Windturbinecurvefittingmonth wm : templs) {
                        if (strs[i].equals(wm.getWindturbineid())) {
                            if (!monthmap.containsKey(wm.getMonth())) {
                                monthmap.put(wm.getMonth(), wm.getMonth());
                            }
                            int c = (int) wm.getSpeed().intValue();
                            if (c == wm.getSpeed()) {
                                if (map.containsKey(wm.getSpeed())) {
                                    Windturbinecurvefittingmonth po = map.get(wm.getSpeed());
                                    po.setActualpower(po.getActualpower() + wm.getActualpower());
                                    map.put(wm.getSpeed(), po);
                                } else {
                                    Windturbinecurvefittingmonth po = new Windturbinecurvefittingmonth();
                                    po.setActualpower(wm.getActualpower());
                                    po.setId(wm.getId());
                                    po.setMainid(wm.getMainid());
                                    po.setMonth(wm.getMonth());
                                    po.setOptimalpower(wm.getOptimalpower());
                                    po.setWindturbineid(wm.getWindturbineid());
                                    po.setYear(wm.getYear());
                                    po.setSpeed(wm.getSpeed());
                                    map.put(wm.getSpeed(), po);
                                }

                            }
                        }


                    }
                    List<Windturbinecurvefittingmonth> wcls = new ArrayList<Windturbinecurvefittingmonth>();

                    Set<Map.Entry<Double, Windturbinecurvefittingmonth>> set = map.entrySet();
                    for (Iterator<Map.Entry<Double, Windturbinecurvefittingmonth>> it = set.iterator(); it.hasNext(); ) {
                        Map.Entry<Double, Windturbinecurvefittingmonth> entry = (Map.Entry<Double, Windturbinecurvefittingmonth>) it.next();
                        Windturbinecurvefittingmonth temp = entry.getValue();
                        BigDecimal thisbig = new BigDecimal(temp.getActualpower());
                        temp.setActualpower(thisbig.divide(new BigDecimal(monthmap.size()), 2, RoundingMode.HALF_EVEN).doubleValue());
                        wcls.add(temp);
                    }
                    if (!wcls.isEmpty()) {
                        Collections.sort(wcls, new Comparator<Windturbinecurvefittingmonth>() {
                            public int compare(Windturbinecurvefittingmonth arg0, Windturbinecurvefittingmonth arg1) {
                                return arg0.getSpeed().compareTo(arg1.getSpeed());
//								int result = 0;
//								if (arg0.getSpeed() > arg1.getSpeed())
//									result = 1;
//								else
//									result = 0;
//								return result;
                            }
                        });
                        switch (i) {
                            case 0:
                                for (Windturbinecurvefittingmonth wc : wcls) {

                                    DataVo vo = new DataVo();
                                    vo.setSpeed(wc.getSpeed());
                                    vo.setValue1(wc.getActualpower());
                                    datavos.add(vo);
                                }
                                break;
                            case 1:
                                for (Windturbinecurvefittingmonth wc : wcls) {

                                    for (DataVo vo : datavos) {
                                        if (wc.getSpeed().equals(vo.getSpeed())) {
                                            vo.setValue2(wc.getActualpower());
                                        }

                                    }

                                }
                                break;
                            case 2:
                                for (Windturbinecurvefittingmonth wc : wcls) {

                                    for (DataVo vo : datavos) {
                                        if (wc.getSpeed().equals(vo.getSpeed())) {
                                            vo.setValue3(wc.getActualpower());
                                        }
                                    }

                                }
                                break;
                            case 3:
                                for (Windturbinecurvefittingmonth wc : wcls) {

                                    for (DataVo vo : datavos) {
                                        if (wc.getSpeed().equals(vo.getSpeed())) {
                                            vo.setValue4(wc.getActualpower());
                                        }
                                    }

                                }
                                break;
                            case 4:
                                for (Windturbinecurvefittingmonth wc : wcls) {

                                    for (DataVo vo : datavos) {
                                        if (wc.getSpeed().equals(vo.getSpeed())) {
                                            vo.setValue5(wc.getActualpower());
                                        }
                                    }

                                }
                                break;
                            default:
                                break;
                        }

                    }
                }
            }

            }

        if (!datavos.isEmpty()) {

            return AjaxResult.successData(AjaxStatus.success.code, datavos);
        } else {
            return AjaxResult.successData(AjaxStatus.success.code, datavos);
        }
    }
}
