|
@@ -56,7 +56,8 @@ public class ExportStudentAnswerAndScoreDetailTask {
|
|
Long examId = jsonParams.get("examId").asLong(0L);
|
|
Long examId = jsonParams.get("examId").asLong(0L);
|
|
String courseCodes = jsonParams.get("courseCodes").asText("");
|
|
String courseCodes = jsonParams.get("courseCodes").asText("");
|
|
Boolean needSubjective = jsonParams.get("needSubjective").asBoolean(false);
|
|
Boolean needSubjective = jsonParams.get("needSubjective").asBoolean(false);
|
|
- log.info("examId = {}, courseCodes = {}, needSubjective = {}", examId, courseCodes, needSubjective);
|
|
|
|
|
|
+ Boolean needQuestionId = jsonParams.get("needQuestionId").asBoolean(false);
|
|
|
|
+ log.info("examId = {}, courseCodes = {}, needSubjective = {}, needQuestionId = {}", examId, courseCodes, needSubjective, needQuestionId);
|
|
|
|
|
|
// 待处理的课程列表(未指定课程则按考试的全部课程)
|
|
// 待处理的课程列表(未指定课程则按考试的全部课程)
|
|
List<CourseVO> todoCourses;
|
|
List<CourseVO> todoCourses;
|
|
@@ -79,13 +80,13 @@ public class ExportStudentAnswerAndScoreDetailTask {
|
|
int index = 0;
|
|
int index = 0;
|
|
for (CourseVO course : todoCourses) {
|
|
for (CourseVO course : todoCourses) {
|
|
// 按考试课程逐个处理
|
|
// 按考试课程逐个处理
|
|
- this.export(examId, course, needSubjective, user, tempDir);
|
|
|
|
|
|
+ this.export(examId, course, needSubjective, needQuestionId, user, tempDir);
|
|
|
|
|
|
log.info("examId:{} courseId:{} 已处理课程数:{}", examId, course.getCourseId(), ++index);
|
|
log.info("examId:{} courseId:{} 已处理课程数:{}", examId, course.getCourseId(), ++index);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- private void export(Long examId, CourseVO course, Boolean needSubjective, User user, String tempDir) {
|
|
|
|
|
|
+ private void export(Long examId, CourseVO course, Boolean needSubjective, Boolean needQuestionId, User user, String tempDir) {
|
|
List<ExamStudentScoreVO> examStudentScoreList = this.getExamStudentScoreList(user.getKey(), user.getToken(), examId, course.getCourseId());
|
|
List<ExamStudentScoreVO> examStudentScoreList = this.getExamStudentScoreList(user.getKey(), user.getToken(), examId, course.getCourseId());
|
|
|
|
|
|
// Excel动态列
|
|
// Excel动态列
|
|
@@ -126,7 +127,9 @@ public class ExportStudentAnswerAndScoreDetailTask {
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
|
|
|
|
- // dynamicExcelHeaders.add(String.format("%s%s-%s-ID", question.getQuestionType().getDesc(), question.getMainNumber(), question.getOrder()));
|
|
|
|
|
|
+ if (needQuestionId) {
|
|
|
|
+ dynamicExcelHeaders.add(String.format("%s%s-%s-ID", question.getQuestionType().getDesc(), question.getMainNumber(), question.getOrder()));
|
|
|
|
+ }
|
|
dynamicExcelHeaders.add(String.format("%s%s-%s答案", question.getQuestionType().getDesc(), question.getMainNumber(), question.getOrder()));
|
|
dynamicExcelHeaders.add(String.format("%s%s-%s答案", question.getQuestionType().getDesc(), question.getMainNumber(), question.getOrder()));
|
|
dynamicExcelHeaders.add(String.format("%s%s-%s作答", question.getQuestionType().getDesc(), question.getMainNumber(), question.getOrder()));
|
|
dynamicExcelHeaders.add(String.format("%s%s-%s作答", question.getQuestionType().getDesc(), question.getMainNumber(), question.getOrder()));
|
|
dynamicExcelHeaders.add(String.format("%s%s-%s得分", question.getQuestionType().getDesc(), question.getMainNumber(), question.getOrder()));
|
|
dynamicExcelHeaders.add(String.format("%s%s-%s得分", question.getQuestionType().getDesc(), question.getMainNumber(), question.getOrder()));
|
|
@@ -160,7 +163,9 @@ public class ExportStudentAnswerAndScoreDetailTask {
|
|
studentAnswer = numbersToLetters(question.getStudentAnswer());
|
|
studentAnswer = numbersToLetters(question.getStudentAnswer());
|
|
}
|
|
}
|
|
|
|
|
|
- // dynamicColumnValues.add(question.getQuestionId());
|
|
|
|
|
|
+ if (needQuestionId) {
|
|
|
|
+ dynamicColumnValues.add(question.getQuestionId());
|
|
|
|
+ }
|
|
dynamicColumnValues.add(correctAnswer);
|
|
dynamicColumnValues.add(correctAnswer);
|
|
dynamicColumnValues.add(studentAnswer);
|
|
dynamicColumnValues.add(studentAnswer);
|
|
if (correctAnswer.equals(studentAnswer)) {
|
|
if (correctAnswer.equals(studentAnswer)) {
|
|
@@ -170,7 +175,9 @@ public class ExportStudentAnswerAndScoreDetailTask {
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
if (needSubjective) {
|
|
if (needSubjective) {
|
|
- // dynamicColumnValues.add(question.getQuestionId());
|
|
|
|
|
|
+ if (needQuestionId) {
|
|
|
|
+ dynamicColumnValues.add(question.getQuestionId());
|
|
|
|
+ }
|
|
String correctAnswer = question.getCorrectAnswer() != null ? question.getCorrectAnswer() : "";
|
|
String correctAnswer = question.getCorrectAnswer() != null ? question.getCorrectAnswer() : "";
|
|
dynamicColumnValues.add(Jsoup.clean(correctAnswer, Safelist.simpleText()));
|
|
dynamicColumnValues.add(Jsoup.clean(correctAnswer, Safelist.simpleText()));
|
|
String studentAnswer = question.getStudentAnswer() != null ? question.getStudentAnswer() : "";
|
|
String studentAnswer = question.getStudentAnswer() != null ? question.getStudentAnswer() : "";
|