|
@@ -9,19 +9,22 @@ import cn.com.qmth.examcloud.core.oe.admin.api.request.GetPagedToBeMarkExamRecor
|
|
|
import cn.com.qmth.examcloud.core.oe.admin.api.response.GetPagedToBeMarkExamRecordResp;
|
|
|
import cn.com.qmth.examcloud.exchange.outer.api.ExamQuestionOuterService;
|
|
|
import cn.com.qmth.examcloud.exchange.outer.api.bean.*;
|
|
|
+import cn.com.qmth.examcloud.exchange.outer.api.request.OuterGetPaperStructReq;
|
|
|
import cn.com.qmth.examcloud.exchange.outer.api.request.OuterGetQuestionAnswerReq;
|
|
|
import cn.com.qmth.examcloud.exchange.outer.api.request.OuterGetSubjectivePaperStructReq;
|
|
|
import cn.com.qmth.examcloud.exchange.outer.api.request.OuterGetSubjectiveQuestionReq;
|
|
|
-import cn.com.qmth.examcloud.exchange.outer.api.response.OuterGetQuestionAnswerResp;
|
|
|
-import cn.com.qmth.examcloud.exchange.outer.api.response.OuterGetScoreQueueTopResp;
|
|
|
-import cn.com.qmth.examcloud.exchange.outer.api.response.OuterGetSubjectivePaperStructResp;
|
|
|
-import cn.com.qmth.examcloud.exchange.outer.api.response.OuterGetSubjectiveQuestionResp;
|
|
|
+import cn.com.qmth.examcloud.exchange.outer.api.response.*;
|
|
|
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.DefaultPaper;
|
|
|
+import cn.com.qmth.examcloud.question.commons.core.paper.DefaultQuestionGroup;
|
|
|
+import cn.com.qmth.examcloud.question.commons.core.paper.DefaultQuestionStructureWrapper;
|
|
|
+import cn.com.qmth.examcloud.question.commons.core.paper.DefaultQuestionUnitWrapper;
|
|
|
import cn.com.qmth.examcloud.question.commons.core.question.AnswerType;
|
|
|
import cn.com.qmth.examcloud.question.commons.core.question.QuestionType;
|
|
|
import cn.com.qmth.examcloud.support.cache.CacheHelper;
|
|
|
+import cn.com.qmth.examcloud.support.cache.bean.ExtractConfigPaperCacheBean;
|
|
|
import cn.com.qmth.examcloud.support.cache.bean.QuestionAnswerCacheBean;
|
|
|
import cn.com.qmth.examcloud.support.helper.ExamCacheTransferHelper;
|
|
|
import cn.com.qmth.examcloud.web.support.ControllerSupport;
|
|
@@ -183,6 +186,89 @@ public class ExamQuestionOuterServiceProvider extends ControllerSupport implemen
|
|
|
return resp;
|
|
|
}
|
|
|
|
|
|
+ @ApiOperation(value = "获取试卷结构(题库中的原始试卷结构)", httpMethod = "POST")
|
|
|
+ @ApiResponses({@ApiResponse(code = 200, message = "成功", response = OuterGetQuestionAnswerResp.class),
|
|
|
+ @ApiResponse(code = 500, message = "系统异常(异常信息见响应体)", response = StatusResponse.class)})
|
|
|
+ @PostMapping("/getPaperStruct")
|
|
|
+ @Override
|
|
|
+ public OuterGetPaperStructResp getPaperStruct(@RequestBody OuterGetPaperStructReq req) {
|
|
|
+ if (null == req.getExamId()) {
|
|
|
+ throw new StatusException("103001", "考试记录id不允许为空");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (null == req.getCourseCode()) {
|
|
|
+ throw new StatusException("103002", "课程代码不允许为空");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isNullOrEmpty(req.getPaperType())) {
|
|
|
+ throw new StatusException("103003", "试卷类型不允许为空");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isNullOrEmpty(req.getBasePaperId())) {
|
|
|
+ throw new StatusException("103004", "原始试卷id不允许为空");
|
|
|
+ }
|
|
|
+
|
|
|
+ ExtractConfigPaperCacheBean extractConfigPaper = CacheHelper.getExtractConfigPaper(req.getExamId(),
|
|
|
+ req.getCourseCode(), req.getPaperType(), req.getBasePaperId());
|
|
|
+
|
|
|
+ OuterGetPaperStructResp resp = new OuterGetPaperStructResp();
|
|
|
+ if (null != extractConfigPaper.getDefaultPaper()) {
|
|
|
+ resp.setDefaultPaper(transferPaperFrom(extractConfigPaper.getDefaultPaper()));
|
|
|
+ }
|
|
|
+
|
|
|
+ return resp;
|
|
|
+ }
|
|
|
+
|
|
|
+ private DefaultPaperBean transferPaperFrom(DefaultPaper defaultPaper) {
|
|
|
+ DefaultPaperBean defaultPaperBean = new DefaultPaperBean();
|
|
|
+ defaultPaperBean.setFullyObjective(defaultPaper.getFullyObjective());
|
|
|
+ defaultPaperBean.setName(defaultPaper.getName());
|
|
|
+
|
|
|
+ List<DefaultQuestionGroup> qgList = defaultPaper.getQuestionGroupList();
|
|
|
+ List<DefaultQuestionGroupBean> qgBeanList = new ArrayList<>();
|
|
|
+ for (DefaultQuestionGroup dqg : qgList) {
|
|
|
+ DefaultQuestionGroupBean dqgBean = new DefaultQuestionGroupBean();
|
|
|
+ dqgBean.setGroupName(dqg.getGroupName());
|
|
|
+ dqgBean.setGroupScore(dqg.getGroupScore());
|
|
|
+
|
|
|
+ List<DefaultQuestionStructureWrapper> qwList = dqg.getQuestionWrapperList();
|
|
|
+ List<DefaultQuestionStructureWrapperBean> qwBeanList = new ArrayList<>();
|
|
|
+ for (DefaultQuestionStructureWrapper qw : qwList) {
|
|
|
+ DefaultQuestionStructureWrapperBean qwBean = new DefaultQuestionStructureWrapperBean();
|
|
|
+ qwBean.setQuestionId(qw.getQuestionId());
|
|
|
+ qwBean.setVersion(qw.getVersion());
|
|
|
+ qwBean.setQuestionScore(qw.getQuestionScore());
|
|
|
+ qwBean.setLimitedPlayTimes(qw.getLimitedPlayTimes());
|
|
|
+ qwBean.setPlayedTimes(qw.getPlayedTimes());
|
|
|
+ qwBean.setTimeLimit(qw.getTimeLimit());
|
|
|
+
|
|
|
+ List<DefaultQuestionUnitWrapper> quwList = qw.getQuestionUnitWrapperList();
|
|
|
+ List<DefaultQuestionUnitWrapperBean> quwBeanList = new ArrayList<>();
|
|
|
+ for (DefaultQuestionUnitWrapper quw : quwList) {
|
|
|
+ DefaultQuestionUnitWrapperBean quwBean = new DefaultQuestionUnitWrapperBean();
|
|
|
+ quwBean.setOptionPermutation(quw.getOptionPermutation());
|
|
|
+ quwBean.setQuestionScore(quw.getQuestionScore());
|
|
|
+ quwBean.setQuestionType(quw.getQuestionType() == null ? null : quw.getQuestionType().name());
|
|
|
+ quwBean.setAnswerType(quw.getAnswerType() == null ? null : quw.getAnswerType().name());
|
|
|
+
|
|
|
+ quwBeanList.add(quwBean);
|
|
|
+ }
|
|
|
+
|
|
|
+ qwBean.setQuestionUnitWrapperList(quwBeanList);
|
|
|
+
|
|
|
+ qwBeanList.add(qwBean);
|
|
|
+ }
|
|
|
+
|
|
|
+ dqgBean.setQuestionWrapperList(qwBeanList);
|
|
|
+
|
|
|
+ qgBeanList.add(dqgBean);
|
|
|
+ }
|
|
|
+
|
|
|
+ defaultPaperBean.setQuestionGroupList(qgBeanList);
|
|
|
+
|
|
|
+ return defaultPaperBean;
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* 构造满足条件的考试记录集合
|