|
|
|
@ -1,5 +1,7 @@ |
|
|
|
package com.project.appeal.domain.service.Impl; |
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollUtil; |
|
|
|
import cn.hutool.core.util.StrUtil; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
|
@ -89,7 +91,7 @@ public class SearchAppealDomainServiceImpl implements SearchAppealDomainService |
|
|
|
Map<Long, QuestionEntity> questionEntityMap = questionBaseService.listByIds(questionIdList).stream() |
|
|
|
.collect(Collectors.toMap(questionEntity -> questionEntity.getId(), questionEntity -> questionEntity)); |
|
|
|
|
|
|
|
//知识点拼接
|
|
|
|
//知识点拼接和填充题目相关信息
|
|
|
|
Set<Long> kpIdSet = new HashSet<>(); |
|
|
|
appealDTOList.forEach(appealDTO -> { |
|
|
|
if (questionEntityMap.containsKey(appealDTO.getQuestionId())){ |
|
|
|
@ -98,9 +100,28 @@ public class SearchAppealDomainServiceImpl implements SearchAppealDomainService |
|
|
|
|
|
|
|
appealDTO.setSubLineName(taskIdToSubLineNameMap.get(appealDTO.getTaskId())); |
|
|
|
appealDTO.setQuestionContent(questionDetail.getQuestionContent()); |
|
|
|
appealDTO.setRightAnswer(questionDetail.getRightAnswer()); |
|
|
|
appealDTO.setKpIdList(questionEntity.getKpIdList()); |
|
|
|
kpIdSet.addAll(questionEntity.getKpIdList()); |
|
|
|
|
|
|
|
//构建参考答案
|
|
|
|
String rightAnswer = questionDetail.getRightAnswer(); |
|
|
|
List<String> rightAnswerList = new ArrayList<>(); |
|
|
|
|
|
|
|
if (StrUtil.isNotBlank(rightAnswer)) { |
|
|
|
rightAnswerList = rightAnswer.contains(",") |
|
|
|
? new ArrayList<>(Arrays.asList(rightAnswer.split(","))) |
|
|
|
: rightAnswer.chars().mapToObj(c -> String.valueOf((char) c)).collect(Collectors.toCollection(ArrayList::new)); |
|
|
|
} |
|
|
|
// 按 ABCD 顺序提取完整答案
|
|
|
|
Map<String, String> options = questionDetail.getOptions(); |
|
|
|
List<String> optionOrder = new ArrayList<>(Arrays.asList("A", "B", "C", "D")); |
|
|
|
final List<String> finalRightAnswerList = rightAnswerList; |
|
|
|
String fullRightAnswer = optionOrder.stream() |
|
|
|
.filter(finalRightAnswerList::contains) |
|
|
|
.map(opt -> opt + "." + options.get(opt)).filter(StrUtil::isNotBlank) |
|
|
|
.collect(Collectors.joining(",")); |
|
|
|
appealDTO.setRightAnswer(fullRightAnswer); |
|
|
|
|
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
|