package com.mosty.common.task.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.mosty.common.base.domain.ResponseResult;
import com.mosty.common.base.entity.log.BusinessType;
import com.mosty.common.base.entity.log.Log;
import com.mosty.common.base.util.IpUtil;
import com.mosty.common.task.entity.SysTask;
import com.mosty.common.task.entity.vo.*;
import com.mosty.common.task.service.SysTaskService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import java.util.List;

@Slf4j
@SuppressWarnings("unused")
@RestController
@AllArgsConstructor
@CrossOrigin
@RequestMapping("/sysTaskReport")
@Api(tags = "任务数量报表接口")
public class SysTaskReportController {
    @Resource
    private SysTaskService sysTaskService;

    /**
     * 查询今日数据
     * @param
     * @return 添加结果
     */
    @PostMapping("todayCount")
    @ApiOperation(value = "查询今日统计数据", httpMethod = "POST", response = SysTaskCountToday.class)
    public ResponseResult<SysTaskCountToday> todayCount() {
        SysTaskCountToday today= sysTaskService.todayCount();
        return ResponseResult.success(today);
    }

    /**
     * 查询全部统计数据
     * @param
     * @return 添加结果
     */
    @PostMapping("allCount")
    @ApiOperation(value = "查询全部统计数据", httpMethod = "POST", response = SysTaskCountToday.class)
    public ResponseResult<SysTaskCountToday> allCount() {
        SysTaskCountToday today= sysTaskService.allCount();
        return ResponseResult.success(today);
    }

    /**
     * 查询分类条数
     * @param
     * @return 添加结果
     */
    @PostMapping("groupCount/{countType}")
    @ApiOperation(value = "查询全部统计数据 1.今日 2.七日 3。 30天 4。 全部。", httpMethod = "POST", response = SysTaskCountGroup.class)
    public ResponseResult<List<SysTaskCountGroup>> groupCount(@PathVariable("countType") Integer countType) {
        List<SysTaskCountGroup> groups = sysTaskService.groupCount(countType);
        return ResponseResult.success(groups);
    }

    /**
     * 查询折线图数据
     * @param
     * @return 添加结果
     */
    @PostMapping("lineChart/{lineChartType}")
    @ApiOperation(value = "查询折线图数据 1 按日统计 2 按月统计", httpMethod = "POST", response = SysTaskLineChartVO.class)
    public ResponseResult<List<SysTaskLineChartVO>> lineChart(@PathVariable("lineChartType") Integer lineChartType) {
        List<SysTaskLineChartVO>  lineCharts= sysTaskService.lineChart(lineChartType);
        return ResponseResult.success(lineCharts);
    }




}
