|
@@ -133,9 +133,13 @@ public class UserPracticeServiceImpl extends ServiceImpl<UserPracticeMapper, Use
|
|
|
questionList = questionService.listByIds(questionIdList);
|
|
|
}
|
|
|
questionService.setQuestionAnswer(questionList);
|
|
|
- Map<String, Question> questionMap = questionList.stream().collect(Collectors.toMap(Question::getId, a -> a, (k1, k2) -> k1));
|
|
|
+
|
|
|
+ Map<String, Question> questionMap = null;
|
|
|
+ if (!CollectionUtils.isEmpty(questionList)) {
|
|
|
+ questionMap = questionList.stream().collect(Collectors.toMap(Question::getId, a -> a, (k1, k2) -> k1));
|
|
|
+ }
|
|
|
for (UserPracticeQuestion userPracticeQuestion : userPracticeQuestionList) {
|
|
|
- if (!Objects.isNull(questionMap.get(userPracticeQuestion.getQuestionId()))) {
|
|
|
+ if (!Objects.isNull(questionMap) && !Objects.isNull(questionMap.get(userPracticeQuestion.getQuestionId()))) {
|
|
|
Question question = questionMap.get(userPracticeQuestion.getQuestionId());
|
|
|
//渲染填空题的题干,填充进答案
|
|
|
if (QuestionType.BLANK.getCode().equals(userPracticeQuestion.getQuestionType())) {
|