Bläddra i källkod

待考列表优化

wangliang 1 år sedan
förälder
incheckning
25a18734d3

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

@@ -224,14 +224,11 @@ public class TEExamController {
                 teExamActivityService.updateExamActivityCacheBean(teExamActivity.getId());
             }
             themisCacheService.updateTodayExamListCache(teExam.getId());
-            if (teExam.getEndTime().intValue() == 1 && teExam.getEndTime().longValue() > System.currentTimeMillis()) {
-                themisCacheService.updateExamListIdCache(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());
                 if (t.getEnable().intValue() == 1 && t.getFinishTime().longValue() > System.currentTimeMillis()) {
-                    themisCacheService.updateExamListCache(t.getExamId().toString(), t.getId().toString());
+                    themisCacheService.updateOrgExamListCache(teExam.getOrgId().toString(), t.getExamId().toString(), t.getId());
                 }
             }
         } catch (Exception e) {

+ 51 - 0
themis-business/src/main/java/com/qmth/themis/business/bean/admin/ExamListBean.java

@@ -0,0 +1,51 @@
+package com.qmth.themis.business.bean.admin;
+
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
+import io.swagger.annotations.ApiModelProperty;
+
+import java.io.Serializable;
+import java.util.Set;
+
+/**
+ * @Description: 考试列表集合
+ * @Param:
+ * @return:
+ * @Author: wangliang
+ * @Date: 2023/10/27
+ */
+public class ExamListBean implements Serializable {
+
+    @ApiModelProperty(name = "考试批次id")
+    @JsonSerialize(using = ToStringSerializer.class)
+    private Long examId;
+
+    @ApiModelProperty(name = "考场场次集合")
+    @JsonSerialize(using = ToStringSerializer.class)
+    private Set<Long> examActivityIdSet;
+
+    public ExamListBean() {
+
+    }
+
+    public ExamListBean(Long examId, Set<Long> examActivityIdSet) {
+        this.examId = examId;
+        this.examActivityIdSet = examActivityIdSet;
+    }
+
+    public Long getExamId() {
+        return examId;
+    }
+
+    public void setExamId(Long examId) {
+        this.examId = examId;
+    }
+
+    public Set<Long> getExamActivityIdSet() {
+        return examActivityIdSet;
+    }
+
+    public void setExamActivityIdSet(Set<Long> examActivityIdSet) {
+        this.examActivityIdSet = examActivityIdSet;
+    }
+}

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

@@ -217,8 +217,7 @@ public class SystemConstant {
     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_ID_LIST_CACHE = "today:exam:id:list:cache";
-    public static final String EXAM_LIST_MAP_CACHE = "exam:list:map:cache:";
-    public static final String EXAM_LIST_ID_CACHE = "exam:list:id:cache";
+    public static final String ORG_EXAM_LIST_MAP_CACHE = "org:exam:list:map:cache:";
 
     public volatile static Searcher SEARCHER = null;
     public static final String ONLINE_WARN_INTERVAL = "online.warn.interval";

+ 2 - 1
themis-business/src/main/java/com/qmth/themis/business/dao/TEExamActivityMapper.java

@@ -81,9 +81,10 @@ public interface TEExamActivityMapper extends BaseMapper<TEExamActivity> {
      *
      * @param studentId
      * @param examActivityIds
+     * @param orgId
      * @return
      */
-    public List<TEExamActivityWaitDto> getWaitingExam(@Param("studentId") Long studentId, @Param("examActivityIds") Set<Long> examActivityIds);
+    public List<TEExamActivityWaitDto> getWaitingExam(@Param("studentId") Long studentId, @Param("examActivityIds") Set<Long> examActivityIds, @Param("orgId") Long orgId);
 
     /**
      * 获取考试待考列表

+ 12 - 0
themis-business/src/main/java/com/qmth/themis/business/dto/response/TEExamActivityWaitDto.java

@@ -30,6 +30,10 @@ public class TEExamActivityWaitDto implements Serializable {
     @ApiModelProperty(name = "考生id")
     private Long examStudentId;//考生id
 
+    @JsonSerialize(using = ToStringSerializer.class)
+    @ApiModelProperty(name = "考场id")
+    private Long examActivityId;//考场id
+
     @ApiModelProperty(name = "科目代码")
     private String courseCode;//科目代码
 
@@ -99,6 +103,14 @@ public class TEExamActivityWaitDto implements Serializable {
         this.leftExamCount = (ec.getExamCount().intValue() - examStudentCacheBean.getAlreadyExamCount().intValue()) < 0 ? 0 : ec.getExamCount().intValue() - examStudentCacheBean.getAlreadyExamCount().intValue();
     }
 
+    public Long getExamActivityId() {
+        return examActivityId;
+    }
+
+    public void setExamActivityId(Long examActivityId) {
+        this.examActivityId = examActivityId;
+    }
+
     public Long getExamId() {
         return examId;
     }

+ 2 - 1
themis-business/src/main/java/com/qmth/themis/business/service/TEExamActivityService.java

@@ -79,9 +79,10 @@ public interface TEExamActivityService extends IService<TEExamActivity> {
      *
      * @param studentId
      * @param examActivityIds
+     * @param orgId
      * @return
      */
-    public List<TEExamActivityWaitDto> getWaitingExam(Long studentId, Set<Long> examActivityIds);
+    public List<TEExamActivityWaitDto> getWaitingExam(Long studentId, Set<Long> examActivityIds, Long orgId);
 
     /**
      * 获取考试待考列表

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

@@ -1,6 +1,5 @@
 package com.qmth.themis.business.service;
 
-import com.qmth.themis.business.constant.SystemConstant;
 import com.qmth.themis.business.dto.AuthDto;
 import com.qmth.themis.business.dto.cache.TEStudentCacheDto;
 import com.qmth.themis.business.entity.*;
@@ -313,60 +312,59 @@ public interface ThemisCacheService {
     public void setTodayExamCache();
 
     /**
-     * 设置考试列表缓存
+     * 设置机构考试列表缓存
      */
-    public void setExamListCache();
+    public void setOrgExamListCache();
 
     /**
-     * 获取考试列表缓存
+     * 获取机构考试列表缓存
      *
-     * @param examId
+     * @param orgId
      * @return
      */
-    public Map<String, List<Long>> getExamListCache(String examId);
+    public Map<String, Set<Long>> getOrgExamListCache(String orgId);
 
     /**
-     * 获取考试列表id缓存
+     * 获取机构考试列表缓存
      *
+     * @param orgId
+     * @param examId
      * @return
      */
-    public Set<Long> getExamIdListCache();
+    public Set<Long> getOrgExamListCache(String orgId, String examId);
 
     /**
-     * 更新考试列表id缓存
+     * 更新机构考试列表缓存
      *
+     * @param orgId
      * @param examId
+     * @param examActivityId
      */
-    public void updateExamListIdCache(Long examId);
+    public void updateOrgExamListCache(String orgId, String examId, Long examActivityId);
 
     /**
-     * 更新考试列表id缓存
+     * 删除机构考试列表缓存
      *
-     * @param examId
+     * @param orgId
      */
-    public void removeExamListIdCache(Long examId);
+    public void removeOrgExamListCache(String orgId);
 
     /**
-     * 更新考试列表缓存
+     * 删除机构考试列表缓存
      *
+     * @param orgId
      * @param examId
-     * @param examActivityId
      */
-    public void updateExamListCache(String examId, String examActivityId);
+    public void removeOrgExamListCache(String orgId, String examId);
 
     /**
-     * 删除考试列表缓存
+     * 删除机构考试列表缓存
      *
-     * @return
-     */
-    public void removeExamListCache(String examId);
-
-    /**
-     * 删除考试列表缓存
-     *
-     * @return
+     * @param orgId
+     * @param examId
+     * @param examActivityId
      */
-    public void removeExamListCache(String examId, String examActivityId);
+    public void removeOrgExamListCache(String orgId, String examId, Long examActivityId);
 
     /**
      * 获取当天考试缓存

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

@@ -164,8 +164,8 @@ public class TEExamActivityServiceImpl extends ServiceImpl<TEExamActivityMapper,
      * @return
      */
     @Override
-    public List<TEExamActivityWaitDto> getWaitingExam(Long studentId, Set<Long> examActivityIds) {
-        return teExamActivityMapper.getWaitingExam(studentId, examActivityIds);
+    public List<TEExamActivityWaitDto> getWaitingExam(Long studentId, Set<Long> examActivityIds, Long orgId) {
+        return teExamActivityMapper.getWaitingExam(studentId, examActivityIds, orgId);
     }
 
     /**
@@ -415,7 +415,7 @@ public class TEExamActivityServiceImpl extends ServiceImpl<TEExamActivityMapper,
             for (TEExamActivity ac : teExamActivityList) {
                 themisCacheService.updateTodayExamCache(ac.getExamId().toString(), ac.getId().toString());
                 if (ac.getEnable().intValue() == 1 && ac.getFinishTime().longValue() > System.currentTimeMillis()) {
-                    themisCacheService.updateExamListCache(ac.getExamId().toString(), ac.getId().toString());
+                    themisCacheService.updateOrgExamListCache(teExam.getOrgId().toString(), ac.getExamId().toString(), ac.getId());
                 }
                 teExamActivityService.updateExamActivityCacheBean(ac.getId());
             }

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

@@ -155,23 +155,49 @@ public class TEExamServiceImpl extends ServiceImpl<TEExamMapper, TEExam> impleme
     @Override
     public List<TEExamWaitDto> getWaitingExam(Long studentId, Long examId, Long orgId) {
         List<TEExamWaitDto> list = new ArrayList<>();
-        Map<String, List<Long>> examActivityIdMap = themisCacheService.getExamListCache(examId.toString());
-        if (!CollectionUtils.isEmpty(examActivityIdMap)) {
-            examActivityIdMap.forEach((k, v) -> {
-                ExamCacheBean examCache = getExamCacheBeanNative(examId);
-                TEExamWaitDto teExamWaitDto = new TEExamWaitDto(examId, Long.parseLong(k), examCache.getName(), examCache.getCode());
-                List<TEExamActivityWaitDto> teExamActivityWaitList = teExamActivityService.getWaitingExam(studentId, new HashSet<>(v));
-                Map<Long, Set<TEExamActivityWaitDto>> map = new HashMap<>();
-                teExamActivityWaitList.forEach(i -> {
-                    Set<TEExamActivityWaitDto> teExamActivityWaitDtos = Objects.nonNull(map.get(examId)) ? map.get(examId) : new LinkedHashSet<>();
-                    teExamActivityWaitDtos.add(i);
-                    map.put(examId, teExamActivityWaitDtos);
-                    ExamStudentCacheBean examStudentCacheBean = teExamStudentService.getExamStudentCacheBean(i.getExamStudentId());
-                    Integer leftExamCount = examCache.getExamCount().intValue() - examStudentCacheBean.getAlreadyExamCount().intValue() < 0 ? 0 : examCache.getExamCount().intValue() - examStudentCacheBean.getAlreadyExamCount().intValue();
-                    i.setLeftExamCount(leftExamCount);
-                });
-                teExamWaitDto.setActivities(new ArrayList<>(map.get(k)));
-                list.add(teExamWaitDto);
+        if (Objects.isNull(examId)) {
+            Map<String, Set<Long>> examList = themisCacheService.getOrgExamListCache(orgId.toString());
+            if (!CollectionUtils.isEmpty(examList)) {
+                for (Map.Entry<String, Set<Long>> entry : examList.entrySet()) {
+                    List<TEExamActivityWaitDto> teExamActivityWaitList = teExamActivityService.getWaitingExam(studentId, entry.getValue(), null);
+                    list = this.waitingExamCommon(list, teExamActivityWaitList);
+                }
+            }
+        } else {
+            Set<Long> examActivityIdSet = themisCacheService.getOrgExamListCache(orgId.toString(), examId.toString());
+            if (!CollectionUtils.isEmpty(examActivityIdSet)) {
+                List<TEExamActivityWaitDto> teExamActivityWaitList = teExamActivityService.getWaitingExam(studentId, examActivityIdSet, null);
+                list = this.waitingExamCommon(list, teExamActivityWaitList);
+            }
+        }
+        return list;
+    }
+
+    /**
+     * 获取待考列表公用
+     *
+     * @param list
+     * @param teExamActivityWaitList
+     * @return
+     */
+    protected List<TEExamWaitDto> waitingExamCommon(List<TEExamWaitDto> list, List<TEExamActivityWaitDto> teExamActivityWaitList) {
+        if (!CollectionUtils.isEmpty(teExamActivityWaitList)) {
+            Map<Long, Set<TEExamActivityWaitDto>> map = new HashMap<>();
+            Map<Long, TEExamWaitDto> setMap = new LinkedHashMap<>();
+            teExamActivityWaitList.forEach(i -> {
+                ExamCacheBean examCache = getExamCacheBeanNative(i.getExamId());
+                TEExamWaitDto teExamWaitDto = new TEExamWaitDto(i.getExamId(), i.getExamActivityId(), examCache.getName(), examCache.getCode());
+                setMap.put(i.getExamId(), teExamWaitDto);
+                Set<TEExamActivityWaitDto> teExamActivityWaitDtos = Objects.nonNull(map.get(i.getExamId())) ? map.get(i.getExamId()) : new LinkedHashSet<>();
+                teExamActivityWaitDtos.add(i);
+                map.put(i.getExamId(), teExamActivityWaitDtos);
+                ExamStudentCacheBean examStudentCacheBean = teExamStudentService.getExamStudentCacheBean(i.getExamStudentId());
+                Integer leftExamCount = examCache.getExamCount().intValue() - examStudentCacheBean.getAlreadyExamCount().intValue() < 0 ? 0 : examCache.getExamCount().intValue() - examStudentCacheBean.getAlreadyExamCount().intValue();
+                i.setLeftExamCount(leftExamCount);
+            });
+            setMap.forEach((k, v) -> {
+                v.setActivities(new ArrayList<>(map.get(k)));
+                list.add(v);
             });
         }
         return list;

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

@@ -2,6 +2,7 @@ package com.qmth.themis.business.service.impl;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.qmth.themis.business.bean.admin.ExamActivityTodayBean;
+import com.qmth.themis.business.bean.admin.ExamListBean;
 import com.qmth.themis.business.cache.bean.ExamCacheBean;
 import com.qmth.themis.business.constant.SpringContextHolder;
 import com.qmth.themis.business.constant.SystemConstant;
@@ -27,6 +28,7 @@ import org.springframework.util.LinkedMultiValueMap;
 import javax.annotation.Resource;
 import java.text.SimpleDateFormat;
 import java.util.*;
+import java.util.concurrent.CopyOnWriteArraySet;
 import java.util.stream.Collectors;
 
 /**
@@ -648,106 +650,129 @@ public class ThemisCacheServiceImpl implements ThemisCacheService {
      * 设置考试列表缓存
      */
     @Override
-    public void setExamListCache() {
+    public void setOrgExamListCache() {
         //查询考试场次结束时间大于当前时间的所有考试
         List<TEExamActivity> teExamActivityList = teExamActivityService.list(new QueryWrapper<TEExamActivity>().lambda().gt(TEExamActivity::getFinishTime, System.currentTimeMillis()).eq(TEExamActivity::getEnable, 1));
         if (!CollectionUtils.isEmpty(teExamActivityList)) {
-            LinkedMultiValueMap<Long, Long> examActivityMap = new LinkedMultiValueMap<>();
+            LinkedMultiValueMap<Long, ExamListBean> examActivityMap = new LinkedMultiValueMap<>();
+            Map<Long, Set<Long>> examMap = new HashMap<>();
+            Map<Long, Set<Long>> orgMap = new HashMap<>();
             for (TEExamActivity t : teExamActivityList) {
                 ExamCacheBean examCacheBean = teExamService.getExamCacheBean(t.getExamId());
                 if (Objects.nonNull(examCacheBean.getEnable()) && examCacheBean.getEnable().intValue() == 1) {
-                    examActivityMap.add(t.getExamId(), t.getId());
+                    if (orgMap.containsKey(examCacheBean.getOrgId())) {
+                        Set<Long> examIdSet = orgMap.get(examCacheBean.getOrgId());
+                        examIdSet.add(t.getExamId());
+                        orgMap.put(examCacheBean.getOrgId(), examIdSet);
+                    } else {
+                        orgMap.put(examCacheBean.getOrgId(), new HashSet<>(Arrays.asList(t.getExamId())));
+                    }
+                    if (examMap.containsKey(t.getExamId())) {
+                        Set<Long> examActivityIdSet = examMap.get(examCacheBean.getId());
+                        examActivityIdSet.add(t.getId());
+                        examMap.put(t.getExamId(), examActivityIdSet);
+                    } else {
+                        examMap.put(t.getExamId(), new HashSet<>(Arrays.asList(t.getId())));
+                    }
                 }
             }
-            examActivityMap.forEach((k, v) -> {
+            orgMap.forEach((k, v) -> {
                 for (Long l : v) {
-                    redisUtil.set(SystemConstant.EXAM_LIST_MAP_CACHE + k, l.toString(), l);
-                    redisUtil.addSet(SystemConstant.EXAM_LIST_ID_CACHE, k);
+                    examActivityMap.add(k, new ExamListBean(l, examMap.get(l)));
+                }
+            });
+            examActivityMap.forEach((k, v) -> {
+                for (ExamListBean e : v) {
+                    redisUtil.set(SystemConstant.ORG_EXAM_LIST_MAP_CACHE + k, e.getExamId().toString(), e.getExamActivityIdSet());
                 }
             });
         }
     }
 
     /**
-     * 获取考试列表缓存
-     *
-     * @param examId
-     * @return
-     */
-    @Override
-    public Map<String, List<Long>> getExamListCache(String examId) {
-        return redisUtil.getHashEntries(SystemConstant.EXAM_LIST_MAP_CACHE + examId);
-    }
-
-    /**
-     * 获取考试列表id缓存
+     * 获取机构考试列表缓存
      *
+     * @param orgId
      * @return
      */
     @Override
-    public Set<Long> getExamIdListCache() {
-        return redisUtil.getSet(SystemConstant.EXAM_LIST_ID_CACHE);
+    public Map<String, Set<Long>> getOrgExamListCache(String orgId) {
+        return redisUtil.getHashEntries(SystemConstant.ORG_EXAM_LIST_MAP_CACHE + orgId);
     }
 
     /**
-     * 更新考试列表id缓存
+     * 获取机构考试列表缓存
      *
+     * @param orgId
      * @param examId
+     * @return
      */
     @Override
-    public void updateExamListIdCache(Long examId) {
-        redisUtil.addSet(SystemConstant.EXAM_LIST_ID_CACHE, examId);
+    public Set<Long> getOrgExamListCache(String orgId, String examId) {
+        Map<String, Set<Long>> map = redisUtil.getHashEntries(SystemConstant.ORG_EXAM_LIST_MAP_CACHE + orgId);
+        if (!CollectionUtils.isEmpty(map)) {
+            return map.get(examId);
+        } else {
+            return null;
+        }
     }
 
     /**
-     * 删除考试列表id缓存
-     *
+     * @param orgId
      * @param examId
+     * @param examActivityId
      */
     @Override
-    public void removeExamListIdCache(Long examId) {
-        redisUtil.removeSet(SystemConstant.EXAM_LIST_ID_CACHE, examId);
+    public void updateOrgExamListCache(String orgId, String examId, Long examActivityId) {
+        Map<String, Set<Long>> map = redisUtil.getHashEntries(SystemConstant.ORG_EXAM_LIST_MAP_CACHE + orgId);
+        if (CollectionUtils.isEmpty(map)) {
+            redisUtil.set(SystemConstant.ORG_EXAM_LIST_MAP_CACHE + orgId, examId, new HashSet<>(Arrays.asList(examActivityId)));
+        } else {
+            Set<Long> examActivityIdSet = map.get(examId);
+            examActivityIdSet.add(examActivityId);
+            redisUtil.set(SystemConstant.ORG_EXAM_LIST_MAP_CACHE + orgId, examId, examActivityIdSet);
+        }
     }
 
     /**
-     * 更新考试列表缓存
+     * 删除机构考试列表缓存
      *
-     * @param examId
-     * @param examActivityId
+     * @param orgId
      */
     @Override
-    public void updateExamListCache(String examId, String examActivityId) {
-        this.removeExamListCache(examId, examActivityId);
-        redisUtil.set(SystemConstant.EXAM_LIST_MAP_CACHE + examId, examActivityId, examActivityId);
+    public void removeOrgExamListCache(String orgId) {
+        redisUtil.delete(SystemConstant.ORG_EXAM_LIST_MAP_CACHE + orgId);
     }
 
     /**
-     * 删除考试列表缓存
+     * 删除机构考试列表缓存
      *
+     * @param orgId
      * @param examId
      */
     @Override
-    public void removeExamListCache(String examId) {
-        redisUtil.delete(SystemConstant.EXAM_LIST_MAP_CACHE + examId);
+    public void removeOrgExamListCache(String orgId, String examId) {
+        redisUtil.delete(SystemConstant.ORG_EXAM_LIST_MAP_CACHE + orgId, examId);
     }
 
-    /**
-     * 删除考试列表缓存
-     *
-     * @param examId
-     * @param examActivityId
-     */
     @Override
-    public void removeExamListCache(String examId, String examActivityId) {
-        redisUtil.delete(SystemConstant.EXAM_LIST_MAP_CACHE + examId, examActivityId);
+    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);
+        for (Long l : examActivityIdSet) {
+            if (l.longValue() == examActivityId.longValue()) {
+                examActivityIdSet.remove(l);
+                break;
+            }
+        }
+        if (CollectionUtils.isEmpty(examActivityIdSet)) {
+            this.removeOrgExamListCache(orgId, examId);
+            this.removeOrgExamListCache(orgId);
+        } else {
+            redisUtil.set(SystemConstant.ORG_EXAM_LIST_MAP_CACHE + orgId, examId, new HashSet<>(examActivityIdSet));
+        }
     }
 
-    /**
-     * 获取当天考试缓存
-     *
-     * @param examId
-     * @return
-     */
     @Override
     public Map<String, Set<String>> getTodayExamCache(String examId) {
         return redisUtil.getHashEntries(SystemConstant.TODAY_EXAM_MAP_CACHE + examId);
@@ -837,7 +862,14 @@ public class ThemisCacheServiceImpl implements ThemisCacheService {
         if (Objects.nonNull(roomCode)) {
             teExamSummaryQueryWrapper.lambda().eq(TEExamSummary::getRoomCode, roomCode);
         }
-        return teExamSummaryService.list(teExamSummaryQueryWrapper);
+        List<TEExamSummary> teExamSummaryList = teExamSummaryService.list(teExamSummaryQueryWrapper);
+        if (CollectionUtils.isEmpty(teExamSummaryList)) {
+            if (Objects.nonNull(examActivityId) && Objects.nonNull(roomCode)) {
+                teExamSummaryService.examSummary(examId, examActivityId, new HashSet<>(Arrays.asList(roomCode)));
+            }
+            teExamSummaryList = teExamSummaryService.list(teExamSummaryQueryWrapper);
+        }
+        return teExamSummaryList;
     }
 
     /**

+ 13 - 5
themis-business/src/main/resources/mapper/TEExamActivityMapper.xml

@@ -129,18 +129,26 @@
         <include refid="getWaitingHeadCommon"/>
         ,tees.id as examStudentId,
         tees.course_code as courseCode,
-        tees.course_name as courseName
+        tees.course_name as courseName,
+        teea.id as examActivityId
         from t_e_exam_student tees
         left join t_e_exam tee on tee.id = tees.exam_id
         left join t_e_exam_activity teea on teea.id = tees.exam_activity_id
         <where>1 = 1
-            and teea.id in
-            <foreach collection="examActivityIds" item="examActivityId" index="index" open="(" close=")" separator=",">
-                #{examActivityId}
-            </foreach>
+            <if test="examActivityIds != null and examActivityIds != '' and examActivityIds.size > 0">
+                and teea.id in
+                <foreach collection="examActivityIds" item="examActivityId" index="index" open="(" close=")" separator=",">
+                    #{examActivityId}
+                </foreach>
+            </if>
             <if test="studentId != null and studentId != ''">
                 and tees.student_id = #{studentId}
             </if>
+            <if test="orgId != null and orgId != ''">
+                and tee.org_id = #{orgId}
+                and tee.enable = 1
+                and teea.enable = 1
+            </if>
             and tees.enable = 1
         </where>
     </select>

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

@@ -27,6 +27,6 @@ public class ExamListJob extends QuartzJobBean {
     @Override
     protected void executeInternal(JobExecutionContext context) throws JobExecutionException {
         log.info("ExamListJob,context:{}", context);
-        themisCacheService.setExamListCache();
+        themisCacheService.setOrgExamListCache();
     }
 }

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

@@ -59,7 +59,7 @@ public class StartRunning implements CommandLineRunner {
         log.info("服务器启动时执行 start");
         log.info("增加mqjob start");
         themisCacheService.setTodayExamCache();
-        themisCacheService.setExamListCache();
+        themisCacheService.setOrgExamListCache();
 
         Map mqMap = new HashMap();
         mqMap.put(SystemConstant.NAME, MqJob.class.getName());