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

import com.tofly.common.core.entity.ResultRespone;
import com.tofly.xrtygis.custom.entity.dataquery.WaterPlanSearch;
import com.tofly.xrtygis.custom.service.zsdata.DataOfferWaterService;
import com.tofly.xrtygis.custom.service.zsdata.DataTrendService;
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/5/14 14:50
 */
@RestController
@RequestMapping("/offerWater")
@AllArgsConstructor
@Api(tags = "制水成本--供水量分布图")
public class DataOfferWaterController {

    private final DataOfferWaterService dataOfferWaterService;

    @GetMapping("/quarter")
    @ApiOperation("季度供水量查询")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "year", value = "年份 如：2019", required = false, dataType = "string")
    })
    public ResultRespone quarterDataOffer(HttpServletResponse response, WaterPlanSearch search) {
        return ResultRespone.success(dataOfferWaterService.quarterDataOffer(response , search));
    }

    @GetMapping("/month")
    @ApiOperation("月度供水量查询")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "startMonth", value = "年份 如：如 2021-01", required = false, dataType = "string")
    })
    public ResultRespone monthDataOffer(HttpServletResponse response, WaterPlanSearch search) {
        return ResultRespone.success(dataOfferWaterService.monthDataOffer(response , search));
    }

    @GetMapping("/year")
    @ApiOperation("年度供水量查询")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "year", value = "年份 如：2019", required = false, dataType = "string")
    })
    public ResultRespone yearDataOffer(HttpServletResponse response, WaterPlanSearch search) {
        return ResultRespone.success(dataOfferWaterService.yearDataOffer(response , search));
    }


}
