|
@@ -7,6 +7,7 @@
|
|
|
|
|
|
package cn.com.qmth.examcloud.exchange.outer.service.impl;
|
|
|
|
|
|
+import cn.com.qmth.examcloud.commons.exception.StatusException;
|
|
|
import cn.com.qmth.examcloud.core.oe.admin.api.ExamCourseCloudService;
|
|
|
import cn.com.qmth.examcloud.core.oe.admin.api.bean.ExamCourseBean;
|
|
|
import cn.com.qmth.examcloud.core.oe.admin.api.request.GetExamCourseReq;
|
|
@@ -50,37 +51,36 @@ public class OutletPaperStructServiceImpl implements OutletPaperStructService {
|
|
|
*/
|
|
|
@Override
|
|
|
public List<OuterQuestionBean> getPaperStructQuestions(Long examId, String courseCode, QuestionCategory questionCategory) {
|
|
|
- try {
|
|
|
- // 获取题库调卷规则
|
|
|
- ExtractConfigCacheBean extractConfig = CacheHelper.getExtractConfig(examId, courseCode);
|
|
|
- if (extractConfig == null || CollectionUtils.isEmpty(extractConfig.getDetails())) {
|
|
|
- // 调卷规则不存在
|
|
|
- return new ArrayList<>();
|
|
|
- }
|
|
|
+ // 获取题库调卷规则
|
|
|
+ ExtractConfigCacheBean extractConfig = CacheHelper.getExtractConfig(examId, courseCode);
|
|
|
+ if (extractConfig == null || CollectionUtils.isEmpty(extractConfig.getDetails())) {
|
|
|
+ // 调卷规则不存在
|
|
|
+ return new ArrayList<>();
|
|
|
+ }
|
|
|
|
|
|
- // 默认选取调卷规则中的任意一份试卷
|
|
|
- ExtractConfigDetailCacheBean examPaper = extractConfig.getDetails().get(0);
|
|
|
- log.info(examPaper.getPaperId() + " - " + examPaper.getGroupCode());
|
|
|
+ //需求调整20200904:考试下某课程存在多套试卷时,直接给出错误提示,101444这个错误码有外部使用,不要随便修改
|
|
|
+ if (extractConfig.getDetails().size() > 1) {
|
|
|
+ throw new StatusException("101444", "当前课程下存在多套试卷");
|
|
|
+ }
|
|
|
|
|
|
- // 获取当前的试卷结构
|
|
|
- ExtractConfigPaperCacheBean extractConfigPaper = CacheHelper.getExtractConfigPaper(examId, courseCode, examPaper.getGroupCode(), examPaper.getPaperId());
|
|
|
- List<DefaultQuestionGroup> questionGroupList = extractConfigPaper.getDefaultPaper().getQuestionGroupList();
|
|
|
+ // 默认选取调卷规则中的任意一份试卷
|
|
|
+ ExtractConfigDetailCacheBean examPaper = extractConfig.getDetails().get(0);
|
|
|
+ log.info(examPaper.getPaperId() + " - " + examPaper.getGroupCode());
|
|
|
|
|
|
- if (QuestionCategory.SUBJECTIVE.equals(questionCategory)) {
|
|
|
- return this.parseSubjectiveQuestions(questionGroupList, examPaper.getGroupCode());
|
|
|
- }
|
|
|
+ // 获取当前的试卷结构
|
|
|
+ ExtractConfigPaperCacheBean extractConfigPaper = CacheHelper.getExtractConfigPaper(examId, courseCode, examPaper.getGroupCode(), examPaper.getPaperId());
|
|
|
+ List<DefaultQuestionGroup> questionGroupList = extractConfigPaper.getDefaultPaper().getQuestionGroupList();
|
|
|
|
|
|
- if (QuestionCategory.OBJECTIVE.equals(questionCategory)) {
|
|
|
- return this.parseObjectiveQuestions(questionGroupList, examPaper.getGroupCode());
|
|
|
- }
|
|
|
-
|
|
|
- //默认返回全部
|
|
|
- return this.parseQuestions(questionGroupList, examPaper.getGroupCode());
|
|
|
+ if (QuestionCategory.SUBJECTIVE.equals(questionCategory)) {
|
|
|
+ return this.parseSubjectiveQuestions(questionGroupList, examPaper.getGroupCode());
|
|
|
+ }
|
|
|
|
|
|
- } catch (Exception e) {
|
|
|
- log.error(e.getMessage(), e);
|
|
|
- return new ArrayList<>();
|
|
|
+ if (QuestionCategory.OBJECTIVE.equals(questionCategory)) {
|
|
|
+ return this.parseObjectiveQuestions(questionGroupList, examPaper.getGroupCode());
|
|
|
}
|
|
|
+
|
|
|
+ //默认返回全部
|
|
|
+ return this.parseQuestions(questionGroupList, examPaper.getGroupCode());
|
|
|
}
|
|
|
|
|
|
private List<OuterQuestionBean> parseSubjectiveQuestions(List<DefaultQuestionGroup> questionGroupList, String paperType) {
|