|
|
@@ -106,7 +106,7 @@ public class RecommendServiceImpl implements RecommendService {
|
|
|
// System.out.println(entry.getKey()+": "+entry.getValue());
|
|
|
// }
|
|
|
|
|
|
- //还需要添加的题目数目,姑且设计为5错题+15低分+10大类中未做过的,剩下不足的由未做过的题目补充
|
|
|
+ //还需要添加的题目数目,姑且设计为5错题+5错题同类型题+15低分能力下的题目+5大类中未做过的,剩下不足的由未做过的题目补充
|
|
|
int left = QUESTION_NUM;
|
|
|
//最终生成试卷的所有题号的集合
|
|
|
List<String> total = new ArrayList<>();
|
|
|
@@ -119,7 +119,40 @@ public class RecommendServiceImpl implements RecommendService {
|
|
|
errors.remove(errors.get(r));
|
|
|
}
|
|
|
|
|
|
- //随机选择10道和低分类似类似的题目
|
|
|
+ //随机选择5道和错题知识点相同的题目
|
|
|
+ List<String> errKnows = new ArrayList<>();
|
|
|
+ for(int i=0;i<total.size();i++){
|
|
|
+ List<String> knows = questionService.getKnowledgesById(total.get(i));
|
|
|
+ //排除基础的SR类
|
|
|
+ for(String know : knows){
|
|
|
+ if(know.split("\\.").length == 1){
|
|
|
+ knows.remove(know);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //逐个搜索
|
|
|
+ for(String know : knows){
|
|
|
+ List<String> search = new ArrayList<>();
|
|
|
+ search.add(know);
|
|
|
+ List<QuestionVO> questions = questionService.searchQuestions(search);
|
|
|
+ for(QuestionVO questionVO : questions){
|
|
|
+ String questionId = questionVO.getId();
|
|
|
+ if(total.contains(questionId)==false && errKnows.contains(questionId)==false){
|
|
|
+ errKnows.add(questionId);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //得到相似错题后,选择5道
|
|
|
+ for(int i=0;errKnows.size()>0&&i<5;i++){
|
|
|
+ int r = random.nextInt(errKnows.size());
|
|
|
+ total.add(errKnows.get(r));
|
|
|
+ left--;
|
|
|
+ errKnows.remove(errKnows.get(r));
|
|
|
+ }
|
|
|
+
|
|
|
+ //随机选择15道和低分类似类似的题目
|
|
|
List<String> similar = new ArrayList<>();
|
|
|
int index = 0;
|
|
|
for(Map.Entry<String,Double> entry : afterSort.entrySet()){
|
|
|
@@ -142,7 +175,7 @@ public class RecommendServiceImpl implements RecommendService {
|
|
|
}
|
|
|
index++;
|
|
|
}
|
|
|
- //随机选择15道相似题目
|
|
|
+ //得到所有相似题目的题号后,选择15道
|
|
|
for(int i=0;similar.size()>0&&i<15;i++){
|
|
|
int r = random.nextInt(similar.size());
|
|
|
total.add(similar.get(r));
|