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.WeekConditionDto;
import com.tofly.watermeter.custom.service.meterBusiness.WeeklyInspectionService;
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
@RequestMapping("/weeksToPickUp")
@Api(tags = "表务管理-水表周检")
@AllArgsConstructor
public class WeeklyInspectionController {

    private final WeeklyInspectionService weeklyInspectionService;

    @GetMapping("/count")
    @ApiOperation("周检统计")
    @ApiImplicitParams({
            @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"),
            @ApiImplicitParam(name = "month", value = "提前到期月份（传负数）",dataType = "long")
    })
    public ResultRespone count(HttpServletResponse response, WeekConditionDto dto) {
        return ResultRespone.success(weeklyInspectionService.count(response, dto));
    }

    @GetMapping("/queryInfo")
    @ApiOperation("周检详情")
    @ApiImplicitParams({
            @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"),
            @ApiImplicitParam(name = "month", value = "提前到期月份（传负数）",dataType = "long")
    })
    public ResultRespone queryInfo(HttpServletResponse response, Page page, WeekConditionDto dto){
        return ResultRespone.success(weeklyInspectionService.queryInfo(response, page, dto));
    }
}
