wangliang 1 tahun lalu
induk
melakukan
55c0a50a01

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

@@ -228,13 +228,15 @@ public class TEExamController {
             }
             //加入更新考试列表缓存方法
             List<TEExamActivity> teExamActivityList = teExamActivityService.list(new QueryWrapper<TEExamActivity>().lambda().eq(TEExamActivity::getExamId, teExam.getId()).eq(TEExamActivity::getEnable, 1));
-            for (TEExamActivity t : teExamActivityList) {
-                if (Objects.nonNull(t.getEnable()) && t.getEnable().intValue() == 1 && teExam.getEnable().intValue() == 1 && (Objects.nonNull(teExam.getEndTime()) && teExam.getEndTime().longValue() > System.currentTimeMillis())) {
-                    themisCacheService.updateCurrentExamListCache(t.getExamId().toString(), t.getId());
-                    themisCacheService.updateOrgExamListCache(teExam.getOrgId().toString(), t.getExamId().toString(), t.getId());
-                } else {
-                    themisCacheService.removeCurrentExamListCache(t.getExamId().toString(), t.getId());
-                    themisCacheService.removeOrgExamListCache(teExam.getOrgId().toString(), t.getExamId().toString(), t.getId());
+            if (!CollectionUtils.isEmpty(teExamActivityList)) {
+                for (TEExamActivity t : teExamActivityList) {
+                    if (Objects.nonNull(t) && Objects.nonNull(t.getEnable()) && t.getEnable().intValue() == 1 && teExam.getEnable().intValue() == 1 && (Objects.nonNull(teExam.getEndTime()) && teExam.getEndTime().longValue() > System.currentTimeMillis())) {
+                        themisCacheService.updateCurrentExamListCache(t.getExamId().toString(), t.getId());
+                        themisCacheService.updateOrgExamListCache(teExam.getOrgId().toString(), t.getExamId().toString(), t.getId());
+                    } else {
+                        themisCacheService.removeCurrentExamListCache(t.getExamId().toString(), t.getId());
+                        themisCacheService.removeOrgExamListCache(teExam.getOrgId().toString(), t.getExamId().toString(), t.getId());
+                    }
                 }
             }
         } catch (Exception e) {

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

@@ -2,7 +2,6 @@ package com.qmth.themis.business.service.impl;
 
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
-import com.aliyun.oss.common.utils.BinaryUtil;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -24,7 +23,6 @@ import com.qmth.themis.business.util.ServletUtil;
 import com.qmth.themis.common.enums.ExceptionResultEnum;
 import com.qmth.themis.common.exception.BusinessException;
 import com.qmth.themis.common.util.GsonUtil;
-import com.qmth.themis.common.util.HexUtils;
 import org.apache.commons.io.FilenameUtils;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -105,14 +103,20 @@ public class TEStudentServiceImpl extends ServiceImpl<TEStudentMapper, TEStudent
                 }.getType());
                 Set<MonitorVideoSourceEnum> set = new LinkedHashSet<>(monitorRecordList.size());
                 for (TEStudentMonitorRecordDto teStudentMonitorRecordDto : monitorRecordList) {
-                    set.add(SystemConstant.getMonitorRecordVideoSource(teStudentMonitorRecordDto.getVideoSource()));
+                    MonitorVideoSourceEnum monitorVideoSourceEnum = SystemConstant.getMonitorRecordVideoSource(teStudentMonitorRecordDto.getVideoSource());
+                    if (Objects.nonNull(monitorVideoSourceEnum)) {
+                        set.add(monitorVideoSourceEnum);
+                    }
                 }
                 t.setMonitorRecord(set.toString().replaceAll("\\[", "").replaceAll("\\]", "").replaceAll(", ", ",").trim());
             } else if (Objects.nonNull(t.getVideoSource()) && !Objects.equals(t.getVideoSource().trim(), "")) {
                 String[] strs = t.getVideoSource().split(",");
                 Set<MonitorVideoSourceEnum> set = new LinkedHashSet<>(strs.length);
                 for (String s : strs) {
-                    set.add(SystemConstant.getMonitorRecordVideoSource(s));
+                    MonitorVideoSourceEnum monitorVideoSourceEnum = SystemConstant.getMonitorRecordVideoSource(s);
+                    if (Objects.nonNull(monitorVideoSourceEnum)) {
+                        set.add(monitorVideoSourceEnum);
+                    }
                 }
                 t.setMonitorRecord(set.toString().replaceAll("\\[", "").replaceAll("\\]", "").replaceAll(", ", ",").trim());
             }

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

@@ -955,14 +955,20 @@ public class TOeExamRecordServiceImpl extends ServiceImpl<TOeExamRecordMapper, T
                 }.getType());
                 Set<MonitorVideoSourceEnum> set = new LinkedHashSet<>(monitorRecordList.size());
                 for (TEStudentMonitorRecordDto teStudentMonitorRecordDto : monitorRecordList) {
-                    set.add(SystemConstant.getMonitorRecordVideoSource(teStudentMonitorRecordDto.getVideoSource()));
+                    MonitorVideoSourceEnum monitorVideoSourceEnum = SystemConstant.getMonitorRecordVideoSource(teStudentMonitorRecordDto.getVideoSource());
+                    if (Objects.nonNull(monitorVideoSourceEnum)) {
+                        set.add(monitorVideoSourceEnum);
+                    }
                 }
                 t.setMonitorRecord(set.toString().replaceAll("\\[", "").replaceAll("\\]", "").replaceAll(", ", ",").trim());
             } else if (Objects.nonNull(t.getVideoSource()) && !Objects.equals(t.getVideoSource().trim(), "")) {
                 String[] strs = t.getVideoSource().split(",");
                 Set<MonitorVideoSourceEnum> set = new LinkedHashSet<>(strs.length);
                 for (String s : strs) {
-                    set.add(SystemConstant.getMonitorRecordVideoSource(s));
+                    MonitorVideoSourceEnum monitorVideoSourceEnum = SystemConstant.getMonitorRecordVideoSource(s);
+                    if (Objects.nonNull(monitorVideoSourceEnum)) {
+                        set.add(monitorVideoSourceEnum);
+                    }
                 }
                 t.setMonitorRecord(set.toString().replaceAll("\\[", "").replaceAll("\\]", "").replaceAll(", ", ",").trim());
             }