|
@@ -1,15 +1,14 @@
|
|
|
package com.qmth.themis.business.cache;
|
|
|
|
|
|
-import java.util.Date;
|
|
|
-import java.util.Objects;
|
|
|
-
|
|
|
import com.qmth.themis.business.constant.SpringContextHolder;
|
|
|
-import com.qmth.themis.business.enums.ExamRecordStatusEnum;
|
|
|
-import com.qmth.themis.business.enums.FinishTypeEnum;
|
|
|
-import com.qmth.themis.business.enums.VerifyExceptionEnum;
|
|
|
+import com.qmth.themis.business.constant.SystemConstant;
|
|
|
+import com.qmth.themis.business.enums.*;
|
|
|
import com.qmth.themis.business.service.TOeExamRecordService;
|
|
|
import com.qmth.themis.business.util.RedisUtil;
|
|
|
|
|
|
+import java.util.Date;
|
|
|
+import java.util.Objects;
|
|
|
+
|
|
|
/**
|
|
|
* 考试记录缓存hash值操作
|
|
|
*
|
|
@@ -23,15 +22,15 @@ public class ExamRecordCacheUtil {
|
|
|
private static RedisUtil redisUtil = SpringContextHolder.getBean(RedisUtil.class);
|
|
|
|
|
|
public static Long getId(Long recordId) {
|
|
|
- return (Long) redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "id");
|
|
|
+ return Long.parseLong(String.valueOf(redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "id")));
|
|
|
}
|
|
|
|
|
|
public static Long getExamStudentId(Long recordId) {
|
|
|
- return (Long) redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "examStudentId");
|
|
|
+ return Long.parseLong(String.valueOf(redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "examStudentId")));
|
|
|
}
|
|
|
|
|
|
public static Long getPaperId(Long recordId) {
|
|
|
- return (Long) redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "paperId");
|
|
|
+ return Long.parseLong(String.valueOf(redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "paperId")));
|
|
|
}
|
|
|
|
|
|
public static void setFirstStartTime(Long recordId, Date date) {
|
|
@@ -45,15 +44,15 @@ public class ExamRecordCacheUtil {
|
|
|
}
|
|
|
|
|
|
public static Integer getDurationSeconds(Long recordId) {
|
|
|
- return (Integer) redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "durationSeconds");
|
|
|
+ return Integer.parseInt(String.valueOf(redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "durationSeconds")));
|
|
|
}
|
|
|
|
|
|
public static Double getObjectiveScore(Long recordId) {
|
|
|
- return (Double) redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "objectiveScore");
|
|
|
+ return Double.parseDouble(String.valueOf(redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "objectiveScore")));
|
|
|
}
|
|
|
|
|
|
public static Long getExamId(Long recordId) {
|
|
|
- return (Long) redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "examId");
|
|
|
+ return Long.parseLong(String.valueOf(redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "examId")));
|
|
|
}
|
|
|
|
|
|
public static void setObjectiveScore(Long recordId, Double objectiveScore) {
|
|
@@ -89,7 +88,7 @@ public class ExamRecordCacheUtil {
|
|
|
}
|
|
|
|
|
|
public static Integer getLeftBreakResumeCount(Long recordId) {
|
|
|
- return (Integer) redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "leftBreakResumeCount");
|
|
|
+ return Integer.parseInt(String.valueOf(redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "leftBreakResumeCount")));
|
|
|
}
|
|
|
|
|
|
public static void setLeftBreakResumeCount(Long recordId, Integer leftBreakResumeCount) {
|
|
@@ -98,11 +97,11 @@ public class ExamRecordCacheUtil {
|
|
|
}
|
|
|
|
|
|
public static ExamRecordStatusEnum getStatus(Long recordId) {
|
|
|
- return (ExamRecordStatusEnum) redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "status");
|
|
|
+ return ExamRecordStatusEnum.valueOf(String.valueOf(redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "status")));
|
|
|
}
|
|
|
|
|
|
public static Long getLastBreakId(Long recordId) {
|
|
|
- return (Long) redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "lastBreakId");
|
|
|
+ return Long.parseLong(String.valueOf(redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "lastBreakId")));
|
|
|
}
|
|
|
|
|
|
public static Date getLastBreakTime(Long recordId) {
|
|
@@ -119,7 +118,7 @@ public class ExamRecordCacheUtil {
|
|
|
}
|
|
|
|
|
|
public static Long getEntryAuthenticationId(Long recordId) {
|
|
|
- return (Long) redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "entryAuthenticationId");
|
|
|
+ return Long.parseLong(String.valueOf(redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "entryAuthenticationId")));
|
|
|
}
|
|
|
|
|
|
public static void setEntryAuthenticationId(Long recordId, Long entryAuthenticationId) {
|
|
@@ -128,7 +127,7 @@ public class ExamRecordCacheUtil {
|
|
|
}
|
|
|
|
|
|
public static Long getExamActivityId(Long recordId) {
|
|
|
- return (Long) redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "examActivityId");
|
|
|
+ return Long.parseLong(String.valueOf(redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "examActivityId")));
|
|
|
}
|
|
|
|
|
|
public static void setWarningCount(Long recordId, Integer warningCount) {
|
|
@@ -137,7 +136,7 @@ public class ExamRecordCacheUtil {
|
|
|
}
|
|
|
|
|
|
public static Integer getWarningCount(Long recordId) {
|
|
|
- return (Integer) redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "warningCount");
|
|
|
+ return Integer.parseInt(String.valueOf(redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "warningCount")));
|
|
|
}
|
|
|
|
|
|
public static void setBreachStatus(Long recordId, Integer breachStatus) {
|
|
@@ -146,7 +145,7 @@ public class ExamRecordCacheUtil {
|
|
|
}
|
|
|
|
|
|
public static Integer getBreachStatus(Long recordId) {
|
|
|
- return (Integer) redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "breachStatus");
|
|
|
+ return Integer.parseInt(String.valueOf(redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "breachStatus")));
|
|
|
}
|
|
|
|
|
|
public static void setInProcessLivenessVerifyCount(Long recordId, Integer inProcessLivenessVerifyCount) {
|
|
@@ -155,7 +154,7 @@ public class ExamRecordCacheUtil {
|
|
|
}
|
|
|
|
|
|
public static Integer getInProcessLivenessVerifyCount(Long recordId) {
|
|
|
- return (Integer) redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "inProcessLivenessVerifyCount");
|
|
|
+ return Integer.parseInt(String.valueOf(redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "inProcessLivenessVerifyCount")));
|
|
|
}
|
|
|
|
|
|
public static void setMonitorKey(Long recordId, String monitorKey) {
|
|
@@ -169,4 +168,102 @@ public class ExamRecordCacheUtil {
|
|
|
}
|
|
|
return (String) redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "monitorKey");
|
|
|
}
|
|
|
+
|
|
|
+ public static String getMonitorLiveUrl(Long recordId, String source) {
|
|
|
+ return (String) redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), SystemConstant.MONITOR_LIVE_URL_ + source);
|
|
|
+ }
|
|
|
+
|
|
|
+ public static String getMonitorLiveUrlMobileFirst(Long recordId) {
|
|
|
+ return (String) redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), SystemConstant.MONITOR_LIVE_URL_ + MonitorVideoSourceEnum.MOBILE_FIRST.name());
|
|
|
+ }
|
|
|
+
|
|
|
+ public static String getMonitorLiveUrlMobileSecond(Long recordId) {
|
|
|
+ return (String) redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), SystemConstant.MONITOR_LIVE_URL_ + MonitorVideoSourceEnum.MOBILE_SECOND.name());
|
|
|
+ }
|
|
|
+
|
|
|
+ public static String getMonitorLiveUrlClientCamera(Long recordId) {
|
|
|
+ return (String) redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), SystemConstant.MONITOR_LIVE_URL_ + MonitorVideoSourceEnum.CLIENT_CAMERA.name());
|
|
|
+ }
|
|
|
+
|
|
|
+ public static String getMonitorLiveUrlClientScreen(Long recordId) {
|
|
|
+ return (String) redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), SystemConstant.MONITOR_LIVE_URL_ + MonitorVideoSourceEnum.CLIENT_SCREEN.name());
|
|
|
+ }
|
|
|
+
|
|
|
+ public static void setMonitorLiveUrl(Long recordId, String source, String liveUrl) {
|
|
|
+ redisUtil.set(RedisKeyHelper.examRecordCacheKey(recordId), SystemConstant.MONITOR_LIVE_URL_ + source, liveUrl);
|
|
|
+ examRecordService.dataUpdateMq(recordId, "monitor_live_url", liveUrl);
|
|
|
+ }
|
|
|
+
|
|
|
+ public static MonitorStatusSourceEnum getMonitorStatus(Long recordId, String source) {
|
|
|
+ return MonitorStatusSourceEnum.valueOf(String.valueOf(redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), SystemConstant.MONITOR_STATUS_ + source)));
|
|
|
+ }
|
|
|
+
|
|
|
+ public static void setMonitorStatus(Long recordId, String source, MonitorStatusSourceEnum statusSourceEnum) {
|
|
|
+ redisUtil.set(RedisKeyHelper.examRecordCacheKey(recordId), SystemConstant.MONITOR_STATUS_ + source, statusSourceEnum);
|
|
|
+ examRecordService.dataUpdateMq(recordId, "monitor_status_source", statusSourceEnum);
|
|
|
+ }
|
|
|
+
|
|
|
+ public static MonitorCallStatusSourceEnum getMonitorCallStatus(Long recordId, String source) {
|
|
|
+ return MonitorCallStatusSourceEnum.valueOf(String.valueOf(redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), SystemConstant.MONITOR_CALL_STATUS_ + source)));
|
|
|
+ }
|
|
|
+
|
|
|
+ public static void setMonitorCallStatus(Long recordId, String source, MonitorCallStatusSourceEnum callStatusSourceEnum) {
|
|
|
+ redisUtil.set(RedisKeyHelper.examRecordCacheKey(recordId), SystemConstant.MONITOR_CALL_STATUS_ + source, callStatusSourceEnum.name());
|
|
|
+ }
|
|
|
+
|
|
|
+ public static WebsocketStatusEnum getClientWebsocketStatus(Long recordId) {
|
|
|
+ return WebsocketStatusEnum.valueOf(String.valueOf(redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "clientWebsocketStatus")));
|
|
|
+ }
|
|
|
+
|
|
|
+ public static void setClientWebsocketStatus(Long recordId, WebsocketStatusEnum websocketStatusEnum) {
|
|
|
+ redisUtil.set(RedisKeyHelper.examRecordCacheKey(recordId), "clientWebsocketStatus", websocketStatusEnum);
|
|
|
+ examRecordService.dataUpdateMq(recordId, "client_websocket_status", websocketStatusEnum);
|
|
|
+ }
|
|
|
+
|
|
|
+ public static void setClientCurrentIp(Long recordId, String ip) {
|
|
|
+ redisUtil.set(RedisKeyHelper.examRecordCacheKey(recordId), "clientCurrentIp", ip);
|
|
|
+ examRecordService.dataUpdateMq(recordId, "client_current_ip", ip);
|
|
|
+ }
|
|
|
+
|
|
|
+ public static void setClientWebsocketId(Long recordId, String id) {
|
|
|
+ redisUtil.set(RedisKeyHelper.examRecordCacheKey(recordId), "clientWebsocketId", id);
|
|
|
+ examRecordService.dataUpdateMq(recordId, "client_websocket_id", id);
|
|
|
+ }
|
|
|
+
|
|
|
+ public static void setClientLastSyncTime(Long recordId) {
|
|
|
+ Date now = new Date();
|
|
|
+ redisUtil.set(RedisKeyHelper.examRecordCacheKey(recordId), "clientLastSyncTime", now);
|
|
|
+ examRecordService.dataUpdateMq(recordId, "client_last_sync_time", now);
|
|
|
+ }
|
|
|
+
|
|
|
+ public static void setPaperDownload(Long recordId, Integer paperDownload) {
|
|
|
+ redisUtil.set(RedisKeyHelper.examRecordCacheKey(recordId), "paperDownload", paperDownload);
|
|
|
+ examRecordService.dataUpdateMq(recordId, "paper_download", paperDownload);
|
|
|
+ }
|
|
|
+
|
|
|
+ public static void setAnswerProgress(Long recordId, Double progress) {
|
|
|
+ redisUtil.set(RedisKeyHelper.examRecordCacheKey(recordId), "answerProgress", progress);
|
|
|
+ examRecordService.dataUpdateMq(recordId, "answer_progress", progress);
|
|
|
+ }
|
|
|
+
|
|
|
+ public static void setLastBreakId(Long recordId, Long breakId) {
|
|
|
+ redisUtil.set(RedisKeyHelper.examRecordCacheKey(recordId), "lastBreakId", breakId);
|
|
|
+ examRecordService.dataUpdateMq(recordId, "last_break_id", breakId);
|
|
|
+ }
|
|
|
+
|
|
|
+ public static void setLastBreakTime(Long recordId) {
|
|
|
+ Date now = new Date();
|
|
|
+ redisUtil.set(RedisKeyHelper.examRecordCacheKey(recordId), "lastBreakTime", now);
|
|
|
+ examRecordService.dataUpdateMq(recordId, "last_break_time", now);
|
|
|
+ }
|
|
|
+
|
|
|
+ public static void setLastStartTime(Long recordId) {
|
|
|
+ Date now = new Date();
|
|
|
+ redisUtil.set(RedisKeyHelper.examRecordCacheKey(recordId), "lastStartTime", now);
|
|
|
+ examRecordService.dataUpdateMq(recordId, "last_start_time", now);
|
|
|
+ }
|
|
|
+
|
|
|
+ public static Date getLastStartTime(Long recordId) {
|
|
|
+ return (Date) redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "lastStartTime");
|
|
|
+ }
|
|
|
}
|