package cn.cecep.talroad.controller.effective;

import cn.cecep.talroad.common.core.web.domain.AjaxResults;
import cn.cecep.talroad.domain.analysis.PcRaProblemType;
import cn.cecep.talroad.service.effective.ForecastAccuracyService;
import cn.cecep.talroad.vo.effective.ForecastAccuracyInfo;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;
import java.util.List;

@RestController
@RequestMapping("forecastAccuracy")
@Api(tags = "预测精准度评估")
public class ForecastAccuracyController {

    @Autowired
    private ForecastAccuracyService service;

    @ApiOperation(value = "获取列表")
    @GetMapping("/list")
    public AjaxResults<IPage<ForecastAccuracyInfo>> getList(@RequestParam(name = "problemType",required = false) String problemType,
                                                            @RequestParam(name = "startTime",required = false)  @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")   Date startTime,
                                                            @RequestParam(name = "endTime",required = false) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date endTime,
                                                            @RequestParam(name = "pageNum",required = false)  Integer pageNum,
                                                            @RequestParam(name = "pageSize",required = false)  Integer pageSize){
        return AjaxResults.success(service.getList(problemType,startTime,endTime,pageNum,pageSize));
    }
    @ApiOperation(value = "获取问题列表")
    @GetMapping("/problemList")
    public AjaxResults<List<PcRaProblemType>> getProblemList(){
        return  AjaxResults.success(service.getProblemListService());
    }
}
