|
@@ -1,6 +1,7 @@
|
|
package cn.com.qmth.examcloud.core.oe.admin.service.impl;
|
|
package cn.com.qmth.examcloud.core.oe.admin.service.impl;
|
|
|
|
|
|
import cn.com.qmth.examcloud.api.commons.enums.AdminOperateType;
|
|
import cn.com.qmth.examcloud.api.commons.enums.AdminOperateType;
|
|
|
|
+import cn.com.qmth.examcloud.api.commons.enums.CallType;
|
|
import cn.com.qmth.examcloud.api.commons.enums.ExamSpecialSettingsType;
|
|
import cn.com.qmth.examcloud.api.commons.enums.ExamSpecialSettingsType;
|
|
import cn.com.qmth.examcloud.api.commons.enums.ExamType;
|
|
import cn.com.qmth.examcloud.api.commons.enums.ExamType;
|
|
import cn.com.qmth.examcloud.commons.exception.StatusException;
|
|
import cn.com.qmth.examcloud.commons.exception.StatusException;
|
|
@@ -23,6 +24,8 @@ import cn.com.qmth.examcloud.core.oe.admin.service.bean.uploadfile.FileInfo;
|
|
import cn.com.qmth.examcloud.core.questions.api.ExtractConfigCloudService;
|
|
import cn.com.qmth.examcloud.core.questions.api.ExtractConfigCloudService;
|
|
import cn.com.qmth.examcloud.core.questions.api.request.GetPaperReq;
|
|
import cn.com.qmth.examcloud.core.questions.api.request.GetPaperReq;
|
|
import cn.com.qmth.examcloud.core.questions.api.response.GetPaperResp;
|
|
import cn.com.qmth.examcloud.core.questions.api.response.GetPaperResp;
|
|
|
|
+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.reports.commons.bean.AdminOperateReport;
|
|
import cn.com.qmth.examcloud.reports.commons.bean.AdminOperateReport;
|
|
import cn.com.qmth.examcloud.reports.commons.util.ReportsUtil;
|
|
import cn.com.qmth.examcloud.reports.commons.util.ReportsUtil;
|
|
import cn.com.qmth.examcloud.support.cache.CacheHelper;
|
|
import cn.com.qmth.examcloud.support.cache.CacheHelper;
|
|
@@ -174,6 +177,16 @@ public class OfflineExamServiceImpl implements OfflineExamService {
|
|
return resultList;
|
|
return resultList;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private double parsePaperScore(DefaultPaper defaultPaper) {
|
|
|
|
+ double paperScore = 0d;
|
|
|
|
+ if (org.apache.commons.collections.CollectionUtils.isNotEmpty(defaultPaper.getQuestionGroupList())) {
|
|
|
|
+ for (DefaultQuestionGroup group : defaultPaper.getQuestionGroupList()) {
|
|
|
|
+ paperScore += group.getGroupScore();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return paperScore;
|
|
|
|
+ }
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public void startOfflineExam(Long examStudentId) {
|
|
public void startOfflineExam(Long examStudentId) {
|
|
Check.isNull(examStudentId, "examStudentId不能为空");
|
|
Check.isNull(examStudentId, "examStudentId不能为空");
|
|
@@ -188,33 +201,47 @@ public class OfflineExamServiceImpl implements OfflineExamService {
|
|
if (stuClientLoginLimit.getHasValue()) {
|
|
if (stuClientLoginLimit.getHasValue()) {
|
|
stuClientLoginLimitBoolean = Boolean.parseBoolean(stuClientLoginLimit.getValue().toString());
|
|
stuClientLoginLimitBoolean = Boolean.parseBoolean(stuClientLoginLimit.getValue().toString());
|
|
}
|
|
}
|
|
|
|
+
|
|
if (stuClientLoginLimitBoolean) {
|
|
if (stuClientLoginLimitBoolean) {
|
|
throw new StatusException("1001", "系统维护中... ...");
|
|
throw new StatusException("1001", "系统维护中... ...");
|
|
}
|
|
}
|
|
|
|
+
|
|
List<ExamRecordDataEntity> examRecordList = examRecordDataRepo.findByExamStudentId(examStudentId);
|
|
List<ExamRecordDataEntity> examRecordList = examRecordDataRepo.findByExamStudentId(examStudentId);
|
|
if (examRecordList != null && examRecordList.size() > 0) {
|
|
if (examRecordList != null && examRecordList.size() > 0) {
|
|
throw new StatusException("1002", "已经存在examStudentId=" + examStudentId + "的离线考试记录");
|
|
throw new StatusException("1002", "已经存在examStudentId=" + examStudentId + "的离线考试记录");
|
|
}
|
|
}
|
|
|
|
+
|
|
//获取考生信息
|
|
//获取考生信息
|
|
ExamStudentEntity examStudentEntity = examStudentRepo.findByExamStudentId(examStudentId);
|
|
ExamStudentEntity examStudentEntity = examStudentRepo.findByExamStudentId(examStudentId);
|
|
ExamStudentBean bean = of(examStudentEntity);
|
|
ExamStudentBean bean = of(examStudentEntity);
|
|
|
|
+
|
|
//检查并获取课程信息
|
|
//检查并获取课程信息
|
|
CourseCacheBean courseBean = checkCourse(bean);
|
|
CourseCacheBean courseBean = checkCourse(bean);
|
|
|
|
+
|
|
//检查并获取考试信息
|
|
//检查并获取考试信息
|
|
ExamSettingsCacheBean examBean = checkExam(bean);
|
|
ExamSettingsCacheBean examBean = checkExam(bean);
|
|
- //获取题库试卷结构(由于存在随机抽卷,所以不能缓存 )
|
|
|
|
|
|
+
|
|
|
|
+ //获取题库试卷结构
|
|
GetPaperReq getPaperReq = new GetPaperReq();
|
|
GetPaperReq getPaperReq = new GetPaperReq();
|
|
getPaperReq.setExamId(examStudentEntity.getExamId());
|
|
getPaperReq.setExamId(examStudentEntity.getExamId());
|
|
getPaperReq.setCourseCode(courseBean.getCode());
|
|
getPaperReq.setCourseCode(courseBean.getCode());
|
|
getPaperReq.setGroupCode(examStudentEntity.getPaperType());
|
|
getPaperReq.setGroupCode(examStudentEntity.getPaperType());
|
|
GetPaperResp getPaperResp = extractConfigCloudService.getPaper(getPaperReq);
|
|
GetPaperResp getPaperResp = extractConfigCloudService.getPaper(getPaperReq);
|
|
|
|
|
|
|
|
+ // 是否采用千人千卷规则
|
|
|
|
+ boolean randomPaper = CallType.RANDOM_PAPER.name().equals(examBean.getCallType());
|
|
|
|
+
|
|
|
|
+ DefaultPaper defaultPaper = getPaperResp.getDefaultPaper();
|
|
|
|
+ double paperScore = this.parsePaperScore(defaultPaper);
|
|
|
|
+
|
|
//生成考试记录
|
|
//生成考试记录
|
|
- ExamRecordDataEntity examRecordData = examRecordDataService.createOfflineExamRecordData(bean,
|
|
|
|
- examBean, courseBean, getPaperResp.getPaperId(),
|
|
|
|
- null, getPaperResp.getDefaultPaper().getFullyObjective());
|
|
|
|
|
|
+ ExamRecordDataEntity examRecordData = examRecordDataService.createOfflineExamRecordData(
|
|
|
|
+ bean, examBean, courseBean, getPaperResp.getPaperId(), defaultPaper.getFullyObjective(),
|
|
|
|
+ randomPaper, paperScore);
|
|
|
|
+
|
|
//生成分数
|
|
//生成分数
|
|
examScoreService.createExamScoreWithOffline(examRecordData.getId());
|
|
examScoreService.createExamScoreWithOffline(examRecordData.getId());
|
|
|
|
+
|
|
//更新考生
|
|
//更新考生
|
|
examStudentRepo.updateExamStudentFinished(examStudentId);
|
|
examStudentRepo.updateExamStudentFinished(examStudentId);
|
|
}
|
|
}
|