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.DbrwjzcxBPO;
import com.zjrs.zwnw.dbgl.dto.DbrwglDbrwQueryDTO;
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;
import jakarta.validation.Valid;

/**
 * @author dagou
 * @date 2022/11/24 18:09
 **/
@Api("督办任务跟踪")
@RestController
@RequestMapping("/api/dbrwgl/dbrwjzcx")
public class DbrwjzcxController {
    private static final Logger logger = LoggerFactory.getLogger(DbrwjzcxController.class);

    @Resource
    private DbrwjzcxBPO dbrwjzcxBPO;

    /**
     * 督办任务进展查询列表
     * @param dto
     * @return
     */
    @ApiOperation(value = "督办任务进展查询列表", notes = "督办任务进展查询列表")
    @PostMapping(value = "/getDbrwjzcxList")
    public AjaxResponse getDbrwtbList(@RequestBody @Valid DbrwglDbrwQueryDTO dto){
        AjaxResponse ajaxResponse = new AjaxResponse();

        Integer pagenum = Math.toIntExact(dto.getPagenum());
        Integer pagesize = Math.toIntExact(dto.getPagesize());
        PageResult pageResult = dbrwjzcxBPO.getDbrwjzcxList(dto, pagenum, pagesize);
        ajaxResponse.setData("data", pageResult);
        ajaxResponse.setData("pagesize", pagesize);
        ajaxResponse.setData("pagenum", pagenum);
        return ajaxResponse;
    }

    /**
     * 督办任务进展查询列表
     * @param dto
     * @return
     */
    @ApiOperation(value = "导出督办任务进展查询列表", notes = "导出督办任务进展查询列表")
    @PostMapping(value = "/exportDbrwjzcxList")
    public void exportDbrwjzcxList(@RequestBody DbrwglDbrwQueryDTO dto, HttpServletResponse res) {
        dbrwjzcxBPO.exportDbrwjzcxList(dto, res);
    }
}
