|
@@ -84,9 +84,9 @@ public class ExportExamStudentScore {
|
|
|
List<String> defaultDynamicColumnValues = new ArrayList<>();// Excel动态列默认值
|
|
|
String paperStructKey = "";// 试卷结构关键值
|
|
|
|
|
|
- int index = 0;
|
|
|
+ int index = 0, total = examStudents.size();
|
|
|
for (ExamStudentVO examStudent : examStudents) {
|
|
|
- log.debug((++index) + "---> examStudentId is " + examStudent.getExamStudentId());
|
|
|
+ index++;
|
|
|
|
|
|
if (!orgNameMaps.containsKey(examStudent.getOrgId())) {
|
|
|
String orgName = this.queryOrgName(examStudent.getOrgId());
|
|
@@ -109,6 +109,7 @@ public class ExportExamStudentScore {
|
|
|
|
|
|
if (!examStudent.getFinished()) {
|
|
|
// 跳过缺考的情况
|
|
|
+ log.warn("---> {}-{} examStudentId={}, finished=false", total, index, examStudent.getExamStudentId());
|
|
|
continue;
|
|
|
}
|
|
|
|
|
@@ -116,6 +117,7 @@ public class ExportExamStudentScore {
|
|
|
List<Map<String, Object>> examRecordDataList = this.queryExamRecordDataList(examId, courseId, examStudent.getExamStudentId());
|
|
|
if (CollectionUtils.isEmpty(examRecordDataList)) {
|
|
|
// 跳过暂无有效考试记录的情况
|
|
|
+ log.warn("---> {}-{} examStudentId={}, examRecordData is empty", total, index, examStudent.getExamStudentId());
|
|
|
continue;
|
|
|
}
|
|
|
|
|
@@ -163,12 +165,17 @@ public class ExportExamStudentScore {
|
|
|
examStudent.setTotalScore(okScore.getTotalScore());
|
|
|
}
|
|
|
|
|
|
+ log.info("---> {}-{} examStudentId={}, examRecordDataId={}", total, index, examStudent.getExamStudentId(), okExamRecordDataId);
|
|
|
+
|
|
|
// 获取试题作答记录
|
|
|
ExamRecordQuestionVO questions = this.queryExamRecordQuestions(okExamRecordDataId);
|
|
|
if (questions == null || CollectionUtils.isEmpty(questions.getExamQuestionEntities())) {
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
+ // 查询阅卷端考生考试记录中主观题的得分明细
|
|
|
+ Map<String, Double> subjectiveQuestionScores = needSubjective ? this.querySubjectiveQuestionScores(okExamRecordDataId) : new HashMap<>();
|
|
|
+
|
|
|
List<ExamQuestionVO> examQuestionEntities = questions.getExamQuestionEntities();
|
|
|
|
|
|
if (!hasDynamicExcelHeaderSetting) {
|
|
@@ -221,7 +228,8 @@ public class ExportExamStudentScore {
|
|
|
if (needSubjective) {
|
|
|
curDynamicColumnValues.add(Jsoup.clean(question.getStudentAnswer() != null ? question.getStudentAnswer() : "", Safelist.relaxed()));
|
|
|
|
|
|
- curDynamicColumnValues.add(question.getStudentScore() != null ? question.getStudentScore().toString() : "0");
|
|
|
+ Double studentScore = subjectiveQuestionScores.get(question.getMainNumber() + "-" + question.getOrder());
|
|
|
+ curDynamicColumnValues.add(studentScore != null ? studentScore.toString() : "0");
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -391,6 +399,31 @@ public class ExportExamStudentScore {
|
|
|
return score;
|
|
|
}
|
|
|
|
|
|
+ private Map<String, Double> querySubjectiveQuestionScores(Long examRecordDataId) {
|
|
|
+ StringBuilder querySql = new StringBuilder()
|
|
|
+ .append(" select mi.main_number,mi.orders,ri.score")
|
|
|
+ .append(" from ec_m_student_paper sp")
|
|
|
+ .append(" left join ec_m_mark_item mi on mi.work_id=sp.work_id and mi.base_paper_id=sp.base_paper_id")
|
|
|
+ .append(" left join ec_m_mark_result mr on mr.student_paper_id=sp.id")
|
|
|
+ .append(" left join ec_m_result_item ri on ri.mark_item_id=mi.id and ri.mark_result_id=mr.id")
|
|
|
+ .append(" where sp.exam_record_data_id=").append(examRecordDataId);
|
|
|
+
|
|
|
+ List<Map<String, Object>> result = jdbcTemplate.queryForList(querySql.toString());
|
|
|
+
|
|
|
+ Map<String, Double> scores = new HashMap<>();
|
|
|
+ if (CollectionUtils.isNotEmpty(result)) {
|
|
|
+ for (Map<String, Object> row : result) {
|
|
|
+ Integer mainNumber = (Integer) row.get("main_number");
|
|
|
+ Integer orders = (Integer) row.get("orders");
|
|
|
+ Double score = (Double) row.get("score");
|
|
|
+
|
|
|
+ scores.put(mainNumber + "-" + orders, score);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return scores;
|
|
|
+ }
|
|
|
+
|
|
|
private ExamRecordQuestionVO queryExamRecordQuestions(Long examRecordDataId) {
|
|
|
Query query = new Query();
|
|
|
query.addCriteria(Criteria.where("examRecordDataId").is(examRecordDataId));
|