|
|
@@ -1,14 +1,21 @@
|
|
|
package com.seecoder.dataanalysis.logic.question.Impl;
|
|
|
|
|
|
import cn.seecoder.bok.client.SeecoderBokClient;
|
|
|
+import cn.seecoder.bok.common.QuestionType;
|
|
|
+import cn.seecoder.bok.common.vo.KnowledgeNodeVO;
|
|
|
import cn.seecoder.bok.common.vo.QuestionVO;
|
|
|
import com.seecoder.dataanalysis.data.entity.eval.Question;
|
|
|
import com.seecoder.dataanalysis.logic.question.QuestionService;
|
|
|
import com.seecoder.dataanalysis.vo.question.CompleteQuestionVO;
|
|
|
import org.apache.kafka.common.protocol.types.Field;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
+import org.springframework.data.domain.Page;
|
|
|
+import org.springframework.data.domain.PageRequest;
|
|
|
+import org.springframework.data.domain.Pageable;
|
|
|
+import org.springframework.data.domain.Sort;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.Arrays;
|
|
|
import java.util.List;
|
|
|
import java.util.Optional;
|
|
|
@@ -17,7 +24,17 @@ import java.util.Optional;
|
|
|
public class QuestionServiceImpl implements QuestionService {
|
|
|
|
|
|
@Override
|
|
|
- public Question getQuestionById(String questionId){
|
|
|
+ public QuestionVO getQuestionById(String questionId){
|
|
|
+ SeecoderBokClient seecoderBokClient = new SeecoderBokClient("http://bok.seec.seecoder.cn");
|
|
|
+ Optional<QuestionVO> response = seecoderBokClient.getQuestionById(questionId);
|
|
|
+ if(!response.isPresent()){
|
|
|
+ System.out.println("不存在该题目");
|
|
|
+ }
|
|
|
+ return response.get();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Question getQuestionByIdForAnalysis(String questionId){
|
|
|
SeecoderBokClient seecoderBokClient = new SeecoderBokClient("http://bok.seec.seecoder.cn");
|
|
|
Optional<QuestionVO> response = seecoderBokClient.getQuestionById(questionId);
|
|
|
if(!response.isPresent()){
|
|
|
@@ -34,11 +51,28 @@ public class QuestionServiceImpl implements QuestionService {
|
|
|
Question question = new Question(res);
|
|
|
// for(String s : question.getCompetencies()) {
|
|
|
// System.out.println(s);
|
|
|
-// String[] cs = s.split("\\.");
|
|
|
-// for(String s1 : cs){
|
|
|
-// System.out.println(s1);
|
|
|
-// }
|
|
|
// }
|
|
|
return question;
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<QuestionVO> searchQuestions(List<String> knowledgeIds){
|
|
|
+ SeecoderBokClient seecoderBokClient = new SeecoderBokClient("http://bok.seec.seecoder.cn");
|
|
|
+ List<String> tags = new ArrayList<>();
|
|
|
+ List<QuestionType> types = new ArrayList<>();
|
|
|
+ List<Integer> weights = new ArrayList<>();
|
|
|
+ Pageable page = PageRequest.of(0, 5000, Sort.by("id").ascending());
|
|
|
+ Page<QuestionVO> response = seecoderBokClient.getQuestionList("", tags, types, weights, knowledgeIds, page);
|
|
|
+ return response.getContent();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<String> getKnowledgesById(String questionId){
|
|
|
+ SeecoderBokClient seecoderBokClient = new SeecoderBokClient("http://bok.seec.seecoder.cn");
|
|
|
+ Optional<QuestionVO> response = seecoderBokClient.getQuestionById(questionId);
|
|
|
+ if(!response.isPresent()){
|
|
|
+ System.out.println("不存在该题目");
|
|
|
+ }
|
|
|
+ return response.get().getKnowledgeId();
|
|
|
+ }
|
|
|
}
|