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