解决pdf下载压缩包文件损坏bug

master
jian.wang 2 years ago
parent 6a3dade53b
commit 9338ef2496

@ -1344,6 +1344,8 @@ public class TemplateSearchController {
while ((len = bis.read(buf, 0, buf.length)) != -1) {
bos.write(buf, 0, len);
}
bis.close(); // 及时关闭流,避免资源泄露
out.reset();
}
} catch (Exception e) {
ExceptionPrintUtil.printException(e);

@ -295,7 +295,7 @@ public class BatchExportServiceImpl implements BatchExportService {
public Boolean imageToPdf1(List<ExportDetailsVo> scanPathVos, ByteArrayOutputStream bos, EmrPdfWaterSet pdfWaterSet) {
//ByteArrayOutputStream bos = null;
FileOutputStream fileOutputStream = null;
//FileOutputStream fileOutputStream = null;
PdfWriter writer = null;
try {
//bos = new ByteArrayOutputStream();
@ -380,22 +380,20 @@ public class BatchExportServiceImpl implements BatchExportService {
e.printStackTrace();
return false;
} finally {
//try {
try {
if (writer != null) {
writer.close();
}
/*if (fileOutputStream != null) {
fileOutputStream.close();
}
}*/
if (bos != null) {
bos.flush();
bos.close();
}*/
/*} catch (IOException e) {
}
} catch (IOException e) {
e.printStackTrace();
}*/
}
}
return true;
}

Loading…
Cancel
Save