|
@@ -1,71 +1,30 @@
|
|
|
package cn.com.qmth.examcloud.core.oe.student.service.impl;
|
|
|
|
|
|
-import java.io.UnsupportedEncodingException;
|
|
|
-import java.net.URLEncoder;
|
|
|
-import java.text.SimpleDateFormat;
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.Collections;
|
|
|
-import java.util.Comparator;
|
|
|
-import java.util.Date;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.HashSet;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Locale;
|
|
|
-import java.util.Map;
|
|
|
-import java.util.Random;
|
|
|
-import java.util.Set;
|
|
|
-import java.util.TimeZone;
|
|
|
-import java.util.concurrent.TimeUnit;
|
|
|
-import java.util.stream.Collectors;
|
|
|
-
|
|
|
-import org.apache.commons.collections.CollectionUtils;
|
|
|
-import org.apache.commons.lang.math.RandomUtils;
|
|
|
-import org.apache.commons.lang3.StringUtils;
|
|
|
-import org.apache.commons.lang3.time.DateUtils;
|
|
|
-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 com.google.common.base.Splitter;
|
|
|
-
|
|
|
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.security.bean.User;
|
|
|
import cn.com.qmth.examcloud.api.commons.security.bean.UserType;
|
|
|
import cn.com.qmth.examcloud.commons.exception.StatusException;
|
|
|
-import cn.com.qmth.examcloud.commons.util.ByteUtil;
|
|
|
-import cn.com.qmth.examcloud.commons.util.JsonUtil;
|
|
|
-import cn.com.qmth.examcloud.commons.util.SHA256;
|
|
|
-import cn.com.qmth.examcloud.commons.util.StringUtil;
|
|
|
import cn.com.qmth.examcloud.commons.util.UUID;
|
|
|
-import cn.com.qmth.examcloud.commons.util.UrlUtil;
|
|
|
-import cn.com.qmth.examcloud.commons.util.Util;
|
|
|
+import cn.com.qmth.examcloud.commons.util.*;
|
|
|
import cn.com.qmth.examcloud.core.oe.admin.api.ExamRecordCloudService;
|
|
|
+import cn.com.qmth.examcloud.core.oe.admin.api.SyncExamDataCloudService;
|
|
|
+import cn.com.qmth.examcloud.core.oe.admin.api.bean.ExamQuestionBean;
|
|
|
+import cn.com.qmth.examcloud.core.oe.admin.api.bean.ExamRecordDataBean;
|
|
|
+import cn.com.qmth.examcloud.core.oe.admin.api.bean.ExamRecordPaperStructBean;
|
|
|
+import cn.com.qmth.examcloud.core.oe.admin.api.bean.ExamRecordQuestionsBean;
|
|
|
import cn.com.qmth.examcloud.core.oe.admin.api.request.GetPartialExamRecordDataReq;
|
|
|
+import cn.com.qmth.examcloud.core.oe.admin.api.request.SyncExamDataReq;
|
|
|
import cn.com.qmth.examcloud.core.oe.admin.api.response.GetPartialExamRecordDataResp;
|
|
|
-import cn.com.qmth.examcloud.support.examing.ExamQuestion;
|
|
|
-import cn.com.qmth.examcloud.support.examing.ExamRecordQuestions;
|
|
|
+import cn.com.qmth.examcloud.core.oe.student.api.bean.StuExamQuestionBean;
|
|
|
+import cn.com.qmth.examcloud.core.oe.student.api.request.GetExamRecordPaperStructReq;
|
|
|
+import cn.com.qmth.examcloud.core.oe.student.api.request.GetExamRecordQuestionsReq;
|
|
|
+import cn.com.qmth.examcloud.core.oe.student.api.response.GetExamRecordPaperStructResp;
|
|
|
+import cn.com.qmth.examcloud.core.oe.student.api.response.GetExamRecordQuestionsResp;
|
|
|
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.CheckExamInProgressInfo;
|
|
|
-import cn.com.qmth.examcloud.core.oe.student.bean.CheckQrCodeInfo;
|
|
|
-import cn.com.qmth.examcloud.core.oe.student.bean.EndExamInfo;
|
|
|
-import cn.com.qmth.examcloud.support.examing.ExamRecordPaperStruct;
|
|
|
-import cn.com.qmth.examcloud.core.oe.student.bean.GetQrCodeReq;
|
|
|
-import cn.com.qmth.examcloud.core.oe.student.bean.GetUpyunSignatureReq;
|
|
|
-import cn.com.qmth.examcloud.core.oe.student.bean.StartExamInfo;
|
|
|
-import cn.com.qmth.examcloud.core.oe.student.bean.UploadedFileAnswerInfo;
|
|
|
-import cn.com.qmth.examcloud.core.oe.student.bean.UpyunSignatureInfo;
|
|
|
-import cn.com.qmth.examcloud.core.oe.student.service.ExamBossService;
|
|
|
-import cn.com.qmth.examcloud.core.oe.student.service.ExamControlService;
|
|
|
-import cn.com.qmth.examcloud.core.oe.student.service.ExamFaceLivenessVerifyService;
|
|
|
-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.core.oe.student.service.FaceBiopsyService;
|
|
|
+import cn.com.qmth.examcloud.core.oe.student.bean.*;
|
|
|
+import cn.com.qmth.examcloud.core.oe.student.service.*;
|
|
|
import cn.com.qmth.examcloud.core.oe.task.api.ExamCaptureCloudService;
|
|
|
import cn.com.qmth.examcloud.core.oe.task.api.request.SaveExamCaptureSyncCompareResultReq;
|
|
|
import cn.com.qmth.examcloud.core.oe.task.api.request.UpdateExamCaptureQueuePriorityReq;
|
|
@@ -81,27 +40,12 @@ import cn.com.qmth.examcloud.reports.commons.bean.OnlineExamStudentReport;
|
|
|
import cn.com.qmth.examcloud.reports.commons.util.ReportsUtil;
|
|
|
import cn.com.qmth.examcloud.support.Constants;
|
|
|
import cn.com.qmth.examcloud.support.cache.CacheHelper;
|
|
|
-import cn.com.qmth.examcloud.support.cache.bean.CourseCacheBean;
|
|
|
-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.ExamSettingsCacheBean;
|
|
|
-import cn.com.qmth.examcloud.support.cache.bean.ExamStudentCacheBean;
|
|
|
-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.StudentCacheBean;
|
|
|
-import cn.com.qmth.examcloud.support.cache.bean.SysPropertyCacheBean;
|
|
|
+import cn.com.qmth.examcloud.support.cache.bean.*;
|
|
|
import cn.com.qmth.examcloud.support.enums.ExamProperties;
|
|
|
import cn.com.qmth.examcloud.support.enums.ExamRecordStatus;
|
|
|
import cn.com.qmth.examcloud.support.enums.FaceBiopsyScheme;
|
|
|
import cn.com.qmth.examcloud.support.enums.HandInExamType;
|
|
|
-import cn.com.qmth.examcloud.support.examing.ExamBoss;
|
|
|
-import cn.com.qmth.examcloud.support.examing.ExamRecordData;
|
|
|
-import cn.com.qmth.examcloud.support.examing.ExamingActivityTime;
|
|
|
-import cn.com.qmth.examcloud.support.examing.ExamingHeartbeat;
|
|
|
-import cn.com.qmth.examcloud.support.examing.ExamingSession;
|
|
|
-import cn.com.qmth.examcloud.support.examing.ExamingStatus;
|
|
|
+import cn.com.qmth.examcloud.support.examing.*;
|
|
|
import cn.com.qmth.examcloud.support.helper.ExamCacheTransferHelper;
|
|
|
import cn.com.qmth.examcloud.support.helper.FaceBiopsyHelper;
|
|
|
import cn.com.qmth.examcloud.support.redis.RedisKeyHelper;
|
|
@@ -115,9 +59,26 @@ import cn.com.qmth.examcloud.ws.api.enums.WebSocketEventType;
|
|
|
import cn.com.qmth.examcloud.ws.api.request.SendFileAnswerMessageReq;
|
|
|
import cn.com.qmth.examcloud.ws.api.request.SendScanQrCodeMessageReq;
|
|
|
import cn.com.qmth.examcloud.ws.api.request.SendTextReq;
|
|
|
+import com.google.common.base.Splitter;
|
|
|
import main.java.com.upyun.Base64Coder;
|
|
|
import main.java.com.upyun.UpException;
|
|
|
import main.java.com.upyun.UpYunUtils;
|
|
|
+import org.apache.commons.collections.CollectionUtils;
|
|
|
+import org.apache.commons.lang.math.RandomUtils;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.apache.commons.lang3.time.DateUtils;
|
|
|
+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 java.io.UnsupportedEncodingException;
|
|
|
+import java.net.URLEncoder;
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
+import java.util.*;
|
|
|
+import java.util.concurrent.TimeUnit;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* @author chenken
|
|
@@ -166,6 +127,9 @@ public class ExamControlServiceImpl implements ExamControlService {
|
|
|
@Autowired
|
|
|
ExamRecordCloudService examRecordCloudService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ SyncExamDataCloudService syncExamDataCloudService;
|
|
|
+
|
|
|
private static final String SEPARATOR = "/";
|
|
|
|
|
|
private static final String UNDERLINE = "_";
|
|
@@ -291,7 +255,7 @@ public class ExamControlServiceImpl implements ExamControlService {
|
|
|
if (eb == null) {
|
|
|
throw new StatusException("008001", "ExamBoss is not created");
|
|
|
}
|
|
|
- if(eb.getExamRecordDataIds()==null) {
|
|
|
+ if (eb.getExamRecordDataIds() == null) {
|
|
|
eb.setExamRecordDataIds(new ArrayList<Long>());
|
|
|
}
|
|
|
eb.getExamRecordDataIds().add(examRecordData.getId());
|
|
@@ -509,6 +473,23 @@ public class ExamControlServiceImpl implements ExamControlService {
|
|
|
throw new StatusException("201101", "暂不支持的交卷类型");
|
|
|
}
|
|
|
|
|
|
+ //特殊处理:如果考试类型为 在线练习,则需要将部分数据提前入库,并更新相关状态
|
|
|
+ if (ExamType.PRACTICE == examRecordData.getExamType()) {
|
|
|
+
|
|
|
+ // 提前更新考试状态
|
|
|
+ examRecordData.setExamRecordStatus(
|
|
|
+ examRecordData.getHandInExamType() == HandInExamType.MANUAL
|
|
|
+ ? ExamRecordStatus.EXAM_END
|
|
|
+ : ExamRecordStatus.EXAM_OVERDUE);
|
|
|
+
|
|
|
+ //提前同步部分数据
|
|
|
+ SyncExamDataReq syncExamDataReq = new SyncExamDataReq();
|
|
|
+ syncExamDataReq.setExamRecordData(copyExamRecordDataFrom(examRecordData));
|
|
|
+ syncExamDataReq.setExamRecordPaperStruct(getExamRecordPaperStruct(examRecordDataId));
|
|
|
+ syncExamDataReq.setExamRecordQuestions(getExamRecordQuestions(examRecordDataId));
|
|
|
+ syncExamDataCloudService.syncExamData(syncExamDataReq);
|
|
|
+ }
|
|
|
+
|
|
|
// 保存考试记录
|
|
|
examRecordDataService.saveExamRecordDataCache(examRecordDataId, examRecordData);
|
|
|
|
|
@@ -1497,4 +1478,93 @@ public class ExamControlServiceImpl implements ExamControlService {
|
|
|
return examRecordDataIdObject.getHasValue()
|
|
|
&& examRecordDataId.equals(Long.valueOf(examRecordDataIdObject.getValue().toString()));
|
|
|
}
|
|
|
+
|
|
|
+ private ExamRecordDataBean copyExamRecordDataFrom(ExamRecordData examRecordData) {
|
|
|
+ ExamRecordDataBean data = new ExamRecordDataBean();
|
|
|
+ data.setId(examRecordData.getId());
|
|
|
+ data.setExamId(examRecordData.getExamId());
|
|
|
+ data.setExamType(examRecordData.getExamType() == null ? null : examRecordData.getExamType().toString());
|
|
|
+ data.setExamStudentId(examRecordData.getExamStudentId());
|
|
|
+ data.setStudentId(examRecordData.getStudentId());
|
|
|
+ data.setCourseId(examRecordData.getCourseId());
|
|
|
+ data.setOrgId(examRecordData.getOrgId());
|
|
|
+ data.setRootOrgId(examRecordData.getRootOrgId());
|
|
|
+ data.setBasePaperId(examRecordData.getBasePaperId());
|
|
|
+ data.setPaperType(examRecordData.getPaperType());
|
|
|
+ data.setExamRecordStatus(examRecordData.getExamRecordStatus() == null ? null : examRecordData.getExamRecordStatus().toString());
|
|
|
+ data.setStartTime(examRecordData.getStartTime());
|
|
|
+ data.setEndTime(examRecordData.getEndTime());
|
|
|
+ data.setCleanTime(examRecordData.getCleanTime());
|
|
|
+ data.setWarn(examRecordData.getIsWarn() == null ? false : examRecordData.getIsWarn());
|
|
|
+ data.setAudit(examRecordData.getIsAudit() == null ? false : examRecordData.getIsAudit());
|
|
|
+ data.setIllegality(examRecordData.getIsIllegality() == null ? false : examRecordData.getIsIllegality());
|
|
|
+ data.setUsedExamTime(examRecordData.getUsedExamTime());
|
|
|
+ data.setContinued(examRecordData.getIsContinued() == null ? false : examRecordData.getIsContinued());
|
|
|
+ data.setContinuedCount(examRecordData.getContinuedCount());
|
|
|
+ data.setExceed(examRecordData.getIsExceed() == null ? false : examRecordData.getIsExceed());
|
|
|
+ data.setFaceSuccessCount(examRecordData.getFaceSuccessCount());
|
|
|
+ data.setFaceFailedCount(examRecordData.getFaceFailedCount());
|
|
|
+ data.setFaceStrangerCount(examRecordData.getFaceStrangerCount());
|
|
|
+ data.setFaceTotalCount(examRecordData.getFaceTotalCount());
|
|
|
+ data.setFaceSuccessPercent(examRecordData.getFaceSuccessPercent());
|
|
|
+ data.setFaceVerifyResult(examRecordData.getFaceVerifyResult() == null ? null : examRecordData.getFaceVerifyResult().toString());
|
|
|
+ data.setBaiduFaceLivenessSuccessPercent(examRecordData.getBaiduFaceLivenessSuccessPercent());
|
|
|
+ data.setTotalScore(examRecordData.getTotalScore());
|
|
|
+ data.setObjectiveScore(examRecordData.getObjectiveScore());
|
|
|
+ data.setObjectiveAccuracy(examRecordData.getObjectiveAccuracy());
|
|
|
+ data.setSubjectiveScore(examRecordData.getSubjectiveScore());
|
|
|
+ data.setSuccPercent(examRecordData.getSuccPercent());
|
|
|
+
|
|
|
+ return data;
|
|
|
+ }
|
|
|
+
|
|
|
+ private ExamRecordQuestionsBean getExamRecordQuestions(Long examRecordDataId) {
|
|
|
+ GetExamRecordQuestionsReq req = new GetExamRecordQuestionsReq();
|
|
|
+ req.setExamRecordDataId(examRecordDataId);
|
|
|
+ GetExamRecordQuestionsResp resp = examRecordQuestionsService.getExamRecordQuestions(req);
|
|
|
+
|
|
|
+ ExamRecordQuestionsBean bean = new ExamRecordQuestionsBean();
|
|
|
+ bean.setCreationTime(resp.getCreationTime());
|
|
|
+ bean.setExamRecordDataId(resp.getExamRecordDataId());
|
|
|
+
|
|
|
+ List<ExamQuestionBean> examQuestionBeanList = new ArrayList<>();
|
|
|
+ for (StuExamQuestionBean stuExamQuestionBean : resp.getExamQuestions()) {
|
|
|
+ ExamQuestionBean examQuestionBean = new ExamQuestionBean();
|
|
|
+ examQuestionBean.setExamRecordDataId(stuExamQuestionBean.getExamRecordDataId());
|
|
|
+ examQuestionBean.setMainNumber(stuExamQuestionBean.getMainNumber());
|
|
|
+ examQuestionBean.setQuestionId(stuExamQuestionBean.getQuestionId());
|
|
|
+ examQuestionBean.setOrder(stuExamQuestionBean.getOrder());
|
|
|
+ examQuestionBean.setQuestionScore(stuExamQuestionBean.getQuestionScore());
|
|
|
+ examQuestionBean.setQuestionType(stuExamQuestionBean.getQuestionType());
|
|
|
+ examQuestionBean.setCorrectAnswer(stuExamQuestionBean.getCorrectAnswer());
|
|
|
+ examQuestionBean.setStudentAnswer(stuExamQuestionBean.getStudentAnswer());
|
|
|
+ examQuestionBean.setStudentScore(stuExamQuestionBean.getStudentScore());
|
|
|
+ examQuestionBean.setAnswer(stuExamQuestionBean.getAnswer());
|
|
|
+ examQuestionBean.setSign(stuExamQuestionBean.getSign());
|
|
|
+ examQuestionBean.setOptionPermutation(stuExamQuestionBean.getOptionPermutation());
|
|
|
+ examQuestionBean.setAudioPlayTimes(stuExamQuestionBean.getAudioPlayTimes());
|
|
|
+
|
|
|
+ if (null != stuExamQuestionBean.getAnswerType()) {
|
|
|
+ examQuestionBean.setAnswerType(stuExamQuestionBean.getAnswerType().name());
|
|
|
+ }
|
|
|
+
|
|
|
+ examQuestionBeanList.add(examQuestionBean);
|
|
|
+ }
|
|
|
+
|
|
|
+ bean.setExamQuestionBeans(examQuestionBeanList);
|
|
|
+
|
|
|
+ return bean;
|
|
|
+ }
|
|
|
+
|
|
|
+ private ExamRecordPaperStructBean getExamRecordPaperStruct(Long examRecordDataId) {
|
|
|
+ GetExamRecordPaperStructReq req = new GetExamRecordPaperStructReq();
|
|
|
+ req.setExamRecordDataId(examRecordDataId);
|
|
|
+ GetExamRecordPaperStructResp resp = examRecordPaperStructService.getExamRecordPaperStruct(req);
|
|
|
+
|
|
|
+ ExamRecordPaperStructBean bean = new ExamRecordPaperStructBean();
|
|
|
+ bean.setId(resp.getId());
|
|
|
+ bean.setDefaultPaper(resp.getDefaultPaper());
|
|
|
+
|
|
|
+ return bean;
|
|
|
+ }
|
|
|
}
|