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.NewInstallDto;
import com.tofly.watermeter.custom.service.meterBusiness.NewInstallService;
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
@Api(tags = "表务-统计查询-新装统计")
@RequestMapping("/newInstall")
public class NewInstallController {

    private final NewInstallService newInstallService;

    @GetMapping("/count")
    @ApiOperation("第一层-新装统计")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "dept", value = "部门", dataType = "List<Long>"),
            @ApiImplicitParam(name = "vendor", value = "厂家", dataType = "List<Long>"),
            @ApiImplicitParam(name = "cal", value = "口径", dataType = "List<Long>"),
            @ApiImplicitParam(name = "type", value = "类型", dataType = "List<Long>"),
            @ApiImplicitParam(name = "export", value = "0 不导出 1 导出", required = true, dataType = "Long"),
            @ApiImplicitParam(name = "start", value = "开始日期", required = true, dataType = "string"),
            @ApiImplicitParam(name = "end", value = "结束日期", required = true, dataType = "string")
    })
    public ResultRespone count(HttpServletResponse response, NewInstallDto dto) {
        return ResultRespone.success(newInstallService.count(response, dto));
    }

    @GetMapping("/countByDept")
    @ApiOperation("第二层-口径汇总统计")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "dept", value = "部门", dataType = "List<Long>"),
            @ApiImplicitParam(name = "vendor", value = "厂家", dataType = "List<Long>"),
            @ApiImplicitParam(name = "cal", value = "口径", dataType = "List<Long>"),
            @ApiImplicitParam(name = "type", value = "类型", dataType = "List<Long>"),
            @ApiImplicitParam(name = "export", value = "0 不导出 1 导出", required = true, dataType = "Long"),
            @ApiImplicitParam(name = "start", value = "开始日期", required = true, dataType = "string"),
            @ApiImplicitParam(name = "end", value = "结束日期", required = true, dataType = "string")
    })
    public ResultRespone countByDept(HttpServletResponse response, Page page,NewInstallDto dto){
        return ResultRespone.success(newInstallService.countByDept(response, page, dto));
    }

    @GetMapping("/queryInfo")
    @ApiOperation("第三层-新装详情")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "dept", value = "部门", dataType = "List<Long>"),
            @ApiImplicitParam(name = "vendor", value = "厂家", dataType = "List<Long>"),
            @ApiImplicitParam(name = "cal", value = "口径", dataType = "List<Long>"),
            @ApiImplicitParam(name = "type", value = "类型", dataType = "List<Long>"),
            @ApiImplicitParam(name = "export", value = "0 不导出 1 导出", required = true, dataType = "Long"),
            @ApiImplicitParam(name = "start", value = "开始日期", required = true, dataType = "string"),
            @ApiImplicitParam(name = "end", value = "结束日期", required = true, dataType = "string")
    })
    public ResultRespone queryInfo(HttpServletResponse response, Page page, NewInstallDto dto){
        return ResultRespone.success(newInstallService.queryInfo(response, page, dto));
    }

}
