xiatian před 5 roky
rodič
revize
b5bc353c9f

+ 41 - 0
examcloud-core-oe-student-service/src/main/java/cn/com/qmth/examcloud/core/oe/student/bean/ExamRecordPaperStruct.java

@@ -0,0 +1,41 @@
+package cn.com.qmth.examcloud.core.oe.student.bean;
+
+import java.io.Serializable;
+
+import cn.com.qmth.examcloud.question.commons.core.paper.DefaultPaper;
+
+/**
+ * 
+ * @author  	chenken
+ * @date    	2018年8月27日 下午3:26:27
+ * @company 	QMTH
+ * @description ExamRecordPaper.java
+ */
+public class ExamRecordPaperStruct implements Serializable{
+
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = -4672132535133881321L;
+
+	private String id;
+	
+	private DefaultPaper defaultPaper;
+
+	public String getId() {
+		return id;
+	}
+
+	public void setId(String id) {
+		this.id = id;
+	}
+
+	public DefaultPaper getDefaultPaper() {
+		return defaultPaper;
+	}
+
+	public void setDefaultPaper(DefaultPaper defaultPaper) {
+		this.defaultPaper = defaultPaper;
+	}
+	
+}

+ 4 - 3
examcloud-core-oe-student-service/src/main/java/cn/com/qmth/examcloud/core/oe/student/service/ExamRecordPaperStructService.java

@@ -1,6 +1,6 @@
 package cn.com.qmth.examcloud.core.oe.student.service;
 
-import cn.com.qmth.examcloud.question.commons.core.paper.DefaultPaper;
+import cn.com.qmth.examcloud.core.oe.student.bean.ExamRecordPaperStruct;
 
 /**
  * @author chenken
@@ -12,18 +12,19 @@ public interface ExamRecordPaperStructService {
      * 保存
      * @param timeout   秒
      */
-    public void saveExamRecordPaperStruct(Long examRecordDataId,DefaultPaper paper);
+    public void saveExamRecordPaperStruct(Long examRecordDataId,ExamRecordPaperStruct paper);
 
     /**
      * 获取
      * @param examRecordDataId
      * @return
      */
-    public DefaultPaper getExamRecordPaperStruct(Long examRecordDataId);
+    public ExamRecordPaperStruct getExamRecordPaperStruct(Long examRecordDataId);
 
     /**
      * 删除
      * @param examRecordDataId
      */
     public void deleteExamRecordPaperStruct(Long examRecordDataId);
+    
 }

+ 14 - 10
examcloud-core-oe-student-service/src/main/java/cn/com/qmth/examcloud/core/oe/student/service/impl/ExamControlServiceImpl.java

@@ -22,6 +22,7 @@ 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.commons.util.UUID;
 import cn.com.qmth.examcloud.commons.util.Util;
 import cn.com.qmth.examcloud.core.basic.api.bean.CourseBean;
 import cn.com.qmth.examcloud.core.oe.student.base.enums.ExamProperties;
@@ -29,6 +30,7 @@ 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.CheckExamInProgressInfo;
+import cn.com.qmth.examcloud.core.oe.student.bean.ExamRecordPaperStruct;
 import cn.com.qmth.examcloud.core.oe.student.bean.StartExamInfo;
 import cn.com.qmth.examcloud.core.oe.student.service.ExamControlService;
 import cn.com.qmth.examcloud.core.oe.student.service.ExamFaceLivenessVerifyService;
