|
|
@@ -85,7 +85,8 @@ public class QuestionServiceImpl implements QuestionService {
|
|
|
|
|
|
@Override
|
|
|
public Page<BaseQuestionVO> getQuestions(LoginUser user, String stem, String tag, String knowledgeId, Pageable pageable) {
|
|
|
- return questionApi.getQuestionList(stem, tag, knowledgeId, pageable).map(bokQuestion -> BaseQuestionVO.convertBokQuestionToVO(bokQuestion, true));
|
|
|
+ Page<BaseQuestionVO> page = questionApi.getQuestionList(stem, tag, knowledgeId, pageable).map(bokQuestion -> BaseQuestionVO.convertBokQuestionToVO(bokQuestion, true));
|
|
|
+ return page;
|
|
|
}
|
|
|
|
|
|
@Transactional(readOnly = true)
|
|
|
@@ -150,11 +151,13 @@ public class QuestionServiceImpl implements QuestionService {
|
|
|
@Override
|
|
|
public Page<BaseQuestionVO> getCreatedQuestions(LoginUser user, String stem, String tag, String knowledgeId, Pageable pageable) {
|
|
|
Page<String> questionIdPage = questionRecordDAO.findQuestionIdsByTeacher(userDAO.findUserById(user.getId()), pageable);
|
|
|
- List<String> knowledgeIdList = (knowledgeId==null || knowledgeId.equals("")) ? new ArrayList<>() : Arrays.asList(knowledgeId.split("\\."));
|
|
|
+// List<String> knowledgeIdList = (knowledgeId==null || knowledgeId.equals("")) ? new ArrayList<>() : Arrays.asList(knowledgeId.split("\\."));
|
|
|
+ // 目前仅支持单个知识点的匹配 多个知识点匹配仍需进一步完善
|
|
|
// 这里对当前用户创建的所有问题 根据题干语句、知识点 进行筛选
|
|
|
List<BaseQuestionVO> ret = questionQueryApi.getQuestionListById(questionIdPage.getContent())
|
|
|
.stream()
|
|
|
- .filter(questionVO -> questionVO.getStem().contains(stem) && questionVO.getKnowledgeId().containsAll(knowledgeIdList))
|
|
|
+ .filter(questionVO -> questionVO.getStem().contains(stem) &&
|
|
|
+ questionVO.getKnowledgeId().stream().anyMatch(singleKnowledge -> singleKnowledge.contains(knowledgeId)))
|
|
|
.map(bokQuestion -> BaseQuestionVO.convertBokQuestionToVO(bokQuestion, true))
|
|
|
.collect(Collectors.toList());
|
|
|
return new PageImpl<>(ret, pageable, ret.size());
|