wangliang 1 жил өмнө
parent
commit
06e34495a8

+ 1 - 1
themis-admin/src/main/java/com/qmth/themis/admin/api/TEExamController.java

@@ -223,7 +223,7 @@ public class TEExamController {
                 teExamActivityService.saveOrUpdate(teExamActivity);
                 teExamActivityService.updateExamActivityCacheBean(teExamActivity.getId());
             }
-            themisCacheService.updateTodayExamListCache(teExam.getId());
+            themisCacheService.updateTodayExamIdListCache(teExam.getId());
             List<TEExamActivity> teExamActivityList = teExamActivityService.list(new QueryWrapper<TEExamActivity>().lambda().eq(TEExamActivity::getExamId, teExam.getId()).eq(TEExamActivity::getEnable, 1));
             for (TEExamActivity t : teExamActivityList) {
                 themisCacheService.updateTodayExamCache(t.getExamId().toString(), t.getId().toString());

+ 1 - 1
themis-business/src/main/java/com/qmth/themis/business/constant/SystemConstant.java

@@ -215,7 +215,7 @@ public class SystemConstant {
     public static final String BLACK_LIST_CACHE = "blacklist:cache";
     public static final String SYS_NOTIFY_CACHE = "sys:notify:cache";
     public static final String PROBLEM_CACHE = "problem:cache";
-    public static final String TODAY_EXAM_MAP_CACHE = "today:exam:map:cache:";
+    public static final String TODAY_EXAM_MAP_CACHE = "today:exam:list:map:cache:";
     public static final String TODAY_EXAM_ID_LIST_CACHE = "today:exam:id:list:cache";
     public static final String ORG_EXAM_LIST_MAP_CACHE = "org:exam:list:map:cache:";
 

+ 3 - 3
themis-business/src/main/java/com/qmth/themis/business/service/ThemisCacheService.java

@@ -401,7 +401,7 @@ public interface ThemisCacheService {
      *
      * @return
      */
-    public Set<Long> getTodayExamListCache();
+    public Set<Long> getTodayExamIdListCache();
 
     /**
      * 更新当天考试列表缓存
@@ -409,14 +409,14 @@ public interface ThemisCacheService {
      * @param examId
      * @return
      */
-    public void updateTodayExamListCache(Long examId);
+    public void updateTodayExamIdListCache(Long examId);
 
     /**
      * 删除当天考试列表缓存
      *
      * @return
      */
-    public void removeTodayExamListCache(Long examId);
+    public void removeTodayExamIdListCache(Long examId);
 
     /**
      * 获取考试统计缓存

+ 1 - 1
themis-business/src/main/java/com/qmth/themis/business/service/impl/TOeExamRecordServiceImpl.java

@@ -1766,7 +1766,7 @@ public class TOeExamRecordServiceImpl extends ServiceImpl<TOeExamRecordMapper, T
      */
     @Override
     public List<OrgDataCountBean> orgDataCount() {
-        Set<Long> examIdSet = themisCacheService.getTodayExamListCache();
+        Set<Long> examIdSet = themisCacheService.getTodayExamIdListCache();
         LinkedMultiValueMap<Long, Long> orgExamIdMap = tbOrgService.mergeOrgId(examIdSet);
         if (Objects.nonNull(orgExamIdMap) && orgExamIdMap.size() > 0) {
             List<OrgDataCountBean> orgDataCountBeanList = new ArrayList<>();

+ 5 - 4
themis-business/src/main/java/com/qmth/themis/business/service/impl/ThemisCacheServiceImpl.java

@@ -751,7 +751,8 @@ public class ThemisCacheServiceImpl implements ThemisCacheService {
     @Override
     public void removeOrgExamListCache(String orgId, String examId, Long examActivityId) {
         Map<String, Set<Long>> map = redisUtil.getHashEntries(SystemConstant.ORG_EXAM_LIST_MAP_CACHE + orgId);
-        CopyOnWriteArraySet<Long> examActivityIdSet = (CopyOnWriteArraySet<Long>) map.get(examId);
+        CopyOnWriteArraySet<Long> examActivityIdSet = new CopyOnWriteArraySet<>();
+        examActivityIdSet.addAll(map.get(examId));
         for (Long l : examActivityIdSet) {
             if (l.longValue() == examActivityId.longValue()) {
                 examActivityIdSet.remove(l);
@@ -814,7 +815,7 @@ public class ThemisCacheServiceImpl implements ThemisCacheService {
      * @return
      */
     @Override
-    public Set<Long> getTodayExamListCache() {
+    public Set<Long> getTodayExamIdListCache() {
         return redisUtil.getSet(SystemConstant.TODAY_EXAM_ID_LIST_CACHE);
     }
 
@@ -824,7 +825,7 @@ public class ThemisCacheServiceImpl implements ThemisCacheService {
      * @param examId
      */
     @Override
-    public void updateTodayExamListCache(Long examId) {
+    public void updateTodayExamIdListCache(Long examId) {
         redisUtil.addSet(SystemConstant.TODAY_EXAM_ID_LIST_CACHE, examId);
     }
 
@@ -834,7 +835,7 @@ public class ThemisCacheServiceImpl implements ThemisCacheService {
      * @param examId
      */
     @Override
-    public void removeTodayExamListCache(Long examId) {
+    public void removeTodayExamIdListCache(Long examId) {
         redisUtil.removeSet(SystemConstant.TODAY_EXAM_ID_LIST_CACHE, examId);
     }
 

+ 3 - 3
themis-task/src/main/java/com/qmth/themis/task/quartz/ExamSummaryJob.java

@@ -53,7 +53,7 @@ public class ExamSummaryJob extends QuartzJobBean {
     protected void executeInternal(JobExecutionContext context) throws JobExecutionException {
         log.info("ExamSummaryJob进来了,context:{}", context);
         //获取当天考试列表
-        Set<Long> examIdSet = themisCacheService.getTodayExamListCache();
+        Set<Long> examIdSet = themisCacheService.getTodayExamIdListCache();
         if (!CollectionUtils.isEmpty(examIdSet)) {
             LinkedMultiValueMap<Long, Long> orgExamIdMap = new LinkedMultiValueMap<>();
             for (Long l : examIdSet) {
@@ -61,7 +61,7 @@ public class ExamSummaryJob extends QuartzJobBean {
                 //不在考试时间范围内或者禁用,则删除当前考试批次id,更新缓存
                 if (examCacheBean.getEnable().intValue() == 0 || examCacheBean.getEndTime().longValue() <= System.currentTimeMillis()) {
                     themisCacheService.removeTodayExamCache(l.toString());
-                    themisCacheService.removeTodayExamListCache(l);
+                    themisCacheService.removeTodayExamIdListCache(l);
                 }
                 TBOrg tbOrg = themisCacheService.addOrgCache(examCacheBean.getOrgId());
                 orgExamIdMap.add(tbOrg.getId(), l);
@@ -94,7 +94,7 @@ public class ExamSummaryJob extends QuartzJobBean {
                     });
                 } else {
                     themisCacheService.removeTodayExamCache(l.toString());
-                    themisCacheService.removeTodayExamListCache(l);
+                    themisCacheService.removeTodayExamIdListCache(l);
                 }
             }
             //统计机构信息

+ 3 - 3
themis-task/src/main/java/com/qmth/themis/task/quartz/MqActivityJob.java

@@ -60,12 +60,12 @@ public class MqActivityJob extends QuartzJobBean {
         log.info("mq_activity_job进来了,context:{}", context);
         themisCacheService.setTodayExamCache();
         //每天凌晨清理考试缓存数据
-        Set<Long> examIdSet = themisCacheService.getTodayExamListCache();
+        Set<Long> examIdSet = themisCacheService.getTodayExamIdListCache();
         for (Long l : examIdSet) {
             ExamCacheBean examCacheBean = teExamService.getExamCacheBean(l);
             if (examCacheBean.getEnable().intValue() == 0 || examCacheBean.getEndTime().longValue() <= System.currentTimeMillis()) {
                 themisCacheService.removeTodayExamCache(l.toString());
-                themisCacheService.removeTodayExamListCache(l);
+                themisCacheService.removeTodayExamIdListCache(l);
             }
             Map<String, Set<String>> map = themisCacheService.getTodayExamCache(l.toString());
             if (!CollectionUtils.isEmpty(map)) {
@@ -77,7 +77,7 @@ public class MqActivityJob extends QuartzJobBean {
                 });
             } else {
                 themisCacheService.removeTodayExamCache(l.toString());
-                themisCacheService.removeTodayExamListCache(l);
+                themisCacheService.removeTodayExamIdListCache(l);
             }
         }
         Long finishTime = System.currentTimeMillis();