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.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/4/29 14:00
 */
@RestController
@RequestMapping("/dataTrend")
@AllArgsConstructor
@Api(tags = "制水成本--趋势分析")
public class DataTrendController {

    private final DataTrendService dataTrendService;


    @GetMapping("/waterData")
    @ApiOperation("水量数据查询")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "startYear", value = "起始年度 如：2019", dataType = "string"),
            @ApiImplicitParam(name = "endYear", value = "结束年度 如：2021", dataType = "string"),
            @ApiImplicitParam(name = "type", value = "查询类别的ID；多个以逗号隔开", dataType = "string")
    })
    public ResultRespone getWaterData(HttpServletResponse response, WaterPlanSearch search) {
        return ResultRespone.success(dataTrendService.getWaterData(response, search));
    }

    @GetMapping("/electricityData")
    @ApiOperation("用电量查询")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "startYear", value = "起始年度 如：2019", dataType = "string"),
            @ApiImplicitParam(name = "endYear", value = "结束年度 如：2021", dataType = "string"),
            @ApiImplicitParam(name = "type", value = "查询类别的ID；多个以逗号隔开", dataType = "string")
    })
    public ResultRespone getElectricityData(HttpServletResponse response, WaterPlanSearch search) {
        return ResultRespone.success(dataTrendService.getElectricityData(response, search));
    }

    @GetMapping("/materialsData")
    @ApiOperation("材料单耗查询")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "startYear", value = "起始年度 如：2019", dataType = "string"),
            @ApiImplicitParam(name = "endYear", value = "结束年度 如：2021", dataType = "string"),
            @ApiImplicitParam(name = "type", value = "查询类别的ID；多个以逗号隔开", dataType = "string")
    })
    public ResultRespone getMaterialsData(HttpServletResponse response, WaterPlanSearch search) {
        return ResultRespone.success(dataTrendService.getMaterialsData(response, search));
    }


    @GetMapping("/priceData")
    @ApiOperation("制水指标单价")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "startYear", value = "起始年度 如：2019", dataType = "string"),
            @ApiImplicitParam(name = "endYear", value = "结束年度 如：2021", dataType = "string"),
            @ApiImplicitParam(name = "type", value = "查询类别的ID；多个以逗号隔开", dataType = "string")
    })
    public ResultRespone getPriceData(HttpServletResponse response, WaterPlanSearch search) {
        return ResultRespone.success(dataTrendService.getPriceData(response, search));
    }

}
