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.service.CostrlfixedService;
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/30 10:13
 */
@RestController
@RequestMapping("/unitCost")
@AllArgsConstructor
@Api(tags = "制水成本--单位成本")
public class DataUnitCostController {

    private final CostrlfixedService costrlfixedService;

    @GetMapping("/materials")
    @ApiOperation("制水材料趋势图")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "startYear" , value = "起始年度 如：2019" , dataType = "string"),
            @ApiImplicitParam(name = "endYear" , value = "结束年度 如：2021" , dataType = "string")
    })
    public ResultRespone materials(HttpServletResponse response, WaterPlanSearch search) {
        return ResultRespone.success( costrlfixedService.getWaterData(response , search));
    }

    @GetMapping("/waterTax")
    @ApiOperation("水资源税费趋势图")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "startYear" , value = "起始年度 如：2019" ,  dataType = "string"),
            @ApiImplicitParam(name = "endYear" , value = "结束年度 如：2021" ,  dataType = "string")
    })
    public ResultRespone waterTax(HttpServletResponse response, WaterPlanSearch search) {
        return ResultRespone.success( costrlfixedService.getWaterData(response , search));
    }

    @GetMapping("/electricCost")
    @ApiOperation("电费成本趋势图")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "startYear" , value = "起始年度 如：2019" , dataType = "string"),
            @ApiImplicitParam(name = "endYear" , value = "结束年度 如：2021" , dataType = "string")
    })
    public ResultRespone electricCost(HttpServletResponse response, WaterPlanSearch search) {
        return ResultRespone.success( costrlfixedService.getWaterData(response , search));
    }

    @GetMapping("/unitCost")
    @ApiOperation("单位成本饼图")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "startMonth" , value = "起始月度" , dataType = "string"),
            @ApiImplicitParam(name = "endMonth" , value = "结束月度" , dataType = "string"),
            @ApiImplicitParam(name = "year" , value = "年份" , dataType = "string")
    })
    public ResultRespone unitCost(HttpServletResponse response, WaterPlanSearch search) {
        return ResultRespone.success( costrlfixedService.getUnitCost(response , search));
    }

    @GetMapping("/waterRate")
    @ApiOperation("原水费趋势图")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "startYear" , value = "起始年度 如：2019" , required = false, dataType = "string"),
            @ApiImplicitParam(name = "endYear" , value = "结束年度 如：2021" , required = false, dataType = "string")
    })
    public ResultRespone waterRate(HttpServletResponse response, WaterPlanSearch search) {
        return ResultRespone.success( costrlfixedService.getWaterRate(response , search));
    }
    @GetMapping("/meterailsCost")
    @ApiOperation("材料成本饼图")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "startMonth" , value = "起始月度" , required = false, dataType = "string"),
            @ApiImplicitParam(name = "endMonth" , value = "结束月度" , required = false, dataType = "string"),
            @ApiImplicitParam(name = "year" , value = "年份" , required = false, dataType = "string")
    })
    public ResultRespone meterailsCost(HttpServletResponse response, WaterPlanSearch search) {
        return ResultRespone.success( costrlfixedService.getUnitCost(response , search));
    }


}
