wangliang 1 год назад
Родитель
Сommit
70e990d973

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

@@ -504,18 +504,18 @@ public class TEExamController {
                 if (freshen) {
                     teExamSummaryService.examSummary(examId, examActivityId, Objects.nonNull(s) ? new HashSet<>(Arrays.asList(s)) : null);
                 }
-                teExamSummaryAllList.addAll(themisCacheService.addExamSummaryCache(examId, examActivityId, s));
+                teExamSummaryAllList.addAll(themisCacheService.getExamSummaryCache(examId, examActivityId, s));
             }
         } else if (Objects.nonNull(examId) && Objects.nonNull(examActivityId)) {
             if (freshen) {
                 teExamSummaryService.examSummary(examId, examActivityId, null);
             }
-            teExamSummaryAllList.addAll(themisCacheService.addExamSummaryCache(examId, examActivityId));
+            teExamSummaryAllList.addAll(themisCacheService.getExamSummaryCache(examId, examActivityId));
         } else {
             if (freshen) {
                 teExamSummaryService.examSummary(examId, null, null);
             }
-            teExamSummaryAllList.addAll(themisCacheService.addExamSummaryCache(examId));
+            teExamSummaryAllList.addAll(themisCacheService.getExamSummaryCache(examId));
         }
         ExamPropCountDto examPropCountDto = new ExamPropCountDto(examId, 0, 0, 0, 0, 0, new BigDecimal(0));
         if (!CollectionUtils.isEmpty(teExamSummaryAllList)) {

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

@@ -82,7 +82,7 @@ public class TIeInvigilateWarnInfoController {
                     List<TEExamActivity> teExamActivityList = teExamActivityService.list(new QueryWrapper<TEExamActivity>().lambda().eq(TEExamActivity::getExamId, t.getExamId()));
                     for (TEExamActivity teExamActivity : teExamActivityList) {
                         teExamSummaryService.examSummary(t.getExamId(), teExamActivity.getId(), new HashSet<>(Arrays.asList(t.getRoomCode())));
-                        teExamSummaryAllList.addAll(themisCacheService.addExamSummaryCache(t.getExamId(), teExamActivity.getId(), t.getRoomCode()));
+                        teExamSummaryAllList.addAll(themisCacheService.getExamSummaryCache(t.getExamId(), teExamActivity.getId(), t.getRoomCode()));
                     }
                 }
                 count = teExamSummaryAllList.stream().mapToInt(s -> s.getWarningUnread()).sum();

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

@@ -310,7 +310,7 @@ public interface ThemisCacheService {
     /**
      * 设置当天考试缓存
      */
-    public void setTodayExamCache();
+    public void setTodayExamListCache();
 
     /**
      * 设置机构考试列表缓存
@@ -403,7 +403,7 @@ public interface ThemisCacheService {
      * @param examId
      * @return
      */
-    public List<TEExamSummary> addExamSummaryCache(Long examId);
+    public List<TEExamSummary> getExamSummaryCache(Long examId);
 
     /**
      * 获取考试统计缓存
@@ -412,7 +412,7 @@ public interface ThemisCacheService {
      * @param examActivityId
      * @return
      */
-    public List<TEExamSummary> addExamSummaryCache(Long examId, Long examActivityId);
+    public List<TEExamSummary> getExamSummaryCache(Long examId, Long examActivityId);
 
     /**
      * 获取考试统计缓存
@@ -422,7 +422,7 @@ public interface ThemisCacheService {
      * @param roomCode
      * @return
      */
-    public List<TEExamSummary> addExamSummaryCache(Long examId, Long examActivityId, String roomCode);
+    public List<TEExamSummary> getExamSummaryCache(Long examId, Long examActivityId, String roomCode);
 
     /**
      * 修改考试统计缓存
@@ -481,7 +481,7 @@ public interface ThemisCacheService {
      * @param orgId
      * @return
      */
-    public TEOrgSummary addOrgSummaryCache(Long orgId);
+    public TEOrgSummary getOrgSummaryCache(Long orgId);
 
     /**
      * 更新机构统计缓存
@@ -503,7 +503,7 @@ public interface ThemisCacheService {
      *
      * @return
      */
-    public List<TERegionSummary> addRegionSummaryCache();
+    public List<TERegionSummary> getRegionSummaryCache();
 
     /**
      * 更新地区统计缓存

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

@@ -157,9 +157,9 @@ public class TEExamServiceImpl extends ServiceImpl<TEExamMapper, TEExam> impleme
         if (Objects.isNull(examId)) {
             Map<String, Set<Long>> examList = themisCacheService.getOrgExamListCache(orgId.toString());
             if (!CollectionUtils.isEmpty(examList)) {
-                examList = examList.entrySet().stream()
-                        .sorted(Map.Entry.comparingByKey())
-                        .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (oldValue, newValue) -> oldValue, LinkedHashMap::new));
+//                examList = examList.entrySet().stream()
+//                        .sorted(Map.Entry.comparingByKey())
+//                        .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (oldValue, newValue) -> oldValue, LinkedHashMap::new));
                 for (Map.Entry<String, Set<Long>> entry : examList.entrySet()) {
                     List<TEExamActivityWaitDto> teExamActivityWaitList = teExamActivityService.getWaitingExam(studentId, entry.getValue(), null);
                     list = this.waitingExamCommon(list, teExamActivityWaitList);
@@ -168,7 +168,7 @@ public class TEExamServiceImpl extends ServiceImpl<TEExamMapper, TEExam> impleme
         } else {
             Set<Long> examActivityIdSet = themisCacheService.getOrgExamListCache(orgId.toString(), examId.toString());
             if (!CollectionUtils.isEmpty(examActivityIdSet)) {
-                examActivityIdSet = examActivityIdSet.stream().sorted().collect(Collectors.toCollection(LinkedHashSet::new));
+//                examActivityIdSet = examActivityIdSet.stream().sorted().collect(Collectors.toCollection(LinkedHashSet::new));
                 List<TEExamActivityWaitDto> teExamActivityWaitList = teExamActivityService.getWaitingExam(studentId, examActivityIdSet, null);
                 list = this.waitingExamCommon(list, teExamActivityWaitList);
             }

+ 2 - 2
themis-business/src/main/java/com/qmth/themis/business/service/impl/TEOrgSummaryServiceImpl.java

@@ -56,7 +56,7 @@ public class TEOrgSummaryServiceImpl extends ServiceImpl<TEOrgSummaryMapper, TEO
             boolean reloadDb = false;
             //先查询考试批次统计缓存
             for (Long l : examIdSet) {
-                List<TEExamSummary> teExamSummaryList = themisCacheService.addExamSummaryCache(l);
+                List<TEExamSummary> teExamSummaryList = themisCacheService.getExamSummaryCache(l);
                 if (!CollectionUtils.isEmpty(teExamSummaryList)) {//如果没有该批次的考试统计缓存信息,则自己从数据库取
                     ExamCacheBean examCacheBean = teExamService.getExamCacheBean(l);
                     TBOrg tbOrg = themisCacheService.addOrgCache(examCacheBean.getOrgId());
@@ -76,7 +76,7 @@ public class TEOrgSummaryServiceImpl extends ServiceImpl<TEOrgSummaryMapper, TEO
                 orgExamIdMap.forEach((k, v) -> {//从考试批次缓存信息里拿取在线人数、考试人数、完成考生数
                     Integer onlineCount = 0, examCount = 0, finishStudentCount = 0;
                     for (Long l : v) {
-                        List<TEExamSummary> teExamSummaryList = themisCacheService.addExamSummaryCache(l);
+                        List<TEExamSummary> teExamSummaryList = themisCacheService.getExamSummaryCache(l);
                         for (TEExamSummary t : teExamSummaryList) {
                             onlineCount = onlineCount + t.getOnlineCount();
                             examCount = examCount + t.getExamCount();

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

@@ -1759,10 +1759,10 @@ public class TOeExamRecordServiceImpl extends ServiceImpl<TOeExamRecordMapper, T
      */
     @Override
     public List<Long> dataCount() {
-        TEOrgSummary teOrgSummary = themisCacheService.addOrgSummaryCache(0L);
+        TEOrgSummary teOrgSummary = themisCacheService.getOrgSummaryCache(0L);
         if (Objects.isNull(teOrgSummary)) {
             teOrgSummaryService.orgSummary(0L, null);//第一次进来没数据,强制统计一次
-            teOrgSummary = themisCacheService.addOrgSummaryCache(0L);
+            teOrgSummary = themisCacheService.getOrgSummaryCache(0L);
         }
         List<Long> list = new ArrayList<>();
         list.add(Objects.nonNull(teOrgSummary) && Objects.nonNull(teOrgSummary.getOnlineCount()) ? Long.parseLong(teOrgSummary.getOnlineCount().toString()) : 0L);
@@ -1787,7 +1787,7 @@ public class TOeExamRecordServiceImpl extends ServiceImpl<TOeExamRecordMapper, T
                 List<OrgDataCountBean> orgDataCountBeanList = new ArrayList<>();
                 //统计机构信息
                 orgExamIdMap.forEach((k, v) -> {
-                    TEOrgSummary teOrgSummary = themisCacheService.addOrgSummaryCache(k);
+                    TEOrgSummary teOrgSummary = themisCacheService.getOrgSummaryCache(k);
                     if (Objects.nonNull(teOrgSummary) && ((Objects.nonNull(teOrgSummary.getExamCount()) &&
                             teOrgSummary.getExamCount().intValue() > 0)
                             || (Objects.nonNull(teOrgSummary) && Objects.nonNull(teOrgSummary.getOnlineCount()) &&
@@ -1809,7 +1809,7 @@ public class TOeExamRecordServiceImpl extends ServiceImpl<TOeExamRecordMapper, T
      */
     @Override
     public List<MapDataCountBean> mapDataCount() {
-        List<TERegionSummary> teRegionSummaryList = themisCacheService.addRegionSummaryCache();
+        List<TERegionSummary> teRegionSummaryList = themisCacheService.getRegionSummaryCache();
         if (!CollectionUtils.isEmpty(teRegionSummaryList)) {
             return GsonUtil.fromJson(GsonUtil.toJson(teRegionSummaryList), new TypeToken<List<MapDataCountBean>>() {
             }.getType());

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

@@ -611,7 +611,7 @@ public class ThemisCacheServiceImpl implements ThemisCacheService {
      * 设置当天考试缓存
      */
     @Override
-    public void setTodayExamCache() {
+    public void setTodayExamListCache() {
         try {
             Date now = new Date();
             SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd");
@@ -623,8 +623,8 @@ public class ThemisCacheServiceImpl implements ThemisCacheService {
             //统计当天00:00:00~23:59:59可以进行的考试批次、场次、考场编码信息
             if (!CollectionUtils.isEmpty(teExamActivityList)) {
                 LinkedMultiValueMap<Long, ExamListBean> todayExamListMap = new LinkedMultiValueMap<>();//考试批次、场次集合/考场编码集合
-                Map<Long, Set<Long>> examActivityIdMap = new HashMap<>();//考试批次id,场次id集合
-                Map<Long, Set<String>> roomCodeMap = new HashMap<>();//考试场次id,考场编码集合
+                Map<Long, Set<Long>> examActivityIdMap = new LinkedHashMap<>();//考试批次id,场次id集合
+                Map<Long, Set<String>> roomCodeMap = new LinkedHashMap<>();//考试场次id,考场编码集合
                 for (TEExamActivity t : teExamActivityList) {
                     ExamCacheBean examCacheBean = teExamService.getExamCacheBean(t.getExamId());
                     if (Objects.nonNull(examCacheBean.getEnable()) && examCacheBean.getEnable().intValue() == 1 && Objects.nonNull(t.getEnable()) && t.getEnable().intValue() == 1) {
@@ -665,8 +665,8 @@ public class ThemisCacheServiceImpl implements ThemisCacheService {
         //查询考试场次结束时间大于当前时间的所有考试
         List<TEExamActivity> teExamActivityList = teExamActivityService.list(new QueryWrapper<TEExamActivity>().lambda().gt(TEExamActivity::getFinishTime, System.currentTimeMillis()).eq(TEExamActivity::getEnable, 1));
         if (!CollectionUtils.isEmpty(teExamActivityList)) {
-            Map<Long, Set<Long>> orgMap = new HashMap<>();//机构id,考试批次id集合
-            Map<Long, Set<Long>> examMap = new HashMap<>();//考试批次id,场次id集合
+            Map<Long, Set<Long>> orgMap = new LinkedHashMap<>();//机构id,考试批次id集合
+            Map<Long, Set<Long>> examMap = new LinkedHashMap<>();//考试批次id,场次id集合
             for (TEExamActivity t : teExamActivityList) {
                 ExamCacheBean examCacheBean = teExamService.getExamCacheBean(t.getExamId());
                 if (Objects.nonNull(examCacheBean.getEnable()) && examCacheBean.getEnable().intValue() == 1) {
@@ -884,7 +884,7 @@ public class ThemisCacheServiceImpl implements ThemisCacheService {
      */
     @Override
     @Cacheable(value = SystemConstant.examSummaryCache, key = "#p0", unless = "#result?.size() == 0")
-    public List<TEExamSummary> addExamSummaryCache(Long examId) {
+    public List<TEExamSummary> getExamSummaryCache(Long examId) {
         return this.examSummaryQueryCommon(examId, null, null);
     }
 
@@ -897,7 +897,7 @@ public class ThemisCacheServiceImpl implements ThemisCacheService {
      */
     @Override
     @Cacheable(value = SystemConstant.examSummaryCache, key = "#p0 + '-' + #p1", unless = "#result?.size() == 0")
-    public List<TEExamSummary> addExamSummaryCache(Long examId, Long examActivityId) {
+    public List<TEExamSummary> getExamSummaryCache(Long examId, Long examActivityId) {
         return this.examSummaryQueryCommon(examId, examActivityId, null);
     }
 
@@ -911,7 +911,7 @@ public class ThemisCacheServiceImpl implements ThemisCacheService {
      */
     @Override
     @Cacheable(value = SystemConstant.examSummaryCache, key = "#p0 + '-' + #p1 + '-' + #p2", unless = "#result?.size() == 0")
-    public List<TEExamSummary> addExamSummaryCache(Long examId, Long examActivityId, String roomCode) {
+    public List<TEExamSummary> getExamSummaryCache(Long examId, Long examActivityId, String roomCode) {
         return this.examSummaryQueryCommon(examId, examActivityId, roomCode);
     }
 
@@ -998,7 +998,7 @@ public class ThemisCacheServiceImpl implements ThemisCacheService {
      */
     @Override
     @Cacheable(value = SystemConstant.orgSummaryCache, key = "#p0", unless = "#result == null")
-    public TEOrgSummary addOrgSummaryCache(Long orgId) {
+    public TEOrgSummary getOrgSummaryCache(Long orgId) {
         return teOrgSummaryService.getOne(new QueryWrapper<TEOrgSummary>().lambda().eq(TEOrgSummary::getOrgId, orgId));
     }
 
@@ -1032,7 +1032,7 @@ public class ThemisCacheServiceImpl implements ThemisCacheService {
      */
     @Override
     @Cacheable(value = SystemConstant.regionSummaryCache, unless = "#result?.size() == 0")
-    public List<TERegionSummary> addRegionSummaryCache() {
+    public List<TERegionSummary> getRegionSummaryCache() {
         return teRegionSummaryService.list();
     }
 

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

@@ -63,7 +63,7 @@ public class MqActivityJob extends QuartzJobBean {
     @Override
     protected void executeInternal(JobExecutionContext context) {
         log.info("mq_activity_job进来了,context:{}", context);
-        themisCacheService.setTodayExamCache();
+        themisCacheService.setTodayExamListCache();
         //每天凌晨清理考试缓存数据
         Map<String, List<ExamListBean>> examListMap = redisUtil.getHashEntries(SystemConstant.TODAY_EXAM_LIST_MAP_CACHE);
         if (!CollectionUtils.isEmpty(examListMap)) {

+ 1 - 1
themis-task/src/main/java/com/qmth/themis/task/start/StartRunning.java

@@ -58,7 +58,7 @@ public class StartRunning implements CommandLineRunner {
     public void run(String... args) throws Exception {
         log.info("服务器启动时执行 start");
         log.info("增加mqjob start");
-        themisCacheService.setTodayExamCache();
+        themisCacheService.setTodayExamListCache();
         themisCacheService.setOrgExamListCache();
 
         Map mqMap = new HashMap();