|
@@ -5,6 +5,7 @@ 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 org.bouncycastle.util.Strings;
|
|
|
|
|
|
import java.util.Date;
|
|
|
import java.util.Objects;
|
|
@@ -22,15 +23,15 @@ public class ExamRecordCacheUtil {
|
|
|
private static RedisUtil redisUtil = SpringContextHolder.getBean(RedisUtil.class);
|
|
|
|
|
|
public static Long getId(Long recordId) {
|
|
|
- return Objects.nonNull(redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "id")) ? Long.parseLong(String.valueOf(redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "id"))) : null;
|
|
|
+ return (Long) redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "id");
|
|
|
}
|
|
|
|
|
|
public static Long getExamStudentId(Long recordId) {
|
|
|
- return Objects.nonNull(redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "examStudentId")) ? Long.parseLong(String.valueOf(redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "examStudentId"))) : null;
|
|
|
+ return (Long) redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "examStudentId");
|
|
|
}
|
|
|
|
|
|
public static Long getPaperId(Long recordId) {
|
|
|
- return Objects.nonNull(redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "paperId")) ? Long.parseLong(String.valueOf(redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "paperId"))) : null;
|
|
|
+ return (Long) redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "paperId");
|
|
|
}
|
|
|
|
|
|
public static void setFirstStartTime(Long recordId, Date date) {
|
|
@@ -44,15 +45,15 @@ public class ExamRecordCacheUtil {
|
|
|
}
|
|
|
|
|
|
public static Integer getDurationSeconds(Long recordId) {
|
|
|
- return Objects.nonNull(redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "durationSeconds")) ? Integer.parseInt(String.valueOf(redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "durationSeconds"))) : null;
|
|
|
+ return (Integer) redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "durationSeconds");
|
|
|
}
|
|
|
|
|
|
public static Double getObjectiveScore(Long recordId) {
|
|
|
- return Objects.nonNull(redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "objectiveScore")) ? Double.parseDouble(String.valueOf(redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "objectiveScore"))) : null;
|
|
|
+ return (Double) redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "objectiveScore");
|
|
|
}
|
|
|
|
|
|
public static Long getExamId(Long recordId) {
|
|
|
- return Objects.nonNull(redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "examId")) ? Long.parseLong(String.valueOf(redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "examId"))) : null;
|
|
|
+ return (Long) redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "examId");
|
|
|
}
|
|
|
|
|
|
public static void setObjectiveScore(Long recordId, Double objectiveScore) {
|
|
@@ -66,7 +67,7 @@ public class ExamRecordCacheUtil {
|
|
|
}
|
|
|
|
|
|
public static Date getFinishTime(Long recordId) {
|
|
|
- return Objects.nonNull(redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "finishTime")) ? (Date) redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "finishTime") : null;
|
|
|
+ return (Date) redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "finishTime");
|
|
|
}
|
|
|
|
|
|
public static void setDurationSeconds(Long recordId, Integer durationSeconds) {
|
|
@@ -80,15 +81,15 @@ public class ExamRecordCacheUtil {
|
|
|
}
|
|
|
|
|
|
public static FinishTypeEnum getFinishType(Long recordId) {
|
|
|
- return Objects.nonNull(String.valueOf(redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "finishType"))) ? FinishTypeEnum.valueOf(String.valueOf(redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "finishType"))) : null;
|
|
|
+ return (FinishTypeEnum) redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "finishType");
|
|
|
}
|
|
|
|
|
|
public static Date getClientLastSyncTime(Long recordId) {
|
|
|
- return Objects.nonNull(redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "clientLastSyncTime")) ? (Date) redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "clientLastSyncTime") : null;
|
|
|
+ return (Date) redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "clientLastSyncTime");
|
|
|
}
|
|
|
|
|
|
public static Integer getLeftBreakResumeCount(Long recordId) {
|
|
|
- return Objects.nonNull(redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "leftBreakResumeCount")) ? Integer.parseInt(String.valueOf(redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "leftBreakResumeCount"))) : null;
|
|
|
+ return (Integer) redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "leftBreakResumeCount");
|
|
|
}
|
|
|
|
|
|
public static void setLeftBreakResumeCount(Long recordId, Integer leftBreakResumeCount) {
|
|
@@ -97,15 +98,15 @@ public class ExamRecordCacheUtil {
|
|
|
}
|
|
|
|
|
|
public static ExamRecordStatusEnum getStatus(Long recordId) {
|
|
|
- return Objects.nonNull(redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "status")) ? ExamRecordStatusEnum.valueOf(String.valueOf(redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "status"))) : null;
|
|
|
+ return (ExamRecordStatusEnum) redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "status");
|
|
|
}
|
|
|
|
|
|
public static Long getLastBreakId(Long recordId) {
|
|
|
- return Objects.nonNull(redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "lastBreakId")) ? Long.parseLong(String.valueOf(redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "lastBreakId"))) : null;
|
|
|
+ return (Long) redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "lastBreakId");
|
|
|
}
|
|
|
|
|
|
public static Date getLastBreakTime(Long recordId) {
|
|
|
- return Objects.nonNull(redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "lastBreakTime")) ? (Date) redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "lastBreakTime") : null;
|
|
|
+ return (Date) redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "lastBreakTime");
|
|
|
}
|
|
|
|
|
|
public static void setEntryAuthenticationResult(Long recordId, VerifyExceptionEnum entryAuthenticationResult) {
|
|
@@ -119,7 +120,7 @@ public class ExamRecordCacheUtil {
|
|
|
}
|
|
|
|
|
|
public static Long getExamActivityId(Long recordId) {
|
|
|
- return Long.parseLong(String.valueOf(redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "examActivityId")));
|
|
|
+ return (Long) redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "examActivityId");
|
|
|
}
|
|
|
|
|
|
public static void setWarningCount(Long recordId, Integer warningCount) {
|
|
@@ -128,7 +129,7 @@ public class ExamRecordCacheUtil {
|
|
|
}
|
|
|
|
|
|
public static Integer getWarningCount(Long recordId) {
|
|
|
- return Objects.nonNull(redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "warningCount")) ? Integer.parseInt(String.valueOf(redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "warningCount"))) : null;
|
|
|
+ return (Integer) redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "warningCount");
|
|
|
}
|
|
|
|
|
|
public static void setBreachStatus(Long recordId, Integer breachStatus) {
|
|
@@ -137,7 +138,7 @@ public class ExamRecordCacheUtil {
|
|
|
}
|
|
|
|
|
|
public static Integer getBreachStatus(Long recordId) {
|
|
|
- return Objects.nonNull(redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "breachStatus")) ? Integer.parseInt(String.valueOf(redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "breachStatus"))) : null;
|
|
|
+ return (Integer) redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "breachStatus");
|
|
|
}
|
|
|
|
|
|
public static void setInProcessLivenessVerifyCount(Long recordId, Integer inProcessLivenessVerifyCount) {
|
|
@@ -146,7 +147,7 @@ public class ExamRecordCacheUtil {
|
|
|
}
|
|
|
|
|
|
public static Integer getInProcessLivenessVerifyCount(Long recordId) {
|
|
|
- return Objects.nonNull(redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "inProcessLivenessVerifyCount")) ? Integer.parseInt(String.valueOf(redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "inProcessLivenessVerifyCount"))) : null;
|
|
|
+ return (Integer) redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "inProcessLivenessVerifyCount");
|
|
|
}
|
|
|
|
|
|
public static void setMonitorKey(Long recordId, String monitorKey) {
|
|
@@ -158,27 +159,27 @@ public class ExamRecordCacheUtil {
|
|
|
if (Objects.isNull(redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "monitorKey"))) {
|
|
|
setMonitorKey(recordId, String.valueOf(redisUtil.getRedisSequence()));
|
|
|
}
|
|
|
- return String.valueOf(redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "monitorKey"));
|
|
|
+ return (String) redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "monitorKey");
|
|
|
}
|
|
|
|
|
|
public static String getMonitorLiveUrl(Long recordId, String source) {
|
|
|
- return Objects.nonNull(redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), SystemConstant.MONITOR_LIVE_URL_ + source)) ? String.valueOf(redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), SystemConstant.MONITOR_LIVE_URL_ + source)) : null;
|
|
|
+ return (String) redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), SystemConstant.MONITOR_LIVE_URL_ + source);
|
|
|
}
|
|
|
|
|
|
public static String getMonitorLiveUrlMobileFirst(Long recordId) {
|
|
|
- return Objects.nonNull(redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), SystemConstant.MONITOR_LIVE_URL_ + MonitorVideoSourceEnum.MOBILE_FIRST.name())) ? String.valueOf(redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), SystemConstant.MONITOR_LIVE_URL_ + MonitorVideoSourceEnum.MOBILE_FIRST.name())) : null;
|
|
|
+ return (String) redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), SystemConstant.MONITOR_LIVE_URL_ + MonitorVideoSourceEnum.MOBILE_FIRST.name());
|
|
|
}
|
|
|
|
|
|
public static String getMonitorLiveUrlMobileSecond(Long recordId) {
|
|
|
- return Objects.nonNull(redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), SystemConstant.MONITOR_LIVE_URL_ + MonitorVideoSourceEnum.MOBILE_SECOND.name())) ? String.valueOf(redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), SystemConstant.MONITOR_LIVE_URL_ + MonitorVideoSourceEnum.MOBILE_SECOND.name())) : null;
|
|
|
+ return (String) redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), SystemConstant.MONITOR_LIVE_URL_ + MonitorVideoSourceEnum.MOBILE_SECOND.name());
|
|
|
}
|
|
|
|
|
|
public static String getMonitorLiveUrlClientCamera(Long recordId) {
|
|
|
- return Objects.nonNull(redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), SystemConstant.MONITOR_LIVE_URL_ + MonitorVideoSourceEnum.CLIENT_CAMERA.name())) ? String.valueOf(redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), SystemConstant.MONITOR_LIVE_URL_ + MonitorVideoSourceEnum.CLIENT_CAMERA.name())) : null;
|
|
|
+ return (String) redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), SystemConstant.MONITOR_LIVE_URL_ + MonitorVideoSourceEnum.CLIENT_CAMERA.name());
|
|
|
}
|
|
|
|
|
|
public static String getMonitorLiveUrlClientScreen(Long recordId) {
|
|
|
- return Objects.nonNull(redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), SystemConstant.MONITOR_LIVE_URL_ + MonitorVideoSourceEnum.CLIENT_SCREEN.name())) ? String.valueOf(redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), SystemConstant.MONITOR_LIVE_URL_ + MonitorVideoSourceEnum.CLIENT_SCREEN.name())) : null;
|
|
|
+ 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) {
|
|
@@ -187,7 +188,7 @@ public class ExamRecordCacheUtil {
|
|
|
}
|
|
|
|
|
|
public static MonitorStatusSourceEnum getMonitorStatus(Long recordId, String source) {
|
|
|
- return Objects.nonNull(redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), SystemConstant.MONITOR_STATUS_ + source)) ? MonitorStatusSourceEnum.valueOf(String.valueOf(redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), SystemConstant.MONITOR_STATUS_ + source))) : null;
|
|
|
+ return (MonitorStatusSourceEnum) redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), SystemConstant.MONITOR_STATUS_ + source);
|
|
|
}
|
|
|
|
|
|
public static void setMonitorStatus(Long recordId, String source, MonitorStatusSourceEnum statusSourceEnum) {
|
|
@@ -196,7 +197,7 @@ public class ExamRecordCacheUtil {
|
|
|
}
|
|
|
|
|
|
public static MonitorCallStatusSourceEnum getMonitorCallStatus(Long recordId, String source) {
|
|
|
- return Objects.nonNull(redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), SystemConstant.MONITOR_CALL_STATUS_ + source)) ? MonitorCallStatusSourceEnum.valueOf(String.valueOf(redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), SystemConstant.MONITOR_CALL_STATUS_ + source))) : null;
|
|
|
+ return (MonitorCallStatusSourceEnum) redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), SystemConstant.MONITOR_CALL_STATUS_ + source);
|
|
|
}
|
|
|
|
|
|
public static void setMonitorCallStatus(Long recordId, String source, MonitorCallStatusSourceEnum callStatusSourceEnum) {
|
|
@@ -204,7 +205,7 @@ public class ExamRecordCacheUtil {
|
|
|
}
|
|
|
|
|
|
public static WebsocketStatusEnum getClientWebsocketStatus(Long recordId) {
|
|
|
- return Objects.nonNull(redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "clientWebsocketStatus")) ? WebsocketStatusEnum.valueOf(String.valueOf(redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "clientWebsocketStatus"))) : null;
|
|
|
+ return (WebsocketStatusEnum) redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "clientWebsocketStatus");
|
|
|
}
|
|
|
|
|
|
public static void setClientWebsocketStatus(Long recordId, WebsocketStatusEnum websocketStatusEnum) {
|
|
@@ -256,6 +257,6 @@ public class ExamRecordCacheUtil {
|
|
|
}
|
|
|
|
|
|
public static Date getLastStartTime(Long recordId) {
|
|
|
- return Objects.nonNull(redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "lastStartTime")) ? (Date) redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "lastStartTime") : null;
|
|
|
+ return (Date) redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "lastStartTime");
|
|
|
}
|
|
|
}
|