Parcourir la source

代码优化及调整

lideyin il y a 5 ans
Parent
commit
c39f380510

+ 8 - 14
examcloud-core-oe-task-service/src/main/java/cn/com/qmth/examcloud/core/oe/task/service/pipeline/HandInExamExecutor.java

@@ -1,6 +1,5 @@
 package cn.com.qmth.examcloud.core.oe.task.service.pipeline;
 
-import cn.com.qmth.examcloud.api.commons.enums.ExamType;
 import cn.com.qmth.examcloud.commons.exception.StatusException;
 import cn.com.qmth.examcloud.commons.helpers.KeyValuePair;
 import cn.com.qmth.examcloud.commons.helpers.ObjectHolder;
@@ -9,12 +8,12 @@ import cn.com.qmth.examcloud.commons.helpers.pipeline.TaskContext;
 import cn.com.qmth.examcloud.commons.logging.ExamCloudLog;
 import cn.com.qmth.examcloud.commons.logging.ExamCloudLogFactory;
 import cn.com.qmth.examcloud.core.oe.student.api.ExamRecordDataCloudService;
-import cn.com.qmth.examcloud.core.oe.student.api.request.CalcExamScoreReq;
-import cn.com.qmth.examcloud.core.oe.student.api.response.CalcExamScoreResp;
+import cn.com.qmth.examcloud.core.oe.student.api.request.HandInExamReq;
 import cn.com.qmth.examcloud.core.oe.task.service.ExamRecordDataService;
 import cn.com.qmth.examcloud.core.oe.task.service.ExamingSessionService;
 import cn.com.qmth.examcloud.support.Constants;
 import cn.com.qmth.examcloud.support.enums.ExamRecordStatus;
+import cn.com.qmth.examcloud.support.enums.HandInExamType;
 import cn.com.qmth.examcloud.support.examing.ExamRecordData;
 import cn.com.qmth.examcloud.support.examing.ExamingActivityTime;
 import cn.com.qmth.examcloud.support.examing.ExamingHeartbeat;
@@ -92,21 +91,16 @@ public class HandInExamExecutor implements NodeExecuter<Long, ExamRecordData, Lo
 
                         this.debugLog("prepare to auto hand in...", examRecordDataId);
 
+                        //自动交卷
+                        HandInExamReq handInExamReq = new HandInExamReq();
+                        handInExamReq.setExamRecordDataId(examRecordDataId);
+                        handInExamReq.setHandInExamType(HandInExamType.AUTO);
+                        examRecordDataCloudService.handInExam(handInExamReq);
+
                         //更改内存中的交卷状态
                         examRecordData.setExamRecordStatus(ExamRecordStatus.EXAM_AUTO_HAND_IN);
                         examRecordData.setCleanTime(new Date());
 
-                        //如果是在线练习,则交卷时立即算出客观分,并保存在考试记录表的缓存中
-                        if (ExamType.PRACTICE == examRecordData.getExamType()) {
-                            CalcExamScoreReq cesReq = new CalcExamScoreReq();
-                            cesReq.setExamRecordDataId(examRecordDataId);
-                            CalcExamScoreResp calcExamScoreResp = examRecordDataCloudService.calcExamScore(cesReq);
-                            examRecordData.setObjectiveScore(calcExamScoreResp.getObjectiveScore());
-                            examRecordData.setObjectiveAccuracy(calcExamScoreResp.getObjectiveAccuracy());
-                            examRecordData.setSuccPercent(calcExamScoreResp.getSuccPercent());
-                            examRecordData.setTotalScore(calcExamScoreResp.getTotalScore());
-                        }
-
                         //更新考试记录缓存
                         examRecordDataService.saveExamRecordDataCache(examRecordDataId, examRecordData);