Selaa lähdekoodia

生成pdf不删除本地文件

wangliang 4 vuotta sitten
vanhempi
commit
b4bd579094

+ 2 - 2
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/BasicAttachmentServiceImpl.java

@@ -152,7 +152,7 @@ public class BasicAttachmentServiceImpl extends ServiceImpl<BasicAttachmentMappe
                 localFileList.add(new PdfDto(pdfFile.getPath(), PageSizeEnum.A3, pdfDto.getPageCount()));
                 fileMd5 = DigestUtils.md5Hex(new FileInputStream(pdfFile));
                 ossUtil.ossUpload(pdfDirName, pdfFile, BinaryUtil.toBase64String(HexUtils.decodeHex(fileMd5)));
-                localHtmlFile.delete();
+//                localHtmlFile.delete();
                 jsonObject.put(SystemConstant.PDF_PATH, pdfDirName);
             } else {//上传至服务器
                 File finalFile = new File(stringJoiner.toString());
@@ -307,7 +307,7 @@ public class BasicAttachmentServiceImpl extends ServiceImpl<BasicAttachmentMappe
             if (oss) {//上传至oss
                 pdfDto = PdfUtil.addPdfPage(pdfFile);
                 ossUtil.ossUpload(pdfDirName, pdfFile, BinaryUtil.toBase64String(HexUtils.decodeHex(pdfFileMd5)));
-                htmlFile.delete();
+//                htmlFile.delete();
             }
             JSONObject attachmentPath = JSONObject.parseObject(examDetail.getAttachmentPath());
             attachmentPath = Objects.isNull(attachmentPath) ? new JSONObject() : attachmentPath;

+ 1 - 1
distributed-print-business/src/main/java/com/qmth/distributed/print/business/templete/service/impl/TaskLogicServiceImpl.java

@@ -318,7 +318,7 @@ public class TaskLogicServiceImpl implements TaskLogicService {
             }
             map.computeIfAbsent("size", v -> examDetailList.size());
             //最后一步删除附件
-            createPdfUtil.deleteAttachment(attachmentIds, ftlList);
+//            createPdfUtil.deleteAttachment(attachmentIds, ftlList);
         } catch (Exception e) {
             log.error("请求出错", e);
             basicAttachmentService.batchDeleteAttachment(basicAttachmentList);

+ 1 - 1
distributed-print-business/src/main/java/com/qmth/distributed/print/business/util/CreatePdfUtil.java

@@ -483,7 +483,7 @@ public class CreatePdfUtil {
         examDetail.setStatus(PrintMethodEnum.AUTO == basicExamRule.getPrintMethod() ? ExamDetailStatusEnum.WAITING : ExamDetailStatusEnum.READY);
         detailService.saveOrUpdate(examDetail);
         ossUtil.ossUpload(dirName, localPdfFile, DigestUtils.md5Hex(new FileInputStream(localPdfFile)));
-        localPdfFile.delete();
+//        localPdfFile.delete();
 //        for (PdfDto pdfDto : mergePdfList) {
 //            new File(pdfDto.getPath()).delete();
 //        }

+ 1 - 1
distributed-print-business/src/main/java/com/qmth/distributed/print/business/util/FreemarkerUtil.java

@@ -124,7 +124,7 @@ public class FreemarkerUtil {
                 basicAttachment.setPath(jsonObject.toJSONString());
                 basicAttachmentService.saveAttachmentPdf(classifyEnum, examDetail, basicAttachment, (List<PdfDto>) dataMap.get("variablePdfList"), (Integer) dataMap.get("printCount"), (Integer) dataMap.get("sequence"));
             }
-            htmlFile.delete();
+//            htmlFile.delete();
         } catch (Exception e) {
             log.error("请求出错", e);
         } finally {