package com.njcn.product.event.report.controller;

import com.njcn.common.pojo.annotation.OperateInfo;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.product.event.devcie.pojo.po.PqGdCompany;
import com.njcn.product.event.report.pojo.param.ReportExportParam;
import com.njcn.product.event.report.service.EasyPoiWordExportService;
import com.njcn.product.event.report.utils.WordTemplate;
import com.njcn.product.event.transientes.pojo.param.LargeScreenCountParam;
import com.njcn.product.event.transientes.pojo.po.PqsDepts;
import com.njcn.product.event.transientes.service.PqsDeptsService;
import com.njcn.product.event.config.RedisUtil;
import com.njcn.web.controller.BaseController;
import com.njcn.web.utils.HttpResultUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.HashMap;
import java.util.List;

/**
 * @Author: cdf
 * @CreateTime: 2025-09-23
 * @Description:
 */
@Api(tags = "报告导出")
@RequestMapping("report")
@RestController
@RequiredArgsConstructor
@Slf4j
public class EasyPoiWordExportController extends BaseController {

    private final EasyPoiWordExportService easyPoiWordExportService;

    @Autowired
    private PqsDeptsService pqsDeptsService;
    @OperateInfo
    @PostMapping("/get")
    @ApiOperation("")
    public void exportWordReport(HttpServletResponse response, @RequestBody ReportExportParam param) {
        String methodDescribe = getMethodDescribe("exportWordReport");
        try {
            easyPoiWordExportService.exportWordReport(response,param);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
       // return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
    }

    @OperateInfo
    @PostMapping("/getDept")
    public  HttpResult<List<PqsDepts>> getDept() {
        String methodDescribe = getMethodDescribe("getDept");
        List<PqsDepts> list = pqsDeptsService.lambdaQuery().eq(PqsDepts::getState, 1).list();
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
    }

}
