Kaynağa Gözat

Merge remote-tracking branch 'origin/dev_v3.3.1' into dev_v3.3.1

wangliang 1 yıl önce
ebeveyn
işleme
a4cc3e537c

+ 1 - 2
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/PrintCommonService.java

@@ -73,8 +73,7 @@ public interface PrintCommonService {
 
     BasicAttachment saveAttachmentPdfFromHtml(String fileName, String htmlContent, Long userId, List<PdfDto> localFileList, List<File> fileTempList) throws IOException;
 
-    BasicAttachment saveAttachmentPdfFromHtml(String fileName, File file, Long userId, List<PdfDto> localFileList, List<File> fileTempList)
-            throws IOException;
+    BasicAttachment saveAttachmentPdfFromHtml(String fileName, File file, Long userId, List<PdfDto> localFileList, List<File> fileTempList) throws IOException;
 
     /**
      * 保存html附件和该html转成pdf的附件

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

@@ -690,7 +690,7 @@ public class PrintCommonServiceImpl implements PrintCommonService {
             if (file != null) {
                 FileUtil.deleteFile(file);
             }
-            if (pdfFileTemp != null) {
+            if (fileTempList != null && pdfFileTemp != null) {
                 fileTempList.add(pdfFileTemp);
             }
         }

+ 4 - 3
distributed-print-business/src/main/java/com/qmth/distributed/print/business/templete/service/impl/PdfTaskLogicServiceImpl.java

@@ -129,7 +129,7 @@ public class PdfTaskLogicServiceImpl implements PdfTaskLogicService {
             // 更新文件路径、更新考场状态、印刷计划状态
             createPdfNewUtil.mergePdfSaveDb(dirNamePaper, dirNameCardA3, tbTaskPdf);
             // 生成A4文件
-            createA4File(tbTaskPdf, examDetailCourseList);
+            createA4File(tbTaskPdf, examDetailCourseList, createPdfDto.getFileTempList());
             long endTime = System.currentTimeMillis();
             addSummary(stringJoinerSummary, "pdf文件生成成功,共处理" + examDetail.getTotalSubjects() + "科次。耗时:" + (endTime - startTime) / 1000 + "秒");
         } catch (Exception e) {
@@ -350,10 +350,11 @@ public class PdfTaskLogicServiceImpl implements PdfTaskLogicService {
      *
      * @param tbTaskPdf
      * @param examDetailCourseList
+     * @param fileTempList
      * @throws Exception
      */
     @Transactional
-    public void createA4File(TBTaskPdf tbTaskPdf, List<ExamDetailCourse> examDetailCourseList) throws Exception {
+    public void createA4File(TBTaskPdf tbTaskPdf, List<ExamDetailCourse> examDetailCourseList, List<File> fileTempList) throws Exception {
         CreatePdfTypeEnum createPdfType = tbTaskPdf.getCreateType();
         ExamPrintPlan examPrintPlan = examPrintPlanService.getById(tbTaskPdf.getPrintPlanId());
         ExamDetail examDetail = examDetailService.getById(tbTaskPdf.getId());
@@ -368,7 +369,7 @@ public class PdfTaskLogicServiceImpl implements PdfTaskLogicService {
                 if (Objects.nonNull(jsonObjectOrdinary.get("attachmentId")) && !Objects.equals("", jsonObjectOrdinary.get("attachmentId"))) {
                     Long attachmentId = Long.parseLong((String) jsonObjectOrdinary.get("attachmentId"));
                     BasicAttachment basicAttachment = basicAttachmentService.getById(attachmentId);
-                    createPdfNewUtil.createCheckIn(examDetail, basicAttachment, (Integer) jsonObjectOrdinary.get("backupCount"));
+                    createPdfNewUtil.createCheckIn(examDetail, basicAttachment, (Integer) jsonObjectOrdinary.get("backupCount"), fileTempList);
                 }
             }
         }

+ 4 - 3
distributed-print-business/src/main/java/com/qmth/distributed/print/business/util/pdf/CreatePdfNewUtil.java

@@ -88,9 +88,10 @@ public class CreatePdfNewUtil {
      * @param examDetail
      * @param basicAttachment
      * @param printCount
+     * @param fileTempList
      * @throws Exception
      */
-    public void createCheckIn(ExamDetail examDetail, BasicAttachment basicAttachment, Integer printCount) throws Exception {
+    public void createCheckIn(ExamDetail examDetail, BasicAttachment basicAttachment, Integer printCount, List<File> fileTempList) throws Exception {
         Optional.ofNullable(basicAttachment).orElseThrow(() -> ExceptionResultEnum.ATTACHMENT_IS_NULL.exception());
 
         String type = basicAttachment.getType();
@@ -106,8 +107,8 @@ public class CreatePdfNewUtil {
 //            }
         } else {
             File htmlFileTemp = SystemConstant.getFileTempVar(SystemConstant.HTML_PREFIX);
-            File file = fileUploadService.downloadFile(basicAttachment.getId(), htmlFileTemp.getPath());
-            BasicAttachment attachment = printCommonService.saveAttachmentPdfFromHtml(String.valueOf(basicAttachment.getId()), file, examDetail.getCreateId(), null, null);
+            fileUploadService.downloadFile(basicAttachment.getId(), htmlFileTemp.getPath());
+            BasicAttachment attachment = printCommonService.saveAttachmentPdfFromHtml(String.valueOf(basicAttachment.getId()), htmlFileTemp, examDetail.getCreateId(), null, fileTempList);
             FilePathVo filePathVo1 = JSON.parseObject(attachment.getPath(), FilePathVo.class);
             PrintPathVo printPathVo = new PrintPathVo(ClassifyEnum.CHECK_IN, filePathVo1.getUploadType(), filePathVo1.getType(), filePathVo1.getPath(), attachment.getMd5(), null, null);
             examDetail.setAttachmentPath(printCommonService.parseAttachmentPath(examDetail.getAttachmentPath(), printPathVo));