package com.zjrs.zwnw.dbgl.controller;

import com.zjrs.zwnw.portal.bpo.CommonBPO;
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.DbrwcxBPO;
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;

@Api("督办任务跟踪")
@RestController
@RequestMapping("/api/dbrwgl/dbrwcx")
public class DbrwcxController {

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

    @Resource
    private DbrwcxBPO dbrwcxBPO;
    @Resource
    private CommonBPO commBPO;

    @ApiOperation(value = "督办任务查询列表", notes = "督办任务查询列表")
    @PostMapping(value = "/getDbrwcxList")
    public AjaxResponse getDbrwcxList(@RequestBody @Valid DbrwglDbrwQueryDTO dto){
        AjaxResponse ajaxResponse = new AjaxResponse();
        Integer pagenum = Math.toIntExact(dto.getPagenum());
        Integer pagesize = Math.toIntExact(dto.getPagesize());
        PageResult pageResult = dbrwcxBPO.getDbrwList(dto, pagenum, pagesize);
        ajaxResponse.setData("data", pageResult);
        ajaxResponse.setData("pagesize", pagesize);
        ajaxResponse.setData("pagenum", pagenum);
        return ajaxResponse;
    }

    @ApiOperation(value = "督办任务查询导出", notes = "督办任务查询导出")
    @PostMapping(value = "/exportDbrwcxList")
    public void exportDbrwcxList(@RequestBody DbrwglDbrwQueryDTO dto, HttpServletResponse res){
        dbrwcxBPO.exportDbrwcxList(dto, res);
    }

}
