package com.tofly.xrtygis.custom.controller;

import com.tofly.common.core.entity.ResultRespone;
import com.tofly.xrtygis.custom.entity.dto.CostbgIndexDto;
import com.tofly.xrtygis.custom.entity.dto.CostbgWaterDto;
import com.tofly.xrtygis.custom.entity.dto.NewElectricityBillDto;
import com.tofly.xrtygis.custom.service.WaterMakingPlanService;
import com.tofly.xrtygis.entity.Costbgprice;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;


@RestController
@RequestMapping("/waterMakingPlan")
@AllArgsConstructor
@Api(tags = "计划管理--制水成本改动")
public class WaterMakingPlanController {

    private final WaterMakingPlanService waterMakingPlanService;

    @PostMapping("/insertPricePlan")
    @ApiOperation("计划管理-添加制水单价计划")
    public ResultRespone insertPricePlan(@RequestBody Costbgprice costbgprice){
        return ResultRespone.success(waterMakingPlanService.insertPricePlan(costbgprice));
    }

    @GetMapping("/viewExpense")
    @ApiOperation("计划管理-查询预算制水费用")
    @ApiImplicitParam(name = "year",value = "年份",required = true,dataType = "string")
    public ResultRespone viewExpense(String year){
        return ResultRespone.success(waterMakingPlanService.viewExpense(year));
    }

    @PutMapping("/updatePricePlan")
    @ApiOperation("计划管理-修改制水单价计划")
    public ResultRespone updatePricePlan(@RequestBody Costbgprice price){
        return ResultRespone.success(waterMakingPlanService.updatePricePlan(price));
    }

    @GetMapping("/viewFixedPlan")
    @ApiOperation("计划管理-查看单变计划详情")
    @ApiImplicitParam(name = "id",value = "年计划id",required = true,dataType = "long")
    public ResultRespone viewFixedPlan(Long id){
        return ResultRespone.success(waterMakingPlanService.viewFixedPlan(id));
    }


    @PostMapping("/insertBill")
    @ApiOperation("基本电费填报")
    public ResultRespone insertElectricityBill(@RequestBody NewElectricityBillDto dto){
        return ResultRespone.success(waterMakingPlanService.insertElectricityBill(dto));
    }

    @GetMapping("viewBill")
    @ApiOperation("查询基本电费")
    @ApiImplicitParam(name = "year",value = "年份xxxx",dataType = "string")
    public ResultRespone viewElectricityBill(String year){
        return ResultRespone.success(waterMakingPlanService.viewElectricityBill(year));
    }
    @PostMapping("/insertWaterPlan")
    @ApiOperation("计划管理-填报水量计划")
    public ResultRespone insertWaterPlan(@RequestBody CostbgWaterDto dto){
        return ResultRespone.success(waterMakingPlanService.insertWaterPlan(dto));
    }

    @PutMapping("/updateWaterPlan")
    @ApiOperation("计划管理-修改水量计划")
    public ResultRespone updateWaterPlan(@RequestBody CostbgWaterDto dto){
        return ResultRespone.success(waterMakingPlanService.updateWaterPlan(dto));
    }

    @PutMapping("/updateIndexPlan")
    @ApiOperation("计划管理-修改指标计划")
    public ResultRespone updateIndexPlan(@RequestBody CostbgIndexDto dto){
        return ResultRespone.success(waterMakingPlanService.updateIndexPlan(dto));
    }

    @GetMapping("/getDosage")
    @ApiOperation("计划管理获取--获取制水用量")
    @ApiImplicitParam(name = "year",value = "年份xxxx",required = true,dataType = "string")
    public ResultRespone getDosage(String year){
        return ResultRespone.success(waterMakingPlanService.getDosage(year));
    }

    @PutMapping("/calculateWaterPlan")
    @ApiOperation("计算预算制水")
    public ResultRespone calculateWaterPlan(String year){
        return ResultRespone.success(waterMakingPlanService.calculateWaterPlan(year));
    }


}
