|
@@ -559,16 +559,22 @@ public class DdExcelService {
|
|
public void exportSubQues(String orgId, Long examId, List<String> codes) throws Exception {
|
|
public void exportSubQues(String orgId, Long examId, List<String> codes) throws Exception {
|
|
System.out.println(String.format("共%s门课程的调卷规则", codes.size()));
|
|
System.out.println(String.format("共%s门课程的调卷规则", codes.size()));
|
|
|
|
|
|
- List<SubQuestionDto> dtos = new ArrayList<SubQuestionDto>();
|
|
|
|
- int j = 1;
|
|
|
|
|
|
+ int index = 1;
|
|
|
|
+ List<SubQuestionDto> subjectQuestions = new ArrayList<>();
|
|
for (String code : codes) {
|
|
for (String code : codes) {
|
|
|
|
+ System.out.println("开始处理第" + index + "门课程的调卷规则");
|
|
|
|
+ index++;
|
|
|
|
+
|
|
Query query = new Query();
|
|
Query query = new Query();
|
|
query.addCriteria(Criteria.where("orgId").is(orgId));
|
|
query.addCriteria(Criteria.where("orgId").is(orgId));
|
|
query.addCriteria(Criteria.where("examId").is(examId));
|
|
query.addCriteria(Criteria.where("examId").is(examId));
|
|
- System.out.println("开始处理第" + j + "门课程的调卷规则");
|
|
|
|
-
|
|
|
|
query.addCriteria(Criteria.where("courseCode").is(code));
|
|
query.addCriteria(Criteria.where("courseCode").is(code));
|
|
ExtractConfig tempConfig = this.mongoTemplate.findOne(query, ExtractConfig.class);
|
|
ExtractConfig tempConfig = this.mongoTemplate.findOne(query, ExtractConfig.class);
|
|
|
|
+ if (tempConfig == null) {
|
|
|
|
+ System.out.println(String.format("课程-%s:没有调卷规则", code));
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+
|
|
//定义试卷集合
|
|
//定义试卷集合
|
|
Set<String> ids = new HashSet<String>();
|
|
Set<String> ids = new HashSet<String>();
|
|
|
|
|
|
@@ -609,11 +615,10 @@ public class DdExcelService {
|
|
dto.setPaperId(basePaper.getId());
|
|
dto.setPaperId(basePaper.getId());
|
|
dto.setPaperName(basePaper.getName());
|
|
dto.setPaperName(basePaper.getName());
|
|
dto.setScore(paperDetailUnit.getScore());
|
|
dto.setScore(paperDetailUnit.getScore());
|
|
- dtos.add(dto);
|
|
|
|
|
|
+ subjectQuestions.add(dto);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- j++;
|
|
|
|
}
|
|
}
|
|
|
|
|
|
//生成Excel对象
|
|
//生成Excel对象
|
|
@@ -638,10 +643,10 @@ public class DdExcelService {
|
|
titleRow.createCell(11).setCellValue("标答(含标签)");
|
|
titleRow.createCell(11).setCellValue("标答(含标签)");
|
|
|
|
|
|
//向Excle中写入数据,从第2行开始
|
|
//向Excle中写入数据,从第2行开始
|
|
- for (int i = 0; i < dtos.size(); i++) {
|
|
|
|
|
|
+ for (int i = 0; i < subjectQuestions.size(); i++) {
|
|
//创建一行:从第1行开始,跳过表头
|
|
//创建一行:从第1行开始,跳过表头
|
|
Row row = sheet.createRow(i + 1);
|
|
Row row = sheet.createRow(i + 1);
|
|
- SubQuestionDto dto = dtos.get(i);
|
|
|
|
|
|
+ SubQuestionDto dto = subjectQuestions.get(i);
|
|
//每列赋值
|
|
//每列赋值
|
|
row.createCell(0).setCellValue(dto.getCourseCode());
|
|
row.createCell(0).setCellValue(dto.getCourseCode());
|
|
row.createCell(1).setCellValue(dto.getCourseName());
|
|
row.createCell(1).setCellValue(dto.getCourseName());
|