xiatian 4 年 前
コミット
f14c13df7b

+ 85 - 0
themis-business/src/main/java/com/qmth/themis/business/cache/ExamBreakCacheUtil.java

@@ -0,0 +1,85 @@
+package com.qmth.themis.business.cache;
+
+import java.util.Date;
+
+import com.qmth.themis.business.constant.SpringContextHolder;
+import com.qmth.themis.business.enums.BreakReasonEnum;
+import com.qmth.themis.business.util.RedisUtil;
+
+/**
+ * 断点缓存hash值操作
+ * 
+ * @Description:
+ * @Author: xiatian
+ * @Date: 2020-07-29
+ */
+public class ExamBreakCacheUtil {
+	private static RedisUtil redisUtil = SpringContextHolder.getBean(RedisUtil.class);
+
+	public static void setExamRecordId(Long examBreakId,Long examRecordId) {
+		redisUtil.set(RedisKeyHelper.examBreakCacheKey(examBreakId), "examRecordId", examRecordId);
+	}
+	
+	public static Long getExamRecordId(Long examBreakId) {
+		return (Long) redisUtil.get(RedisKeyHelper.examBreakCacheKey(examBreakId), "examRecordId");
+	}
+	
+	public static void setBreakTime(Long examBreakId,Date breakTime) {
+		redisUtil.set(RedisKeyHelper.examBreakCacheKey(examBreakId), "breakTime", breakTime);
+	}
+	
+	public static Date getBreakTime(Long examBreakId) {
+		return (Date) redisUtil.get(RedisKeyHelper.examBreakCacheKey(examBreakId), "breakTime");
+	}
+	
+	
+	public static void setBreakReason(Long examBreakId,BreakReasonEnum breakReason) {
+		redisUtil.set(RedisKeyHelper.examBreakCacheKey(examBreakId), "breakReason", breakReason);
+	}
+	
+	public static BreakReasonEnum getBreakReason(Long examBreakId) {
+		return (BreakReasonEnum) redisUtil.get(RedisKeyHelper.examBreakCacheKey(examBreakId), "breakReason");
+	}
+	
+	public static void setResumeReason(Long examBreakId,String resumeReason) {
+		redisUtil.set(RedisKeyHelper.examBreakCacheKey(examBreakId), "resumeReason", resumeReason);
+	}
+	
+	public static Long getResumeReason(Long examBreakId) {
+		return (Long) redisUtil.get(RedisKeyHelper.examBreakCacheKey(examBreakId), "resumeReason");
+	}
+	
+	
+	public static void setPrepareTime(Long examBreakId,Date prepareTime) {
+		redisUtil.set(RedisKeyHelper.examBreakCacheKey(examBreakId), "prepareTime", prepareTime);
+	}
+	
+	public static Date getPrepareTime(Long examBreakId) {
+		return (Date) redisUtil.get(RedisKeyHelper.examBreakCacheKey(examBreakId), "prepareTime");
+	}
+	
+	
+	public static void setStartTime(Long examBreakId,Date startTime) {
+		redisUtil.set(RedisKeyHelper.examBreakCacheKey(examBreakId), "startTime", startTime);
+	}
+	
+	public static Date getStartTime(Long examBreakId) {
+		return (Date) redisUtil.get(RedisKeyHelper.examBreakCacheKey(examBreakId), "startTime");
+	}
+	
+	public static void setEntryAuthenticationResult(Long examBreakId,Boolean entryAuthenticationResult) {
+		redisUtil.set(RedisKeyHelper.examBreakCacheKey(examBreakId), "entryAuthenticationResult", entryAuthenticationResult);
+	}
+	
+	public static Boolean getEntryAuthenticationResult(Long examBreakId) {
+		return (Boolean) redisUtil.get(RedisKeyHelper.examBreakCacheKey(examBreakId), "entryAuthenticationResult");
+	}
+	
+	public static void setEntryAuthenticationId(Long examBreakId,Long entryAuthenticationId) {
+		redisUtil.set(RedisKeyHelper.examBreakCacheKey(examBreakId), "entryAuthenticationId", entryAuthenticationId);
+	}
+	
+	public static Long getEntryAuthenticationId(Long examBreakId) {
+		return (Long) redisUtil.get(RedisKeyHelper.examBreakCacheKey(examBreakId), "entryAuthenticationId");
+	}
+}

+ 15 - 0
themis-business/src/main/java/com/qmth/themis/business/cache/RedisKeyHelper.java

@@ -33,6 +33,11 @@ public class RedisKeyHelper {
 	 */
 	private static String faceVerifyKeyPrefix = "face_verify::";
 	
+	/**
+	 * 断点
+	 */
+	private static String examBreakKeyPrefix = "exam_break::";
+	
 	/**
 	 * 活体验证
 	 */
@@ -134,5 +139,15 @@ public class RedisKeyHelper {
 	public static String livenessVerifyCacheKey(Long id) {
 		return livenessVerifyKeyPrefix + id;
 	}
+	
+	/**断点缓存大key
+	 * @param id
+	 * @return
+	 */
+	public static String examBreakCacheKey(Long id) {
+		return examBreakKeyPrefix + id;
+	}
+	
+	
 
 }