|
@@ -40,7 +40,6 @@ public class ClearExamDataCacheExecutor implements NodeExecuter<Long, ExamRecord
|
|
|
* @param removable
|
|
|
* @param context
|
|
|
* @throws Exception
|
|
|
- * @author WANGWEI
|
|
|
*/
|
|
|
@Override
|
|
|
public void execute(Long key, ExamRecordData examRecordData,
|
|
@@ -62,14 +61,7 @@ public class ClearExamDataCacheExecutor implements NodeExecuter<Long, ExamRecord
|
|
|
if (SyncStatus.SYNCED == examRecordData.getSyncStatus()) {
|
|
|
|
|
|
//清除考试次数相关缓存
|
|
|
- String examBossKey = RedisKeyHelper.getBuilder().examBossKey(examRecordData.getExamStudentId());
|
|
|
- ExamBoss examBoss = redisClient.get(examBossKey, ExamBoss.class);
|
|
|
- if (null != examBoss) {
|
|
|
- //如果开考次数==考试完结次数,则删除考试基础信息缓存
|
|
|
- if (examBoss.getStartCount() == examBoss.getEndCount()) {
|
|
|
- redisClient.delete(examBossKey);
|
|
|
- }
|
|
|
- }
|
|
|
+ clearExamBoss(examRecordData.getExamStudentId(), examRecordDataId);
|
|
|
|
|
|
//清除学生最后活动时间缓存
|
|
|
redisClient.delete(RedisKeyHelper.getBuilder().examingActiveTimeKey(examRecordDataId));
|
|
@@ -105,6 +97,26 @@ public class ClearExamDataCacheExecutor implements NodeExecuter<Long, ExamRecord
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private void clearExamBoss(Long examStudentId, Long examRecordDataId) {
|
|
|
+ String examBossKey = RedisKeyHelper.getBuilder().examBossKey(examStudentId);
|
|
|
+ ExamBoss examBoss = redisClient.get(examBossKey, ExamBoss.class);
|
|
|
+ if (null != examBoss) {
|
|
|
+ //如果开考次数==考试完结次数,则删除考试基础信息缓存
|
|
|
+ if (examBoss.getStartCount() == examBoss.getEndCount()) {
|
|
|
+ redisClient.delete(examBossKey);
|
|
|
+ }
|
|
|
+ //如果examBoss未清除,则清除当前的考试记录id
|
|
|
+ else {
|
|
|
+ List<Long> examRecordDataIds = examBoss.getExamRecordDataIds();
|
|
|
+ if (null != examRecordDataIds && !examRecordDataIds.isEmpty()) {
|
|
|
+ examRecordDataIds.removeIf(p -> examRecordDataId.equals(p));
|
|
|
+ examBoss.setExamRecordDataIds(examRecordDataIds);
|
|
|
+ redisClient.set(examBossKey, examBoss);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
private void debugLog(String msg, Long examRecordDataId) {
|
|
|
if (LOG.isDebugEnabled()) {
|
|
|
LOG.debug("[CLEAR-EXAM-DATA-CACHE-EXECUTOR-" + examRecordDataId + "]:" + msg);
|