|
@@ -0,0 +1,462 @@
|
|
|
+package cn.com.qmth.examcloud.core.oe.student.service.impl;
|
|
|
+
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.Collections;
|
|
|
+import java.util.Date;
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.HashSet;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+import java.util.Random;
|
|
|
+import java.util.Set;
|
|
|
+
|
|
|
+import org.apache.commons.collections.CollectionUtils;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.slf4j.Logger;
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
+
|
|
|
+import cn.com.qmth.examcloud.api.commons.enums.ExamSpecialSettingsType;
|
|
|
+import cn.com.qmth.examcloud.api.commons.security.bean.User;
|
|
|
+import cn.com.qmth.examcloud.commons.exception.StatusException;
|
|
|
+import cn.com.qmth.examcloud.core.basic.api.bean.CourseBean;
|
|
|
+import cn.com.qmth.examcloud.core.oe.student.base.enums.ExamProperties;
|
|
|
+import cn.com.qmth.examcloud.core.oe.student.base.helper.ExamCacheTransferHelper;
|
|
|
+import cn.com.qmth.examcloud.core.oe.student.base.utils.CommonUtil;
|
|
|
+import cn.com.qmth.examcloud.core.oe.student.base.utils.QuestionTypeUtil;
|
|
|
+import cn.com.qmth.examcloud.core.oe.student.bean.StartExamInfo;
|
|
|
+import cn.com.qmth.examcloud.core.oe.student.dao.entity.ExamRecordDataEntity;
|
|
|
+import cn.com.qmth.examcloud.core.oe.student.service.ExamControlService;
|
|
|
+import cn.com.qmth.examcloud.core.oe.student.service.ExamRecordDataService;
|
|
|
+import cn.com.qmth.examcloud.core.oe.student.service.ExamRecordPaperStructService;
|
|
|
+import cn.com.qmth.examcloud.core.oe.student.service.ExamRecordQuestionsService;
|
|
|
+import cn.com.qmth.examcloud.core.oe.student.service.ExamingSessionService;
|
|
|
+import cn.com.qmth.examcloud.examwork.api.bean.ExamBean;
|
|
|
+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.QuestionType;
|
|
|
+import cn.com.qmth.examcloud.reports.commons.bean.OnlineExamStudentReport;
|
|
|
+import cn.com.qmth.examcloud.reports.commons.util.ReportsUtil;
|
|
|
+import cn.com.qmth.examcloud.support.cache.CacheHelper;
|
|
|
+import cn.com.qmth.examcloud.support.cache.bean.ExamOrgSettingsCacheBean;
|
|
|
+import cn.com.qmth.examcloud.support.cache.bean.ExamPropertyCacheBean;
|
|
|
+import cn.com.qmth.examcloud.support.cache.bean.ExamStudentSettingsCacheBean;
|
|
|
+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 cn.com.qmth.examcloud.support.cache.bean.SysPropertyCacheBean;
|
|
|
+import cn.com.qmth.examcloud.support.examing.ExamingSession;
|
|
|
+import cn.com.qmth.examcloud.support.examing.ExamingStatus;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @author chenken
|
|
|
+ * @date 2018年8月13日 下午2:09:08
|
|
|
+ * @company QMTH
|
|
|
+ * @description 在线考试控制服务实现
|
|
|
+ */
|
|
|
+@Service("examControlService")
|
|
|
+public class ExamControlServiceImpl implements ExamControlService {
|
|
|
+
|
|
|
+ private static final Logger log = LoggerFactory.getLogger(ExamControlServiceImpl.class);
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ExamRecordPaperStructService examRecordPaperStructService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ExamingSessionService examingSessionService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ExamRecordDataService examRecordDataService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ExamRecordQuestionsService examRecordQuestionsService;
|
|
|
+
|
|
|
+ @Transactional
|
|
|
+ @Override
|
|
|
+ public StartExamInfo startExam(Long examStudentId, User user) {
|
|
|
+ Long studentId = user.getUserId();
|
|
|
+ long st = System.currentTimeMillis();
|
|
|
+ SysPropertyCacheBean stuClientLoginLimit = CacheHelper.getSysProperty("STU_CLIENT_LOGIN_LIMIT");
|
|
|
+ Boolean stuClientLoginLimitBoolean = false;
|
|
|
+ if (stuClientLoginLimit.getHasValue()) {
|
|
|
+ stuClientLoginLimitBoolean = Boolean.valueOf(stuClientLoginLimit.getValue().toString());
|
|
|
+ }
|
|
|
+ if (stuClientLoginLimitBoolean) {
|
|
|
+ throw new StatusException("1001", "系统维护中... ...");
|
|
|
+ }
|
|
|
+
|
|
|
+ long startTime = System.currentTimeMillis();
|
|
|
+ if (log.isDebugEnabled()) {
|
|
|
+ log.debug("1 获取考生信息耗时:" + (System.currentTimeMillis() - startTime) + " ms");
|
|
|
+ }
|
|
|
+ // 检查redis session
|
|
|
+ ExamingSession examingSession = examingSessionService.getExamingSession(studentId);
|
|
|
+ if (examingSession == null) {
|
|
|
+ throw new StatusException("1002", "未找到考试会话信息");
|
|
|
+ }
|
|
|
+ if (ExamingStatus.FORMAL.equals(examingSession.getExamingStatus())) {
|
|
|
+ throw new StatusException("1003", "已经有考试中的科目");
|
|
|
+ }
|
|
|
+
|
|
|
+ // 检查并获取考试信息
|
|
|
+ startTime = System.currentTimeMillis();
|
|
|
+ ExamBean examBean = checkExam(examingSession.getExamId(), examingSession.getStudentId());
|
|
|
+ if (log.isDebugEnabled()) {
|
|
|
+ log.debug("2 检查并获取考试信息耗时:" + (System.currentTimeMillis() - startTime) + " ms");
|
|
|
+ }
|
|
|
+
|
|
|
+ // 检查并获取课程信息
|
|
|
+ startTime = System.currentTimeMillis();
|
|
|
+ CourseBean courseBean = checkCourse(examingSession.getCourseId());
|
|
|
+ if (log.isDebugEnabled()) {
|
|
|
+ log.debug("3 检查并获取课程信息耗时:" + (System.currentTimeMillis() - startTime) + " ms");
|
|
|
+ }
|
|
|
+
|
|
|
+ // 获取题库试卷结构(由于存在随机抽卷,所以不能缓存 )
|
|
|
+ startTime = System.currentTimeMillis();
|
|
|
+
|
|
|
+ // 获取题库调卷规则
|
|
|
+ ExtractConfigCacheBean extractConfig = CacheHelper.getExtractConfig(examingSession.getExamId(),
|
|
|
+ courseBean.getCode());
|
|
|
+ // 随机生成试卷
|
|
|
+ Map<String, String> paperTypeMaps = getExamPaperByProbability(extractConfig.getDetails());
|
|
|
+ if (paperTypeMaps.isEmpty()) {
|
|
|
+ throw new StatusException("1006", "生成试卷失败");
|
|
|
+ }
|
|
|
+
|
|
|
+ String paperId = paperTypeMaps.get(examingSession.getPaperType());
|
|
|
+ if (StringUtils.isEmpty(paperId)) {
|
|
|
+ throw new StatusException("1007", "获取试卷失败");
|
|
|
+ }
|
|
|
+
|
|
|
+ // 生成考试记录
|
|
|
+ startTime = System.currentTimeMillis();
|
|
|
+ ExamRecordDataEntity examRecordData = examRecordDataService.createExamRecordData(examingSession, examBean,
|
|
|
+ courseBean, paperId);
|
|
|
+
|
|
|
+ // 如果开启人脸比对,将同步人脸比对结果存储到抓后结果表中
|
|
|
+ Long rootOrgId = examRecordData.getRootOrgId();
|
|
|
+ Long examId = examRecordData.getExamId();
|
|
|
+ // TODO
|
|
|
+ // if (FaceBiopsyHelper.isFaceEnable(rootOrgId, examId, studentId)) {
|
|
|
+ // SaveExamCaptureSyncCompareResultReq req = new
|
|
|
+ // SaveExamCaptureSyncCompareResultReq();
|
|
|
+ // req.setExamRecordDataId(examRecordData.getId());
|
|
|
+ // req.setStudentId(user.getUserId());
|
|
|
+ // examCaptureCloudService.saveExamCaptureSyncCompareResult(req);
|
|
|
+ // }
|
|
|
+
|
|
|
+ if (log.isDebugEnabled()) {
|
|
|
+ log.debug("8 生成考试记录耗时:" + (System.currentTimeMillis() - startTime) + " ms");
|
|
|
+ }
|
|
|
+
|
|
|
+ // 生成试卷结构
|
|
|
+ ExtractConfigPaperCacheBean extractConfigPaper = CacheHelper.getExtractConfigPaper(examingSession.getExamId(),
|
|
|
+ courseBean.getCode(), examingSession.getPaperType(), paperId);
|
|
|
+ if (log.isDebugEnabled()) {
|
|
|
+ log.debug("4 获取题库试卷结构耗时:" + (System.currentTimeMillis() - startTime) + " ms");
|
|
|
+ }
|
|
|
+
|
|
|
+ // 小题乱序,选项乱序
|
|
|
+ startTime = System.currentTimeMillis();
|
|
|
+ reorderPaperStruct(extractConfig, extractConfigPaper);
|
|
|
+ if (log.isDebugEnabled()) {
|
|
|
+ log.debug("5 小题乱序耗时:" + (System.currentTimeMillis() - startTime) + " ms");
|
|
|
+ }
|
|
|
+
|
|
|
+ // 保存考试试卷结构
|
|
|
+ startTime = System.currentTimeMillis();
|
|
|
+ examRecordPaperStructService.saveExamRecordPaperStruct(examRecordData.getId(),
|
|
|
+ extractConfigPaper.getDefaultPaper());
|
|
|
+ if (log.isDebugEnabled()) {
|
|
|
+ log.debug("6 保存考试试卷结构耗时:" + (System.currentTimeMillis() - startTime) + " ms");
|
|
|
+ }
|
|
|
+
|
|
|
+ // 创建考试作答记录
|
|
|
+ startTime = System.currentTimeMillis();
|
|
|
+ examRecordQuestionsService.createExamRecordQuestions(examRecordData.getId(),
|
|
|
+ extractConfigPaper.getDefaultPaper());
|
|
|
+ if (log.isDebugEnabled()) {
|
|
|
+ log.debug("9 创建考试作答记录耗时:" + (System.currentTimeMillis() - startTime) + " ms");
|
|
|
+ }
|
|
|
+
|
|
|
+ // 创建考试会话
|
|
|
+ startTime = System.currentTimeMillis();
|
|
|
+ // TODO
|
|
|
+ // initializeExamRecordSession(originalExamStudent, examRecordData,
|
|
|
+ // examBean);
|
|
|
+ if (log.isDebugEnabled()) {
|
|
|
+ log.debug("11 创建考试会话耗时:" + (System.currentTimeMillis() - startTime) + " ms");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (log.isDebugEnabled()) {
|
|
|
+ log.debug("12 合计 耗时:" + (System.currentTimeMillis() - st) + " ms");
|
|
|
+ }
|
|
|
+ // 在线考生开考打点
|
|
|
+ ReportsUtil.report(
|
|
|
+ new OnlineExamStudentReport(user.getRootOrgId(), user.getUserId(), examBean.getId(), examStudentId));
|
|
|
+ // TODO
|
|
|
+ // return buildStartExamInfo(examRecordData.getId(),
|
|
|
+ // originalExamStudent, examBean, courseBean);
|
|
|
+ return null;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 检查并返回考试 开考条件 1.enable为true 2.开始时间和结束时间判断 3.examLimit为null或false
|
|
|
+ * 4.剩余考试次数>0
|
|
|
+ *
|
|
|
+ * @param examStudentEntity
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private ExamBean checkExam(Long examId, Long studentId) {
|
|
|
+
|
|
|
+ // 学习中心特殊考试配置(是否禁考,开考时间可以特殊设置)
|
|
|
+ ExamBean examBean = ExamCacheTransferHelper.getCachedExam(examId, studentId);
|
|
|
+ // 如果启用了了特殊设置,并且无特殊设置时结束考试 配置 设置为true..且实际未设置特殊设置则不允许考试
|
|
|
+ ExamPropertyCacheBean limitedIfNoSpecialSettings = ExamCacheTransferHelper.getDefaultCachedExamProperty(examId,
|
|
|
+ ExamProperties.LIMITED_IF_NO_SPECIAL_SETTINGS.toString());
|
|
|
+ if (examBean.getSpecialSettingsEnabled() && (limitedIfNoSpecialSettings.getHasValue()
|
|
|
+ && Boolean.valueOf(limitedIfNoSpecialSettings.getValue()))) {
|
|
|
+
|
|
|
+ // 学生特殊设置开启未配置,不允许考试
|
|
|
+ if (examBean.getSpecialSettingsType() == ExamSpecialSettingsType.STUDENT_BASED) {
|
|
|
+ ExamStudentSettingsCacheBean specialSettings = CacheHelper.getExamStudentSettings(examId, studentId);
|
|
|
+ if (!specialSettings.getHasValue()) {
|
|
|
+ throw new StatusException("2001", "考试配置未完成,不允许考试");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 机构特殊设置开启未配置,不允许考试
|
|
|
+ if (examBean.getSpecialSettingsType() == ExamSpecialSettingsType.ORG_BASED) {
|
|
|
+ // 需求调整,所有的组织机构取学生表所关联的orgId
|
|
|
+ Long orgId = CacheHelper.getStudent(studentId).getOrgId();
|
|
|
+ ExamOrgSettingsCacheBean specialSettings = CacheHelper.getExamOrgSettings(examId, orgId);
|
|
|
+ if (!specialSettings.getHasValue()) {
|
|
|
+ throw new StatusException("2002", "考试配置未完成,不允许考试");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!examBean.getEnable() || (examBean.getExamLimit() != null && examBean.getExamLimit())) {
|
|
|
+ throw new StatusException("2003", "暂无考试资格,请与学校老师联系");
|
|
|
+ }
|
|
|
+ if (new Date().before(examBean.getBeginTime())) {
|
|
|
+ throw new StatusException("2004", "考试未开始");
|
|
|
+ }
|
|
|
+ if (examBean.getEndTime().before(new Date())) {
|
|
|
+ throw new StatusException("2005", "本次考试已结束");
|
|
|
+ }
|
|
|
+ return examBean;
|
|
|
+ }
|
|
|
+
|
|
|
+ private CourseBean checkCourse(Long courseId) {
|
|
|
+ CourseBean courseBean = ExamCacheTransferHelper.getCachedCourse(courseId);
|
|
|
+ if (!courseBean.getEnable()) {
|
|
|
+ throw new StatusException("3001", "该课程已被禁用");
|
|
|
+ }
|
|
|
+ return courseBean;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 每个试卷类型取出一套试卷 {A:paperId,B:paperId} A是试卷类型,paperId是A类型下选定的试卷ID
|
|
|
+ */
|
|
|
+ private Map<String, String> getExamPaperByProbability(List<ExtractConfigDetailCacheBean> examPapers) {
|
|
|
+ if (CollectionUtils.isEmpty(examPapers)) {
|
|
|
+ throw new StatusException("4001", "可供抽取的试卷集合为空!");
|
|
|
+ }
|
|
|
+
|
|
|
+ Map<String, List<ExtractConfigDetailCacheBean>> examPaperMaps = new HashMap<>();
|
|
|
+ for (ExtractConfigDetailCacheBean examPaper : examPapers) {
|
|
|
+ if (examPaperMaps.containsKey(examPaper.getGroupCode())) {
|
|
|
+ examPaperMaps.get(examPaper.getGroupCode()).add(examPaper);
|
|
|
+ } else {
|
|
|
+ List<ExtractConfigDetailCacheBean> list = new ArrayList<>();
|
|
|
+ list.add(examPaper);
|
|
|
+ examPaperMaps.put(examPaper.getGroupCode(), list);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ Map<String, String> paperTypeMaps = new HashMap<>();
|
|
|
+ for (Map.Entry<String, List<ExtractConfigDetailCacheBean>> entry : examPaperMaps.entrySet()) {
|
|
|
+ List<ExtractConfigDetailCacheBean> list = examPaperMaps.get(entry.getKey());
|
|
|
+
|
|
|
+ String paperId = this.getPaperByProbability(list);
|
|
|
+ if (StringUtils.isEmpty(paperId)) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ paperTypeMaps.put(entry.getKey(), paperId);
|
|
|
+ }
|
|
|
+
|
|
|
+ return paperTypeMaps;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 根据设定几率取出一套试卷
|
|
|
+ */
|
|
|
+ private String getPaperByProbability(List<ExtractConfigDetailCacheBean> examPapers) {
|
|
|
+ int sum = 0;
|
|
|
+ for (ExtractConfigDetailCacheBean examPaper : examPapers) {
|
|
|
+ sum += examPaper.getWeight();
|
|
|
+ }
|
|
|
+
|
|
|
+ // 从1开始
|
|
|
+ int r = new Random().nextInt(sum) + 1;
|
|
|
+ for (ExtractConfigDetailCacheBean examPaper : examPapers) {
|
|
|
+ r -= examPaper.getWeight();
|
|
|
+ if (r <= 0) {
|
|
|
+ return examPaper.getPaperId();// 选中
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取试卷结构 小题乱序、选项乱序
|
|
|
+ *
|
|
|
+ * @param extractConfig
|
|
|
+ * 调卷规则对象
|
|
|
+ * @param paperStruct
|
|
|
+ * 试卷结构对象
|
|
|
+ */
|
|
|
+ private void reorderPaperStruct(ExtractConfigCacheBean extractConfig, ExtractConfigPaperCacheBean paperStruct) {
|
|
|
+ // 小题乱序
|
|
|
+ if (extractConfig.getSortQuestionOrder() != null && extractConfig.getSortQuestionOrder()) {
|
|
|
+ reorderQuestion(paperStruct.getDefaultPaper());
|
|
|
+ }
|
|
|
+ // 选项乱序
|
|
|
+ if (extractConfig.getSortOptionOrder() != null && extractConfig.getSortOptionOrder()) {
|
|
|
+ reorderOption(paperStruct.getDefaultPaper());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 小题乱序
|
|
|
+ *
|
|
|
+ * @param defaultPaper
|
|
|
+ */
|
|
|
+ private void reorderQuestion(DefaultPaper defaultPaper) {
|
|
|
+ List<DefaultQuestionGroup> defaultQuestionGroupList = defaultPaper.getQuestionGroupList();
|
|
|
+ for (int i = 0; i < defaultQuestionGroupList.size(); i++) {
|
|
|
+ DefaultQuestionGroup defaultQuestionGroup = defaultQuestionGroupList.get(i);
|
|
|
+ if (checkObjectiveQuestionByGroup(defaultQuestionGroup)) {
|
|
|
+ List<DefaultQuestionStructureWrapper> questionStructureWrapperList = defaultQuestionGroup
|
|
|
+ .getQuestionWrapperList();
|
|
|
+ Collections.shuffle(questionStructureWrapperList);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 选项乱序
|
|
|
+ *
|
|
|
+ * @param defaultPaper
|
|
|
+ */
|
|
|
+ private void reorderOption(DefaultPaper defaultPaper) {
|
|
|
+ List<DefaultQuestionGroup> defaultQuestionGroupList = defaultPaper.getQuestionGroupList();
|
|
|
+ // 遍历大题
|
|
|
+ for (int i = 0; i < defaultQuestionGroupList.size(); i++) {
|
|
|
+ DefaultQuestionGroup defaultQuestionGroup = defaultQuestionGroupList.get(i);
|
|
|
+ List<DefaultQuestionStructureWrapper> questionStructureWrapperList = defaultQuestionGroup
|
|
|
+ .getQuestionWrapperList();
|
|
|
+ // 遍历小题
|
|
|
+ for (DefaultQuestionStructureWrapper defaultQuestionStructureWrapper : questionStructureWrapperList) {
|
|
|
+ List<DefaultQuestionUnitWrapper> questionUnitWrapperList = defaultQuestionStructureWrapper
|
|
|
+ .getQuestionUnitWrapperList();
|
|
|
+ // 遍历题单元
|
|
|
+ for (DefaultQuestionUnitWrapper defaultQuestionUnitWrapper : questionUnitWrapperList) {
|
|
|
+ if (QuestionTypeUtil.isChoiceQuestion(defaultQuestionUnitWrapper.getQuestionType())) {
|
|
|
+ Integer[] optionPermutation = defaultQuestionUnitWrapper.getOptionPermutation();
|
|
|
+ defaultQuestionUnitWrapper.setOptionPermutation(CommonUtil.reorderArray(optionPermutation));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 小题乱序条件:一个大题下全是单一的客观题,例如全是单选,全是多选,全是判断 判断一个大题下是否是单一的客观题
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private boolean checkObjectiveQuestionByGroup(DefaultQuestionGroup defaultQuestionGroup) {
|
|
|
+ Set<QuestionType> questionTypes = new HashSet<QuestionType>();
|
|
|
+ List<DefaultQuestionStructureWrapper> questionWrapperList = defaultQuestionGroup.getQuestionWrapperList();
|
|
|
+ for (int i = 0; i < questionWrapperList.size(); i++) {
|
|
|
+ List<DefaultQuestionUnitWrapper> questionUnitWrapperList = questionWrapperList.get(i)
|
|
|
+ .getQuestionUnitWrapperList();
|
|
|
+ if (questionUnitWrapperList.size() > 1) {
|
|
|
+ return false;
|
|
|
+ } else {
|
|
|
+ questionTypes.add(questionUnitWrapperList.get(0).getQuestionType());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (questionTypes.size() > 1) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ QuestionType questionType = questionTypes.iterator().next();
|
|
|
+ if (QuestionTypeUtil.isObjectiveQuestion(questionType)) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ // TODO
|
|
|
+
|
|
|
+ // private StartExamInfo buildStartExamInfo(Long examRecordDataId,
|
|
|
+ // ExamingSession examingSession, ExamBean examBean,
|
|
|
+ // CourseBean courseBean) {
|
|
|
+ // StartExamInfo startExamInfo = new StartExamInfo();
|
|
|
+ // startExamInfo.setExamRecordDataId(examRecordDataId);
|
|
|
+ // startExamInfo.setCourseName(courseBean.getName());
|
|
|
+ // startExamInfo.setDuration(examBean.getDuration());
|
|
|
+ // startExamInfo.setFaceVerifyMinute(getFaceVerifyMinute(examingSession.getRootOrgId(),
|
|
|
+ // examBean.getId(),
|
|
|
+ // examingSession.getOrgId(), examingSession.getStudentId()));
|
|
|
+ // return startExamInfo;
|
|
|
+ // }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 确定活体检测开始分钟数
|
|
|
+ *
|
|
|
+ * @param examId
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ // TODO
|
|
|
+ // private Integer getFaceVerifyMinute(Long rootOrgId, Long examId, Long
|
|
|
+ // orgId, Long studentId) {
|
|
|
+ // // 如果开启了活体检测
|
|
|
+ // if (FaceBiopsyHelper.isFaceVerify(rootOrgId, examId, studentId)) {
|
|
|
+ // // 开始分钟数
|
|
|
+ // String startMinuteStr = ExamCacheTransferHelper
|
|
|
+ // .getCachedExamProperty(examId, studentId,
|
|
|
+ // ExamProperties.FACE_VERIFY_START_MINUTE.name()).getValue();
|
|
|
+ // if (CommonUtil.isBlank(startMinuteStr)) {
|
|
|
+ // throw new
|
|
|
+ // StatusException("ExamControlServiceImpl-getFaceVerifyMinute-001",
|
|
|
+ // ExamProperties.FACE_VERIFY_START_MINUTE.getDesc() + "未设置");
|
|
|
+ // }
|
|
|
+ // Integer faceVerifyStartMinute = Integer.valueOf(startMinuteStr);
|
|
|
+ //
|
|
|
+ // // 结束分钟数
|
|
|
+ // String endMinuteStr = ExamCacheTransferHelper
|
|
|
+ // .getCachedExamProperty(examId, studentId,
|
|
|
+ // ExamProperties.FACE_VERIFY_END_MINUTE.name()).getValue();
|
|
|
+ // if (CommonUtil.isBlank(endMinuteStr)) {
|
|
|
+ // throw new
|
|
|
+ // StatusException("ExamControlServiceImpl-getFaceVerifyMinute-002",
|
|
|
+ // ExamProperties.FACE_VERIFY_END_MINUTE.getDesc() + "未设置");
|
|
|
+ // }
|
|
|
+ // Integer faceVerifyEndMinute = Integer.valueOf(endMinuteStr);
|
|
|
+ // return CommonUtil.calculationRandomNumber(faceVerifyStartMinute,
|
|
|
+ // faceVerifyEndMinute);
|
|
|
+ // }
|
|
|
+ // return null;
|
|
|
+ // }
|
|
|
+}
|