ソースを参照

组卷来源大题bug修改

weiwenhai 7 年 前
コミット
288aded08c

+ 10 - 2
examcloud-core-questions-service/src/main/java/cn/com/qmth/examcloud/core/questions/service/impl/GenPaperService.java

@@ -75,6 +75,7 @@ public class GenPaperService {
         String msg = "";
         Map<String, Object> paperMsgMap = new HashMap<String, Object>();
         LinkedList<Question> questions = new LinkedList<Question>();
+        //查询试卷结构
         PaperStruct paperStruct = paperStructRepo.findOne(genPaperDto.getPaperStructId());
         PaperContext paperContext = new PaperContext(paperStruct, genPaperDto.getConditions());
         List<UnitContext> unitContexts = new LinkedList<UnitContext>();
@@ -87,10 +88,17 @@ public class GenPaperService {
             List<PaperDetailUnit> unitList = unitRepo.findByPaperOrderByNumber(oldPaper);
             for (PaperDetailUnit unit : unitList) {
                 Question question = unit.getQuestion();
-                question.setQuesName(unit.getPaperDetail().getName());
+                //根据questionId查询题库中大题来源
+                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;
+                	}
+                }
                 questions.add(question);
             }
-
         }
         Collections.shuffle(questions);
         int maxLoopCount = questions.size() * 2;