|
@@ -301,12 +301,14 @@ public class ExamServiceImpl extends ServiceImpl<ExamMapper, Exam> implements IE
|
|
|
|| userExamQuestion.getQuestionType().intValue() == QuestionType.MULTI.getCode()
|
|
|
|| userExamQuestion.getQuestionType().intValue() == QuestionType.JUDGE.getCode()) {
|
|
|
String answer = userExamQuestion.getAnswer();
|
|
|
- List<QuestionAnswer> answerList = userExamQuestion.getQuestion().getAnswerList();
|
|
|
- if (StringUtils.isNotBlank(answer)) {
|
|
|
- List<String> answers = Arrays.asList(answer.split(","));
|
|
|
- List<QuestionAnswer> resultAnswerList = answerList.stream().filter(item -> answers.contains(item.getId())).collect(Collectors.toList());
|
|
|
- List<String> tagList = resultAnswerList.stream().map(QuestionAnswer::getTag).collect(Collectors.toList());
|
|
|
- userExamQuestion.setAnswer(String.join(",", tagList.stream().sorted().collect(Collectors.toList())));
|
|
|
+ if (!Objects.isNull(userExamQuestion.getQuestion())) {
|
|
|
+ List<QuestionAnswer> answerList = userExamQuestion.getQuestion().getAnswerList();
|
|
|
+ if (StringUtils.isNotBlank(answer) && !CollectionUtils.isEmpty(answerList)) {
|
|
|
+ List<String> answers = Arrays.asList(answer.split(","));
|
|
|
+ List<QuestionAnswer> resultAnswerList = answerList.stream().filter(item -> answers.contains(item.getId())).collect(Collectors.toList());
|
|
|
+ List<String> tagList = resultAnswerList.stream().map(QuestionAnswer::getTag).collect(Collectors.toList());
|
|
|
+ userExamQuestion.setAnswer(String.join(",", tagList.stream().sorted().collect(Collectors.toList())));
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
});
|