|
@@ -34,6 +34,7 @@ import cn.com.qmth.examcloud.core.questions.dao.entity.Paper;
|
|
|
import cn.com.qmth.examcloud.core.questions.dao.entity.PaperDetail;
|
|
|
import cn.com.qmth.examcloud.core.questions.dao.entity.PaperDetailUnit;
|
|
|
import cn.com.qmth.examcloud.core.questions.dao.entity.PaperStruct;
|
|
|
+import cn.com.qmth.examcloud.core.questions.service.PaperDetailUnitService;
|
|
|
import cn.com.qmth.examcloud.core.questions.service.PaperService;
|
|
|
import cn.com.qmth.examcloud.core.questions.dao.entity.QuesProperty;
|
|
|
import cn.com.qmth.examcloud.core.questions.dao.entity.Question;
|
|
@@ -69,6 +70,9 @@ public class GenPaperService {
|
|
|
@Autowired
|
|
|
PaperService paperService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ PaperDetailUnitService paperDetailUnitService;
|
|
|
+
|
|
|
/**
|
|
|
* 精确组卷,根据设定试卷结构组卷
|
|
|
*
|
|
@@ -102,38 +106,35 @@ public class GenPaperService {
|
|
|
long total = (System.currentTimeMillis() - start) / 1000;
|
|
|
log.debug("total:"+total);
|
|
|
|
|
|
- for (PaperDetailUnit unit : spareUnits) {
|
|
|
+ /*for (PaperDetailUnit unit : spareUnits) {
|
|
|
Question question = unit.getQuestion();
|
|
|
//根据questionId查询题库中大题来源
|
|
|
- /*List<PaperDetailUnit> units = unitRepo.findByQuestion(question);
|
|
|
+ List<PaperDetailUnit> units = unitRepo.findByQuestion(question);
|
|
|
for(PaperDetailUnit oldUnit:units){
|
|
|
Paper paper = oldUnit.getPaper();
|
|
|
if(paper.getPaperType() == PaperType.IMPORT){
|
|
|
question.setQuesName(oldUnit.getPaperDetail().getName());
|
|
|
break;
|
|
|
}
|
|
|
- }*/
|
|
|
+ }
|
|
|
question.setQuesName(unit.getPaperDetail().getName());
|
|
|
questions.add(question);
|
|
|
- }
|
|
|
+ }*/
|
|
|
|
|
|
- /*List<Question> oList = new ArrayList<Question>();
|
|
|
+ List<String> oIds = new ArrayList<String>();
|
|
|
for (PaperDetailUnit unit : spareUnits) {
|
|
|
- oList.add(unit.getQuestion());
|
|
|
+ oIds.add(unit.getQuestion().getId());
|
|
|
}
|
|
|
long start2 = System.currentTimeMillis();
|
|
|
- List<PaperDetailUnit> oDetailUnits = unitRepo.findByQuestionIn(oList);
|
|
|
+ List<PaperDetailUnit> oDetailUnits = paperDetailUnitService.findByQuestionsAndPaperType(oIds, PaperType.IMPORT);
|
|
|
long total2 = (System.currentTimeMillis() - start2) / 1000;
|
|
|
- log.debug("total2....."+total2);
|
|
|
+ log.debug("total2....."+total2+"--------获取原题数量:"+oDetailUnits.size());
|
|
|
long start4 = System.currentTimeMillis();
|
|
|
for(PaperDetailUnit oldUnit:oDetailUnits){
|
|
|
- Paper paper = oldUnit.getPaper();
|
|
|
- if(paper.getPaperType() == PaperType.IMPORT){
|
|
|
- oldUnit.getQuestion().setQuesName(oldUnit.getPaperDetail().getName());
|
|
|
- }
|
|
|
+ oldUnit.getQuestion().setQuesName(oldUnit.getPaperDetail().getName());
|
|
|
questions.add(oldUnit.getQuestion());
|
|
|
- }*/
|
|
|
- long total4 = (System.currentTimeMillis() - start) / 1000;
|
|
|
+ }
|
|
|
+ long total4 = (System.currentTimeMillis() - start4) / 1000;
|
|
|
log.debug("循环耗时....."+total4);
|
|
|
Collections.shuffle(questions);
|
|
|
int maxLoopCount = questions.size() * 2;
|