|
@@ -17,6 +17,7 @@ import cn.com.qmth.examcloud.question.commons.core.question.DefaultQuestionUnit;
|
|
|
import cn.com.qmth.examcloud.question.commons.core.question.QuestionType;
|
|
|
import cn.com.qmth.examcloud.support.cache.CacheHelper;
|
|
|
import cn.com.qmth.examcloud.support.cache.bean.CourseCacheBean;
|
|
|
+import cn.com.qmth.examcloud.support.cache.bean.QuestionAnswerCacheBean;
|
|
|
import cn.com.qmth.examcloud.support.cache.bean.QuestionCacheBean;
|
|
|
import cn.com.qmth.examcloud.web.helpers.GlobalHelper;
|
|
|
import cn.com.qmth.examcloud.web.support.ControllerSupport;
|
|
@@ -338,11 +339,13 @@ public class ExamRecordCloudServiceProvider extends ControllerSupport implements
|
|
|
bean.setQuestionId(eq.getQuestionId());
|
|
|
bean.setStudentAnswer(eq.getStudentAnswer());
|
|
|
bean.setAnswerType(eq.getAnswerType());
|
|
|
- bean.setAnswer(eq.getCorrectAnswer());
|
|
|
bean.setQuestionType(eq.getQuestionType());
|
|
|
|
|
|
//获取指定小题的题干相关信息
|
|
|
QuestionCacheBean cachedQues = CacheHelper.getQuestion(examId, courseCode, paperType, eq.getQuestionId());
|
|
|
+
|
|
|
+ bean.setAnswer(getCorrectAnswer(eq.getOrder(), eq.getQuestionId(), cachedQues, eqList));
|
|
|
+
|
|
|
bean.setParentBody(getParentBody(cachedQues));
|
|
|
bean.setBody(getBody(eq.getOrder(), eq.getQuestionId(), cachedQues, eqList));
|
|
|
|
|
@@ -403,6 +406,41 @@ public class ExamRecordCloudServiceProvider extends ControllerSupport implements
|
|
|
return "";
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 获取当前小题的标准答案
|
|
|
+ *
|
|
|
+ * @param curSubNumber 当前小题号
|
|
|
+ * @param questionId 原小题id
|
|
|
+ * @param cachedQues 带题干的试卷结构
|
|
|
+ * @param subjectiveQuesList 主观题集合
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private String getCorrectAnswer(Integer curSubNumber, String questionId,
|
|
|
+ QuestionCacheBean cachedQues, List<ExamQuestionEntity> subjectiveQuesList) {
|
|
|
+ QuestionAnswerCacheBean questionAnswerCache = CacheHelper.getQuestionAnswer(questionId);
|
|
|
+ List<String> rightAnswerList = questionAnswerCache.getRightAnswers();
|
|
|
+ DefaultQuestionStructure questionStructure = cachedQues.getDefaultQuestion().getMasterVersion();
|
|
|
+
|
|
|
+
|
|
|
+ //body为空,则说明当前小题为非套题(rightAnswerList集合大小为1),可直接返回
|
|
|
+ if (StringUtils.isNullOrEmpty(questionStructure.getBody())) {
|
|
|
+ return rightAnswerList.get(0);
|
|
|
+ }
|
|
|
+
|
|
|
+ //同一questionId的主观题集合(不带题干,有小题号)
|
|
|
+ List<ExamQuestionEntity> noBodySubjectiveQuesList = subjectiveQuesList.stream().
|
|
|
+ filter(p -> p.getQuestionId().equals(questionId)).collect(Collectors.toList());
|
|
|
+
|
|
|
+ for (int i = 0; i < noBodySubjectiveQuesList.size(); i++) {
|
|
|
+ //如果小题号相同,则根据相同索引从带题干的集合中取出对应的小题题干
|
|
|
+ if (noBodySubjectiveQuesList.get(i).getOrder().intValue() == curSubNumber.intValue()) {
|
|
|
+ return rightAnswerList.get(i);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return "";
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 校验待阅卷数据
|
|
|
*
|