|
@@ -322,10 +322,25 @@ public class ExamRecordDataServiceImpl implements ExamRecordDataService {
|
|
|
* @param examQuestion
|
|
|
*/
|
|
|
private void updateCorrectAnswer(Long examRecordDataId, ExamQuestion examQuestion) {
|
|
|
+ //更新客观题答案
|
|
|
QuestionAnswerCacheBean questionAnswerCache = CacheHelper.getQuestionAnswer(examQuestion.getQuestionId());
|
|
|
List<String> rightAnswerList = questionAnswerCache.getRightAnswers();
|
|
|
- examQuestion.setCorrectAnswer(rightAnswerList.get(examQuestion.getOrder() - 1));
|
|
|
|
|
|
- examRecordQuestionsService.saveExamQuestion(examRecordDataId, examQuestion.getOrder(), examQuestion);
|
|
|
+ ExamRecordQuestions examRecordQuestions = examRecordQuestionsService.getExamRecordQuestions(examRecordDataId);
|
|
|
+ List<ExamQuestion> examQuestionList = examRecordQuestions.getExamQuestions();
|
|
|
+
|
|
|
+
|
|
|
+ //最小维度的小题单元集合
|
|
|
+ List<ExamQuestion> questionUnitList = examQuestionList.stream().
|
|
|
+ filter(p -> p.getQuestionId().equals(examQuestion.getQuestionId())).
|
|
|
+ sorted((o1, o2) -> o1.getOrder().intValue() - o2.getOrder().intValue()).collect(Collectors.toList());
|
|
|
+
|
|
|
+ //循环保存所有小题单元
|
|
|
+ for (int i = 0; i < questionUnitList.size(); i++) {
|
|
|
+ ExamQuestion curUnitQuestion = questionUnitList.get(i);
|
|
|
+ curUnitQuestion.setCorrectAnswer(rightAnswerList.get(i));
|
|
|
+ examRecordQuestionsService.saveExamQuestion(examRecordDataId, curUnitQuestion.getOrder(), curUnitQuestion);
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
}
|