wangliang 4 tahun lalu
induk
melakukan
0393df315d

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

@@ -237,12 +237,6 @@ public class TaskLogicServiceImpl implements TaskLogicService {
                             String paperType = Objects.nonNull(paperTypeParam) ? paperTypeParam : createPdfUtil.getPaperType(examPrintPlan, examTaskDetail, examDetail, examDetailCourse);
                             examTaskDetail.setRelatePaperType(paperType);
 
-                            //获取试卷pdf
-                            PdfDto pdfDto = createPdfUtil.getPaperPdf(paperType, examTaskDetail, examPrintPlan.getBackupCount(), paperPdfTempList, backupPaperTempPdfList);
-                            examDetailCourse.setPaperPagesA3(Objects.nonNull(pdfDto) ? pdfDto.getPageCount() : examDetailCourse.getPaperPagesA3());
-                            paperPdfList.addAll(paperPdfTempList);
-                            backupPaperPdfList.addAll(backupPaperTempPdfList);
-
                             basicAttachmentList = Objects.isNull(basicAttachmentList) ? basicAttachmentList = new ArrayList<>() : basicAttachmentList;
                             for (ExamCardDetail examCardDetail : examCardDetailList) {
                                 createPdfUtil.getCardAttachmentId(examCardDetail, attachmentIds);
@@ -251,7 +245,15 @@ public class TaskLogicServiceImpl implements TaskLogicService {
                                 String cardContent = createPdfUtil.replaceHtmlTemplete(examCardDetail);
                                 String studentContent = cardContent;
 
+                                PdfDto pdfDto = null;
                                 for (int i = 1; i <= examPrintPlan.getBackupCount(); i++) {
+                                    //获取试卷pdf
+                                    pdfDto = createPdfUtil.getPaperPdf(paperType, examTaskDetail, examPrintPlan.getBackupCount(), paperPdfTempList, backupPaperTempPdfList);
+                                    examDetailCourse.setPaperPagesA3(Objects.nonNull(pdfDto) ? pdfDto.getPageCount() : examDetailCourse.getPaperPagesA3());
+                                    paperPdfList.addAll(paperPdfTempList);
+                                    backupPaperPdfList.addAll(backupPaperTempPdfList);
+
+                                    //获取题卡
                                     BasicAttachment basicAttachment = createPdfUtil.cardHtml(String.format("%02d", i), cardContent, paperType, examDetail, examDetailCourse, examCard, jsonArray, sysUser.getId(), cardPdfTempList);
                                     examDetailCourse.setCardPagesA3(basicAttachment.getPages());
                                     basicAttachmentList.add(basicAttachment);
@@ -662,7 +664,7 @@ public class TaskLogicServiceImpl implements TaskLogicService {
 
             // 处理试卷样品
             List<Map> paperInfo = JSONObject.parseArray(examTaskDetail.getPaperAttachmentIds(), Map.class);
-            if (Objects.isNull(paperInfo)){
+            if (Objects.isNull(paperInfo)) {
                 throw ExceptionResultEnum.ERROR.exception("试卷信息不存在");
             }
             System.out.println("paperInfo = " + JSON.toJSONString(paperInfo));
@@ -746,7 +748,7 @@ public class TaskLogicServiceImpl implements TaskLogicService {
                 }
                 FileCopyUtils.copy(bytes, localFile);
             }
-            count ++;
+            count++;
         }
         ZipUtil.zip(zipLocalRootPath, zipFile.getPath(), true);
         ossUtil.ossUpload(dirNameTmp, zipFile, BinaryUtil.toBase64String(HexUtils.decodeHex(DigestUtils.md5Hex(new FileInputStream(zipFile)))));