package com.goldenwater.web.controller.yjjt;

import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import com.goldenwater.common.core.controller.BaseController;
import com.goldenwater.common.core.domain.AjaxResult;
import com.goldenwater.yjjt.domain.YjjtCount;
import com.goldenwater.yjjt.service.IYjjtCountService;

/**
 * 引江济太数据统计Controller
 */
@RestController
@RequestMapping("/yjjt/data")
public class YjjtStatisticsController extends BaseController
{
    @Autowired
    private IYjjtCountService yjjtCountService;

    /**
     * 按年份和单位统计数据条数
     */
    @PreAuthorize("@ss.hasPermi('yjjt:data:list')")
    @GetMapping("/selectCount")
    public AjaxResult selectCount(@RequestParam(required = false) String year,
                                  @RequestParam(required = false) String month,
                                  @RequestParam(required = false) String addvcd)
    {
        List<YjjtCount> list = yjjtCountService.selectCount(year, month, addvcd);
        return success(list);
    }

    /**
     * 按年份和单位统计站点监测天数
     */
    @PreAuthorize("@ss.hasPermi('yjjt:data:list')")
    @GetMapping("/selectYearCount")
    public AjaxResult selectYearCount(@RequestParam(required = false) String year,
                                      @RequestParam(required = false) String month,
                                      @RequestParam(required = false) String addvcd)
    {
        List<YjjtCount> list = yjjtCountService.selectStcdCount(year, month, addvcd);
        return success(list);
    }

    /**
     * 按站点统计水量数据条数
     */
    @PreAuthorize("@ss.hasPermi('yjjt:data:list')")
    @GetMapping("/stcdSLCount")
    public AjaxResult stcdSLCount(@RequestParam(required = false) String year,
                                  @RequestParam(required = false) String addvcd)
    {
        List<YjjtCount> list = yjjtCountService.selectStcdSLCount(year, addvcd);
        return success(list);
    }

    /**
     * 按站点统计水质数据条数
     */
    @PreAuthorize("@ss.hasPermi('yjjt:data:list')")
    @GetMapping("/stcdSZCount")
    public AjaxResult stcdSZCount(@RequestParam(required = false) String year,
                                  @RequestParam(required = false) String addvcd)
    {
        List<YjjtCount> list = yjjtCountService.selectStcdSZCount(year, addvcd);
        return success(list);
    }

    /**
     * 按年份和单位统计监测频次
     */
    @PreAuthorize("@ss.hasPermi('yjjt:data:list')")
    @GetMapping("/selectnum")
    public AjaxResult selectnum(@RequestParam(required = false) String year,
                                @RequestParam(required = false) String month,
                                @RequestParam(required = false) String addvcd)
    {
        List<YjjtCount> list = yjjtCountService.selectnum(year, month, addvcd);
        return success(list);
    }

    /**
     * 按日期范围统计每日数据量（趋势图）
     */
    @PreAuthorize("@ss.hasPermi('yjjt:data:list')")
    @GetMapping("/sum")
    public AjaxResult sum(@RequestParam(required = false) String beginDate,
                          @RequestParam(required = false) String endDate)
    {
        List<Map<String, Object>> list = yjjtCountService.selectDailySum(beginDate, endDate);
        return success(list);
    }
}
