package com.tofly.xrtygis.custom.controller;

import com.tofly.common.core.entity.ResultRespone;
import com.tofly.xrtygis.custom.service.WaterMakingAnalysisService;
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;

@RestController
@RequestMapping("/waterAnalysis")
@AllArgsConstructor
@Api(tags = "制水成本--指标分析")
public class WaterMakingAnalysisController {

    private final WaterMakingAnalysisService waterMakingAnalysisService;

    /**
     * 获取产销差
     */
    @GetMapping("/getNrw")
    @ApiOperation("获取产销差")
    public ResultRespone getNrw(String years) {
        return ResultRespone.success(waterMakingAnalysisService.getNrw(years));
    }

    /**
     * 更多产销差信息
     */
    @GetMapping("/nrwMore")
    @ApiOperation("更多产销差信息")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "year", value = "年份", required = true, dataType = "integer"),
            @ApiImplicitParam(name = "code", value = "0:月份 1：季度 2:近三年", required = true, dataType = "integer")
    })
    public ResultRespone nrwMore(String year, Integer code) {
        return ResultRespone.success(waterMakingAnalysisService.nrwMore(year, code));
    }

    /**
     * 获取漏损率
     */
    @GetMapping("/getLeakage")
    @ApiOperation("获取漏损率")
    public ResultRespone getLeakage(String years) {
        return ResultRespone.success(waterMakingAnalysisService.getLeakage(years));
    }

    /**
     * 更多漏损率信息
     */
    @GetMapping("/leakageMore")
    @ApiOperation("更多漏损率信息")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "year", value = "年份", required = true, dataType = "integer"),
            @ApiImplicitParam(name = "code", value = "0:月份 1：季度 2:近三年", required = true, dataType = "integer")
    })
    public ResultRespone leakageMore(String year, Integer code) {
        return ResultRespone.success(waterMakingAnalysisService.leakageMore(year, code));
    }

    /**
     * 获取供水量售水量
     */
    @GetMapping("/getSupSellWater")
    @ApiOperation("获取供水量售水量")
    public ResultRespone getSupSellWater(String years) {
        return ResultRespone.success(waterMakingAnalysisService.getSupSellWater(years));
    }

    /**
     * 供水量售水量更多信息
     */
    @GetMapping("/supSellWaterMore")
    @ApiOperation("供水量售水量更多信息")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "year", value = "年份", required = true, dataType = "string"),
            @ApiImplicitParam(name = "code", value = "0:月份 1：季度 2:近三年", required = true, dataType = "integer")
    })
    public ResultRespone supSellWaterMore(String year, Integer code) {
        return ResultRespone.success(waterMakingAnalysisService.supSellWaterMore(year, code));
    }

}
