瀏覽代碼

待考列表优化

wangliang 1 年之前
父節點
當前提交
2e3a803bba

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

@@ -226,7 +226,7 @@ public class TEExamController {
             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());
+                themisCacheService.updateTodayExamListCache(t.getExamId().toString(), t.getId().toString());
                 themisCacheService.updateOrgExamListCache(teExam.getOrgId().toString(), t.getExamId().toString(), t.getId());
             }
         } catch (Exception e) {

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

@@ -372,7 +372,7 @@ public interface ThemisCacheService {
      * @param examId
      * @return
      */
-    public Map<String, Set<String>> getTodayExamCache(String examId);
+    public Map<String, Set<String>> getTodayExamListCache(String examId);
 
     /**
      * 更新当天考试缓存
@@ -380,21 +380,21 @@ public interface ThemisCacheService {
      * @param examId
      * @param examActivityId
      */
-    public void updateTodayExamCache(String examId, String examActivityId);
+    public void updateTodayExamListCache(String examId, String examActivityId);
 
     /**
      * 删除当天考试缓存
      *
      * @return
      */
-    public void removeTodayExamCache(String examId);
+    public void removeTodayExamListCache(String examId);
 
     /**
      * 删除当天考试缓存
      *
      * @return
      */
-    public void removeTodayExamCache(String examId, String examActivityId);
+    public void removeTodayExamListCache(String examId, String examActivityId);
 
     /**
      * 获取当天考试列表缓存

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

@@ -413,7 +413,7 @@ public class TEExamActivityServiceImpl extends ServiceImpl<TEExamActivityMapper,
             teExamActivityService.saveOrUpdateBatch(teExamActivityList);
 
             for (TEExamActivity ac : teExamActivityList) {
-                themisCacheService.updateTodayExamCache(ac.getExamId().toString(), ac.getId().toString());
+                themisCacheService.updateTodayExamListCache(ac.getExamId().toString(), ac.getId().toString());
                 themisCacheService.updateOrgExamListCache(teExam.getOrgId().toString(), ac.getExamId().toString(), ac.getId());
                 teExamActivityService.updateExamActivityCacheBean(ac.getId());
             }

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

@@ -748,6 +748,13 @@ public class ThemisCacheServiceImpl implements ThemisCacheService {
         redisUtil.delete(SystemConstant.ORG_EXAM_LIST_MAP_CACHE + orgId, examId);
     }
 
+    /**
+     * 删除机构考试列表缓存
+     *
+     * @param orgId
+     * @param examId
+     * @param examActivityId
+     */
     @Override
     public void removeOrgExamListCache(String orgId, String examId, Long examActivityId) {
         Map<String, Set<Long>> map = redisUtil.getHashEntries(SystemConstant.ORG_EXAM_LIST_MAP_CACHE + orgId);
@@ -767,8 +774,14 @@ public class ThemisCacheServiceImpl implements ThemisCacheService {
         }
     }
 
+    /**
+     * 获取当天考试列表缓存
+     *
+     * @param examId
+     * @return
+     */
     @Override
-    public Map<String, Set<String>> getTodayExamCache(String examId) {
+    public Map<String, Set<String>> getTodayExamListCache(String examId) {
         return redisUtil.getHashEntries(SystemConstant.TODAY_EXAM_MAP_CACHE + examId);
     }
 
@@ -779,11 +792,11 @@ public class ThemisCacheServiceImpl implements ThemisCacheService {
      * @return
      */
     @Override
-    public void updateTodayExamCache(String examId, String examActivityId) {
+    public void updateTodayExamListCache(String examId, String examActivityId) {
         List<TEExamStudent> teExamStudentList = teExamStudentService.list(new QueryWrapper<TEExamStudent>().lambda().eq(TEExamStudent::getExamId, Long.parseLong(examId)).eq(TEExamStudent::getExamActivityId, examActivityId));
         if (!CollectionUtils.isEmpty(teExamStudentList)) {
             Set<String> roomCodeSet = teExamStudentList.stream().map(s -> s.getRoomCode()).collect(Collectors.toSet());
-            this.removeTodayExamCache(examId, examActivityId);
+            this.removeTodayExamListCache(examId, examActivityId);
             redisUtil.set(SystemConstant.TODAY_EXAM_MAP_CACHE + examId, examActivityId, roomCodeSet);
         }
     }
@@ -794,7 +807,7 @@ public class ThemisCacheServiceImpl implements ThemisCacheService {
      * @param examId
      */
     @Override
-    public void removeTodayExamCache(String examId) {
+    public void removeTodayExamListCache(String examId) {
         redisUtil.delete(SystemConstant.TODAY_EXAM_MAP_CACHE + examId);
     }
 
@@ -805,7 +818,7 @@ public class ThemisCacheServiceImpl implements ThemisCacheService {
      * @param examActivityId
      */
     @Override
-    public void removeTodayExamCache(String examId, String examActivityId) {
+    public void removeTodayExamListCache(String examId, String examActivityId) {
         redisUtil.delete(SystemConstant.TODAY_EXAM_MAP_CACHE + examId, examActivityId);
     }
 

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

@@ -60,13 +60,13 @@ public class ExamSummaryJob extends QuartzJobBean {
                 ExamCacheBean examCacheBean = teExamService.getExamCacheBean(l);
                 //不在考试时间范围内或者禁用,则删除当前考试批次id,更新缓存
                 if (examCacheBean.getEnable().intValue() == 0 || examCacheBean.getEndTime().longValue() <= System.currentTimeMillis()) {
-                    themisCacheService.removeTodayExamCache(l.toString());
+                    themisCacheService.removeTodayExamListCache(l.toString());
                     themisCacheService.removeTodayExamIdListCache(l);
                 }
                 TBOrg tbOrg = themisCacheService.addOrgCache(examCacheBean.getOrgId());
                 orgExamIdMap.add(tbOrg.getId(), l);
 
-                Map<String, Set<String>> map = themisCacheService.getTodayExamCache(l.toString());
+                Map<String, Set<String>> map = themisCacheService.getTodayExamListCache(l.toString());
                 if (!CollectionUtils.isEmpty(map)) {
                     map.forEach((k, v) -> {
                         //换算开始时间和结束时间
@@ -89,11 +89,11 @@ public class ExamSummaryJob extends QuartzJobBean {
                             teExamSummaryService.examSummary(l, Long.parseLong(k), v);
                             teRegionSummaryService.regionSummary();
                         } else {
-                            themisCacheService.removeTodayExamCache(l.toString(), k);
+                            themisCacheService.removeTodayExamListCache(l.toString(), k);
                         }
                     });
                 } else {
-                    themisCacheService.removeTodayExamCache(l.toString());
+                    themisCacheService.removeTodayExamListCache(l.toString());
                     themisCacheService.removeTodayExamIdListCache(l);
                 }
             }

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

@@ -64,19 +64,19 @@ public class MqActivityJob extends QuartzJobBean {
         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.toString());
                 themisCacheService.removeTodayExamIdListCache(l);
             }
-            Map<String, Set<String>> map = themisCacheService.getTodayExamCache(l.toString());
+            Map<String, Set<String>> map = themisCacheService.getTodayExamListCache(l.toString());
             if (!CollectionUtils.isEmpty(map)) {
                 map.forEach((k, v) -> {
                     ExamActivityCacheBean examActivityCacheBean = teExamActivityService.getExamActivityCacheBean(Long.parseLong(k));
                     if (examActivityCacheBean.getEnable().intValue() == 0 || examActivityCacheBean.getFinishTime().longValue() <= System.currentTimeMillis()) {
-                        themisCacheService.removeTodayExamCache(l.toString(), k);
+                        themisCacheService.removeTodayExamListCache(l.toString(), k);
                     }
                 });
             } else {
-                themisCacheService.removeTodayExamCache(l.toString());
+                themisCacheService.removeTodayExamListCache(l.toString());
                 themisCacheService.removeTodayExamIdListCache(l);
             }
         }