From 8af7659bcec8bd887ce01d64d23336d9b8aa6c98 Mon Sep 17 00:00:00 2001 From: taojinlong Date: Thu, 9 May 2024 11:56:48 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=AF=BC=E5=87=BA=E4=B8=AD=E5=BF=83?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E5=A4=A7=E5=B0=8F=E6=98=BE=E7=A4=BA=E9=94=99?= =?UTF-8?q?=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/exportCenter/ExportCenterService.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/core/backend/src/main/java/io/dataease/service/exportCenter/ExportCenterService.java b/core/backend/src/main/java/io/dataease/service/exportCenter/ExportCenterService.java index 8e1874d216..fef077f5e7 100644 --- a/core/backend/src/main/java/io/dataease/service/exportCenter/ExportCenterService.java +++ b/core/backend/src/main/java/io/dataease/service/exportCenter/ExportCenterService.java @@ -294,7 +294,7 @@ public class ExportCenterService { // with DataType if ((excelTypes[j].equals(DeTypeConstants.DE_INT) || excelTypes[j].equals(DeTypeConstants.DE_FLOAT)) && rowData[j] != null) { cell.setCellValue(Double.valueOf(rowData[j].toString())); - } else if(rowData[j] != null){ + } else if (rowData[j] != null) { cell.setCellValue(String.valueOf(rowData[j])); } } catch (Exception e) { @@ -501,7 +501,7 @@ public class ExportCenterService { // with DataType if ((excelTypes[j].equals(DeTypeConstants.DE_INT) || excelTypes[j].equals(DeTypeConstants.DE_FLOAT)) && StringUtils.isNotEmpty(cellValObj.toString())) { cell.setCellValue(Double.valueOf(cellValObj.toString())); - } else if(cellValObj != null){ + } else if (cellValObj != null) { cell.setCellValue(cellValObj.toString()); } } catch (Exception e) { @@ -533,6 +533,7 @@ public class ExportCenterService { try (FileOutputStream outputStream = new FileOutputStream(dataPath + "/" + request.getViewName() + ".xlsx")) { wb.write(outputStream); + outputStream.flush(); } wb.close(); @@ -546,7 +547,7 @@ public class ExportCenterService { exportTask.setExportPogress("100"); exportTask.setExportStatus("SUCCESS"); - setFileSize(dataPath + "/" + dataPath + "/" + request.getViewName() + ".xlsx", exportTask); + setFileSize(dataPath + "/" + request.getViewName() + ".xlsx", exportTask); } catch (Exception e) { LogUtil.error("Failed to export data", e); exportTask.setExportStatus("FAILED"); @@ -754,6 +755,7 @@ public class ExportCenterService { exportTaskMapper.updateByPrimaryKey(exportTask); } wb.write(fileOutputStream); + fileOutputStream.flush(); fileOutputStream.close(); wb.close(); }