|
@@ -153,9 +153,10 @@ public class PaperProviderServiceImpl implements PaperProviderService{
|
|
paperDetailUnit.setCreator(paper.getCreator());
|
|
paperDetailUnit.setCreator(paper.getCreator());
|
|
paperDetailUnit.setPaper(paper);
|
|
paperDetailUnit.setPaper(paper);
|
|
paperDetailUnit.setPaperType(PaperType.GENERATE);
|
|
paperDetailUnit.setPaperType(PaperType.GENERATE);
|
|
- if(!StringUtils.isBlank(map.get(questions.get(i).getId()).getScore()+"")){
|
|
|
|
- paperDetailUnit.setScore(map.get(questions.get(i).getId()).getScore());
|
|
|
|
|
|
+ if(StringUtils.isBlank(map.get(questions.get(i).getId()).getScore()+"")){
|
|
|
|
+ throw new StatusException("Q-014157", questions.get(i).getId() + "分数未设置");
|
|
}
|
|
}
|
|
|
|
+ paperDetailUnit.setScore(map.get(questions.get(i).getId()).getScore());
|
|
if(!StringUtils.isBlank(map.get(questions.get(i).getId()).getTimeLimit()+"")){
|
|
if(!StringUtils.isBlank(map.get(questions.get(i).getId()).getTimeLimit()+"")){
|
|
paperDetailUnit.setTimeLimit(map.get(questions.get(i).getId()).getTimeLimit());
|
|
paperDetailUnit.setTimeLimit(map.get(questions.get(i).getId()).getTimeLimit());
|
|
}
|
|
}
|
|
@@ -184,57 +185,43 @@ public class PaperProviderServiceImpl implements PaperProviderService{
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public String examPaper(String orgId, String paperId, Long examId, String extractConfigId) {
|
|
|
|
- if(StringUtils.isBlank(extractConfigId)){
|
|
|
|
- ExtractConfig extractConfig = new ExtractConfig();
|
|
|
|
- extractConfig.setExamId(examId);
|
|
|
|
- extractConfig.setCourseCode("K12");
|
|
|
|
- extractConfig.setOrgId(orgId);
|
|
|
|
- ExtractConfig tempConfig = extractConfigService.findConfig(extractConfig);
|
|
|
|
- if(tempConfig != null){
|
|
|
|
- throw new StatusException("Q-014195", "考卷关联对象已经生成!");
|
|
|
|
- }else {
|
|
|
|
- //查询试卷对象
|
|
|
|
- Paper paper = paperRepo.findOne(paperId);
|
|
|
|
- //初始化默认课程
|
|
|
|
- Course course = new Course();
|
|
|
|
- course.setId("k12");
|
|
|
|
- course.setCode("k12");
|
|
|
|
- course.setName("k12");
|
|
|
|
- course.setLevel("ALL");
|
|
|
|
- course.setOrgId(orgId);
|
|
|
|
- course.setCreateTime(CommonUtils.getCurDateTime());
|
|
|
|
- course.setEnable("true");
|
|
|
|
- extractConfig.setCourse(course);
|
|
|
|
- extractConfig.setIfFinish((short)0);
|
|
|
|
- ExamPaper examPaper = new ExamPaper();
|
|
|
|
- examPaper.setId(null);
|
|
|
|
- examPaper.setGroupCode("K");
|
|
|
|
- examPaper.setWeight(100);
|
|
|
|
- examPaper.setPaper(paper);
|
|
|
|
- List<ExamPaper> examPaperList = new ArrayList<ExamPaper>();
|
|
|
|
- examPaperList.add(examPaper);
|
|
|
|
- extractConfig.setExamPaperList(examPaperList);
|
|
|
|
- extractConfig.setScrambling_the_option_order((short)0);
|
|
|
|
- extractConfig.setScrambling_the_question_order((short)0);
|
|
|
|
- }
|
|
|
|
- extractConfig = extractConfigRepo.save(extractConfig);
|
|
|
|
- return extractConfig.getId();
|
|
|
|
- }else {
|
|
|
|
- ExtractConfig extractConfig = extractConfigRepo.findOne(extractConfigId);
|
|
|
|
- if(extractConfig == null){
|
|
|
|
- throw new StatusException("Q-Q-014225", "考卷关联对象不存在");
|
|
|
|
- }
|
|
|
|
- List<ExamPaper> examPaperList = extractConfig.getExamPaperList();
|
|
|
|
- if(examPaperList != null && examPaperList.size()>0){
|
|
|
|
- ExamPaper examPaper = examPaperList.get(0);
|
|
|
|
- //查询试卷对象
|
|
|
|
- Paper paper = paperRepo.findOne(paperId);
|
|
|
|
- examPaper.setPaper(paper);
|
|
|
|
- }
|
|
|
|
- extractConfigRepo.save(extractConfig);
|
|
|
|
- return extractConfig.getId();
|
|
|
|
|
|
+ public String examPaper(String orgId, String paperId, Long examId) {
|
|
|
|
+ ExtractConfig extractConfig = new ExtractConfig();
|
|
|
|
+ extractConfig.setExamId(examId);
|
|
|
|
+ extractConfig.setCourseCode("K12");
|
|
|
|
+ extractConfig.setOrgId(orgId);
|
|
|
|
+ ExtractConfig tempConfig = extractConfigService.findConfig(extractConfig);
|
|
|
|
+ if(tempConfig != null){
|
|
|
|
+ extractConfigRepo.delete(tempConfig);
|
|
|
|
+ }
|
|
|
|
+ //查询试卷对象
|
|
|
|
+ Paper paper = paperRepo.findOne(paperId);
|
|
|
|
+ if(paper == null){
|
|
|
|
+ throw new StatusException("Q-014200", "paper is null");
|
|
}
|
|
}
|
|
|
|
+ //初始化默认课程
|
|
|
|
+ Course course = new Course();
|
|
|
|
+ course.setId("k12");
|
|
|
|
+ course.setCode("k12");
|
|
|
|
+ course.setName("k12");
|
|
|
|
+ course.setLevel("ALL");
|
|
|
|
+ course.setOrgId(orgId);
|
|
|
|
+ course.setCreateTime(CommonUtils.getCurDateTime());
|
|
|
|
+ course.setEnable("true");
|
|
|
|
+ extractConfig.setCourse(course);
|
|
|
|
+ extractConfig.setIfFinish((short)0);
|
|
|
|
+ ExamPaper examPaper = new ExamPaper();
|
|
|
|
+ examPaper.setId(null);
|
|
|
|
+ examPaper.setGroupCode("K");
|
|
|
|
+ examPaper.setWeight(100);
|
|
|
|
+ examPaper.setPaper(paper);
|
|
|
|
+ List<ExamPaper> examPaperList = new ArrayList<ExamPaper>();
|
|
|
|
+ examPaperList.add(examPaper);
|
|
|
|
+ extractConfig.setExamPaperList(examPaperList);
|
|
|
|
+ extractConfig.setScrambling_the_option_order((short)0);
|
|
|
|
+ extractConfig.setScrambling_the_question_order((short)0);
|
|
|
|
+ extractConfig = extractConfigRepo.save(extractConfig);
|
|
|
|
+ return extractConfig.getId();
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|