|
@@ -1,6 +1,7 @@
|
|
|
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;
|
|
@@ -11,161 +12,161 @@ import com.qmth.themis.business.util.RedisUtil;
|
|
|
|
|
|
/**
|
|
|
* 考试记录缓存hash值操作
|
|
|
- *
|
|
|
+ *
|
|
|
* @Description:
|
|
|
* @Author: xiatian
|
|
|
* @Date: 2020-07-29
|
|
|
*/
|
|
|
public class ExamRecordCacheUtil {
|
|
|
-
|
|
|
- private static TOeExamRecordService examRecordService = SpringContextHolder.getBean(TOeExamRecordService.class);
|
|
|
- private static RedisUtil redisUtil = SpringContextHolder.getBean(RedisUtil.class);
|
|
|
-
|
|
|
- public static Long getId(Long recordId) {
|
|
|
- return (Long) redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "id");
|
|
|
- }
|
|
|
-
|
|
|
- public static Long getExamStudentId(Long recordId) {
|
|
|
- return (Long)redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "examStudentId");
|
|
|
- }
|
|
|
-
|
|
|
- public static Long getPaperId(Long recordId) {
|
|
|
- return (Long) redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "paperId");
|
|
|
- }
|
|
|
-
|
|
|
- public static void setFirstStartTime(Long recordId, Date date) {
|
|
|
- redisUtil.set(RedisKeyHelper.examRecordCacheKey(recordId), "firstStartTime", date);
|
|
|
- examRecordService.dataUpdateMq(recordId, "first_start_time", date,1);
|
|
|
- }
|
|
|
-
|
|
|
- public static void setStatus(Long recordId, ExamRecordStatusEnum status) {
|
|
|
- redisUtil.set(RedisKeyHelper.examRecordCacheKey(recordId), "status", status);
|
|
|
- examRecordService.dataUpdateMq(recordId, "status", status);
|
|
|
- }
|
|
|
-
|
|
|
- public static Integer getDurationSeconds(Long recordId) {
|
|
|
- return (Integer) redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "surationSeconds");
|
|
|
- }
|
|
|
-
|
|
|
- public static Double getObjectiveScore(Long recordId) {
|
|
|
- return (Double) redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "objectiveScore");
|
|
|
- }
|
|
|
-
|
|
|
- public static Long getExamId(Long recordId) {
|
|
|
- return (Long) redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "examId");
|
|
|
- }
|
|
|
-
|
|
|
- public static void setObjectiveScore(Long recordId, Double objectiveScore) {
|
|
|
- redisUtil.set(RedisKeyHelper.examRecordCacheKey(recordId), "objectiveScore", objectiveScore);
|
|
|
- examRecordService.dataUpdateMq(recordId, "objective_score", objectiveScore);
|
|
|
- }
|
|
|
-
|
|
|
- public static void setFinishTime(Long recordId, Date finishTime) {
|
|
|
- redisUtil.set(RedisKeyHelper.examRecordCacheKey(recordId), "finishTime", finishTime);
|
|
|
- examRecordService.dataUpdateMq(recordId, "finish_time", finishTime,1);
|
|
|
- }
|
|
|
-
|
|
|
- public static Date getFinishTime(Long recordId) {
|
|
|
- return (Date) redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "finishTime");
|
|
|
- }
|
|
|
-
|
|
|
- public static void setDurationSeconds(Long recordId, Integer durationSeconds) {
|
|
|
- redisUtil.set(RedisKeyHelper.examRecordCacheKey(recordId), "durationSeconds", durationSeconds);
|
|
|
- examRecordService.dataUpdateMq(recordId, "duration_seconds", durationSeconds);
|
|
|
- }
|
|
|
-
|
|
|
- public static void setFinishType(Long recordId, FinishTypeEnum finishType) {
|
|
|
- redisUtil.set(RedisKeyHelper.examRecordCacheKey(recordId), "finishType", finishType);
|
|
|
- examRecordService.dataUpdateMq(recordId, "finish_type", finishType);
|
|
|
- }
|
|
|
-
|
|
|
- public static FinishTypeEnum getFinishType(Long recordId) {
|
|
|
- return (FinishTypeEnum) redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "finishType");
|
|
|
- }
|
|
|
-
|
|
|
- public static Date getClientLastSyncTime(Long recordId) {
|
|
|
- return (Date) redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "clientLastSyncTime");
|
|
|
- }
|
|
|
-
|
|
|
- public static Integer getLeftBreakResumeCount(Long recordId) {
|
|
|
- return (Integer) redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "leftBreakResumeCount");
|
|
|
- }
|
|
|
-
|
|
|
- public static void setLeftBreakResumeCount(Long recordId,Integer leftBreakResumeCount) {
|
|
|
- redisUtil.set(RedisKeyHelper.examRecordCacheKey(recordId), "leftBreakResumeCount",leftBreakResumeCount);
|
|
|
- examRecordService.dataUpdateMq(recordId, "left_break_resume_count", leftBreakResumeCount);
|
|
|
- }
|
|
|
-
|
|
|
- public static ExamRecordStatusEnum getStatus(Long recordId) {
|
|
|
- return (ExamRecordStatusEnum) redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "status");
|
|
|
- }
|
|
|
-
|
|
|
- public static Long getLastBreakId(Long recordId) {
|
|
|
- return (Long) redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "lastBreakId");
|
|
|
- }
|
|
|
-
|
|
|
- public static Date getLastBreakTime(Long recordId) {
|
|
|
- return (Date) redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "lastBreakTime");
|
|
|
- }
|
|
|
-
|
|
|
- public static VerifyExceptionEnum getEntryAuthenticationResult(Long recordId) {
|
|
|
- return (VerifyExceptionEnum) redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "entryAuthenticationResult");
|
|
|
- }
|
|
|
-
|
|
|
- public static void setEntryAuthenticationResult(Long recordId, VerifyExceptionEnum entryAuthenticationResult) {
|
|
|
- redisUtil.set(RedisKeyHelper.examRecordCacheKey(recordId), "entryAuthenticationResult", entryAuthenticationResult);
|
|
|
- examRecordService.dataUpdateMq(recordId, "entry_authentication_result", entryAuthenticationResult);
|
|
|
- }
|
|
|
-
|
|
|
- public static Long getEntryAuthenticationId(Long recordId) {
|
|
|
- return (Long) redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "entryAuthenticationId");
|
|
|
- }
|
|
|
-
|
|
|
- public static void setEntryAuthenticationId(Long recordId, Long entryAuthenticationId) {
|
|
|
- redisUtil.set(RedisKeyHelper.examRecordCacheKey(recordId), "entryAuthenticationId", entryAuthenticationId);
|
|
|
- examRecordService.dataUpdateMq(recordId, "entry_authentication_id", entryAuthenticationId);
|
|
|
- }
|
|
|
-
|
|
|
- public static Long getExamActivityId(Long recordId) {
|
|
|
- return (Long) redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "examActivityId");
|
|
|
- }
|
|
|
-
|
|
|
- public static void setWarningCount(Long recordId, Integer warningCount) {
|
|
|
- redisUtil.set(RedisKeyHelper.examRecordCacheKey(recordId), "warningCount", warningCount);
|
|
|
- examRecordService.dataUpdateMq(recordId, "warning_count", warningCount);
|
|
|
- }
|
|
|
-
|
|
|
- public static Integer getWarningCount(Long recordId) {
|
|
|
- return (Integer) redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "warningCount");
|
|
|
- }
|
|
|
-
|
|
|
- public static void setBreachStatus(Long recordId, Integer breachStatus) {
|
|
|
- redisUtil.set(RedisKeyHelper.examRecordCacheKey(recordId), "breachStatus", breachStatus);
|
|
|
- examRecordService.dataUpdateMq(recordId, "breach_status", breachStatus);
|
|
|
- }
|
|
|
-
|
|
|
- public static Integer getBreachStatus(Long recordId) {
|
|
|
- return (Integer) redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "breachStatus");
|
|
|
- }
|
|
|
-
|
|
|
- public static void setInProcessLivenessVerifyCount(Long recordId, Integer inProcessLivenessVerifyCount) {
|
|
|
- redisUtil.set(RedisKeyHelper.examRecordCacheKey(recordId), "inProcessLivenessVerifyCount", inProcessLivenessVerifyCount);
|
|
|
- examRecordService.dataUpdateMq(recordId, "in_process_liveness_verify_count", inProcessLivenessVerifyCount);
|
|
|
- }
|
|
|
-
|
|
|
- public static Integer getInProcessLivenessVerifyCount(Long recordId) {
|
|
|
- return (Integer) redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "inProcessLivenessVerifyCount");
|
|
|
- }
|
|
|
-
|
|
|
- public static void setMonitorKey(Long recordId, String monitorKey) {
|
|
|
- redisUtil.set(RedisKeyHelper.examRecordCacheKey(recordId), "monitorKey", monitorKey);
|
|
|
- examRecordService.dataUpdateMq(recordId, "monitorKey", monitorKey);
|
|
|
- }
|
|
|
-
|
|
|
- public static String getMonitorKey(Long recordId) {
|
|
|
- return (String) redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "monitorKey");
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+ private static TOeExamRecordService examRecordService = SpringContextHolder.getBean(TOeExamRecordService.class);
|
|
|
+ private static RedisUtil redisUtil = SpringContextHolder.getBean(RedisUtil.class);
|
|
|
+
|
|
|
+ public static Long getId(Long recordId) {
|
|
|
+ return (Long) redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "id");
|
|
|
+ }
|
|
|
+
|
|
|
+ public static Long getExamStudentId(Long recordId) {
|
|
|
+ return (Long) redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "examStudentId");
|
|
|
+ }
|
|
|
+
|
|
|
+ public static Long getPaperId(Long recordId) {
|
|
|
+ return (Long) redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "paperId");
|
|
|
+ }
|
|
|
+
|
|
|
+ public static void setFirstStartTime(Long recordId, Date date) {
|
|
|
+ redisUtil.set(RedisKeyHelper.examRecordCacheKey(recordId), "firstStartTime", date);
|
|
|
+ examRecordService.dataUpdateMq(recordId, "first_start_time", date, 1);
|
|
|
+ }
|
|
|
+
|
|
|
+ public static void setStatus(Long recordId, ExamRecordStatusEnum status) {
|
|
|
+ redisUtil.set(RedisKeyHelper.examRecordCacheKey(recordId), "status", status);
|
|
|
+ examRecordService.dataUpdateMq(recordId, "status", status);
|
|
|
+ }
|
|
|
+
|
|
|
+ public static Integer getDurationSeconds(Long recordId) {
|
|
|
+ return (Integer) redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "surationSeconds");
|
|
|
+ }
|
|
|
+
|
|
|
+ public static Double getObjectiveScore(Long recordId) {
|
|
|
+ return (Double) redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "objectiveScore");
|
|
|
+ }
|
|
|
+
|
|
|
+ public static Long getExamId(Long recordId) {
|
|
|
+ return (Long) redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "examId");
|
|
|
+ }
|
|
|
+
|
|
|
+ public static void setObjectiveScore(Long recordId, Double objectiveScore) {
|
|
|
+ redisUtil.set(RedisKeyHelper.examRecordCacheKey(recordId), "objectiveScore", objectiveScore);
|
|
|
+ examRecordService.dataUpdateMq(recordId, "objective_score", objectiveScore);
|
|
|
+ }
|
|
|
+
|
|
|
+ public static void setFinishTime(Long recordId, Date finishTime) {
|
|
|
+ redisUtil.set(RedisKeyHelper.examRecordCacheKey(recordId), "finishTime", finishTime);
|
|
|
+ examRecordService.dataUpdateMq(recordId, "finish_time", finishTime, 1);
|
|
|
+ }
|
|
|
+
|
|
|
+ public static Date getFinishTime(Long recordId) {
|
|
|
+ return (Date) redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "finishTime");
|
|
|
+ }
|
|
|
+
|
|
|
+ public static void setDurationSeconds(Long recordId, Integer durationSeconds) {
|
|
|
+ redisUtil.set(RedisKeyHelper.examRecordCacheKey(recordId), "durationSeconds", durationSeconds);
|
|
|
+ examRecordService.dataUpdateMq(recordId, "duration_seconds", durationSeconds);
|
|
|
+ }
|
|
|
+
|
|
|
+ public static void setFinishType(Long recordId, FinishTypeEnum finishType) {
|
|
|
+ redisUtil.set(RedisKeyHelper.examRecordCacheKey(recordId), "finishType", finishType);
|
|
|
+ examRecordService.dataUpdateMq(recordId, "finish_type", finishType);
|
|
|
+ }
|
|
|
+
|
|
|
+ public static FinishTypeEnum getFinishType(Long recordId) {
|
|
|
+ return (FinishTypeEnum) redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "finishType");
|
|
|
+ }
|
|
|
+
|
|
|
+ public static Date getClientLastSyncTime(Long recordId) {
|
|
|
+ return (Date) redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "clientLastSyncTime");
|
|
|
+ }
|
|
|
+
|
|
|
+ public static Integer getLeftBreakResumeCount(Long recordId) {
|
|
|
+ return (Integer) redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "leftBreakResumeCount");
|
|
|
+ }
|
|
|
+
|
|
|
+ public static void setLeftBreakResumeCount(Long recordId, Integer leftBreakResumeCount) {
|
|
|
+ redisUtil.set(RedisKeyHelper.examRecordCacheKey(recordId), "leftBreakResumeCount", leftBreakResumeCount);
|
|
|
+ examRecordService.dataUpdateMq(recordId, "left_break_resume_count", leftBreakResumeCount);
|
|
|
+ }
|
|
|
+
|
|
|
+ public static ExamRecordStatusEnum getStatus(Long recordId) {
|
|
|
+ return (ExamRecordStatusEnum) redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "status");
|
|
|
+ }
|
|
|
+
|
|
|
+ public static Long getLastBreakId(Long recordId) {
|
|
|
+ return (Long) redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "lastBreakId");
|
|
|
+ }
|
|
|
+
|
|
|
+ public static Date getLastBreakTime(Long recordId) {
|
|
|
+ return (Date) redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "lastBreakTime");
|
|
|
+ }
|
|
|
+
|
|
|
+ public static VerifyExceptionEnum getEntryAuthenticationResult(Long recordId) {
|
|
|
+ return (VerifyExceptionEnum) redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "entryAuthenticationResult");
|
|
|
+ }
|
|
|
+
|
|
|
+ public static void setEntryAuthenticationResult(Long recordId, VerifyExceptionEnum entryAuthenticationResult) {
|
|
|
+ redisUtil.set(RedisKeyHelper.examRecordCacheKey(recordId), "entryAuthenticationResult", entryAuthenticationResult);
|
|
|
+ examRecordService.dataUpdateMq(recordId, "entry_authentication_result", entryAuthenticationResult);
|
|
|
+ }
|
|
|
+
|
|
|
+ public static Long getEntryAuthenticationId(Long recordId) {
|
|
|
+ return (Long) redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "entryAuthenticationId");
|
|
|
+ }
|
|
|
+
|
|
|
+ public static void setEntryAuthenticationId(Long recordId, Long entryAuthenticationId) {
|
|
|
+ redisUtil.set(RedisKeyHelper.examRecordCacheKey(recordId), "entryAuthenticationId", entryAuthenticationId);
|
|
|
+ examRecordService.dataUpdateMq(recordId, "entry_authentication_id", entryAuthenticationId);
|
|
|
+ }
|
|
|
+
|
|
|
+ public static Long getExamActivityId(Long recordId) {
|
|
|
+ return (Long) redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "examActivityId");
|
|
|
+ }
|
|
|
+
|
|
|
+ public static void setWarningCount(Long recordId, Integer warningCount) {
|
|
|
+ redisUtil.set(RedisKeyHelper.examRecordCacheKey(recordId), "warningCount", warningCount);
|
|
|
+ examRecordService.dataUpdateMq(recordId, "warning_count", warningCount);
|
|
|
+ }
|
|
|
+
|
|
|
+ public static Integer getWarningCount(Long recordId) {
|
|
|
+ return (Integer) redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "warningCount");
|
|
|
+ }
|
|
|
+
|
|
|
+ public static void setBreachStatus(Long recordId, Integer breachStatus) {
|
|
|
+ redisUtil.set(RedisKeyHelper.examRecordCacheKey(recordId), "breachStatus", breachStatus);
|
|
|
+ examRecordService.dataUpdateMq(recordId, "breach_status", breachStatus);
|
|
|
+ }
|
|
|
+
|
|
|
+ public static Integer getBreachStatus(Long recordId) {
|
|
|
+ return (Integer) redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "breachStatus");
|
|
|
+ }
|
|
|
+
|
|
|
+ public static void setInProcessLivenessVerifyCount(Long recordId, Integer inProcessLivenessVerifyCount) {
|
|
|
+ redisUtil.set(RedisKeyHelper.examRecordCacheKey(recordId), "inProcessLivenessVerifyCount", inProcessLivenessVerifyCount);
|
|
|
+ examRecordService.dataUpdateMq(recordId, "in_process_liveness_verify_count", inProcessLivenessVerifyCount);
|
|
|
+ }
|
|
|
+
|
|
|
+ public static Integer getInProcessLivenessVerifyCount(Long recordId) {
|
|
|
+ return (Integer) redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "inProcessLivenessVerifyCount");
|
|
|
+ }
|
|
|
+
|
|
|
+ public static void setMonitorKey(Long recordId, String monitorKey) {
|
|
|
+ redisUtil.set(RedisKeyHelper.examRecordCacheKey(recordId), "monitorKey", monitorKey);
|
|
|
+ examRecordService.dataUpdateMq(recordId, "monitorKey", monitorKey);
|
|
|
+ }
|
|
|
+
|
|
|
+ public static String getMonitorKey(Long recordId) {
|
|
|
+ if (Objects.isNull(redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "monitorKey"))) {
|
|
|
+ setMonitorKey(recordId, String.valueOf(redisUtil.getRedisSequence()));
|
|
|
+ }
|
|
|
+ return (String) redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "monitorKey");
|
|
|
+ }
|
|
|
}
|