|
|
@@ -9,6 +9,7 @@ import cn.afterturn.easypoi.excel.entity.result.ExcelImportResult;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.dk.common.exception.BaseBusinessException;
|
|
|
import com.dk.common.response.ResponseCodeEnum;
|
|
|
+import com.dk.common.response.ResponseResultUtil;
|
|
|
import io.swagger.models.auth.In;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.apache.poi.hssf.usermodel.DVConstraint;
|
|
|
@@ -20,6 +21,7 @@ import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
import java.io.File;
|
|
|
+import java.io.FileOutputStream;
|
|
|
import java.io.IOException;
|
|
|
import java.net.URLEncoder;
|
|
|
import java.util.*;
|
|
|
@@ -38,12 +40,23 @@ public class ExcelUtils {
|
|
|
defaultExport(list, fileName, response);
|
|
|
}
|
|
|
|
|
|
+ public static Workbook exportExcelUrl(List<?> list, String title, String sheetName, Class<?> pojoClass,String fileName, HttpServletResponse response){
|
|
|
+ Workbook workbook = defaultExportUrl(list, pojoClass, fileName, response, new ExportParams(title, sheetName));
|
|
|
+ return workbook;
|
|
|
+ }
|
|
|
+
|
|
|
private static void defaultExport(List<?> list, Class<?> pojoClass, String fileName, HttpServletResponse response, ExportParams exportParams) {
|
|
|
Workbook workbook = ExcelExportUtil.exportExcel(exportParams,pojoClass,list);
|
|
|
if (workbook != null);
|
|
|
downLoadExcel(fileName, response, workbook);
|
|
|
}
|
|
|
|
|
|
+ private static Workbook defaultExportUrl(List<?> list, Class<?> pojoClass, String fileName, HttpServletResponse response, ExportParams exportParams) {
|
|
|
+ Workbook workbook = ExcelExportUtil.exportExcel(exportParams,pojoClass,list);
|
|
|
+ if (workbook != null);
|
|
|
+ return workbook;
|
|
|
+ }
|
|
|
+
|
|
|
public static void exportExcel(List<Map<String, Object>> list, String fileName){
|
|
|
// Workbook workbook = ExcelExportUtil.exportExcel(list, ExcelType.HSSF);
|
|
|
}
|