|
|
@@ -17,7 +17,6 @@ import org.springframework.stereotype.Component;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
-import java.io.ByteArrayOutputStream;
|
|
|
import java.io.IOException;
|
|
|
import java.io.InputStream;
|
|
|
import java.io.OutputStream;
|
|
|
@@ -70,12 +69,10 @@ public class ExcelUtils2 implements ResourceLoaderAware {
|
|
|
excelWriter.fill(data, writeSheet);
|
|
|
}
|
|
|
long t5 = System.currentTimeMillis();
|
|
|
- /* long size = getExportFileSize(template,list);
|
|
|
- logger.info("getExportFileSize==="+size);*/
|
|
|
excelWriter.finish();
|
|
|
outputStream.flush();
|
|
|
logger.info("excelWriter time:" + (t5- t4));
|
|
|
- } catch (Exception e) {
|
|
|
+ } catch (IOException e) {
|
|
|
e.printStackTrace();
|
|
|
throw new RuntimeException(e);
|
|
|
} finally {
|
|
|
@@ -88,16 +85,6 @@ public class ExcelUtils2 implements ResourceLoaderAware {
|
|
|
logger.info("export time:" + (System.currentTimeMillis() - begin));
|
|
|
}
|
|
|
|
|
|
- private static long getExportFileSize( Resource template,List<?> list) throws Exception{
|
|
|
- InputStream is = template.getInputStream();
|
|
|
- ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
|
|
|
- ExcelWriter excelWriter = EasyExcel.write(byteArrayOutputStream).withTemplate(is).build();
|
|
|
- WriteSheet writeSheet = EasyExcel.writerSheet().build();
|
|
|
- excelWriter.write(list,writeSheet);
|
|
|
- excelWriter.finish();
|
|
|
- return byteArrayOutputStream.size();
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* 实体模型导出
|
|
|
* @param response 响应类
|