package com.tofly.xrtygis.custom.controller.zsdata;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.tofly.common.core.entity.ResultRespone;
import com.tofly.xrtygis.custom.entity.dataquery.WaterPlanSearch;
import com.tofly.xrtygis.custom.service.zsdata.DataContrastService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletResponse;

/**
 * 数据比对
 * @author FlashWJL
 * @date 2021/4/27 15:34
 */
@RestController
@RequestMapping("/dataContrast")
@AllArgsConstructor
@Api(tags = "制水成本--数据对比")
public class DataContrastController {

    private final DataContrastService contrastService;


    @GetMapping("/produceCostPrice")
    @ApiOperation("生产成本单价")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "startYear", value = "起始年度 如：2019", required = false, dataType = "string"),
            @ApiImplicitParam(name = "year", value = "年份：按年份查询 如：2020", required = false, dataType = "string"),
            @ApiImplicitParam(name = "startMonth", value = "起始月度 如：2019-01", required = false, dataType = "string"),
            @ApiImplicitParam(name = "endMonth", value = "结束月度 如：2022-01", required = false, dataType = "string"),
            @ApiImplicitParam(name = "templateFlag", value = "导出标识；1：导出", required = false, dataType = "string")

    })
    public ResultRespone getProduceCostPrice(HttpServletResponse response, Page page, WaterPlanSearch search) {
        return ResultRespone.success(contrastService.getProduceCostPrice(response, page, search));
    }


    @GetMapping("/produceDataQuery")
    @ApiOperation("生产数据查询")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "startYear", value = "起始年度 如：2019", required = false, dataType = "string"),
            @ApiImplicitParam(name = "year", value = "年份：按年份查询 如：2020", required = false, dataType = "string"),
            @ApiImplicitParam(name = "startMonth", value = "起始月度 如：2019-01", required = false, dataType = "string"),
            @ApiImplicitParam(name = "endMonth", value = "结束月度 如：2022-01", required = false, dataType = "string"),
            @ApiImplicitParam(name = "templateFlag", value = "导出标识；1：导出", required = false, dataType = "string")

    })
    public ResultRespone getProduceDataQuery(HttpServletResponse response, Page page, WaterPlanSearch search) {
        return ResultRespone.success(contrastService.getProduceDataQuery(response, page, search));
    }
    @GetMapping("/costData")
    @ApiOperation("成本数据查询")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "startYear", value = "起始年度 如：2019", required = false, dataType = "string"),
            @ApiImplicitParam(name = "year", value = "年份：按年份查询 如：2020", required = false, dataType = "string"),
            @ApiImplicitParam(name = "startMonth", value = "起始月度 如：2019-01", required = false, dataType = "string"),
            @ApiImplicitParam(name = "endMonth", value = "结束月度 如：2022-01", required = false, dataType = "string"),
            @ApiImplicitParam(name = "templateFlag", value = "导出标识；1：导出", required = false, dataType = "string")

    })
    public ResultRespone getCostData(HttpServletResponse response, Page page, WaterPlanSearch search) {
        return ResultRespone.success(contrastService.getCostData(response, page, search));
    }


}
