|
@@ -113,7 +113,7 @@ public class TEExamServiceImpl extends ServiceImpl<TEExamMapper, TEExam> impleme
|
|
|
|
|
|
@Resource
|
|
@Resource
|
|
SystemConfig systemConfig;
|
|
SystemConfig systemConfig;
|
|
-
|
|
|
|
|
|
+
|
|
@Resource
|
|
@Resource
|
|
MqDtoService mqDtoService;
|
|
MqDtoService mqDtoService;
|
|
|
|
|
|
@@ -164,7 +164,7 @@ public class TEExamServiceImpl extends ServiceImpl<TEExamMapper, TEExam> impleme
|
|
if (Objects.nonNull(v.getMonitorVideoSourceStr()) && !Objects.equals(v.getMonitorVideoSourceStr().toString().trim().replaceAll(" ", ""), "")) {
|
|
if (Objects.nonNull(v.getMonitorVideoSourceStr()) && !Objects.equals(v.getMonitorVideoSourceStr().toString().trim().replaceAll(" ", ""), "")) {
|
|
v.setMonitorVideoSource(Arrays.asList(v.getMonitorVideoSourceStr().trim().toUpperCase().replaceAll(" ", "").split(",")));
|
|
v.setMonitorVideoSource(Arrays.asList(v.getMonitorVideoSourceStr().trim().toUpperCase().replaceAll(" ", "").split(",")));
|
|
//加入monitorAudioEnable逻辑
|
|
//加入monitorAudioEnable逻辑
|
|
- if (v.getMonitorVideoSourceStr().toUpperCase().contains(MonitorVideoSourceEnum.CLIENT_SCREEN.name()) || v.getMonitorVideoSourceStr().toUpperCase().contains(MonitorVideoSourceEnum.CLIENT_CAMERA.name())) {
|
|
|
|
|
|
+ if (v.getMonitorVideoSource().size() == 4 || (v.getMonitorVideoSourceStr().toUpperCase().contains(MonitorVideoSourceEnum.CLIENT_SCREEN.name()) || v.getMonitorVideoSourceStr().toUpperCase().contains(MonitorVideoSourceEnum.CLIENT_CAMERA.name()))) {
|
|
v.setMonitorAudioEnable(true);
|
|
v.setMonitorAudioEnable(true);
|
|
}
|
|
}
|
|
//加入hardwareTest逻辑
|
|
//加入hardwareTest逻辑
|
|
@@ -365,10 +365,10 @@ public class TEExamServiceImpl extends ServiceImpl<TEExamMapper, TEExam> impleme
|
|
if (now.getTime() > end) {
|
|
if (now.getTime() > end) {
|
|
throw new BusinessException("允许开考的时间已结束");
|
|
throw new BusinessException("允许开考的时间已结束");
|
|
}
|
|
}
|
|
- ExamRecordStatusEnum sta=ExamRecordCacheUtil.getStatus(recordId);
|
|
|
|
- if(ExamRecordStatusEnum.FINISHED.equals(sta)||ExamRecordStatusEnum.PERSISTED.equals(sta)) {
|
|
|
|
- throw new BusinessException("该考试已结束");
|
|
|
|
- }
|
|
|
|
|
|
+ ExamRecordStatusEnum sta = ExamRecordCacheUtil.getStatus(recordId);
|
|
|
|
+ if (ExamRecordStatusEnum.FINISHED.equals(sta) || ExamRecordStatusEnum.PERSISTED.equals(sta)) {
|
|
|
|
+ throw new BusinessException("该考试已结束");
|
|
|
|
+ }
|
|
Long paperId = ExamRecordCacheUtil.getPaperId(recordId);
|
|
Long paperId = ExamRecordCacheUtil.getPaperId(recordId);
|
|
ExamPaperCacheBean ep = teExamPaperService.getExamPaperCacheBean(paperId);
|
|
ExamPaperCacheBean ep = teExamPaperService.getExamPaperCacheBean(paperId);
|
|
if (ep == null) {
|
|
if (ep == null) {
|
|
@@ -406,10 +406,10 @@ public class TEExamServiceImpl extends ServiceImpl<TEExamMapper, TEExam> impleme
|
|
if (!studentId.equals(es.getStudentId())) {
|
|
if (!studentId.equals(es.getStudentId())) {
|
|
throw new BusinessException("考试记录的学生Id和当前登录用户不一致");
|
|
throw new BusinessException("考试记录的学生Id和当前登录用户不一致");
|
|
}
|
|
}
|
|
- ExamRecordStatusEnum sta=ExamRecordCacheUtil.getStatus(recordId);
|
|
|
|
- if(ExamRecordStatusEnum.FINISHED.equals(sta)||ExamRecordStatusEnum.PERSISTED.equals(sta)) {
|
|
|
|
- throw new BusinessException("该考试已结束");
|
|
|
|
- }
|
|
|
|
|
|
+ ExamRecordStatusEnum sta = ExamRecordCacheUtil.getStatus(recordId);
|
|
|
|
+ if (ExamRecordStatusEnum.FINISHED.equals(sta) || ExamRecordStatusEnum.PERSISTED.equals(sta)) {
|
|
|
|
+ throw new BusinessException("该考试已结束");
|
|
|
|
+ }
|
|
ExamStudentPaperStructCacheBean struct = new ExamStudentPaperStructCacheBean();
|
|
ExamStudentPaperStructCacheBean struct = new ExamStudentPaperStructCacheBean();
|
|
struct.setContent(content);
|
|
struct.setContent(content);
|
|
struct.setTime(System.currentTimeMillis());
|
|
struct.setTime(System.currentTimeMillis());
|
|
@@ -440,10 +440,10 @@ public class TEExamServiceImpl extends ServiceImpl<TEExamMapper, TEExam> impleme
|
|
if (!studentId.equals(es.getStudentId())) {
|
|
if (!studentId.equals(es.getStudentId())) {
|
|
throw new BusinessException("考试记录的学生Id和当前登录用户不一致");
|
|
throw new BusinessException("考试记录的学生Id和当前登录用户不一致");
|
|
}
|
|
}
|
|
- ExamRecordStatusEnum sta=ExamRecordCacheUtil.getStatus(recordId);
|
|
|
|
- if(ExamRecordStatusEnum.FINISHED.equals(sta)||ExamRecordStatusEnum.PERSISTED.equals(sta)) {
|
|
|
|
- throw new BusinessException("该考试已结束");
|
|
|
|
- }
|
|
|
|
|
|
+ ExamRecordStatusEnum sta = ExamRecordCacheUtil.getStatus(recordId);
|
|
|
|
+ if (ExamRecordStatusEnum.FINISHED.equals(sta) || ExamRecordStatusEnum.PERSISTED.equals(sta)) {
|
|
|
|
+ throw new BusinessException("该考试已结束");
|
|
|
|
+ }
|
|
ExamStudentAnswerCacheBean answerCache = (ExamStudentAnswerCacheBean) redisUtil.get(
|
|
ExamStudentAnswerCacheBean answerCache = (ExamStudentAnswerCacheBean) redisUtil.get(
|
|
RedisKeyHelper.examAnswerKey(recordId),
|
|
RedisKeyHelper.examAnswerKey(recordId),
|
|
RedisKeyHelper.examAnswerHashKey(mainNumber, subNumber, subIndex));
|
|
RedisKeyHelper.examAnswerHashKey(mainNumber, subNumber, subIndex));
|
|
@@ -475,6 +475,7 @@ public class TEExamServiceImpl extends ServiceImpl<TEExamMapper, TEExam> impleme
|
|
calculateObjectiveScore(recordId, mainNumber, subNumber, subIndex);
|
|
calculateObjectiveScore(recordId, mainNumber, subNumber, subIndex);
|
|
return ret;
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
+
|
|
private void calculateObjectiveScore(Long recordId, Integer mainNumber, Integer subNumber, Integer subIndex) {
|
|
private void calculateObjectiveScore(Long recordId, Integer mainNumber, Integer subNumber, Integer subIndex) {
|
|
Map<String, Object> transMap = new HashMap<String, Object>();
|
|
Map<String, Object> transMap = new HashMap<String, Object>();
|
|
transMap.put("recordId", recordId);
|
|
transMap.put("recordId", recordId);
|
|
@@ -506,10 +507,10 @@ public class TEExamServiceImpl extends ServiceImpl<TEExamMapper, TEExam> impleme
|
|
if (!studentId.equals(es.getStudentId())) {
|
|
if (!studentId.equals(es.getStudentId())) {
|
|
throw new BusinessException("考试记录的学生Id和当前登录用户不一致");
|
|
throw new BusinessException("考试记录的学生Id和当前登录用户不一致");
|
|
}
|
|
}
|
|
- ExamRecordStatusEnum sta=ExamRecordCacheUtil.getStatus(recordId);
|
|
|
|
- if(ExamRecordStatusEnum.FINISHED.equals(sta)||ExamRecordStatusEnum.PERSISTED.equals(sta)) {
|
|
|
|
- throw new BusinessException("该考试已结束");
|
|
|
|
- }
|
|
|
|
|
|
+ ExamRecordStatusEnum sta = ExamRecordCacheUtil.getStatus(recordId);
|
|
|
|
+ if (ExamRecordStatusEnum.FINISHED.equals(sta) || ExamRecordStatusEnum.PERSISTED.equals(sta)) {
|
|
|
|
+ throw new BusinessException("该考试已结束");
|
|
|
|
+ }
|
|
// 音频剩余播放次数缓存
|
|
// 音频剩余播放次数缓存
|
|
redisUtil.set(RedisKeyHelper.audioLeftPlayCountKey(recordId), key, count);
|
|
redisUtil.set(RedisKeyHelper.audioLeftPlayCountKey(recordId), key, count);
|
|
AudioLeftPlayCountSubmitBean ret = new AudioLeftPlayCountSubmitBean();
|
|
AudioLeftPlayCountSubmitBean ret = new AudioLeftPlayCountSubmitBean();
|
|
@@ -536,10 +537,10 @@ public class TEExamServiceImpl extends ServiceImpl<TEExamMapper, TEExam> impleme
|
|
if (!studentId.equals(es.getStudentId())) {
|
|
if (!studentId.equals(es.getStudentId())) {
|
|
throw new BusinessException("考试记录的学生Id和当前登录用户不一致");
|
|
throw new BusinessException("考试记录的学生Id和当前登录用户不一致");
|
|
}
|
|
}
|
|
- ExamRecordStatusEnum sta=ExamRecordCacheUtil.getStatus(recordId);
|
|
|
|
- if(ExamRecordStatusEnum.FINISHED.equals(sta)||ExamRecordStatusEnum.PERSISTED.equals(sta)) {
|
|
|
|
- throw new BusinessException("该考试已结束");
|
|
|
|
- }
|
|
|
|
|
|
+ ExamRecordStatusEnum sta = ExamRecordCacheUtil.getStatus(recordId);
|
|
|
|
+ if (ExamRecordStatusEnum.FINISHED.equals(sta) || ExamRecordStatusEnum.PERSISTED.equals(sta)) {
|
|
|
|
+ throw new BusinessException("该考试已结束");
|
|
|
|
+ }
|
|
|
|
|
|
String filePath = "upload/" + sdf.format(new Date()) + "/" + uuid() + "." + suffix;
|
|
String filePath = "upload/" + sdf.format(new Date()) + "/" + uuid() + "." + suffix;
|
|
InputStream in = null;
|
|
InputStream in = null;
|
|
@@ -597,10 +598,10 @@ public class TEExamServiceImpl extends ServiceImpl<TEExamMapper, TEExam> impleme
|
|
if (ep == null) {
|
|
if (ep == null) {
|
|
throw new BusinessException("未找到试卷");
|
|
throw new BusinessException("未找到试卷");
|
|
}
|
|
}
|
|
- ExamRecordStatusEnum sta=ExamRecordCacheUtil.getStatus(recordId);
|
|
|
|
- if(ExamRecordStatusEnum.FINISHED.equals(sta)||ExamRecordStatusEnum.PERSISTED.equals(sta)) {
|
|
|
|
- throw new BusinessException("该考试已结束");
|
|
|
|
- }
|
|
|
|
|
|
+ ExamRecordStatusEnum sta = ExamRecordCacheUtil.getStatus(recordId);
|
|
|
|
+ if (ExamRecordStatusEnum.FINISHED.equals(sta) || ExamRecordStatusEnum.PERSISTED.equals(sta)) {
|
|
|
|
+ throw new BusinessException("该考试已结束");
|
|
|
|
+ }
|
|
|
|
|
|
ExamResumeBean ret = new ExamResumeBean();
|
|
ExamResumeBean ret = new ExamResumeBean();
|
|
ret.setDurationSeconds(ExamRecordCacheUtil.getDurationSeconds(recordId));
|
|
ret.setDurationSeconds(ExamRecordCacheUtil.getDurationSeconds(recordId));
|
|
@@ -689,10 +690,10 @@ public class TEExamServiceImpl extends ServiceImpl<TEExamMapper, TEExam> impleme
|
|
if (!studentId.equals(es.getStudentId())) {
|
|
if (!studentId.equals(es.getStudentId())) {
|
|
throw new BusinessException("考试记录的学生Id和当前登录用户不一致");
|
|
throw new BusinessException("考试记录的学生Id和当前登录用户不一致");
|
|
}
|
|
}
|
|
- ExamRecordStatusEnum sta=ExamRecordCacheUtil.getStatus(recordId);
|
|
|
|
- if(ExamRecordStatusEnum.FINISHED.equals(sta)||ExamRecordStatusEnum.PERSISTED.equals(sta)) {
|
|
|
|
- throw new BusinessException("该考试已结束");
|
|
|
|
- }
|
|
|
|
|
|
+ ExamRecordStatusEnum sta = ExamRecordCacheUtil.getStatus(recordId);
|
|
|
|
+ if (ExamRecordStatusEnum.FINISHED.equals(sta) || ExamRecordStatusEnum.PERSISTED.equals(sta)) {
|
|
|
|
+ throw new BusinessException("该考试已结束");
|
|
|
|
+ }
|
|
|
|
|
|
Date now = new Date();
|
|
Date now = new Date();
|
|
ExamFinishBean ret = new ExamFinishBean();
|
|
ExamFinishBean ret = new ExamFinishBean();
|
|
@@ -742,6 +743,7 @@ public class TEExamServiceImpl extends ServiceImpl<TEExamMapper, TEExam> impleme
|
|
checkToPersisted(recordId);
|
|
checkToPersisted(recordId);
|
|
return ret;
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 检查条件并发送持久化消息
|
|
* 检查条件并发送持久化消息
|
|
*
|
|
*
|
|
@@ -764,6 +766,7 @@ public class TEExamServiceImpl extends ServiceImpl<TEExamMapper, TEExam> impleme
|
|
MqTagEnum.examRecordPersisted, recordId.toString(), recordId.toString());
|
|
MqTagEnum.examRecordPersisted, recordId.toString(), recordId.toString());
|
|
mqDtoService.assembleSendOneWayMsg(mqDto);
|
|
mqDtoService.assembleSendOneWayMsg(mqDto);
|
|
}
|
|
}
|
|
|
|
+
|
|
@Cacheable(value = "exam", key = "#examId", unless = "#result == null")
|
|
@Cacheable(value = "exam", key = "#examId", unless = "#result == null")
|
|
@Override
|
|
@Override
|
|
public ExamCacheBean getExamCacheBean(Long examId) {
|
|
public ExamCacheBean getExamCacheBean(Long examId) {
|