Browse Source

fix:考点内包含多个班级生成pdf报错

caozixuan 3 years ago
parent
commit
bc10b980d3

+ 10 - 1
distributed-print-business/src/main/java/com/qmth/distributed/print/business/util/CreatePdfUtil.java

@@ -175,7 +175,16 @@ public class CreatePdfUtil {
             htmlMap.put("courseCode", "");
             htmlMap.put("collegeName", "");
         }
-        List<Long> classIds = examDetailCourseList.stream().filter(m -> StringUtils.isNotBlank(m.getClazzId())).map(m -> Long.valueOf(m.getClazzId())).distinct().collect(Collectors.toList());
+        Set<Long> clazzIdSet = new HashSet<>();
+        for (ExamDetailCourse examDetailCourse : examDetailCourseList) {
+            String clazzInfo = examDetailCourse.getClazzId();
+            if (SystemConstant.strNotNull(clazzInfo)){
+                Set<Long> clazzIdSetCell = Arrays.stream(clazzInfo.split(",")).map(SystemConstant::convertIdToLong).collect(Collectors.toSet());
+                clazzIdSet.addAll(clazzIdSetCell);
+            }
+        }
+        List<Long> classIds = new ArrayList<>(clazzIdSet);
+
         String campusName = CollectionUtils.isEmpty(classIds) ? "" : basicCampusService.findCampusNamesByClazzIdList(classIds, ",");
         htmlMap.put("schoolName", schoolName);
         htmlMap.put("campusName", campusName);