package com.tofly.xrtygis.custom.controller;

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

/**
 * 自定义实际水量
 *制水成本
 * @author 陈浩
 * @date 2021-3-23
 */
@AllArgsConstructor
@RestController
@RequestMapping("customWater")
@Api(tags = "实际管理-制水指标")
public class CustomWaterController {

    private final CustomWaterService customWaterService;

    @PostMapping("/insertWater")
    @ApiOperation("填报制水指标")
    public ResultRespone insertWater(Costrlwater water) {
        return ResultRespone.success(customWaterService.insertWater(water));
    }

    @DeleteMapping("/deleteWater")
    @ApiOperation("删除制水指标")
    @ApiImplicitParams(
            @ApiImplicitParam(name = "id", value = "多个id以‘,’分隔", required = true, dataType = "string")
    )
    public ResultRespone deleteWater(String id) {
        return ResultRespone.success(customWaterService.deleteWater(id));
    }

    @PutMapping("/updateWater")
    @ApiOperation("修改制水指标")
    public ResultRespone updateWater(@RequestBody Costrlwater costrlwater) {
        return ResultRespone.success(customWaterService.updateWater(costrlwater));
    }

    @GetMapping("/waterTotal")
    @ApiOperation("获取实际值、预算值、财务填报,每日填报值")
    @ApiImplicitParams(
            @ApiImplicitParam(name = "month", value = "月份（xxxx-xx）", required = true, dataType = "string")
    )
    public ResultRespone waterTotal(String month){
        return ResultRespone.success(customWaterService.waterTotal(month));
    }

}
