浏览代码

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

xiaof 4 年之前
父节点
当前提交
4ca76ce3b5

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

@@ -19,6 +19,7 @@ import com.qmth.distributed.print.business.service.ExamDetailService;
 import com.qmth.distributed.print.common.contant.SystemConstant;
 import com.qmth.distributed.print.common.enums.ExceptionResultEnum;
 import org.apache.commons.codec.digest.DigestUtils;
+import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.stereotype.Component;
@@ -189,9 +190,16 @@ public class CreatePdfUtil {
         }
         Map<String, Object> htmlMap = new HashMap<>();
         if (Objects.nonNull(examStudentList) && examStudentList.size() > 0) {
-            htmlMap.put("examDetailCourseId", examStudentList.get(0).getExamDetailCourseId());
-            htmlMap.put("courseName", examStudentList.get(0).getCourseName());
-            htmlMap.put("courseCode", examStudentList.get(0).getCourseCode());
+            Set<Long> examDetailCourseIds = new HashSet<>();
+            Set<String> courseCodes = new HashSet<>(), courseNames = new HashSet<>();
+            for (ExamStudentCourseDto examStudentCourseDto : examStudentList) {
+                examDetailCourseIds.add(examStudentCourseDto.getExamDetailCourseId());
+                courseCodes.add(examStudentCourseDto.getCourseCode());
+                courseNames.add(examStudentCourseDto.getCourseName());
+            }
+            htmlMap.put("examDetailCourseId", StringUtils.join(examDetailCourseIds, ", "));
+            htmlMap.put("courseName", String.join(", ", courseNames));
+            htmlMap.put("courseCode", String.join(", ", courseCodes));
         } else {
             htmlMap.put("examDetailCourseId", "");
             htmlMap.put("courseName", "");

+ 8 - 6
distributed-print-business/src/main/resources/mapper/ExamPrintPlanMapper.xml

@@ -139,8 +139,8 @@
             exam_detail b ON a.id = b.print_plan_id
                 JOIN
             (SELECT
-                    b.exam_detail_id,
-                    b.print_plan_id,
+                    a.exam_detail_id,
+                    c.print_plan_id,
                     GROUP_CONCAT(CONCAT(a.course_name, '(', a.course_code, ')')) courseNameCode,
                     GROUP_CONCAT(a.paper_number) paperNumber,
                     GROUP_CONCAT(IFNULL(a.paper_pages_a3, 0) + IFNULL(a.card_pages_a3, 0)) singlePagesA3,
@@ -158,12 +158,13 @@
                     END) isPass
             FROM
                 exam_detail_course a
+            LEFT JOIN exam_detail c ON a.exam_detail_id = c.id
             LEFT JOIN client_status b ON a.school_id = b.school_id
                 AND a.exam_detail_id = b.exam_detail_id
                 AND a.course_code = b.course_code
                 AND a.paper_number = b.paper_number
                 AND b.machine_code = #{machineCode}
-            GROUP BY b.exam_detail_id, b.print_plan_id) c ON a.id = c.print_plan_id and b.id = c.exam_detail_id
+            GROUP BY a.exam_detail_id , c.print_plan_id) c ON a.id = c.print_plan_id and b.id = c.exam_detail_id
                 LEFT JOIN
             sys_user e ON b.print_user = e.login_name
                 LEFT JOIN
@@ -231,8 +232,8 @@
             exam_detail b ON a.id = b.print_plan_id
         JOIN
             (SELECT
-                b.exam_detail_id,
-                b.print_plan_id,
+                a.exam_detail_id,
+                c.print_plan_id,
                 GROUP_CONCAT(CONCAT(a.course_name, '(', a.course_code, ')')) courseNameCode,
                 GROUP_CONCAT(a.paper_number) paperNumber,
                 GROUP_CONCAT(IFNULL(a.paper_pages_a3, 0) + IFNULL(a.card_pages_a3, 0)) singlePagesA3,
@@ -250,12 +251,13 @@
                     END) isPass
         FROM
             exam_detail_course a
+                LEFT JOIN exam_detail c ON a.exam_detail_id = c.id
                 LEFT JOIN client_status b ON a.school_id = b.school_id
                 AND a.exam_detail_id = b.exam_detail_id
                 AND a.course_code = b.course_code
                 AND a.paper_number = b.paper_number
                 AND b.machine_code = #{machineCode}
-        GROUP BY b.exam_detail_id, b.print_plan_id) c ON a.id = c.print_plan_id and b.id = c.exam_detail_id
+        GROUP BY a.exam_detail_id , c.print_plan_id) c ON a.id = c.print_plan_id and b.id = c.exam_detail_id
             LEFT JOIN
         sys_user e ON b.print_user = e.login_name
             LEFT JOIN