|
@@ -30,9 +30,7 @@ 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.*;
|
|
|
import cn.com.qmth.examcloud.core.oe.student.dao.ExamContinuedRecordRepo;
|
|
|
-import cn.com.qmth.examcloud.core.oe.student.dao.ExamRecordDataRepo;
|
|
|
import cn.com.qmth.examcloud.core.oe.student.dao.entity.ExamContinuedRecordEntity;
|
|
|
-import cn.com.qmth.examcloud.core.oe.student.dao.entity.ExamRecordDataEntity;
|
|
|
import cn.com.qmth.examcloud.core.oe.student.report.ExamProcessRecordReport;
|
|
|
import cn.com.qmth.examcloud.core.oe.student.service.*;
|
|
|
import cn.com.qmth.examcloud.core.oe.task.api.ExamCaptureCloudService;
|
|
@@ -58,7 +56,6 @@ import cn.com.qmth.examcloud.support.helper.FaceBiopsyHelper;
|
|
|
import cn.com.qmth.examcloud.support.redis.RedisKeyHelper;
|
|
|
import cn.com.qmth.examcloud.web.bootstrap.PropertyHolder;
|
|
|
import cn.com.qmth.examcloud.web.exception.SequenceLockException;
|
|
|
-import cn.com.qmth.examcloud.web.helpers.GlobalHelper;
|
|
|
import cn.com.qmth.examcloud.web.helpers.SequenceLockHelper;
|
|
|
import cn.com.qmth.examcloud.web.redis.RedisClient;
|
|
|
import cn.com.qmth.examcloud.ws.api.WsCloudService;
|
|
@@ -143,9 +140,6 @@ public class ExamControlServiceImpl implements ExamControlService {
|
|
|
@Autowired
|
|
|
SyncExamDataCloudService syncExamDataCloudService;
|
|
|
|
|
|
- @Autowired
|
|
|
- private ExamRecordDataRepo examRecordDataRepo;
|
|
|
-
|
|
|
@Autowired
|
|
|
private ExamContinuedRecordRepo examContinuedRecordRepo;
|
|
|
|
|
@@ -1167,18 +1161,34 @@ public class ExamControlServiceImpl implements ExamControlService {
|
|
|
* @param examRecordDataId
|
|
|
*/
|
|
|
@Override
|
|
|
- public void switchScreen(Long examRecordDataId) {
|
|
|
- ExamRecordDataEntity examRecordDataEntity =
|
|
|
- GlobalHelper.getEntity(examRecordDataRepo, examRecordDataId, ExamRecordDataEntity.class);
|
|
|
- if (null == examRecordDataEntity) {
|
|
|
+ public SwitchScreenCountInfo switchScreen(Long examRecordDataId) {
|
|
|
+ ExamRecordData examRecordData = examRecordDataService.getExamRecordDataCache(examRecordDataId);
|
|
|
+ if (null == examRecordData) {
|
|
|
throw new StatusException("100001", "找不到相关考试记录");
|
|
|
}
|
|
|
+
|
|
|
+ ExamingSession examSessionInfo = examingSessionService.getExamingSession(examRecordData.getStudentId());
|
|
|
+ if (examSessionInfo == null
|
|
|
+ || examSessionInfo.getExamingStatus().equals(ExamingStatus.INFORMAL)) {
|
|
|
+ throw new StatusException("101001", "无效的会话,请离开考试");
|
|
|
+ }
|
|
|
+
|
|
|
+ SwitchScreenCountInfo ret=new SwitchScreenCountInfo();
|
|
|
+ if(examSessionInfo.getRecordSwitchScreen()) {
|
|
|
+ ret.setMaxSwitchScreenCount(examSessionInfo.getMaxSwitchScreenCount());
|
|
|
+ }else {
|
|
|
+ ret.setMaxSwitchScreenCount(null);
|
|
|
+ }
|
|
|
|
|
|
//更新考试记录缓存
|
|
|
- ExamRecordData examRecordData = examRecordDataService.getExamRecordDataCache(examRecordDataId);
|
|
|
int switchScreenCount = null == examRecordData.getSwitchScreenCount() ? 0 : examRecordData.getSwitchScreenCount();
|
|
|
examRecordData.setSwitchScreenCount(++switchScreenCount);
|
|
|
+ ret.setSwitchScreenCount(examRecordData.getSwitchScreenCount());
|
|
|
+ if(ret.getMaxSwitchScreenCount()!=null&&ret.getSwitchScreenCount()>ret.getMaxSwitchScreenCount()) {
|
|
|
+ examRecordData.setExceedMaxSwitchScreenCount(true);
|
|
|
+ }
|
|
|
examRecordDataService.saveExamRecordDataCache(examRecordDataId, examRecordData);
|
|
|
+ return ret;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -1307,7 +1317,7 @@ public class ExamControlServiceImpl implements ExamControlService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- //场次禁用,不允许考试 TODO 20200814 跟张莹确认一下,场次被禁用了是不能考试还是使用考试的设置???
|
|
|
+ //场次禁用,不允许考试
|
|
|
if (examBean.getSpecialSettingsType() == ExamSpecialSettingsType.STAGE_BASED) {
|
|
|
if (null != examStageId) {
|
|
|
ExamStageCacheBean examStage = CacheHelper.getExamStage(examId, examStageId);
|
|
@@ -1530,6 +1540,20 @@ public class ExamControlServiceImpl implements ExamControlService {
|
|
|
*/
|
|
|
public void initializeExamRecordSession(ExamingSession examSessionInfo, ExamRecordData examRecordData,
|
|
|
final ExamSettingsCacheBean examBean) {
|
|
|
+ //切屏设置
|
|
|
+ Boolean isRecordSwitchScreenCount=false;
|
|
|
+ Integer maxSwitchScreenCount=null;
|
|
|
+ OrgPropertyCacheBean ss=CacheHelper.getOrgProperty(examRecordData.getRootOrgId(), "PREVENT_CHEATING_CONFIG");
|
|
|
+ if(ss!=null&&ss.getHasValue()&&ss.getValue().contains("RECORD_SWITCH_SCREEN")) {
|
|
|
+ isRecordSwitchScreenCount=true;
|
|
|
+ ExamPropertyCacheBean sc=CacheHelper.getExamProperty(examBean.getId(), ExamProperties.MAX_SWITCH_SCREEN_COUNT.name());
|
|
|
+ if(sc!=null&&StringUtils.isNotEmpty(sc.getValue())) {
|
|
|
+ maxSwitchScreenCount=Integer.valueOf(sc.getValue());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ examSessionInfo.setMaxSwitchScreenCount(maxSwitchScreenCount);
|
|
|
+ examSessionInfo.setRecordSwitchScreen(isRecordSwitchScreenCount);
|
|
|
+
|
|
|
examSessionInfo.setExamRecordDataId(examRecordData.getId());
|
|
|
// examSessionInfo.setStartTime(examRecordData.getStartTime().getTime());//调整为在作答页面时赋值
|
|
|
examSessionInfo.setExamType(examBean.getExamType());
|
|
@@ -1661,6 +1685,10 @@ public class ExamControlServiceImpl implements ExamControlService {
|
|
|
ReportsUtil.report(new ExamProcessRecordReport(examRecordDataId, ExamProcess.CONTINUE, new Date()));
|
|
|
|
|
|
setAndSaveActiveTime(examRecordDataId, ip);
|
|
|
+
|
|
|
+ checkExamInProgressInfo.setExceedMaxSwitchScreenCount(examingRecord.getExceedMaxSwitchScreenCount());
|
|
|
+ checkExamInProgressInfo.setSwitchScreenCount(examingRecord.getSwitchScreenCount());
|
|
|
+ checkExamInProgressInfo.setMaxSwitchScreenCount(examSessionInfo.getMaxSwitchScreenCount());
|
|
|
|
|
|
return checkExamInProgressInfo;
|
|
|
}
|