package com.zjrs.zwnw.dbgl.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.mohrss.leaf.core.framework.persistens.PageResult;
import org.mohrss.leaf.core.framework.web.controller.AjaxResponse;
import com.zjrs.zwnw.dbgl.bpo.CqcxBPO;
import com.zjrs.zwnw.dbgl.dto.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletResponse;

@Api("超期查询")
@RestController
@RequestMapping("/api/dbrwgl/cqcx")
public class CqcxController {

    private static final Logger logger = LoggerFactory.getLogger(CqcxController.class);

    @Resource
    private CqcxBPO cqcxBPO;

/*
超期查询列表	getCqcxList
超期查询导出  exportCqcx

*/
    /**
     * 超期查询列表
     * @param dto
     * @return
     */
    @ApiOperation(value = "超期查询列表", notes = "超期查询列表")
    @PostMapping(value = "/getCqcxList")
    public AjaxResponse getCqcxList(@RequestBody DbrwglCqcxQueryDTO dto){
        AjaxResponse ajaxResponse = new AjaxResponse();
        Integer pagenum = Math.toIntExact(dto.getPagenum());
        Integer pagesize = Math.toIntExact(dto.getPagesize());
        PageResult pageResult = cqcxBPO.getCqcxList(dto);
        ajaxResponse.setData("data", pageResult);
        ajaxResponse.setData("pagesize", pagesize);
        ajaxResponse.setData("pagenum", pagenum);
        return ajaxResponse;
    }
    /**
     * 超期查询导出
     * @param dto
     * @return
     */
    @ApiOperation(value = "导出督办任务进展查询列表", notes = "导出督办任务进展查询列表")
    @PostMapping(value = "/exportCqcx")
    public void exportCqcx(@RequestBody DbrwglCqcxQueryDTO dto, HttpServletResponse res) {
        cqcxBPO.exportCqcx(dto, res);
    }


}
