|
@@ -897,10 +897,11 @@ public class ArchiveAutoPdfServiceImpl implements IArchiveAutoPdfService {
|
|
|
Long id = SnowFlakeUtil.getId();
|
|
|
String localPdf = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL) + "/pdf/" + id + ".pdf";
|
|
|
String fileName = id + ".pdf";
|
|
|
+ OutputStream outputStream = null;
|
|
|
try {
|
|
|
//合并PDF
|
|
|
byte[] bytes = FileUtils.InputStreamToBytes(inputStream);
|
|
|
- OutputStream outputStream = new FileOutputStream(localPdf);
|
|
|
+ outputStream = new FileOutputStream(localPdf);
|
|
|
outputStream.write(bytes);
|
|
|
|
|
|
//设置PDF每页大小为A4,内容等比缩放,方向同步
|
|
@@ -910,9 +911,17 @@ public class ArchiveAutoPdfServiceImpl implements IArchiveAutoPdfService {
|
|
|
String absoluteFileName = FileUtils.getOssPath(OssConstant.ARCHIVE_DIRECTORY, fileName, projectId);
|
|
|
BladeFile file = newIOSSClient.uploadFile(absoluteFileName, localPdf);
|
|
|
url = file.getLink();
|
|
|
-
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
+ } finally {
|
|
|
+ try {
|
|
|
+ //关闭输出流
|
|
|
+ if (outputStream != null) {
|
|
|
+ outputStream.close();
|
|
|
+ }
|
|
|
+ } catch (IOException ex) {
|
|
|
+ ex.printStackTrace();
|
|
|
+ }
|
|
|
}
|
|
|
return url;
|
|
|
}
|