weiwenhai 6 rokov pred
rodič
commit
358602e415

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

@@ -424,7 +424,11 @@ public class GenPaperService {
     			//计算所有题目数量
     			int questionSum = countQuestions(unitList);
     			Paper paper = paperRepo.findOne(paperId);
-    			if(needNumber>questionSum){
+    			if(needNumber>questionSum || needNumber == 0){
+    				if(needNumber == 0){
+    					paperMsgMap.put("msg", "\""+paper.getName()+"\"试卷,组卷数量不能为0");
+                        return paperMsgMap;
+    				}
     				paperMsgMap.put("msg", "\""+ paper.getName()+"\"试卷,题源不够");
                     return paperMsgMap;
     			}
@@ -658,6 +662,9 @@ public class GenPaperService {
     	for(String name:map.keySet()) {
     		List<PaperDetailUnit> units = map.get(name);
     		for(PaperDetailUnit unit:units){
+    			if(unit.getQuestion().getScore() == null){
+    				unit.setScore(0d);
+    			}
     			if(unit.getQuestion().getDifficultyDegree() == null){
     				unit.getQuestion().setDifficultyDegree(0.5);
     			}
@@ -684,7 +691,7 @@ public class GenPaperService {
     		paperDetail = paperDetailRepo.save(paperDetail);
     		List<PaperDetailUnit> units = map.get(paperDetail.getName());
     		for(int j=0;j<units.size();j++){
-    			if (units.get(j).getQuestion() != null 
+    			if (units.get(j).getQuestion() != null
                 		&& units.get(j).getQuestion().getSubQuestions() != null
                             && units.get(j).getQuestion().getSubQuestions().size() > 0) {
                     nestQusNum += units.get(j).getQuestion().getSubQuestions().size() - 1;