|
@@ -1,8 +1,10 @@
|
|
|
package com.qmth.themis.business.cache;
|
|
|
|
|
|
import com.qmth.themis.business.constant.SpringContextHolder;
|
|
|
+import com.qmth.themis.business.enums.ExamBreakHistoryFieldEnum;
|
|
|
import com.qmth.themis.business.enums.ExceptionEnum;
|
|
|
import com.qmth.themis.business.enums.VerifyExceptionEnum;
|
|
|
+import com.qmth.themis.business.service.TOeExamBreakHistoryService;
|
|
|
import com.qmth.themis.business.util.RedisUtil;
|
|
|
|
|
|
/**
|
|
@@ -13,71 +15,95 @@ import com.qmth.themis.business.util.RedisUtil;
|
|
|
* @Long: 2020-07-29
|
|
|
*/
|
|
|
public class ExamBreakCacheUtil {
|
|
|
+ private static TOeExamBreakHistoryService tOeExamBreakHistoryService = SpringContextHolder.getBean(TOeExamBreakHistoryService.class);
|
|
|
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 void setExamRecordId(Long examBreakId, Long examRecordId, boolean update) {
|
|
|
+ redisUtil.set(RedisKeyHelper.examBreakCacheKey(examBreakId), ExamBreakHistoryFieldEnum.exam_record_id.getCode(), examRecordId);
|
|
|
+ if (update) {
|
|
|
+ tOeExamBreakHistoryService.dataUpdateMq(examBreakId, ExamBreakHistoryFieldEnum.exam_record_id.name(), examRecordId);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
public static Long getExamRecordId(Long examBreakId) {
|
|
|
- return (Long) redisUtil.get(RedisKeyHelper.examBreakCacheKey(examBreakId), "examRecordId");
|
|
|
+ return (Long) redisUtil.get(RedisKeyHelper.examBreakCacheKey(examBreakId), ExamBreakHistoryFieldEnum.exam_record_id.getCode());
|
|
|
}
|
|
|
|
|
|
- public static void setBreakTime(Long examBreakId, Long breakTime) {
|
|
|
- redisUtil.set(RedisKeyHelper.examBreakCacheKey(examBreakId), "breakTime", breakTime);
|
|
|
+ public static void setBreakTime(Long examBreakId, Long breakTime, boolean update) {
|
|
|
+ redisUtil.set(RedisKeyHelper.examBreakCacheKey(examBreakId), ExamBreakHistoryFieldEnum.break_time.getCode(), breakTime);
|
|
|
+ if (update) {
|
|
|
+ tOeExamBreakHistoryService.dataUpdateMq(examBreakId, ExamBreakHistoryFieldEnum.break_time.name(), breakTime);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
public static Long getBreakTime(Long examBreakId) {
|
|
|
- return (Long) redisUtil.get(RedisKeyHelper.examBreakCacheKey(examBreakId), "breakTime");
|
|
|
+ return (Long) redisUtil.get(RedisKeyHelper.examBreakCacheKey(examBreakId), ExamBreakHistoryFieldEnum.break_time.getCode());
|
|
|
}
|
|
|
|
|
|
- public static void setBreakReason(Long examBreakId, ExceptionEnum breakReason) {
|
|
|
- redisUtil.set(RedisKeyHelper.examBreakCacheKey(examBreakId), "breakReason", breakReason);
|
|
|
+ public static void setBreakReason(Long examBreakId, ExceptionEnum breakReason, boolean update) {
|
|
|
+ redisUtil.set(RedisKeyHelper.examBreakCacheKey(examBreakId), ExamBreakHistoryFieldEnum.break_reason.getCode(), breakReason);
|
|
|
+ if (update) {
|
|
|
+ tOeExamBreakHistoryService.dataUpdateMq(examBreakId, ExamBreakHistoryFieldEnum.break_reason.name(), breakReason.name());
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
public static ExceptionEnum getBreakReason(Long examBreakId) {
|
|
|
- return (ExceptionEnum) redisUtil.get(RedisKeyHelper.examBreakCacheKey(examBreakId), "breakReason");
|
|
|
+ return (ExceptionEnum) redisUtil.get(RedisKeyHelper.examBreakCacheKey(examBreakId), ExamBreakHistoryFieldEnum.break_reason.getCode());
|
|
|
}
|
|
|
|
|
|
- public static void setResumeReason(Long examBreakId, String resumeReason) {
|
|
|
- redisUtil.set(RedisKeyHelper.examBreakCacheKey(examBreakId), "resumeReason", resumeReason);
|
|
|
+ public static void setResumeReason(Long examBreakId, String resumeReason, boolean update) {
|
|
|
+ redisUtil.set(RedisKeyHelper.examBreakCacheKey(examBreakId), ExamBreakHistoryFieldEnum.resume_reason.getCode(), resumeReason);
|
|
|
+ if (update) {
|
|
|
+ tOeExamBreakHistoryService.dataUpdateMq(examBreakId, ExamBreakHistoryFieldEnum.resume_reason.name(), resumeReason);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
public static Long getResumeReason(Long examBreakId) {
|
|
|
- return (Long) redisUtil.get(RedisKeyHelper.examBreakCacheKey(examBreakId), "resumeReason");
|
|
|
+ return (Long) redisUtil.get(RedisKeyHelper.examBreakCacheKey(examBreakId), ExamBreakHistoryFieldEnum.resume_reason.getCode());
|
|
|
}
|
|
|
|
|
|
|
|
|
- public static void setPrepareTime(Long examBreakId, Long prepareTime) {
|
|
|
- redisUtil.set(RedisKeyHelper.examBreakCacheKey(examBreakId), "prepareTime", prepareTime);
|
|
|
+ public static void setPrepareTime(Long examBreakId, Long prepareTime, boolean update) {
|
|
|
+ redisUtil.set(RedisKeyHelper.examBreakCacheKey(examBreakId), ExamBreakHistoryFieldEnum.prepare_time.getCode(), prepareTime);
|
|
|
+ if (update) {
|
|
|
+ tOeExamBreakHistoryService.dataUpdateMq(examBreakId, ExamBreakHistoryFieldEnum.prepare_time.name(), prepareTime);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
public static Long getPrepareTime(Long examBreakId) {
|
|
|
- return (Long) redisUtil.get(RedisKeyHelper.examBreakCacheKey(examBreakId), "prepareTime");
|
|
|
+ return (Long) redisUtil.get(RedisKeyHelper.examBreakCacheKey(examBreakId), ExamBreakHistoryFieldEnum.prepare_time.getCode());
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- public static void setStartTime(Long examBreakId, Long startTime) {
|
|
|
- redisUtil.set(RedisKeyHelper.examBreakCacheKey(examBreakId), "startTime", startTime);
|
|
|
+ public static void setStartTime(Long examBreakId, Long startTime, boolean update) {
|
|
|
+ redisUtil.set(RedisKeyHelper.examBreakCacheKey(examBreakId), ExamBreakHistoryFieldEnum.start_time.getCode(), startTime);
|
|
|
+ if (update) {
|
|
|
+ tOeExamBreakHistoryService.dataUpdateMq(examBreakId, ExamBreakHistoryFieldEnum.start_time.name(), startTime);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
public static Long getStartTime(Long examBreakId) {
|
|
|
- return (Long) redisUtil.get(RedisKeyHelper.examBreakCacheKey(examBreakId), "startTime");
|
|
|
+ return (Long) redisUtil.get(RedisKeyHelper.examBreakCacheKey(examBreakId), ExamBreakHistoryFieldEnum.start_time.getCode());
|
|
|
}
|
|
|
|
|
|
- public static void setEntryAuthenticationResult(Long examBreakId, VerifyExceptionEnum entryAuthenticationResult) {
|
|
|
- redisUtil.set(RedisKeyHelper.examBreakCacheKey(examBreakId), "entryAuthenticationResult", entryAuthenticationResult);
|
|
|
+ public static void setEntryAuthenticationResult(Long examBreakId, VerifyExceptionEnum entryAuthenticationResult, boolean update) {
|
|
|
+ redisUtil.set(RedisKeyHelper.examBreakCacheKey(examBreakId), ExamBreakHistoryFieldEnum.entry_authentication_result.getCode(), entryAuthenticationResult);
|
|
|
+ if (update) {
|
|
|
+ tOeExamBreakHistoryService.dataUpdateMq(examBreakId, ExamBreakHistoryFieldEnum.entry_authentication_result.name(), entryAuthenticationResult.name());
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
public static VerifyExceptionEnum getEntryAuthenticationResult(Long examBreakId) {
|
|
|
- return (VerifyExceptionEnum) redisUtil.get(RedisKeyHelper.examBreakCacheKey(examBreakId), "entryAuthenticationResult");
|
|
|
+ return (VerifyExceptionEnum) redisUtil.get(RedisKeyHelper.examBreakCacheKey(examBreakId), ExamBreakHistoryFieldEnum.entry_authentication_result.getCode());
|
|
|
}
|
|
|
|
|
|
- public static void setEntryAuthenticationId(Long examBreakId, Long entryAuthenticationId) {
|
|
|
- redisUtil.set(RedisKeyHelper.examBreakCacheKey(examBreakId), "entryAuthenticationId", entryAuthenticationId);
|
|
|
+ public static void setEntryAuthenticationId(Long examBreakId, Long entryAuthenticationId, boolean update) {
|
|
|
+ redisUtil.set(RedisKeyHelper.examBreakCacheKey(examBreakId), ExamBreakHistoryFieldEnum.entry_authentication_id.getCode(), entryAuthenticationId);
|
|
|
+ if (update) {
|
|
|
+ tOeExamBreakHistoryService.dataUpdateMq(examBreakId, ExamBreakHistoryFieldEnum.entry_authentication_id.name(), entryAuthenticationId);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
public static Long getEntryAuthenticationId(Long examBreakId) {
|
|
|
- return (Long) redisUtil.get(RedisKeyHelper.examBreakCacheKey(examBreakId), "entryAuthenticationId");
|
|
|
+ return (Long) redisUtil.get(RedisKeyHelper.examBreakCacheKey(examBreakId), ExamBreakHistoryFieldEnum.entry_authentication_id.getCode());
|
|
|
}
|
|
|
-}
|
|
|
+}
|