|
@@ -7,13 +7,25 @@
|
|
|
|
|
|
package cn.com.qmth.examcloud.exchange.outer.service.impl;
|
|
|
|
|
|
+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;
|
|
|
+import cn.com.qmth.examcloud.core.oe.admin.api.response.GetExamCourseResp;
|
|
|
import cn.com.qmth.examcloud.exchange.outer.service.OutletPaperStructService;
|
|
|
import cn.com.qmth.examcloud.exchange.outer.service.bean.OuterCourseBean;
|
|
|
import cn.com.qmth.examcloud.exchange.outer.service.bean.OuterQuestionBean;
|
|
|
+import cn.com.qmth.examcloud.question.commons.core.paper.DefaultQuestionGroup;
|
|
|
+import cn.com.qmth.examcloud.support.cache.CacheHelper;
|
|
|
+import cn.com.qmth.examcloud.support.cache.bean.ExtractConfigCacheBean;
|
|
|
+import cn.com.qmth.examcloud.support.cache.bean.ExtractConfigDetailCacheBean;
|
|
|
+import cn.com.qmth.examcloud.support.cache.bean.ExtractConfigPaperCacheBean;
|
|
|
+import org.apache.commons.collections.CollectionUtils;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
|
|
|
@Service("outletPaperStructService")
|
|
@@ -21,6 +33,9 @@ public class OutletPaperStructServiceImpl implements OutletPaperStructService {
|
|
|
|
|
|
private static final Logger log = LoggerFactory.getLogger(OutletPaperStructServiceImpl.class);
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private ExamCourseCloudService examCourseCloudService;
|
|
|
+
|
|
|
/**
|
|
|
* 根据考试和课程获取调卷规则下试卷的试题列表
|
|
|
*
|
|
@@ -30,7 +45,34 @@ public class OutletPaperStructServiceImpl implements OutletPaperStructService {
|
|
|
*/
|
|
|
@Override
|
|
|
public List<OuterQuestionBean> getPaperStructQuestions(Long examId, String courseCode) {
|
|
|
- return null;
|
|
|
+ try {
|
|
|
+ // 获取题库调卷规则
|
|
|
+ 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());
|
|
|
+
|
|
|
+ // 获取当前的试卷结构
|
|
|
+ ExtractConfigPaperCacheBean extractConfigPaper = CacheHelper.getExtractConfigPaper(examId, courseCode, examPaper.getGroupCode(), examPaper.getPaperId());
|
|
|
+ List<DefaultQuestionGroup> questionGroupList = extractConfigPaper.getDefaultPaper().getQuestionGroupList();
|
|
|
+
|
|
|
+ log.info("start setting questions...");
|
|
|
+ List<OuterQuestionBean> questions = new ArrayList<>();
|
|
|
+ for (DefaultQuestionGroup group : questionGroupList) {
|
|
|
+ log.info(group.getGroupName());
|
|
|
+ //todo
|
|
|
+ }
|
|
|
+
|
|
|
+ return questions;
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error(e.getMessage(), e);
|
|
|
+ return new ArrayList<>();
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -41,7 +83,25 @@ public class OutletPaperStructServiceImpl implements OutletPaperStructService {
|
|
|
*/
|
|
|
@Override
|
|
|
public List<OuterCourseBean> getExamCourses(Long examId) {
|
|
|
- return null;
|
|
|
+ try {
|
|
|
+ GetExamCourseReq req = new GetExamCourseReq();
|
|
|
+ req.setExamId(examId);
|
|
|
+ GetExamCourseResp resp = examCourseCloudService.getExamCourses(req);
|
|
|
+
|
|
|
+ List<OuterCourseBean> courses = new ArrayList<>();
|
|
|
+ for (ExamCourseBean bean : resp.getList()) {
|
|
|
+ OuterCourseBean course = new OuterCourseBean();
|
|
|
+ course.setId(bean.getId());
|
|
|
+ course.setCode(bean.getCode());
|
|
|
+ course.setName(bean.getName());
|
|
|
+ courses.add(course);
|
|
|
+ }
|
|
|
+
|
|
|
+ return courses;
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error(e.getMessage(), e);
|
|
|
+ return new ArrayList<>();
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
}
|