Browse Source

实时监考台monitorVideoSource从考试记录里获取

wangliang 4 years ago
parent
commit
a6d4747808

+ 9 - 10
themis-admin/src/main/java/com/qmth/themis/admin/api/TIeInvigilateController.java

@@ -133,16 +133,15 @@ public class TIeInvigilateController {
             if (Objects.nonNull(examId)) {
                 examCacheBean = teExamService.getExamCacheBean(examId);
             }
-            List<String> monitorVideoSourceList = null;
-            if (Objects.nonNull(examCacheBean) && Objects.nonNull(examCacheBean.getMonitorVideoSource()) && !Objects.equals(examCacheBean.getMonitorVideoSource().toString().trim().replaceAll(" ", ""), "")) {
-                monitorVideoSourceList = Arrays.asList(examCacheBean.getMonitorVideoSource().trim().toUpperCase().replaceAll(" ", "").split(","));
-            }
             if (Objects.nonNull(invigilateListVideoBeanList) && invigilateListVideoBeanList.size() > 0) {
                 ExamCacheBean finalExamCacheBean = examCacheBean;
-                List<String> finalMonitorVideoSourceList = monitorVideoSourceList;
                 invigilateListVideoBeanList.forEach(s -> {
-                    if (Objects.nonNull(finalMonitorVideoSourceList) && finalMonitorVideoSourceList.size() > 0) {
-                        finalMonitorVideoSourceList.forEach(l -> {
+                    List<String> monitorVideoSourceList = null;
+                    if (Objects.nonNull(s.getMonitorVideoSource()) && !Objects.equals(s.getMonitorVideoSource().trim().replaceAll(" ", ""), "")) {
+                        monitorVideoSourceList = Arrays.asList(s.getMonitorVideoSource().trim().toUpperCase().replaceAll(" ", "").split(","));
+                    }
+                    if (Objects.nonNull(monitorVideoSourceList) && monitorVideoSourceList.size() > 0) {
+                        monitorVideoSourceList.forEach(l -> {
                             MonitorVideoSourceEnum source = MonitorVideoSourceEnum.valueOf(l);
                             switch (source.name()) {
                                 case "CLIENT_SCREEN":
@@ -162,7 +161,7 @@ public class TIeInvigilateController {
                     }
                     if (Objects.nonNull(monitorVideoSource)) {
                         s.setMonitorLiveUrl(SystemConstant.setStreamId(dictionaryConfig.monitorDomain().getPrefix(), s.getExamRecordId(), MonitorVideoSourceEnum.valueOf(monitorVideoSource)));
-                    } else if (Objects.nonNull(finalMonitorVideoSourceList) && finalMonitorVideoSourceList.contains(MonitorVideoSourceEnum.CLIENT_CAMERA.name())) {
+                    } else if (Objects.nonNull(monitorVideoSourceList) && monitorVideoSourceList.contains(MonitorVideoSourceEnum.CLIENT_CAMERA.name())) {
                         s.setMonitorLiveUrl(SystemConstant.setStreamId(dictionaryConfig.monitorDomain().getPrefix(), s.getExamRecordId(), MonitorVideoSourceEnum.CLIENT_CAMERA));
                     }
                     WebsocketStatusEnum websocketStatusEnum = ExamRecordCacheUtil.getClientWebsocketStatus(s.getExamRecordId());
@@ -202,8 +201,8 @@ public class TIeInvigilateController {
             invigilateListVideoBeanList.forEach(s -> {
                 ExamCacheBean examCacheBean = teExamService.getExamCacheBean(s.getExamId());
                 List<String> monitorVideoSourceList = null;
-                if (Objects.nonNull(examCacheBean) && Objects.nonNull(examCacheBean.getMonitorVideoSource()) && !Objects.equals(examCacheBean.getMonitorVideoSource().toString().trim().replaceAll(" ", ""), "")) {
-                    monitorVideoSourceList = Arrays.asList(examCacheBean.getMonitorVideoSource().trim().toUpperCase().replaceAll(" ", "").split(","));
+                if (Objects.nonNull(s.getMonitorVideoSource()) && !Objects.equals(s.getMonitorVideoSource().trim().replaceAll(" ", ""), "")) {
+                    monitorVideoSourceList = Arrays.asList(s.getMonitorVideoSource().trim().toUpperCase().replaceAll(" ", "").split(","));
                 }
                 if (Objects.nonNull(monitorVideoSourceList) && monitorVideoSourceList.contains(MonitorVideoSourceEnum.CLIENT_CAMERA.name())) {
                     s.setMonitorLiveUrl(SystemConstant.setStreamId(dictionaryConfig.monitorDomain().getPrefix(), s.getExamRecordId(), MonitorVideoSourceEnum.CLIENT_CAMERA));

+ 11 - 0
themis-business/src/main/java/com/qmth/themis/business/bean/admin/InvigilateListVideoBean.java

@@ -112,6 +112,17 @@ public class InvigilateListVideoBean implements Serializable {
     @ApiModelProperty(name = "新增预警")
     private Integer warningNew;
 
+    @ApiModelProperty(name = "开启监控的视频源")
+    private String monitorVideoSource;
+
+    public String getMonitorVideoSource() {
+        return monitorVideoSource;
+    }
+
+    public void setMonitorVideoSource(String monitorVideoSource) {
+        this.monitorVideoSource = monitorVideoSource;
+    }
+
     public String getCourseCode() {
         return courseCode;
     }

+ 2 - 1
themis-business/src/main/resources/mapper/TOeExamRecordMapper.xml

@@ -102,7 +102,8 @@
 		IFNULL(t.warning_count,0) as warningCount,
 		IFNULL(t.breach_status,1) as breachStatus,
 		IFNULL(t.client_websocket_status,'OFF_LINE') as clientWebsocketStatus,
-		t.client_last_sync_time as updateTime
+		t.client_last_sync_time as updateTime,
+		t.monitor_video_source as monitorVideoSource
 	</sql>
 
 	<sql id="invigilatePageMiddle">