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 org.springframework.beans.factory.annotation.Autowired;
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 java.util.Date;

@Controller
@RequestMapping("/compare")
public class CompareController {
    @Autowired
    private CompareService compareService;

    /**查询日横向对比列表**/
    @GetMapping("/compareDayList")
    @ResponseBody
    public AjaxResult compareDayList(String windturbineid,String date) {


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

        return ajaxResult;

    }
    /**创建日风资源图表**/
    @GetMapping("/fzyDay")
    @ResponseBody
    public AjaxResult fzyDay(String windturbineid,String date) {

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

        return ajaxResult;

    }
    /**查询日横向对比下方图表**/
    @GetMapping("/compareDayChat")
    @ResponseBody
    public AjaxResult compareDayChat(String windturbineid,String date) {
        Date beginDate_d=null;
        if (StringUtils.isNotEmpty(date))
        {
            beginDate_d= DateUtils.parseDate(date);
        }

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

        return ajaxResult;

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

    /**查询月横向对比列表**/
    @GetMapping("/compareMonthList")
    @ResponseBody
    public AjaxResult compareMonthList(String windturbineid,String date) {
        Date beginDate_d=null;
        if (StringUtils.isNotEmpty(date))
        {
            beginDate_d= DateUtils.parseDate(date);
        }

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

        return ajaxResult;

    }
    /**创建月风资源图表**/
    @GetMapping("/fzyMonth")
    @ResponseBody
    public AjaxResult fzyMonth(String windturbineid,String date) {
        Date beginDate_d=null;
        if (StringUtils.isNotEmpty(date))
        {
            beginDate_d= DateUtils.parseDate(date);
        }

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

        return ajaxResult;

    }
    /**查询月横向对比下方图表**/
    @GetMapping("/compareMonthChat")
    @ResponseBody
    public AjaxResult compareMonthChat(String windturbineid,String date) {

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

        return ajaxResult;

    }


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

    /**查询年横向对比列表**/
    @GetMapping("/compareYearList")
    @ResponseBody
    public AjaxResult compareYearList(String windturbineid,String date) {

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

        return ajaxResult;

    }
    /**创建年风资源图表**/
    @GetMapping("/fzyYear")
    @ResponseBody
    public AjaxResult fzyYear(String windturbineid,String date) {

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

        return ajaxResult;

    }
    /**查询年横向对比下方图表**/
    @GetMapping("/compareYearChat")
    @ResponseBody
    public AjaxResult compareYearChat(String windturbineid,String date) {
        Date beginDate_d=null;
        if (StringUtils.isNotEmpty(date))
        {
            beginDate_d= DateUtils.parseDate(date);
        }

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

        return ajaxResult;

    }

}
