package com.gyee.frame.controller.compare;

import com.gyee.frame.common.domain.AjaxResult;
import com.gyee.frame.service.compare.CompareService;
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.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

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

@Controller
@RequestMapping("/compare")
@Api(value = "单机横向对比功能",tags =  "单机横向对比功能")
public class CompareController {
    @Resource
    private CompareService compareService;

    /**查询日横向对比列表**/
    @GetMapping("/compareDayList")
    @ResponseBody
    @ApiOperation(value = "查询日横向对比列表", notes = "查询日横向对比列表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "windturbineid", value = "风场编号", required = true, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "recorddate", value = "日期", required = true, dataType = "string", paramType = "query")})
    public AjaxResult compareDayList(String windturbineid,String recorddate) {


        AjaxResult ajaxResult=compareService.compareDayList(windturbineid, DateUtils.parseStrtoDate(recorddate)) ;

        return ajaxResult;

    }
    /**创建日风资源图表**/
    @GetMapping("/fzyDay")
    @ResponseBody
    @ApiOperation(value = "创建日风资源图表", notes = "创建日风资源图表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "windturbineid", value = "风场编号", required = true, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "recorddate", value = "日期", required = true, dataType = "string", paramType = "query")})
    public AjaxResult fzyDay(String windturbineid,String recorddate) {

        Date beginDate_d=null;
        if (StringUtils.isNotEmpty(recorddate))
        {
            beginDate_d= DateUtils.parseDate(recorddate);
        }
        AjaxResult ajaxResult=compareService.fzyDay(windturbineid,beginDate_d) ;

        return ajaxResult;

    }
    /**查询日横向对比下方图表**/
    @GetMapping("/compareDayChat")
    @ResponseBody
    @ApiOperation(value = "查询日横向对比下方图表", notes = "查询日横向对比下方图表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "windturbineid", value = "风场编号", required = true, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "recorddate", value = "日期", required = true, dataType = "string", paramType = "query")})
    public AjaxResult compareDayChat(String windturbineid,String recorddate) {
        Date beginDate_d=null;
        if (StringUtils.isNotEmpty(recorddate))
        {
            beginDate_d= DateUtils.parseDate(recorddate);
        }

        AjaxResult ajaxResult=compareService.compareDayChat(windturbineid,beginDate_d) ;

        return ajaxResult;

    }
    /***********************************************************************************************************************/

    /**查询月横向对比列表**/
    @GetMapping("/compareMonthList")
    @ResponseBody
    @ApiOperation(value = "查询月横向对比列表", notes = "查询月横向对比列表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "windturbineid", value = "风场编号", required = true, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "recorddate", value = "日期", required = true, dataType = "string", paramType = "query")})
    public AjaxResult compareMonthList(String windturbineid,String recorddate) {
        Date beginDate_d=null;
        if (StringUtils.isNotEmpty(recorddate))
        {
            beginDate_d= DateUtils.parseDate(recorddate);
        }

        AjaxResult ajaxResult=compareService.compareMonthList(windturbineid,beginDate_d) ;

        return ajaxResult;

    }
    /**创建月风资源图表**/
    @GetMapping("/fzyMonth")
    @ResponseBody
    @ApiOperation(value = "创建月风资源图表", notes = "创建月风资源图表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "windturbineid", value = "风场编号", required = true, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "recorddate", value = "日期", required = true, dataType = "string", paramType = "query")})
    public AjaxResult fzyMonth(String windturbineid,String recorddate) {
        Date beginDate_d=null;
        if (StringUtils.isNotEmpty(recorddate))
        {
            beginDate_d= DateUtils.parseDate(recorddate);
        }

        AjaxResult ajaxResult=compareService.fzyMonth(windturbineid,beginDate_d) ;

        return ajaxResult;

    }
    /**查询月横向对比下方图表**/
    @GetMapping("/compareMonthChat")
    @ResponseBody
    @ApiOperation(value = "查询月横向对比下方图表", notes = "查询月横向对比下方图表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "windturbineid", value = "风场编号", required = true, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "recorddate", value = "日期", required = true, dataType = "string", paramType = "query")})
    public AjaxResult compareMonthChat(String windturbineid,String recorddate) {

        Date beginDate_d=null;
        if (StringUtils.isNotEmpty(recorddate))
        {
            beginDate_d= DateUtils.parseDate(recorddate);
        }
        AjaxResult ajaxResult=compareService.compareMonthChat(windturbineid,beginDate_d) ;

        return ajaxResult;

    }


    /***********************************************************************************************************************/

    /**查询年横向对比列表**/
    @GetMapping("/compareYearList")
    @ResponseBody
    @ApiOperation(value = "查询年横向对比列表", notes = "查询年横向对比列表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "windturbineid", value = "风场编号", required = true, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "recorddate", value = "日期", required = true, dataType = "string", paramType = "query")})
    public AjaxResult compareYearList(String windturbineid,String recorddate) {

        Date beginDate_d=null;
        if (StringUtils.isNotEmpty(recorddate))
        {
            beginDate_d= DateUtils.parseDate(recorddate);
        }
        AjaxResult ajaxResult=compareService.compareYearList(windturbineid,beginDate_d) ;

        return ajaxResult;

    }
    /**创建年风资源图表**/
    @GetMapping("/fzyYear")
    @ResponseBody
    @ApiOperation(value = "创建年风资源图表", notes = "创建年风资源图表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "windturbineid", value = "风场编号", required = true, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "recorddate", value = "日期", required = true, dataType = "string", paramType = "query")})
    public AjaxResult fzyYear(String windturbineid,String recorddate) {

        Date beginDate_d=null;
        if (StringUtils.isNotEmpty(recorddate))
        {
            beginDate_d= DateUtils.parseDate(recorddate);
        }
        AjaxResult ajaxResult=compareService.fzyYear(windturbineid,beginDate_d) ;

        return ajaxResult;

    }
    /**查询年横向对比下方图表**/
    @GetMapping("/compareYearChat")
    @ResponseBody
    @ApiOperation(value = "查询年横向对比下方图表", notes = "查询年横向对比下方图表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "windturbineid", value = "风场编号", required = true, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "recorddate", value = "日期", required = true, dataType = "string", paramType = "query")})
    public AjaxResult compareYearChat(String windturbineid,String recorddate) {
        Date beginDate_d=null;
        if (StringUtils.isNotEmpty(recorddate))
        {
            beginDate_d= DateUtils.parseDate(recorddate);
        }

        AjaxResult ajaxResult=compareService.compareYearChat(windturbineid,beginDate_d) ;

        return ajaxResult;

    }

}
