package com.tofly.watermeter.custom.controller.meterBusiness;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.tofly.common.core.entity.ResultRespone;
import com.tofly.watermeter.custom.entity.meterBusiness.dto.StatementConditionDto;
import com.tofly.watermeter.custom.service.meterBusiness.StatementService;
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;

@RestController
@AllArgsConstructor
@RequestMapping("/statement")
@Api(tags = "表务管理--报表统计接口")
public class StatementController {

    private final StatementService statementService;

    @GetMapping("/count")
    @ApiOperation("第一层-厂家统计情况")
    @ApiImplicitParam(name = "export",value = "0 不导出 1 导出",required = true,dataType = "long")
    public ResultRespone count(HttpServletResponse response, StatementConditionDto dto){
        return ResultRespone.success(statementService.count(response, dto));
    }

    @GetMapping("/queryByVendor")
    @ApiOperation("第二层-口径类型统计情况")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "export",value = "0 不导出 1 导出",required = true,dataType = "long"),
            @ApiImplicitParam(name = "state",value = "0 入库 1 出库 2 剩余",required = true,dataType = "long"),
            @ApiImplicitParam(name = "vendor",value = "厂家，非合计带上厂家",dataType = "list")
    })
    public ResultRespone queryByVendor(HttpServletResponse response, Page page, StatementConditionDto dto){
        return ResultRespone.success(statementService.queryByVendor(response, page, dto));
    }

    @GetMapping("/queryInfo")
    @ApiOperation("第三层-详情")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "export",value = "0 不导出 1 导出",required = true,dataType = "long"),
            @ApiImplicitParam(name = "state",value = "0 入库 1 出库 2 剩余",required = true,dataType = "long"),
            @ApiImplicitParam(name = "type",value = "水表类型",required = true,dataType = "long"),
            @ApiImplicitParam(name = "vendor",value = "厂家，非合计带上厂家",dataType = "list"),
            @ApiImplicitParam(name = "cal",value = "口径，非合计带上口径",dataType = "list")
    })
    public ResultRespone queryInfo(HttpServletResponse response, Page page, StatementConditionDto dto){
        return ResultRespone.success(statementService.queryInfo(response, page, dto));
    }

}