@@ -95,13 +97,13 @@ public class ExamControlServiceImpl implements ExamControlService {
 
     @Autowired
     private ExamCloudService examCloudService;
-    
+
     @Autowired
     private FaceBiopsyService faceBiopsyService;
-    
+
     @Autowired
     private ExamFaceLivenessVerifyService examFaceLivenessVerifyService;
-    
+
     @Transactional
     @Override
     public StartExamInfo startExam(Long examStudentId, User user) {
@@ -195,8 +197,10 @@ public class ExamControlServiceImpl implements ExamControlService {
 
         // 保存考试试卷结构
         startTime = System.currentTimeMillis();
-        examRecordPaperStructService.saveExamRecordPaperStruct(examRecordData.getId(),
-                extractConfigPaper.getDefaultPaper());
+        ExamRecordPaperStruct paperStruct = new ExamRecordPaperStruct();
+        paperStruct.setId(UUID.randomUUID());
+        paperStruct.setDefaultPaper(extractConfigPaper.getDefaultPaper());
+        examRecordPaperStructService.saveExamRecordPaperStruct(examRecordData.getId(), paperStruct);
         if (log.isDebugEnabled()) {
             log.debug("7 保存考试试卷结构耗时:" + (System.currentTimeMillis() - startTime) + " ms");
         }
@@ -565,7 +569,7 @@ public class ExamControlServiceImpl implements ExamControlService {
             } else {// 非新活检,默认使用旧的活检计算方式
                 faceVerifyMinute = examFaceLivenessVerifyService.getFaceLivenessVerifyMinute(
                         examSessionInfo.getRootOrgId(), examSessionInfo.getOrgId(), examSessionInfo.getExamId(),
-                        studentId, examSessionInfo.getExamRecordDataId(), examSessionInfo.getCost().intValue()/60);
+                        studentId, examSessionInfo.getExamRecordDataId(), examSessionInfo.getCost().intValue() / 60);
             }
 
             checkExamInProgressInfo.setFaceVerifyMinute(faceVerifyMinute);
@@ -581,7 +585,7 @@ public class ExamControlServiceImpl implements ExamControlService {
         }
 
         // 如果考试时间结束,自动交卷
-        if (examSessionInfo.getExamDuration() <= examSessionInfo.getCost()*1000) {
+        if (examSessionInfo.getExamDuration() <= examSessionInfo.getCost() * 1000) {
             delayHandInExamIfLocked(examingRecord.getId());
             return null;
         }
@@ -656,8 +660,8 @@ public class ExamControlServiceImpl implements ExamControlService {
                 || examSessionInfo.getCost() >= examSessionInfo.getExamDuration()) {
             throw new StatusException("8001", "无效的会话,请离开考试");
         }
-        //考试耗时加60秒
-        examSessionInfo.setCost(examSessionInfo.getCost()+60);
+        // 考试耗时加60秒
+        examSessionInfo.setCost(examSessionInfo.getCost() + 60);
         long now = System.currentTimeMillis();
         if (now - examSessionInfo.getActiveTime() >= examSessionInfo.getExamReconnectTime().intValue() * 60 * 1000) {
             delayHandInExamIfLocked(examSessionInfo.getExamRecordDataId());
@@ -668,7 +672,7 @@ public class ExamControlServiceImpl implements ExamControlService {
         // 在线考生心跳打点
         ReportsUtil.report(new OnlineExamStudentReport(user.getRootOrgId(), user.getUserId(),
                 examSessionInfo.getExamId(), examSessionInfo.getExamStudentId()));
-        // 返回考试剩余时间 
+        // 返回考试剩余时间
         return examSessionInfo.getExamDuration() - (examSessionInfo.getCost() * 1000);
     }
 }

+ 4 - 5
examcloud-core-oe-student-service/src/main/java/cn/com/qmth/examcloud/core/oe/student/service/impl/ExamRecordPaperStructServiceImpl.java

@@ -3,8 +3,8 @@ package cn.com.qmth.examcloud.core.oe.student.service.impl;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import cn.com.qmth.examcloud.core.oe.student.bean.ExamRecordPaperStruct;
 import cn.com.qmth.examcloud.core.oe.student.service.ExamRecordPaperStructService;
-import cn.com.qmth.examcloud.question.commons.core.paper.DefaultPaper;
 import cn.com.qmth.examcloud.support.redis.RedisKeyHelper;
 import cn.com.qmth.examcloud.web.redis.RedisClient;
 
@@ -16,15 +16,15 @@ public class ExamRecordPaperStructServiceImpl implements ExamRecordPaperStructSe
 
 
     @Override
-    public void saveExamRecordPaperStruct(Long examRecordDataId, DefaultPaper paper) {
+    public void saveExamRecordPaperStruct(Long examRecordDataId, ExamRecordPaperStruct paper) {
         String key = RedisKeyHelper.getBuilder().studentPaperKey(examRecordDataId);
         redisClient.set(key + examRecordDataId, paper,-1);
     }
 
     @Override
-    public DefaultPaper getExamRecordPaperStruct(Long examRecordDataId) {
+    public ExamRecordPaperStruct getExamRecordPaperStruct(Long examRecordDataId) {
         String key = RedisKeyHelper.getBuilder().studentPaperKey(examRecordDataId);
-        return redisClient.get(key + examRecordDataId, DefaultPaper.class);
+        return redisClient.get(key + examRecordDataId, ExamRecordPaperStruct.class);
     }
 
     @Override
@@ -32,5 +32,4 @@ public class ExamRecordPaperStructServiceImpl implements ExamRecordPaperStructSe
         String key = RedisKeyHelper.getBuilder().studentPaperKey(examRecordDataId);
         redisClient.delete(key + examRecordDataId);
     }
-
 }