|
@@ -143,7 +143,6 @@ public class PrintCommonServiceServiceImpl implements PrintCommonService {
|
|
|
@Override
|
|
|
@Transactional
|
|
|
public BasicAttachment saveAttachmentPdf(ClassifyEnum classifyEnum, ExamDetail examDetail, BasicAttachment basicAttachment, List<PdfDto> pdfList, Integer printCount, Integer sequence) throws IOException, DocumentException {
|
|
|
- InputStream inputStream = null;
|
|
|
try {
|
|
|
boolean oss = dictionaryConfig.sysDomain().isOss();
|
|
|
JSONObject jsonObject = JSONObject.parseObject(basicAttachment.getPath());
|
|
@@ -185,13 +184,12 @@ public class PrintCommonServiceServiceImpl implements PrintCommonService {
|
|
|
HtmlToPdfUtil.convert(htmlFile.getPath(), destUrl, PageSizeEnum.A4);
|
|
|
// File pdfFile = asposePdfUtil.documentToPdf(htmlFile.getPath(), destUrl, PaperSize.A4);
|
|
|
String htmlFileMd5 = DigestUtils.md5Hex(new FileInputStream(htmlFile));
|
|
|
- inputStream = new FileInputStream(pdfFile);
|
|
|
- String pdfFileMd5 = DigestUtils.md5Hex(inputStream);
|
|
|
+ String pdfFileMd5 = DigestUtils.md5Hex(new FileInputStream(pdfFile));
|
|
|
PdfDto pdfDto = null;
|
|
|
if (oss) {//上传至oss
|
|
|
pdfDto = PdfUtil.addPdfPage(pdfFile);
|
|
|
// ossUtil.ossUpload(pdfDirNameStr, pdfFile, BinaryUtil.toBase64String(HexUtils.decodeHex(pdfFileMd5)));
|
|
|
- fileStoreUtil.ossUpload(pdfDirNameStr, inputStream, BinaryUtil.toBase64String(HexUtils.decodeHex(pdfFileMd5)), fileStoreUtil.getUploadEnumByPath(pdfDirNameStr).getFssType());
|
|
|
+ fileStoreUtil.ossUpload(pdfDirNameStr, pdfFile, BinaryUtil.toBase64String(HexUtils.decodeHex(pdfFileMd5)), fileStoreUtil.getUploadEnumByPath(pdfDirNameStr).getFssType());
|
|
|
// htmlFile.delete();
|
|
|
}
|
|
|
JSONObject attachmentPath = JSONObject.parseObject(examDetail.getAttachmentPath());
|
|
@@ -223,10 +221,6 @@ public class PrintCommonServiceServiceImpl implements PrintCommonService {
|
|
|
} else {
|
|
|
ResultUtil.error(e.getMessage());
|
|
|
}
|
|
|
- } finally {
|
|
|
- if (Objects.nonNull(inputStream)) {
|
|
|
- inputStream.close();
|
|
|
- }
|
|
|
}
|
|
|
return basicAttachment;
|
|
|
}
|