deason před 4 roky
rodič
revize
6c144e360b

+ 12 - 8
src/main/java/cn/com/qmth/dp/examcloud/oe/modules/export_exam_student_score/ExportExamStudentScore.java

@@ -5,9 +5,10 @@ import cn.com.qmth.dp.examcloud.oe.modules.export_exam_student_score.vo.ExamReco
 import cn.com.qmth.dp.examcloud.oe.modules.export_exam_student_score.vo.ExamStudentVO;
 import cn.com.qmth.dp.examcloud.oe.modules.export_exam_student_score.vo.ScoreVO;
 import cn.com.qmth.examcloud.commons.helpers.poi.ExcelWriter;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Sets;
 import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.lang3.StringUtils;
-import org.assertj.core.util.Lists;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -20,10 +21,7 @@ import org.springframework.jdbc.core.JdbcTemplate;
 import org.springframework.stereotype.Component;
 
 import java.io.File;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 import java.util.stream.Collectors;
 
 /**
@@ -50,13 +48,14 @@ public class ExportExamStudentScore {
             示例2:<1L, 指定某些课程时,则只导指定的课程>
          */
         HashMap<Long, List<Long>> examMaps = new HashMap<>();
+        // examMaps.put(2989L, Lists.newArrayList());
 
-         // examMaps.put(2932L, Lists.list(21564L, 21565L));
+        Set<Long> skipCourseIds = Sets.newHashSet();
 
-        this.export(examMaps);
+        this.export(examMaps, skipCourseIds);
     }
 
-    private void export(HashMap<Long, List<Long>> examMaps) {
+    private void export(HashMap<Long, List<Long>> examMaps, Set<Long> skipCourseIds) {
         Map<Long, String> orgNameMaps = new HashMap<>(), courseNameMaps = new HashMap<>();
 
         log.info("Total size is " + examMaps.size());
@@ -84,6 +83,11 @@ public class ExportExamStudentScore {
             String examName = this.queryExamName(entry.getKey());
 
             for (Long courseId : examCourseIds) {
+                if (skipCourseIds.contains(courseId)) {
+                    log.info("skip courseId " + courseId);
+                    continue;
+                }
+
                 // 按考试的每个课程依次导出
                 this.export(entry.getKey(), examName, courseId, markingType, orgNameMaps, courseNameMaps);
             }