|
|
@@ -26,6 +26,7 @@ import org.apache.commons.lang3.tuple.Pair;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.util.*;
|
|
|
+import java.util.concurrent.ThreadLocalRandom;
|
|
|
import java.util.concurrent.atomic.AtomicLong;
|
|
|
import java.util.function.Function;
|
|
|
import java.util.regex.Matcher;
|
|
|
@@ -560,7 +561,7 @@ public class PaperService {
|
|
|
List<KnowTypeAssign> knowTypeAssignList = Lists.newArrayList(knowTypeAssignMap.values());
|
|
|
List<LearnPaperQuestion> pqList = Lists.newArrayList();
|
|
|
Set<String> existQuestionSet = Sets.newHashSet();
|
|
|
- Random random = new Random();
|
|
|
+ Random random = ThreadLocalRandom.current();
|
|
|
Map<String, List<LearnQuestions>> typeQuestionMap = Maps.newHashMap();
|
|
|
LearnQuestions qCond = new LearnQuestions();
|
|
|
do {
|
|
|
@@ -585,7 +586,11 @@ public class PaperService {
|
|
|
addRandomList(knowTypeAssign.getKnowId(), QuestionType.of(knowTypeAssign.getType()), questions, random, total.longValue(), 1L, 1.0, existQuestionSet, 1, pqList);
|
|
|
if(oldSize != pqList.size()) {
|
|
|
knowTypeAssign.exclAssign++;
|
|
|
+ } else {
|
|
|
+ knowTypeAssignList.remove(idx);
|
|
|
}
|
|
|
+ } else {
|
|
|
+ knowTypeAssignList.remove(idx);
|
|
|
}
|
|
|
} else {
|
|
|
knowTypeAssignList.remove(idx);
|
|
|
@@ -909,7 +914,7 @@ public class PaperService {
|
|
|
public List<LearnPaperQuestion> getQuestions(Long studentId, TestPaperVO.PaperDef paperDef, Map<String, KnowTypeAssign> knowTypeAssignMap) {
|
|
|
// 知识点已经分配,准备题型分配
|
|
|
LearnQuestions qCond = new LearnQuestions();
|
|
|
- Random random = new Random();
|
|
|
+ Random random = ThreadLocalRandom.current();
|
|
|
List<LearnPaperQuestion> pqList = Lists.newArrayList();
|
|
|
Set<String> existQuestionSet = Sets.newHashSet();
|
|
|
int total = paperDef.getTotal().intValue();
|
|
|
@@ -957,7 +962,7 @@ public class PaperService {
|
|
|
public List<LearnPaperQuestion> getQuestions2(Long studentId, Integer total, Integer seqId, Collection<Long> knownIds, String isSubType, List<TestPaperVO.TypeDef2> types, Map<String, KnowTypeAssign> knowTypeAssignMap, Set<String> existQuestionSet) {
|
|
|
// 知识点已经分配,准备题型分配
|
|
|
LearnQuestions qCond = new LearnQuestions();
|
|
|
- Random random = new Random();
|
|
|
+ Random random = ThreadLocalRandom.current();
|
|
|
List<LearnPaperQuestion> pqList = Lists.newArrayList();
|
|
|
for (TestPaperVO.TypeDef2 typeDef : types) {
|
|
|
String typeTitle = typeDef.getType().getTitle();
|