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.DataQueryService;
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/23 11:32
 */
@RestController
@RequestMapping("/dataQuery")
@AllArgsConstructor
@Api(tags = "制水成本--制水成本数据查询")
public class DataQueryController {
    private final DataQueryService dataQueryService;

    @GetMapping("/waterPlanValue")
    @ApiOperation("水量计划值")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "startYear", value = "年度 如：2019,2020,2021", 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 waterPlanValue(HttpServletResponse response, Page page, WaterPlanSearch search) {
        return ResultRespone.success(dataQueryService.getWaterPlanValue(response, page, search));
    }

    /**
     * @param response
     * @param page
     * @param search
     * @return
     */
    @GetMapping("/waterRealityValue")
    @ApiOperation("水量实际值")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "startYear", value = "年度 如：2019,2020,2021", 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 waterRealityValue(HttpServletResponse response, Page page, WaterPlanSearch search) {
        return ResultRespone.success(dataQueryService.getWaterRealityValue(response, page, search));
    }

    /**
     * @param response
     * @param page
     * @param search
     * @return
     */
    @GetMapping("/produceMaterialsPlan")
    @ApiOperation("制水材料计划值")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "startYear", value = "年度 如：2019,2020,2021", 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 produceMaterialsPlanValue(HttpServletResponse response, Page page, WaterPlanSearch search) {

        return ResultRespone.success(dataQueryService.getProduceMaterialsPlan(response, page, search));
    }
    /**000000
     * @param response
     * @param page
     * @param search
     * @return
     */
    @GetMapping("/produceMaterialsReality")
    @ApiOperation("制水材料实际值")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "startYear", value = "年度 如：2019,2020,2021", 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 produceMaterialsReality(HttpServletResponse response, Page page, WaterPlanSearch search) {
        return ResultRespone.success(dataQueryService.getProduceMaterialsReality(response, page, search));
    }
    @GetMapping("/produceCostPlanValue")
    @ApiOperation("制水成本计划值")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "startYear", value = "年度 如：2019,2020,2021", 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 produceCostPlanValue(HttpServletResponse response, Page page, WaterPlanSearch search) {
        return ResultRespone.success(dataQueryService.getProduceCostPlan(response, page, search));
    }
    @GetMapping("/produceCostRealityValue")
    @ApiOperation("制水成本实际值")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "startYear", value = "年度 如：2019,2020,2021", 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 produceCostRealityValue(HttpServletResponse response, Page page, WaterPlanSearch search) {
        return ResultRespone.success(dataQueryService.getProduceCostReality(response, page, search));
    }

    @GetMapping("/pricePlan")
    @ApiOperation("指标单价计划值")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "startYear", value = "年度 如：2019,2020,2021", 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 targetPricePlan(HttpServletResponse response, Page page, WaterPlanSearch search) {
        return ResultRespone.success(dataQueryService.getTargetPricePlan(response, search));
    }
    @GetMapping("/priceReality")
    @ApiOperation("指标单价实际值")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "startYear", value = "年度 如：2019,2020,2021", 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 targetPriceReality(HttpServletResponse response, Page page, WaterPlanSearch search) {
        return ResultRespone.success(dataQueryService.getTargetPriceReality(response,  search));
    }

}
