Parcourir la source

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

xiaof il y a 4 ans
Parent
commit
2a40bb2c27

+ 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", "");