|
@@ -82,16 +82,18 @@ public class ExportExamStudentScore {
|
|
|
String markingType = this.queryExamMarkingType(entry.getKey(), MARKING_TYPE_KEY);
|
|
|
log.info("---> markingType is " + markingType);
|
|
|
|
|
|
+ String examName = this.queryExamName(entry.getKey());
|
|
|
+
|
|
|
for (Long courseId : examCourseIds) {
|
|
|
// 按考试的每个课程依次导出
|
|
|
- this.export(entry.getKey(), courseId, markingType, orgNameMaps, courseNameMaps);
|
|
|
+ this.export(entry.getKey(), examName, courseId, markingType, orgNameMaps, courseNameMaps);
|
|
|
}
|
|
|
|
|
|
log.info("===> export finished, examId = " + entry.getKey() + "\n");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private void export(Long examId, Long courseId, String markingType, Map<Long, String> orgNameMaps, Map<Long, String> courseNameMaps) {
|
|
|
+ private void export(Long examId, String examName, Long courseId, String markingType, Map<Long, String> orgNameMaps, Map<Long, String> courseNameMaps) {
|
|
|
List<ExamStudentVO> examStudents = this.queryExamStudents(examId, courseId);
|
|
|
log.info(String.format("---> examId = %s, courseId = %s, examStudentSize = %s", examId, courseId, examStudents.size()));
|
|
|
|
|
@@ -252,12 +254,12 @@ public class ExportExamStudentScore {
|
|
|
List<String> fixedExcelHeaders = Lists.newArrayList("学习中心", "课程代码", "课程名称", "层次", "是否缺考", "身份证号", "学号", "姓名", "年级", "专业", "客观总分", "主观总分", "总分");
|
|
|
fixedExcelHeaders.addAll(dynamicExcelHeaders);
|
|
|
|
|
|
- this.toExcel(examId, courseId, examStudents, fixedExcelHeaders);
|
|
|
+ this.toExcel(examId, examName, courseId, examStudents, fixedExcelHeaders);
|
|
|
|
|
|
examStudents.clear();
|
|
|
}
|
|
|
|
|
|
- private void toExcel(Long examId, Long courseId, List<ExamStudentVO> examStudents, List<String> excelHeaders) {
|
|
|
+ private void toExcel(Long examId, String examName, Long courseId, List<ExamStudentVO> examStudents, List<String> excelHeaders) {
|
|
|
// 处理Excel
|
|
|
List<Object[]> excelRows = new ArrayList<>();
|
|
|
|
|
@@ -282,7 +284,7 @@ public class ExportExamStudentScore {
|
|
|
excelTypes[n] = String.class;
|
|
|
}
|
|
|
|
|
|
- final String filePath = String.format("/home/admin/project/oe/exam_%s/exam_student_score_%s.xlsx", examId, courseId);
|
|
|
+ final String filePath = String.format("/home/admin/project/oe/%s_%s/exam_student_score_%s.xlsx", examId, examName, courseId);
|
|
|
ExcelWriter.write(excelHeaders.toArray(new String[excelHeaders.size()]), excelTypes, excelRows, new File(filePath));
|
|
|
}
|
|
|
|
|
@@ -295,6 +297,15 @@ public class ExportExamStudentScore {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private String queryExamName(Long examId) {
|
|
|
+ final String querySql = String.format("select name from ec_e_exam where id = %s", examId);
|
|
|
+ try {
|
|
|
+ return jdbcTemplate.queryForObject(querySql, String.class);
|
|
|
+ } catch (EmptyResultDataAccessException e) {
|
|
|
+ return "";
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
private String queryCourseName(Long courseId) {
|
|
|
final String querySql = String.format("select name from ec_b_course where id = %s", courseId);
|
|
|
try {
|