|
@@ -1449,6 +1449,13 @@ public class ExamControlServiceImpl implements ExamControlService {
|
|
|
examSessionInfo.getOrgId());
|
|
|
CheckExamInProgressInfo checkExamInProgressInfo = new CheckExamInProgressInfo();
|
|
|
|
|
|
+ String examingHeartbeatKey = RedisKeyHelper.getBuilder()
|
|
|
+ .examingHeartbeatKey(examSessionInfo.getExamRecordDataId());
|
|
|
+ ExamingHeartbeat examingHeartbeat = redisClient.get(examingHeartbeatKey,
|
|
|
+ ExamingHeartbeat.class);
|
|
|
+ //考试已用时间(秒)
|
|
|
+ long usedTime = null == examingHeartbeat ? 0 : examingHeartbeat.getCost();
|
|
|
+
|
|
|
if ((examingRecord.getIsExceed() == null || !examingRecord.getIsExceed())
|
|
|
&& examingRecord.getContinuedCount().intValue() < maxInterruptNum.intValue()) {// 未达到最大断点次数,可继续断点一次
|
|
|
// 断点续考次数自增
|
|
@@ -1462,7 +1469,7 @@ public class ExamControlServiceImpl implements ExamControlService {
|
|
|
checkExamInProgressInfo.setIsExceed(false);
|
|
|
|
|
|
//添加断点记录
|
|
|
- addExamContinuedRecord(examingRecord.getId(), now);
|
|
|
+ addExamContinuedRecord(examingRecord.getId(), usedTime,now);
|
|
|
} else {
|
|
|
examingRecord.setIsExceed(true);
|
|
|
checkExamInProgressInfo.setIsExceed(true);
|
|
@@ -1471,12 +1478,7 @@ public class ExamControlServiceImpl implements ExamControlService {
|
|
|
// 更新考试中的断点续考属性
|
|
|
examRecordDataService.saveExamRecordDataCache(examingRecord.getId(), examingRecord);
|
|
|
|
|
|
- String examingHeartbeatKey = RedisKeyHelper.getBuilder()
|
|
|
- .examingHeartbeatKey(examSessionInfo.getExamRecordDataId());
|
|
|
- ExamingHeartbeat examingHeartbeat = redisClient.get(examingHeartbeatKey,
|
|
|
- ExamingHeartbeat.class);
|
|
|
|
|
|
- long usedTime = null == examingHeartbeat ? 0 : examingHeartbeat.getCost();
|
|
|
|
|
|
checkExamInProgressInfo.setExamRecordDataId(examingRecord.getId());
|
|
|
checkExamInProgressInfo.setExamId(examSessionInfo.getExamId());
|
|
@@ -1520,12 +1522,14 @@ public class ExamControlServiceImpl implements ExamControlService {
|
|
|
* 添加断点续考记录
|
|
|
*
|
|
|
* @param examRecordDataId
|
|
|
+ * @param usedExamMilliseconds
|
|
|
* @param continuedTime
|
|
|
*/
|
|
|
- private void addExamContinuedRecord(Long examRecordDataId, Date continuedTime) {
|
|
|
+ private void addExamContinuedRecord(Long examRecordDataId,Long usedExamMilliseconds, Date continuedTime) {
|
|
|
ExamContinuedRecordEntity entity = new ExamContinuedRecordEntity();
|
|
|
entity.setExamRecordDataId(examRecordDataId);
|
|
|
entity.setContinuedTime(continuedTime);
|
|
|
+ entity.setUsedExamTime(usedExamMilliseconds);
|
|
|
|
|
|
examContinuedRecordRepo.save(entity);
|
|
|
}
|
|
@@ -1655,7 +1659,7 @@ public class ExamControlServiceImpl implements ExamControlService {
|
|
|
usedExamSeconds = (now.getTime() - examRecordDataCache.getStartTime().getTime()) / 1000;
|
|
|
}
|
|
|
|
|
|
- //如果有断点续考,考试已用时间 = 考试已用时间 + (当前时间 - 最近一次的作答时间)
|
|
|
+ //如果有断点续考,考试已用时间 = 断点前考试已用时间 + (当前时间 - 最近一次的作答时间)
|
|
|
else {
|
|
|
//获取最新的一条断点记录
|
|
|
ExamContinuedRecordEntity latestExamContinuedRecord =
|
|
@@ -1668,7 +1672,11 @@ public class ExamControlServiceImpl implements ExamControlService {
|
|
|
throw new StatusException("101005", "请先执行作答");
|
|
|
}
|
|
|
|
|
|
- usedExamSeconds = usedExamSeconds + (now.getTime() - latestExamContinuedRecord.getStartTime().getTime()) / 1000;
|
|
|
+ //断点前考试已用时间
|
|
|
+ long lastUsedMilliseconds = latestExamContinuedRecord.getUsedExamTime();
|
|
|
+ //最新作答时间
|
|
|
+ long lastStartTime = latestExamContinuedRecord.getStartTime().getTime();
|
|
|
+ usedExamSeconds = (lastUsedMilliseconds + (now.getTime() - lastStartTime)) / 1000;
|
|
|
}
|
|
|
|
|
|
examingHeartbeat.setCost(usedExamSeconds);
|