|
|
@@ -34,10 +34,7 @@ import org.springframework.data.domain.Pageable;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
-import java.util.Collections;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
-import java.util.Set;
|
|
|
+import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
@@ -151,19 +148,33 @@ public class QuestionServiceImpl implements QuestionService {
|
|
|
|
|
|
@Transactional(readOnly = true)
|
|
|
@Override
|
|
|
- public Page<BaseQuestionVO> getCreatedQuestions(LoginUser user, Pageable pageable) {
|
|
|
+ public Page<BaseQuestionVO> getCreatedQuestions(LoginUser user, String stem, String tag, String knowledgeId, Pageable pageable) {
|
|
|
Page<String> questionIdPage = questionRecordDAO.findQuestionIdsByTeacher(userDAO.findUserById(user.getId()), pageable);
|
|
|
-
|
|
|
- return new PageImpl<>(
|
|
|
- questionQueryApi.getQuestionListById(questionIdPage.getContent())
|
|
|
- .stream()
|
|
|
- .map(bokQuestion -> BaseQuestionVO.convertBokQuestionToVO(bokQuestion, true))
|
|
|
- .collect(Collectors.toList())
|
|
|
- , pageable
|
|
|
- , questionIdPage.getTotalElements()
|
|
|
- );
|
|
|
+ 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))
|
|
|
+ .map(bokQuestion -> BaseQuestionVO.convertBokQuestionToVO(bokQuestion, true))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ return new PageImpl<>(ret, pageable, ret.size());
|
|
|
}
|
|
|
|
|
|
+// @Transactional(readOnly = true)
|
|
|
+// @Override
|
|
|
+// public Page<BaseQuestionVO> getCreatedQuestions(LoginUser user, Pageable pageable) {
|
|
|
+// Page<String> questionIdPage = questionRecordDAO.findQuestionIdsByTeacher(userDAO.findUserById(user.getId()), pageable);
|
|
|
+//
|
|
|
+// return new PageImpl<>(
|
|
|
+// questionQueryApi.getQuestionListById(questionIdPage.getContent())
|
|
|
+// .stream()
|
|
|
+// .map(bokQuestion -> BaseQuestionVO.convertBokQuestionToVO(bokQuestion, true))
|
|
|
+// .collect(Collectors.toList())
|
|
|
+// , pageable
|
|
|
+// , questionIdPage.getTotalElements()
|
|
|
+// );
|
|
|
+// }
|
|
|
+
|
|
|
@Transactional(readOnly = true)
|
|
|
@Override
|
|
|
public Set<String> getIdsOfCreatedQuestions(LoginUser user) {
|