Răsfoiți Sursa

Merge branch 'dev' of http://git.qmth.com.cn/wangliang/distributed-print-service into dev

xiaof 4 ani în urmă
părinte
comite
9ee8cc03fa

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

@@ -295,7 +295,7 @@ public class TaskLogicServiceImpl implements TaskLogicService {
                                     if (Objects.nonNull(pdfDto)) {
                                         createPdfUtil.getExamStudentPaperPdf(paperPdfDto, paperPdfTempList);
                                     }
-                                    basicAttachmentList.add(createPdfUtil.examStudentHtml(attachmentIds, studentContent, t, paperType, examCard, sysUser.getId(), examStudentTempPdfList));
+                                    basicAttachmentList.add(createPdfUtil.examStudentHtml(attachmentIds, studentContent, t, examDetail, examDetailCourse, sysUser.getId(), examStudentTempPdfList));
                                 }
                                 paperPdfList.addAll(paperPdfTempList);
                                 examStudentPdfList.addAll(examStudentTempPdfList);

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

@@ -527,14 +527,14 @@ public class CreatePdfUtil {
      * @param attachmentIds
      * @param studentContent
      * @param t
-     * @param paperType
-     * @param examCard
+     * @param examDetail
+     * @param examDetailCourse
      * @param userId
      * @param examStudentPdfList
      * @return
      * @throws IOException
      */
-    public BasicAttachment examStudentHtml(Set<Long> attachmentIds, String studentContent, ExamStudent t, String paperType, ExamCard examCard, Long userId, List<PdfDto> examStudentPdfList) throws IOException {
+    public BasicAttachment examStudentHtml(Set<Long> attachmentIds, String studentContent, ExamStudent t, ExamDetail examDetail, ExamDetailCourse examDetailCourse, Long userId, List<PdfDto> examStudentPdfList) throws IOException {
         if (Objects.nonNull(t.getAttachmentId())) {
             attachmentIds.add(t.getAttachmentId());
         }
@@ -554,18 +554,27 @@ public class CreatePdfUtil {
         }
         studentHtml = studentHtml.replaceAll("\\$\\{examNumberStr\\}", t.getTicketNumber());
         //随机生成学生试卷条码并将图片转成base64
-        if (Objects.nonNull(paperType)) {
-            studentHtml = studentHtml.replaceAll("\\$\\{paperType\\}", GoogleBarCodeUtil.createBarCode(SystemConstant.convertPaperType(paperType), false));
+        if (Objects.nonNull(examDetailCourse.getPaperType())) {
+            studentHtml = studentHtml.replaceAll("\\$\\{paperType\\}", GoogleBarCodeUtil.createBarCode(SystemConstant.convertPaperType(examDetailCourse.getPaperType()), false));
         }
-        studentHtml = studentHtml.replaceAll("\\$\\{paperTypeName\\}", paperType);
+        Map<String, Object> map = ConvertUtil.analyzeDateAndTime(examDetail.getExamStartTime(), examDetail.getExamEndTime());
+        studentHtml = studentHtml.replaceAll("\\$\\{examDate\\}", Objects.nonNull(map.get("date")) ? (String) map.get("date") : "");
+        studentHtml = studentHtml.replaceAll("\\$\\{examTime\\}", Objects.nonNull(map.get("time")) ? (String) map.get("time") : "");
+        studentHtml = studentHtml.replaceAll("\\$\\{ticketNumber\\}", t.getTicketNumber());
+        studentHtml = studentHtml.replaceAll("\\$\\{siteNumber\\}", t.getSiteNumber());
+        studentHtml = studentHtml.replaceAll("\\$\\{paperTypeName\\}", examDetailCourse.getPaperType());
         studentHtml = studentHtml.replaceAll("\\$\\{studentCode\\}", t.getStudentCode());
         studentHtml = studentHtml.replaceAll("\\$\\{studentName\\}", t.getStudentName());
-        studentHtml = studentHtml.replaceAll("\\$\\{courseName\\}", examCard.getCourseName());
+        studentHtml = studentHtml.replaceAll("\\$\\{courseName\\}", examDetailCourse.getCourseName());
+        studentHtml = studentHtml.replaceAll("\\$\\{courseCode\\}", examDetailCourse.getCourseCode());
+        studentHtml = studentHtml.replaceAll("\\$\\{examPlace\\}", examDetail.getExamPlace());
+        studentHtml = studentHtml.replaceAll("\\$\\{examRoom\\}", examDetail.getExamRoom());
+        studentHtml = studentHtml.replaceAll("\\$\\{paperNumber\\}", examDetailCourse.getPaperNumber());
 
         //学生题卡
-        BasicAttachment examStudentAttachment = basicAttachmentService.saveAttachmentHtml(examCard.getSchoolId() + "|" + examCard.getCourseCode() + "|" + t.getTicketNumber(), studentHtml, userId, examStudentPdfList);
+        BasicAttachment examStudentAttachment = basicAttachmentService.saveAttachmentHtml(examDetail.getSchoolId() + "|" + examDetailCourse.getCourseCode() + "|" + t.getTicketNumber(), studentHtml, userId, examStudentPdfList);
         t.setAttachmentId(examStudentAttachment.getId());
-        t.setPaperType(paperType);
+        t.setPaperType(examDetailCourse.getPaperType());
         return examStudentAttachment;
     }