Explorar el Código

移动端加入是否允许考生发起语音通话,屏蔽ip预警

wangliang hace 1 año
padre
commit
4449e2a386

+ 11 - 0
themis-business/src/main/java/com/qmth/themis/business/bean/mobile/MobileAuthorizationMonitorBean.java

@@ -31,6 +31,17 @@ public class MobileAuthorizationMonitorBean extends MobileAuthorizationBean {
     @ApiModelProperty("转录id")
     private String monitorRecordId;
 
+    @ApiModelProperty(value = "是否允许考生发起语音通话,0:否,1:是")
+    private Integer examStudentCallEnable = 1;
+
+    public Integer getExamStudentCallEnable() {
+        return examStudentCallEnable;
+    }
+
+    public void setExamStudentCallEnable(Integer examStudentCallEnable) {
+        this.examStudentCallEnable = examStudentCallEnable;
+    }
+
     public String getMonitorRecordId() {
         return monitorRecordId;
     }

+ 10 - 10
themis-business/src/main/java/com/qmth/themis/business/cache/ExamRecordCacheUtil.java

@@ -534,16 +534,16 @@ public class ExamRecordCacheUtil {
     public static void setClientCurrentIp(Long recordId, String ip) {
         if (Objects.nonNull(getId(recordId)) && (Objects.nonNull(ip) && !Objects.equals(ip.trim(), "") && !Objects.equals(ip.trim(), "0:0:0:0:0:0:0:1") && !Objects.equals(ip.trim(), "127.0.0.1")
                 && !Objects.equals(ip.trim(), "localhost"))) {
-            String historyIp = getClientCurrentIp(recordId);
-            if (Objects.nonNull(historyIp) && !Objects.equals(historyIp.trim(), "") && !Objects.equals(historyIp.trim(), ip.trim())) {
-                Long examId = getExamId(recordId);
-                Long examActivityId = getExamActivityId(recordId);
-                Long examStudentId = getExamStudentId(recordId);
-                TIeInvigilateWarnInfoService tIeInvigilateWarnInfoService = SpringContextHolder.getBean(TIeInvigilateWarnInfoService.class);
-                //ip不同则发生预警
-                TIeInvigilateWarnInfo tIeInvigilateWarnInfo = new TIeInvigilateWarnInfo(examId, examActivityId, recordId, examStudentId, VerifyExceptionEnum.IP_CHANGE_ERROR.getLevel().get(0), VerifyExceptionEnum.IP_CHANGE_ERROR.getTitle(), VerifyExceptionEnum.IP_CHANGE_ERROR, 1);
-                tIeInvigilateWarnInfoService.saveOrUpdate(tIeInvigilateWarnInfo);
-            }
+//            String historyIp = getClientCurrentIp(recordId);
+//            if (Objects.nonNull(historyIp) && !Objects.equals(historyIp.trim(), "") && !Objects.equals(historyIp.trim(), ip.trim())) {
+//                Long examId = getExamId(recordId);
+//                Long examActivityId = getExamActivityId(recordId);
+//                Long examStudentId = getExamStudentId(recordId);
+//                TIeInvigilateWarnInfoService tIeInvigilateWarnInfoService = SpringContextHolder.getBean(TIeInvigilateWarnInfoService.class);
+//                //ip不同则发生预警
+//                TIeInvigilateWarnInfo tIeInvigilateWarnInfo = new TIeInvigilateWarnInfo(examId, examActivityId, recordId, examStudentId, VerifyExceptionEnum.IP_CHANGE_ERROR.getLevel().get(0), VerifyExceptionEnum.IP_CHANGE_ERROR.getTitle(), VerifyExceptionEnum.IP_CHANGE_ERROR, 1);
+//                tIeInvigilateWarnInfoService.saveOrUpdate(tIeInvigilateWarnInfo);
+//            }
             redisUtil.set(RedisKeyHelper.examRecordCacheKey(recordId), ExamRecordFieldEnum.client_current_ip.getCode(),
                     ip.trim());
         }

+ 2 - 2
themis-business/src/main/java/com/qmth/themis/business/enums/VerifyExceptionEnum.java

@@ -22,9 +22,9 @@ public enum VerifyExceptionEnum {
 
     NONE("无异常", Arrays.asList("-1"), "违纪预警"),
 
-    REALNESS("真实性检测异常", Arrays.asList("D15"), "违纪预警"),
+    REALNESS("真实性检测异常", Arrays.asList("D15"), "违纪预警");
 
-    IP_CHANGE_ERROR("IP变动预警", Arrays.asList("D17"), "违纪预警");
+//    IP_CHANGE_ERROR("IP变动预警", Arrays.asList("D17"), "违纪预警");
 
     private String code;
 

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

@@ -109,6 +109,7 @@ public class TEMobileServiceImpl implements TEMobileService {
         ret.setAccessToken(token);
         ret.setTime(System.currentTimeMillis());
         ret.setMode(mode);
+
         //mq发送消息start
         MqDto mqDto = new MqDto(mqUtil.getTopic(), platform.name(), SystemOperationEnum.SESSION, sessionId);
         mqDtoService.assembleSendOneWayMsg(mqDto);
@@ -134,7 +135,7 @@ public class TEMobileServiceImpl implements TEMobileService {
         ret.setMonitorAppId(tencentYunUtil.getAppId());
         ret.setMonitorKey(ExamRecordCacheUtil.getMonitorKey(recordId));
         ret.setMonitorVideoSource(monitorVideoSource);
-        ret.setMonitorAudioEnable(getMonitorAudioEnable(recordId, monitorVideoSource));
+        ret = getMonitorAudioEnable(recordId, monitorVideoSource, ret);
         SysConfig sysConfig = themisCacheService.addSysConfigCache(SystemConstant.MONITOR_CONFIG_PREFIX);
         Optional.ofNullable(sysConfig).orElseThrow(() -> new BusinessException("未配置监控前缀"));
         ret.setMonitorStreamId(SystemConstant.setStreamId(sysConfig.getConfigValue(), recordId, monitorVideoSource));
@@ -228,16 +229,26 @@ public class TEMobileServiceImpl implements TEMobileService {
         return ret;
     }
 
-    private Boolean getMonitorAudioEnable(Long recordId, MonitorVideoSourceEnum videoSource) {
+    /**
+     * 设置是否允许考生端开启语音
+     *
+     * @param recordId
+     * @param videoSource
+     * @param ret
+     * @return
+     */
+    private MobileAuthorizationMonitorBean getMonitorAudioEnable(Long recordId, MonitorVideoSourceEnum videoSource, MobileAuthorizationMonitorBean ret) {
         Long examId = ExamRecordCacheUtil.getExamId(recordId);
         ExamCacheBean exam = examService.getExamCacheBean(examId);
+        ret.setExamStudentCallEnable(exam.getExamStudentCallEnable());
         String monitorVideoSource = exam.getMonitorVideoSource();
         if (!monitorVideoSource.toUpperCase().contains(MonitorVideoSourceEnum.CLIENT_SCREEN.name())
                 && !monitorVideoSource.toUpperCase().contains(MonitorVideoSourceEnum.CLIENT_CAMERA.name())
                 && MonitorVideoSourceEnum.MOBILE_FIRST.equals(videoSource)) {
-            return true;
+            ret.setMonitorAudioEnable(true);
         } else {
-            return false;
+            ret.setMonitorAudioEnable(false);
         }
+        return ret;
     }
 }