|
@@ -52,13 +52,16 @@ public class ExtractConfigServiceImpl implements ExtractConfigService {
|
|
private PaperDetailUnitService paperDetailUnitService;
|
|
private PaperDetailUnitService paperDetailUnitService;
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
- PaperService paperService;
|
|
|
|
|
|
+ private PaperService paperService;
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
- PaperRepo paperRepo;
|
|
|
|
|
|
+ private PaperRepo paperRepo;
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
- QuesRepo quesRepo;
|
|
|
|
|
|
+ private QuesRepo quesRepo;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private ExamPaperService examPaperService;
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public ExtractConfig findConfig(ExtractConfig condition) {
|
|
public ExtractConfig findConfig(ExtractConfig condition) {
|
|
@@ -86,6 +89,7 @@ public class ExtractConfigServiceImpl implements ExtractConfigService {
|
|
Paper paper = examPaper.getPaper();
|
|
Paper paper = examPaper.getPaper();
|
|
paper = paperRepo.findOne(paper.getId());
|
|
paper = paperRepo.findOne(paper.getId());
|
|
examPaper.setPaper(paper);
|
|
examPaper.setPaper(paper);
|
|
|
|
+ examPaperService.saveExamPaper(examPaper);//保存
|
|
}
|
|
}
|
|
extractConfigRepo.save(extractConfig);
|
|
extractConfigRepo.save(extractConfig);
|
|
}
|
|
}
|
|
@@ -108,6 +112,9 @@ public class ExtractConfigServiceImpl implements ExtractConfigService {
|
|
}
|
|
}
|
|
//获得抽取好的试卷
|
|
//获得抽取好的试卷
|
|
Map<String,Paper> paperMap = this.getExamPaperByProbability(extractConfig.getExamPaperList());
|
|
Map<String,Paper> paperMap = this.getExamPaperByProbability(extractConfig.getExamPaperList());
|
|
|
|
+ if(paperMap.isEmpty()){
|
|
|
|
+ throw new RuntimeException("抽取试卷失败");
|
|
|
|
+ }
|
|
for (Map.Entry<String, Paper> entry : paperMap.entrySet()) {
|
|
for (Map.Entry<String, Paper> entry : paperMap.entrySet()) {
|
|
String key = entry.getKey();
|
|
String key = entry.getKey();
|
|
//根据原有试卷重新组卷得到新试卷
|
|
//根据原有试卷重新组卷得到新试卷
|
|
@@ -120,7 +127,7 @@ public class ExtractConfigServiceImpl implements ExtractConfigService {
|
|
* 设置map,并保存调卷规则
|
|
* 设置map,并保存调卷规则
|
|
* 如果已经设置过了,就不再设置
|
|
* 如果已经设置过了,就不再设置
|
|
*/
|
|
*/
|
|
- if(extractConfig.getIfFinish()==null){
|
|
|
|
|
|
+ if(extractConfig.getIfFinish()==null||extractConfig.getIfFinish()==0){
|
|
extractConfig.setFinishedPaperIdMap(finishedPaperIdMap);
|
|
extractConfig.setFinishedPaperIdMap(finishedPaperIdMap);
|
|
extractConfig.setIfFinish((short)1);
|
|
extractConfig.setIfFinish((short)1);
|
|
extractConfigRepo.save(extractConfig);
|
|
extractConfigRepo.save(extractConfig);
|
|
@@ -192,14 +199,16 @@ public class ExtractConfigServiceImpl implements ExtractConfigService {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- Set<String> keys = examPaperMap.keySet();
|
|
|
|
- Iterator<String> it = keys.iterator();
|
|
|
|
- while (it.hasNext()) {
|
|
|
|
- String key = it.next();
|
|
|
|
- Paper paper = this.getPaperByProbability(examPaperMap.get(key));
|
|
|
|
- //不能用原来的paper对象,否则examPaperList中的paper对象会被覆盖
|
|
|
|
- Paper newPaper =paperRepo.findOne(paper.getId());
|
|
|
|
- paperByTypeMap.put(key,newPaper);
|
|
|
|
|
|
+ if(examPaperMap!=null){
|
|
|
|
+ Set<String> keys = examPaperMap.keySet();
|
|
|
|
+ Iterator<String> it = keys.iterator();
|
|
|
|
+ while (it.hasNext()) {
|
|
|
|
+ String key = it.next();
|
|
|
|
+ Paper paper = this.getPaperByProbability(examPaperMap.get(key));
|
|
|
|
+ //不能用原来的paper对象,否则examPaperList中的paper对象会被覆盖
|
|
|
|
+ Paper newPaper =paperRepo.findOne(paper.getId());
|
|
|
|
+ paperByTypeMap.put(key,newPaper);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
return paperByTypeMap;
|
|
return paperByTypeMap;
|
|
}
|
|
}
|