package com.dsk.search.controller;

import com.alibaba.fastjson2.JSONObject;
import com.dsk.common.core.domain.AjaxResult;
import com.dsk.common.utils.poi.ExcelUtil;
import com.dsk.jsk.domain.bo.ComposeQueryDto;
import com.dsk.search.service.BusinessOpportunityRadarService;
import com.dsk.search.service.ExportService;
import com.dsk.system.domain.vo.AptitudeVo;
import com.dsk.system.domain.vo.SysUserImportVo;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.List;


/**
 * 查企业
 * @author lc
 * @ClassName ExportController
 * @Date 2023/12/06 16:40
 */
@RequestMapping("/export")
@RestController
public class ExportController {


    @Resource
    private ExportService exportService;

    /**
     * 获取导入模板
     */
    @PostMapping("/aptitude/importTemplate")
    public void importTemplate(HttpServletResponse response) {
        List<Object> list = new ArrayList<>();
        AptitudeVo aptitudeVo = new AptitudeVo();
        aptitudeVo.setCompanyName("重庆市轨道交通（集团）有限公司");
        list.add(aptitudeVo);
        ExcelUtil.exportTemplate(list, "企业数据", "excel/userImportTemplate.xlsx", response);
    }

    /*
     * 批量资质导出
     */
    @RequestMapping("/aptitude/file")
    public AjaxResult aptitudeFile(@RequestPart("file") MultipartFile file) throws Exception {
        return exportService.aptitudeFile(file);
    }

}
