wangliang 4 tahun lalu
induk
melakukan
e73c72bbf1

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

@@ -182,9 +182,11 @@ public class TaskLogicServiceImpl implements TaskLogicService {
                         JSONArray jsonArrayOrdinary = JSONArray.parseArray(examPrintPlan.getOrdinaryContent());
                         for (int i = 0; i < jsonArrayOrdinary.size(); i++) {
                             JSONObject jsonObjectOrdinary = jsonArrayOrdinary.getJSONObject(i);
-                            Long attachmentId = Long.parseLong((String) jsonObjectOrdinary.get("attachmentId"));
-                            BasicAttachment basicAttachment = basicAttachmentService.getById(attachmentId);
-                            createPdfUtil.createCheckIn(basicAttachment, ordinaryPdfList, (Integer) jsonObjectOrdinary.get("backupCount"));
+                            if (Objects.nonNull(jsonObjectOrdinary.get("attachmentId"))) {
+                                Long attachmentId = Long.parseLong((String) jsonObjectOrdinary.get("attachmentId"));
+                                BasicAttachment basicAttachment = basicAttachmentService.getById(attachmentId);
+                                createPdfUtil.createCheckIn(basicAttachment, ordinaryPdfList, (Integer) jsonObjectOrdinary.get("backupCount"));
+                            }
                         }
                     }
 
@@ -262,13 +264,15 @@ public class TaskLogicServiceImpl implements TaskLogicService {
                                     for (int i = 0; i < jsonArrayVariable.size(); i++) {
                                         JSONObject jsonObjectVariable = jsonArrayVariable.getJSONObject(i);
                                         String type = (String) jsonObjectVariable.get("type");
-                                        Long attachmentId = Long.parseLong((String) jsonObjectVariable.get("attachmentId"));
-                                        BasicAttachment basicAttachment = basicAttachmentService.getById(attachmentId);
-                                        ftlList.add(commonService.getFile(basicAttachment.getPath(), false));
-                                        if (Objects.nonNull(type) && Objects.equals(type.toUpperCase(), "SIGN")) {//签到表
-                                            createPdfUtil.createSignBook(basicAttachment, basicSchool.getName(), examDetail, examDetailCourse, examStudentList, variablePdfList, (Integer) jsonObjectVariable.get("backupCount"));
-                                        } else if (Objects.nonNull(type) && Objects.equals(type.toUpperCase(), "PACKAGE")) {//卷袋贴
-                                            createPdfUtil.createPaperPackage(pdfDto.isTag(), basicAttachment, basicSchool.getName(), examDetail, examDetailCourse, examStudentList, variablePdfList, (Integer) jsonObjectVariable.get("backupCount"));
+                                        if (Objects.nonNull(jsonObjectVariable.get("attachmentId"))) {
+                                            Long attachmentId = Long.parseLong((String) jsonObjectVariable.get("attachmentId"));
+                                            BasicAttachment basicAttachment = basicAttachmentService.getById(attachmentId);
+                                            ftlList.add(commonService.getFile(basicAttachment.getPath(), false));
+                                            if (Objects.nonNull(type) && Objects.equals(type.toUpperCase(), "SIGN")) {//签到表
+                                                createPdfUtil.createSignBook(basicAttachment, basicSchool.getName(), examDetail, examDetailCourse, examStudentList, variablePdfList, (Integer) jsonObjectVariable.get("backupCount"));
+                                            } else if (Objects.nonNull(type) && Objects.equals(type.toUpperCase(), "PACKAGE")) {//卷袋贴
+                                                createPdfUtil.createPaperPackage(pdfDto.isTag(), basicAttachment, basicSchool.getName(), examDetail, examDetailCourse, examStudentList, variablePdfList, (Integer) jsonObjectVariable.get("backupCount"));
+                                            }
                                         }
                                     }
                                 }