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.DisputedConditionDto;
import com.tofly.watermeter.custom.service.meterBusiness.DisputedService;
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("/disputed")
@Api(tags = "表务管理-争议检定改动接口")
@AllArgsConstructor
public class DisputedController {

    private final DisputedService disputedService;

    @GetMapping("/count")
    @ApiOperation("争议检定统计")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "dept", value = "部门", dataType = "list"),
            @ApiImplicitParam(name = "export", value = "0不导出1导出", required = true, dataType = "long"),
            @ApiImplicitParam(name = "start", value = "开始月份，yyyy-mm", dataType = "string"),
            @ApiImplicitParam(name = "end", value = "结束月份，yyyy-mm", dataType = "string")
    })
    public ResultRespone count(HttpServletResponse response, DisputedConditionDto dto) {
        return ResultRespone.success(disputedService.count(response, dto));
    }

    @GetMapping("/queryWorkInfo")
    @ApiOperation("查询工单信息")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "dept", value = "部门", dataType = "list"),
            @ApiImplicitParam(name = "export", value = "0 不导出 1 导出", required = true, dataType = "long"),
            @ApiImplicitParam(name = "start", value = "开始月份，yyyy-mm", dataType = "string"),
            @ApiImplicitParam(name = "end", value = "结束月份，yyyy-mm", dataType = "string"),
            @ApiImplicitParam(name = "state", value = "1 检验总数  2已检验数  3待检验数  4合格数  5未合格数", required = true, dataType = "long")
    })
    public ResultRespone queryWorkInfo(HttpServletResponse response,Page page,DisputedConditionDto dto){
        return ResultRespone.success(disputedService.queryWorkInfo(response, page, dto));
    }

    @GetMapping("/queryInfo")
    @ApiOperation("争议检定详情")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "gdbh", value = "工单编号" ,required = true, dataType = "string"),
    })
    public ResultRespone queryInfo(HttpServletResponse response, Page page, DisputedConditionDto dto) {
        return ResultRespone.success(disputedService.queryInfo(response, page, dto));
    }

}
