ExportDisbursementTotalVO exportDisbursementTotalVO = projectFundsService.exportDisbursementTotal(projectId);
if (exportDisbursementTotalVO != null) {
ServletOutputStream out = null;
try {
out = response.getOutputStream();
ExcelWriterBuilder excelWriterBuilder = new ExcelWriterBuilder();
excelWriterBuilder.excelType(ExcelTypeEnum.XLSX);
excelWriterBuilder.file(out);
excelWriterBuilder.autoCloseStream(true);
ExcelWriter writer = excelWriterBuilder.build();
WriteSheet writeSheet = excelWriterBuilder.sheet().build();
writeSheet.setNeedHead(true);
writeSheet.setHead(exportDisbursementTotalVO.getHeadList());
String fileName = "预算支出合计信息";
writer.write(exportDisbursementTotalVO.getDisbursementTotalMapList(), writeSheet);
response.setHeader("Content-Disposition", "attachment;filename=" + DownloadUtil.getCodedFileName(request, fileName + ".xlsx"));
writer.finish();
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
if (out != null) {
out.close();
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
异常提示 [com.alibaba.excel.ExcelWriter] ExcelWriter.java:342 - [] - Destroy object failed com.alibaba.excel.exception.ExcelGenerateException: Can not close IO. at com.alibaba.excel.context.WriteContextImpl.finish(WriteContextImpl.java:378) at com.alibaba.excel.write.ExcelBuilderImpl.finish(ExcelBuilderImpl.java:95) at com.alibaba.excel.ExcelWriter.finish(ExcelWriter.java:329) at com.alibaba.excel.ExcelWriter.finalize(ExcelWriter.java:340) at java.lang.System$2.invokeFinalize(System.java:1270) at java.lang.ref.Finalizer.runFinalizer(Finalizer.java:102) at java.lang.ref.Finalizer.access$100(Finalizer.java:34) at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:217) Caused by: java.lang.NullPointerException: null at org.apache.coyote.http11.Http11OutputBuffer$SocketOutputBuffer.doWrite(Http11OutputBuffer.java:530) at org.apache.coyote.http11.filters.IdentityOutputFilter.doWrite(IdentityOutputFilter.java:73) at org.apache.coyote.http11.Http11OutputBuffer.doWrite(Http11OutputBuffer.java:189) at org.apache.coyote.Response.doWrite(Response.java:599) at org.apache.catalina.connector.OutputBuffer.realWriteBytes(OutputBuffer.java:329) at org.apache.catalina.connector.OutputBuffer.flushByteBuffer(OutputBuffer.java:766) at org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:288) at org.apache.catalina.connector.OutputBuffer.close(OutputBuffer.java:241) at org.apache.catalina.connector.CoyoteOutputStream.close(CoyoteOutputStream.java:157) at com.alibaba.excel.context.WriteContextImpl.finish(WriteContextImpl.java:356) ... 7 common frames omitted [Finalizer] WARN [com.alibaba.excel.ExcelWriter] ExcelWriter.java:342 - [] - Destroy object failed com.alibaba.excel.exception.ExcelGenerateException: Can not close IO. at com.alibaba.excel.context.WriteContextImpl.finish(WriteContextImpl.java:378) at com.alibaba.excel.write.ExcelBuilderImpl.finish(ExcelBuilderImpl.java:95) at com.alibaba.excel.ExcelWriter.finish(ExcelWriter.java:329) at com.alibaba.excel.ExcelWriter.finalize(ExcelWriter.java:340) at java.lang.System$2.invokeFinalize(System.java:1270) at java.lang.ref.Finalizer.runFinalizer(Finalizer.java:102) at java.lang.ref.Finalizer.access$100(Finalizer.java:34) at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:217) 并且,下载到了一个zip包:
建议描述