package com.gyee.frame.controller.leaderboard;

import com.gyee.frame.common.conf.AjaxStatus;
import com.gyee.frame.common.domain.AjaxResult;
import com.gyee.frame.model.auto.Curvefittingmain;
import com.gyee.frame.model.auto.Curvefittingmonthmain;
import com.gyee.frame.model.auto.Windturbineinfoday3;
import com.gyee.frame.model.custom.SawVo;
import com.gyee.frame.model.custom.StatisticalAnalysisTopVo;
import com.gyee.frame.model.custom.Tablepar;
import com.gyee.frame.service.leaderboard.LeaderboardService;
import com.gyee.frame.util.DateUtils;
import com.gyee.frame.util.StringUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.*;

@Controller
@RequestMapping("/leaderboard")
@Api(value = "排行榜功能",tags =  "排行榜功能")
public class LeaderboardController {
    @Resource
    private LeaderboardService leaderboardService;

    /**查询拟合优度列表**/
    @GetMapping("/fittingtoplist")
    @ResponseBody
    @ApiOperation(value = "查询拟合优度列表", notes = "查询拟合优度列表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "tablepar", value = "分页排序对象", required = true, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "wpIps", value = "风场编号", required = true, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "beginDate", value = "开始日期", required = true, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "endDate", value = "结束日期", required = true, dataType = "string", paramType = "query")})

    public AjaxResult fittingtoplist(Tablepar tablepar, String wpIps, String beginDate, String endDate) {

        Date beginDate_d=null;
        Date endDate_d=null;
        if (StringUtils.isNotEmpty(beginDate))
        {
            beginDate_d= DateUtils.parseDate(beginDate);
        }
        if (StringUtils.isNotEmpty(endDate))
        {
            endDate_d= DateUtils.parseDate(endDate);
        }
        List<StatisticalAnalysisTopVo> vos= leaderboardService.getRnewTopDate(wpIps, beginDate_d, endDate_d);

        for (StatisticalAnalysisTopVo vo : vos) {
            if (vo.getPower() > 1) {
                vo.setPower(1.0);
            }
        }

        if (tablepar.getOrderByColumn().equals("power")) {
            if (tablepar.getIsAsc().equals("asc")) {
                Collections.sort(vos, new Comparator<StatisticalAnalysisTopVo>() {
                    public int compare(StatisticalAnalysisTopVo arg0, StatisticalAnalysisTopVo arg1) {
                        return arg0.getPower().compareTo(arg1.getPower());
                    }

                });

            } else {
                Collections.sort(vos, new Comparator<StatisticalAnalysisTopVo>() {
                    public int compare(StatisticalAnalysisTopVo arg0, StatisticalAnalysisTopVo arg1) {
                        return arg1.getPower().compareTo(arg0.getPower());
                    }

                });
            }
        } else if (tablepar.getOrderByColumn().equals("speed")) {
            if (tablepar.getIsAsc().equals("asc")) {
                Collections.sort(vos, new Comparator<StatisticalAnalysisTopVo>() {
                    public int compare(StatisticalAnalysisTopVo arg0, StatisticalAnalysisTopVo arg1) {
                        return arg0.getSpeed().compareTo(arg1.getSpeed());
                    }

                });

            } else {
                Collections.sort(vos, new Comparator<StatisticalAnalysisTopVo>() {
                    public int compare(StatisticalAnalysisTopVo arg0, StatisticalAnalysisTopVo arg1) {
                        return arg1.getSpeed().compareTo(arg0.getSpeed());
                    }

                });
            }
        }

        if (vos != null && !vos.isEmpty()) {
            return AjaxResult.successData(AjaxStatus.success.code, vos);
        } else {
            return AjaxResult.successData(AjaxStatus.success.code, vos);
        }

    }


    /**查询拟合优度图表**/
    @GetMapping("/fittingtopchart")
    @ResponseBody
    @ApiOperation(value = "查询拟合优度图表", notes = "查询拟合优度图表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "wtIds", value = "风机编号", required = true, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "beginDate", value = "开始日期", required = true, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "endDate", value = "结束日期", required = true, dataType = "string", paramType = "query")})

    public AjaxResult fittingtopchart(String wtIds, String beginDate, String endDate) throws Exception {
        Date beginDate_d=null;
        Date endDate_d=null;
        if (StringUtils.isNotEmpty(beginDate))
        {
            beginDate_d= DateUtils.parseDate(beginDate);
        }
        if (StringUtils.isNotEmpty(endDate))
        {
            endDate_d= DateUtils.parseDate(endDate);
        }
        Map<String, List> map =new HashMap<>();
        if (StringUtils.notEmp(wtIds) && StringUtils.notEmp(beginDate) && StringUtils.notEmp(endDate)) {
            map = leaderboardService.fittingtopchart(wtIds, beginDate_d, endDate_d);
        }

        if (map != null && !map.isEmpty()) {
            return AjaxResult.successData(AjaxStatus.success.code, map);
        } else {
            return AjaxResult.successData(AjaxStatus.success.code, map);
        }
    }

    /**查询总发电量排行列表**/
    @GetMapping("/totalPowerCapacityTopList")
    @ResponseBody
    @ApiOperation(value = "查询总发电量排行列表", notes = "查询总发电量排行列表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "tablepar", value = "分页排序对象", required = true, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "wpIps", value = "风场编号", required = true, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "beginDate", value = "开始日期", required = true, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "endDate", value = "结束日期", required = true, dataType = "string", paramType = "query")})

    public AjaxResult totalPowerCapacityTopList(Tablepar tablepar, String wpIps, String beginDate, String endDate) {

        Date beginDate_d=null;
        Date endDate_d=null;
        if (StringUtils.isNotEmpty(beginDate))
        {
            beginDate_d= DateUtils.parseDate(beginDate);
        }
        if (StringUtils.isNotEmpty(endDate))
        {
            endDate_d= DateUtils.parseDate(endDate);
        }
        List<StatisticalAnalysisTopVo> vos= leaderboardService.totalPowerCapacityTopList(wpIps, beginDate_d, endDate_d);


        if (tablepar.getOrderByColumn().equals("power")) {
            if (tablepar.getIsAsc().equals("asc")) {
                Collections.sort(vos, new Comparator<StatisticalAnalysisTopVo>() {
                    public int compare(StatisticalAnalysisTopVo arg0, StatisticalAnalysisTopVo arg1) {
                        return arg0.getPower().compareTo(arg1.getPower());
                    }

                });

            } else {
                Collections.sort(vos, new Comparator<StatisticalAnalysisTopVo>() {
                    public int compare(StatisticalAnalysisTopVo arg0, StatisticalAnalysisTopVo arg1) {
                        return arg1.getPower().compareTo(arg0.getPower());
                    }

                });
            }
        } else if (tablepar.getOrderByColumn().equals("speed")) {
            if (tablepar.getIsAsc().equals("asc")) {
                Collections.sort(vos, new Comparator<StatisticalAnalysisTopVo>() {
                    public int compare(StatisticalAnalysisTopVo arg0, StatisticalAnalysisTopVo arg1) {
                        return arg0.getSpeed().compareTo(arg1.getSpeed());
                    }

                });

            } else {
                Collections.sort(vos, new Comparator<StatisticalAnalysisTopVo>() {
                    public int compare(StatisticalAnalysisTopVo arg0, StatisticalAnalysisTopVo arg1) {
                        return arg1.getSpeed().compareTo(arg0.getSpeed());
                    }

                });
            }
        } else if (tablepar.getOrderByColumn().equals("generatingcapacity")) {
            if (tablepar.getIsAsc().equals("asc")) {
                Collections.sort(vos, new Comparator<StatisticalAnalysisTopVo>() {
                    public int compare(StatisticalAnalysisTopVo arg0, StatisticalAnalysisTopVo arg1) {
                        return arg0.getSpeed().compareTo(arg1.getSpeed());
                    }

                });

            } else {
                Collections.sort(vos, new Comparator<StatisticalAnalysisTopVo>() {
                    public int compare(StatisticalAnalysisTopVo arg0, StatisticalAnalysisTopVo arg1) {
                        return arg1.getSpeed().compareTo(arg0.getSpeed());
                    }

                });
            }
        }

        if (vos != null && !vos.isEmpty()) {
            return AjaxResult.successData(AjaxStatus.success.code, vos);
        } else {
            return AjaxResult.successData(AjaxStatus.success.code, vos);
        }

    }


    /**查询利用率排行榜列表**/
    @PostMapping("/utilizationList")
    @ResponseBody
    @ApiOperation(value = "查询总发电量排行列表", notes = "查询总发电量排行列表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "tablepar", value = "分页排序对象", required = true, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "wpId", value = "风场编号", required = true, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "beginDate", value = "开始日期", required = true, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "endDate", value = "结束日期", required = true, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "type", value = "类型 0:风场,1:项目,2:线路,3:风机,", required = true, dataType = "string", paramType = "query")})

    public AjaxResult utilizationList(Tablepar tablepar, String wpId, String beginDate, String endDate,String type) {

        Date beginDate_d=null;
        Date endDate_d=null;
        if (StringUtils.isNotEmpty(beginDate))
        {
            beginDate_d= DateUtils.parseDate(beginDate);
        }
        if (StringUtils.isNotEmpty(endDate))
        {
            endDate_d= DateUtils.parseDate(endDate);
        }

        List<Windturbineinfoday3> vos= leaderboardService.utilizationList(tablepar, wpId, beginDate_d, endDate_d, type);


        if (vos != null && !vos.isEmpty()) {
            return AjaxResult.successData(AjaxStatus.success.code, vos);
        } else {
            return AjaxResult.successData(AjaxStatus.success.code, vos);
        }

    }

    /**查询损失率排行榜列表**/
    @GetMapping("/lossList")
    @ResponseBody
    @ApiOperation(value = "查询损失率排行榜列表", notes = "查询损失率排行榜列表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "tablepar", value = "分页排序对象", required = true, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "wpId", value = "风场编号", required = true, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "beginDate", value = "开始日期", required = true, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "endDate", value = "结束日期", required = true, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "type", value = "类型 0:风场,1:项目,2:线路,3:风机,", required = true, dataType = "string", paramType = "query")})

    public AjaxResult lossList(Tablepar tablepar, String wpId, String beginDate, String endDate,String type) {

        Date beginDate_d=null;
        Date endDate_d=null;
        if (StringUtils.isNotEmpty(beginDate))
        {
            beginDate_d= DateUtils.parseDate(beginDate);
        }
        if (StringUtils.isNotEmpty(endDate))
        {
            endDate_d= DateUtils.parseDate(endDate);
        }
        List<Windturbineinfoday3> vos= leaderboardService.lossList(tablepar, wpId, beginDate_d, endDate_d, type);


        if (vos != null && !vos.isEmpty()) {
            return AjaxResult.successData(AjaxStatus.success.code, vos);
        } else {
            return AjaxResult.successData(AjaxStatus.success.code, vos);
        }

    }

    /**查询负荷率排行榜列表**/
    @PostMapping("/loadfactortoplist")
    @ResponseBody
    @ApiOperation(value = "查询负荷率排行榜列表", notes = "查询负荷率排行榜列表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "tablepar", value = "分页排序对象", required = true, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "type", value = "类型 0:风场,1:项目,2:线路,3:风机,", required = true, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "wpId", value = "风场编号", required = true, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "beginDate", value = "开始日期", required = true, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "endDate", value = "结束日期", required = true, dataType = "string", paramType = "query")})

    public AjaxResult loadfactortoplist(Tablepar tablepar,String type, String wpId, String beginDate, String endDate) {


        Date beginDate_d=null;
        Date endDate_d=null;
        if (StringUtils.isNotEmpty(beginDate))
        {
            beginDate_d= DateUtils.parseDate(beginDate);
        }
        if (StringUtils.isNotEmpty(endDate))
        {
            endDate_d= DateUtils.parseDate(endDate);
        }
        List<StatisticalAnalysisTopVo> vos= leaderboardService.loadfactortoplist(type, wpId, beginDate_d, endDate_d);

        if (null!=tablepar.getOrderByColumn() && tablepar.getOrderByColumn().equals("power")) {
            if (tablepar.getIsAsc().equals("asc")) {
                Collections.sort(vos, new Comparator<StatisticalAnalysisTopVo>() {
                    public int compare(StatisticalAnalysisTopVo arg0, StatisticalAnalysisTopVo arg1) {
                        return arg0.getPower().compareTo(arg1.getPower());
                    }

                });

            } else {
                Collections.sort(vos, new Comparator<StatisticalAnalysisTopVo>() {
                    public int compare(StatisticalAnalysisTopVo arg0, StatisticalAnalysisTopVo arg1) {
                        return arg1.getPower().compareTo(arg0.getPower());
                    }

                });
            }
        } else if (null!=tablepar.getOrderByColumn() &&tablepar.getOrderByColumn().equals("speed")) {
            if (tablepar.getIsAsc().equals("asc")) {
                Collections.sort(vos, new Comparator<StatisticalAnalysisTopVo>() {
                    public int compare(StatisticalAnalysisTopVo arg0, StatisticalAnalysisTopVo arg1) {
                        return arg0.getSpeed().compareTo(arg1.getSpeed());
                    }

                });

            } else {
                Collections.sort(vos, new Comparator<StatisticalAnalysisTopVo>() {
                    public int compare(StatisticalAnalysisTopVo arg0, StatisticalAnalysisTopVo arg1) {
                        return arg1.getSpeed().compareTo(arg0.getSpeed());
                    }

                });
            }
        } else if (null!=tablepar.getOrderByColumn() &&tablepar.getOrderByColumn().equals("generatingcapacity")) {
            if (tablepar.getIsAsc().equals("asc")) {
                Collections.sort(vos, new Comparator<StatisticalAnalysisTopVo>() {
                    public int compare(StatisticalAnalysisTopVo arg0, StatisticalAnalysisTopVo arg1) {
                        return arg0.getSpeed().compareTo(arg1.getSpeed());
                    }

                });

            } else {
                Collections.sort(vos, new Comparator<StatisticalAnalysisTopVo>() {
                    public int compare(StatisticalAnalysisTopVo arg0, StatisticalAnalysisTopVo arg1) {
                        return arg1.getSpeed().compareTo(arg0.getSpeed());
                    }

                });
            }
        }


        if (vos != null && !vos.isEmpty()) {
            return AjaxResult.successData(AjaxStatus.success.code, vos);
        } else {
            return AjaxResult.successData(AjaxStatus.success.code, vos);
        }

    }

    /**查询报警排行榜列表**/
    @PostMapping("/querywarningStatistical")
    @ResponseBody
    @ApiOperation(value = "查询报警排行榜列表", notes = "查询报警排行榜列表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "tablepar", value = "分页排序对象", required = true, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "type", value = "类型 1报警:,2:报警类型,3:厂家", required = true, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "beginDate", value = "开始日期", required = true, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "endDate", value = "结束日期", required = true, dataType = "string", paramType = "query")})

    public AjaxResult querywarningStatistical(Tablepar tablepar, String type, String beginDate, String endDate) {

        Date beginDate_d=null;
        Date endDate_d=null;
        if (StringUtils.isNotEmpty(beginDate))
        {
            beginDate_d= DateUtils.parseDate(beginDate);
        }
        if (StringUtils.isNotEmpty(endDate))
        {
            endDate_d= DateUtils.parseDate(endDate);
        }
        List<SawVo> vos= leaderboardService.getWarningTopDate( tablepar, type, beginDate_d, endDate_d);


        if (vos != null && !vos.isEmpty()) {
            return AjaxResult.successData(AjaxStatus.success.code, vos);
        } else {
            return AjaxResult.successData(AjaxStatus.success.code, vos);
        }

    }

    /**查询报警排行榜图表**/
    @PostMapping("/querywarningStatisticalPie")
    @ResponseBody
    @ApiOperation(value = "查询报警排行榜列表", notes = "查询报警排行榜列表")
    @ApiImplicitParams({

            @ApiImplicitParam(name = "type", value = "类型 1报警:,2:报警类型,3:厂家", required = true, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "beginDate", value = "开始日期", required = true, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "endDate", value = "结束日期", required = true, dataType = "string", paramType = "query")})

    public AjaxResult querywarningStatisticalPie(String type,  String beginDate, String endDate) {

        Date beginDate_d=null;
        Date endDate_d=null;
        if (StringUtils.isNotEmpty(beginDate))
        {
            beginDate_d= DateUtils.parseDate(beginDate);
        }
        if (StringUtils.isNotEmpty(endDate))
        {
            endDate_d= DateUtils.parseDate(endDate);
        }
        List<SawVo> vos=
                leaderboardService.getWarningTopDatePercentage( type, beginDate_d, endDate_d);


        if (vos != null && !vos.isEmpty()) {
            return AjaxResult.successData(AjaxStatus.success.code, vos);
        } else {
            return AjaxResult.successData(AjaxStatus.success.code, vos);
        }

    }
/*******************************************************************************************************************************/
    /**查询日曲线偏差率列表**/
    @PostMapping("/curvefittingmainList")
    @ResponseBody
    @ApiOperation(value = "查询日曲线偏差率列表", notes = "查询日曲线偏差率列表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "tablepar", value = "分页排序对象", required = true, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "wpId", value = "风场编号", required = true, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "recorddate", value = "日期", required = true, dataType = "string", paramType = "query")})

    public AjaxResult curvefittingmainList(Tablepar tablepar, String wpId, String recorddate) {
        List<Curvefittingmain> vos=new ArrayList<>();
        if (StringUtils.isNotEmpty(recorddate))
        {
            Date  date= DateUtils.parseDate(recorddate);
            vos= leaderboardService.curvefittingmainList( tablepar, wpId, date);

        }

        if (vos != null && !vos.isEmpty()) {
            return AjaxResult.successData(AjaxStatus.success.code, vos);
        } else {
            return AjaxResult.successData(AjaxStatus.success.code, vos);
        }
    }

    /**查询日曲线（实际/保证 实际/最优 最优/保证）图表**/
    @PostMapping("/getCurvechatAjax")
    @ResponseBody
    @ApiOperation(value = "查询日曲线", notes = "查询日曲线")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "type", value = "类型 sjbz:实际/保证,sjzy:实际/最优,zybz:最优/保证", required = true, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "wtId", value = "风机编号", required = true, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "recorddate", value = "日期", required = true, dataType = "string", paramType = "query")})

    public AjaxResult getCurvechatAjax(String type,String wtId,  String recorddate) {
        Map<String, Object> vos=new HashMap<>();
        if (StringUtils.isNotEmpty(recorddate))
        {
            Date  date= DateUtils.parseDate(recorddate);
            vos= leaderboardService.getCurvechatAjax( type,wtId, date);
        }


        if (vos != null && !vos.isEmpty()) {
            return AjaxResult.successData(AjaxStatus.success.code, vos);
        } else {
            return AjaxResult.successData(AjaxStatus.success.code, vos);
        }
    }

    /**查询日曲线同比图表**/
    @GetMapping("/curvechatAjaxtb")
    @ResponseBody
    @ApiOperation(value = "查询日曲线同比图表", notes = "查询日曲线同比图表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "type", value = "类型 tb:同比,hb:环比,bg:标杆", required = true, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "wtId", value = "风机编号", required = true, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "recorddate", value = "日期", required = true, dataType = "string", paramType = "query")})

    public AjaxResult curvechatAjaxtb(String type,String wtId,  String recorddate) {

        Map<String, Object> vos=new HashMap<>();
        if (StringUtils.isNotEmpty(recorddate))
        {
            Date  date= DateUtils.parseDate(recorddate);
           vos= leaderboardService.curvechatAjaxtb( type,wtId, date);
        }


        if (vos != null && !vos.isEmpty()) {
            return AjaxResult.successData(AjaxStatus.success.code, vos);
        } else {
            return AjaxResult.successData(AjaxStatus.success.code, vos);
        }
    }
    /**查询日曲线环比图表**/
    @GetMapping("/curvechatAjaxhb")
    @ResponseBody
    @ApiOperation(value = "查询日曲线环比图表", notes = "查询日曲线环比图表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "type", value = "类型 tb:同比,hb:环比,bg:标杆", required = true, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "wtId", value = "风机编号", required = true, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "recorddate", value = "日期", required = true, dataType = "string", paramType = "query")})

    public AjaxResult curvechatAjaxhb(String type,String wtId,  String recorddate) {
        Map<String, Object> vos=new HashMap<>();
        if (StringUtils.isNotEmpty(recorddate))
        {
            Date  date= DateUtils.parseDate(recorddate);
            vos= leaderboardService.curvechatAjaxhb( type,wtId, date);
        }


        if (vos != null && !vos.isEmpty()) {
            return AjaxResult.successData(AjaxStatus.success.code, vos);
        } else {
            return AjaxResult.successData(AjaxStatus.success.code, vos);
        }
    }
    /**查询日曲线标杆图表**/
    @GetMapping("/curvechatAjaxbg")
    @ResponseBody
    @ApiOperation(value = "查询日曲线标杆图表", notes = "查询日曲线标杆图表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "type", value = "类型 tb:同比,hb:环比,bg:标杆", required = true, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "wtId", value = "风机编号", required = true, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "recorddate", value = "日期", required = true, dataType = "string", paramType = "query")})

    public AjaxResult curvechatAjaxbg(String type,String wtId,  String recorddate) {
        Map<String, Object> vos=new HashMap<>();
        if (StringUtils.isNotEmpty(recorddate))
        {
            Date  date= DateUtils.parseDate(recorddate);
            vos= leaderboardService.curvechatAjaxbg( type,wtId, date);
        }


        if (vos != null && !vos.isEmpty()) {
            return AjaxResult.successData(AjaxStatus.success.code, vos);
        } else {
            return AjaxResult.successData(AjaxStatus.success.code, vos);
        }
    }

    /*******************************************************************************************************************************/
    /**查询月曲线偏差率列表**/
    @PostMapping("/curvefittingmonthmainList")
    @ResponseBody
    @ApiOperation(value = "查询月曲线偏差率列表", notes = "查询月曲线偏差率列表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "tablepar", value = "分页排序对象", required = true, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "wpId", value = "风场编号", required = true, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "year", value = "年份", required = true, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "month", value = "月份", required = true, dataType = "string", paramType = "query")})

    public AjaxResult curvefittingmonthmainList(Tablepar tablepar, String wpId, String year,String month) {

        List<Curvefittingmonthmain> vos= leaderboardService.curvefittingmonthmainList( tablepar, wpId, year, month);

        if (vos != null && !vos.isEmpty()) {
            return AjaxResult.successData(AjaxStatus.success.code, vos);
        } else {
            return AjaxResult.successData(AjaxStatus.success.code, vos);
        }
    }

    /**查询月曲线（实际/保证 实际/最优 最优/保证）图表**/
    @PostMapping("/curveMonthchatAjax")
    @ResponseBody
    @ApiOperation(value = "查询月曲线偏差率", notes = "查询月曲线偏差率")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "type", value = "类型 sjbz:实际/保证,sjzy:实际/最优,zybz:最优/保证", required = true, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "wtId", value = "风场编号", required = true, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "year", value = "年份", required = true, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "month", value = "月份", required = true, dataType = "string", paramType = "query")})

    public AjaxResult curveMonthchatAjax(String type,String wtId,  String year,String month) {

        Map<String, Object> vos= leaderboardService.curveMonthchatAjax( type,wtId, year, month);

        if (vos != null && !vos.isEmpty()) {
            return AjaxResult.successData(AjaxStatus.success.code, vos);
        } else {
            return AjaxResult.successData(AjaxStatus.success.code, vos);
        }
    }

    /**查询月曲线同比图表**/
    @GetMapping("/curveMonthchatAjaxtb")
    @ResponseBody
    @ApiOperation(value = "查询月曲线同比图表", notes = "查询月曲线同比图表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "type", value = "类型 tb:同比,hb:环比,bg:标杆", required = true, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "wtId", value = "风场编号", required = true, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "year", value = "年份", required = true, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "month", value = "月份", required = true, dataType = "string", paramType = "query")})

    public AjaxResult curveMonthchatAjaxtb(String type,String wtId, String year,String month) {

        Map<String, Object> vos= leaderboardService.curveMonthchatAjaxtb( type,wtId, year, month);

        if (vos != null && !vos.isEmpty()) {
            return AjaxResult.successData(AjaxStatus.success.code, vos);
        } else {
            return AjaxResult.successData(AjaxStatus.success.code, vos);
        }
    }
    /**查询月曲线环比图表**/
    @GetMapping("/curveMonthchatAjaxhb")
    @ResponseBody
    @ApiOperation(value = "查询月曲线环比图表", notes = "查询月曲线环比图表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "type", value = "类型 tb:同比,hb:环比,bg:标杆", required = true, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "wtId", value = "风场编号", required = true, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "year", value = "年份", required = true, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "month", value = "月份", required = true, dataType = "string", paramType = "query")})

    public AjaxResult curveMonthchatAjaxhb(String type,String wtId,  String year,String month) {

        Map<String, Object> vos= leaderboardService.curveMonthchatAjaxhb( type,wtId, year, month);

        if (vos != null && !vos.isEmpty()) {
            return AjaxResult.successData(AjaxStatus.success.code, vos);
        } else {
            return AjaxResult.successData(AjaxStatus.success.code, vos);
        }
    }
    /**查询月曲线标杆图表**/
    @GetMapping("/curveMonthchatAjaxbg")
    @ResponseBody
    @ApiOperation(value = "查询月曲线标杆图表", notes = "查询月曲线标杆图表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "type", value = "类型 tb:同比,hb:环比,bg:标杆", required = true, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "wtId", value = "风场编号", required = true, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "year", value = "年份", required = true, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "month", value = "月份", required = true, dataType = "string", paramType = "query")})

    public AjaxResult curveMonthchatAjaxbg(String type,String wtId,  String year,String month) {

        Map<String, Object> vos= leaderboardService.curveMonthchatAjaxbg( type,wtId, year, month);

        if (vos != null && !vos.isEmpty()) {
            return AjaxResult.successData(AjaxStatus.success.code, vos);
        } else {
            return AjaxResult.successData(AjaxStatus.success.code, vos);
        }
    }
}
