|
@@ -5,11 +5,15 @@ import com.qmth.themis.business.annotation.ApiJsonProperty;
|
|
|
import com.qmth.themis.business.cache.ExamRecordCacheUtil;
|
|
|
import com.qmth.themis.business.constant.SystemConstant;
|
|
|
import com.qmth.themis.business.dto.MqDto;
|
|
|
+import com.qmth.themis.business.dto.cache.TEStudentCacheDto;
|
|
|
import com.qmth.themis.business.entity.TIeExamInvigilateCallLog;
|
|
|
+import com.qmth.themis.business.entity.TOeExamRecord;
|
|
|
import com.qmth.themis.business.enums.*;
|
|
|
import com.qmth.themis.business.service.MqDtoService;
|
|
|
import com.qmth.themis.business.service.TOeExamRecordService;
|
|
|
import com.qmth.themis.business.util.MqUtil;
|
|
|
+import com.qmth.themis.business.util.ServletUtil;
|
|
|
+import com.qmth.themis.common.contanst.Constants;
|
|
|
import com.qmth.themis.common.enums.ExceptionResultEnum;
|
|
|
import com.qmth.themis.common.exception.BusinessException;
|
|
|
import com.qmth.themis.common.util.Result;
|
|
@@ -120,10 +124,10 @@ public class TIeInvigilateCallMobileController {
|
|
|
throw new BusinessException(ExceptionResultEnum.RECORD_ID_IS_NULL);
|
|
|
}
|
|
|
Long recordId = Long.parseLong(String.valueOf(mapParameter.get(SystemConstant.RECORD_ID)));
|
|
|
- if (Objects.isNull(mapParameter.get("source")) || Objects.equals(mapParameter.get("source"), "")) {
|
|
|
+ if (Objects.isNull(mapParameter.get(Constants.HEADER_SOURCE)) || Objects.equals(mapParameter.get(Constants.HEADER_SOURCE), "")) {
|
|
|
throw new BusinessException("来源不能为空!");
|
|
|
}
|
|
|
- MonitorVideoSourceEnum source = MonitorVideoSourceEnum.valueOf(String.valueOf(mapParameter.get("source")));
|
|
|
+ MonitorVideoSourceEnum source = MonitorVideoSourceEnum.valueOf(String.valueOf(mapParameter.get(Constants.HEADER_SOURCE)));
|
|
|
//获取考试记录缓存
|
|
|
if (Objects.isNull(source) || Objects.isNull(ExamRecordCacheUtil.getMonitorStatus(recordId, source))) {
|
|
|
throw new BusinessException("推流状态为空");
|
|
@@ -132,6 +136,28 @@ public class TIeInvigilateCallMobileController {
|
|
|
if (!Objects.equals(status, MonitorStatusSourceEnum.START)) {
|
|
|
throw new BusinessException("推流状态不正常");
|
|
|
}
|
|
|
+ //2022/04/21加入校验
|
|
|
+ TEStudentCacheDto teStudentCacheDto = (TEStudentCacheDto) ServletUtil.getRequestStudentAccount();
|
|
|
+ if (Objects.nonNull(teStudentCacheDto) && Objects.nonNull(teStudentCacheDto.getExamingRecordId())
|
|
|
+ && teStudentCacheDto.getExamingRecordId().longValue() == recordId.longValue()) {
|
|
|
+ String monitorRecord = ExamRecordCacheUtil.getMonitorRecord(recordId);
|
|
|
+ if (Objects.isNull(monitorRecord)) {
|
|
|
+ TOeExamRecord tOeExamRecord = SystemConstant.getExamRecord(recordId);
|
|
|
+ monitorRecord = tOeExamRecord.getMonitorRecord();
|
|
|
+ }
|
|
|
+ Map<String, String> monitorRecordMap = SystemConstant.getMonitorRecordMap(monitorRecord);
|
|
|
+ if (Objects.isNull(monitorRecordMap)) {
|
|
|
+ return ResultUtil.ok();
|
|
|
+ } else {
|
|
|
+ String monitorRecordStr = monitorRecordMap.get(source.name());
|
|
|
+ if (Objects.isNull(monitorRecordStr)) {
|
|
|
+ return ResultUtil.ok();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ return ResultUtil.ok();
|
|
|
+ }
|
|
|
+
|
|
|
String liveUrl = SystemConstant.setStreamId(dictionaryConfig.monitorDomain().getPrefix(), recordId, source);
|
|
|
Long timestamp = System.currentTimeMillis();
|
|
|
ExamRecordCacheUtil.setMonitorCallStatus(recordId, source, MonitorCallStatusSourceEnum.START, timestamp);
|
|
@@ -160,10 +186,10 @@ public class TIeInvigilateCallMobileController {
|
|
|
throw new BusinessException(ExceptionResultEnum.RECORD_ID_IS_NULL);
|
|
|
}
|
|
|
Long recordId = Long.parseLong(String.valueOf(mapParameter.get(SystemConstant.RECORD_ID)));
|
|
|
- if (Objects.isNull(mapParameter.get("source")) || Objects.equals(mapParameter.get("source"), "")) {
|
|
|
+ if (Objects.isNull(mapParameter.get(Constants.HEADER_SOURCE)) || Objects.equals(mapParameter.get(Constants.HEADER_SOURCE), "")) {
|
|
|
throw new BusinessException("监考视频源不能为空");
|
|
|
}
|
|
|
- MonitorVideoSourceEnum source = MonitorVideoSourceEnum.valueOf(String.valueOf(mapParameter.get("source")).toUpperCase());
|
|
|
+ MonitorVideoSourceEnum source = MonitorVideoSourceEnum.valueOf(String.valueOf(mapParameter.get(Constants.HEADER_SOURCE)).toUpperCase());
|
|
|
if (Objects.isNull(mapParameter.get(SystemConstant.STATUS)) || Objects.equals(mapParameter.get(SystemConstant.STATUS), "")) {
|
|
|
throw new BusinessException("监考视频状态不能为空");
|
|
|
}
|
|
@@ -171,6 +197,27 @@ public class TIeInvigilateCallMobileController {
|
|
|
if (Objects.equals(status, MonitorStatusSourceEnum.STOP.name()) && (Objects.isNull(mapParameter.get(SystemConstant.TYPE)) || Objects.equals(mapParameter.get(SystemConstant.TYPE), ""))) {
|
|
|
throw new BusinessException("异常类型不能为空");
|
|
|
}
|
|
|
+ //2022/04/21加入校验
|
|
|
+ TEStudentCacheDto teStudentCacheDto = (TEStudentCacheDto) ServletUtil.getRequestStudentAccount();
|
|
|
+ if (Objects.nonNull(teStudentCacheDto) && Objects.nonNull(teStudentCacheDto.getExamingRecordId())
|
|
|
+ && teStudentCacheDto.getExamingRecordId().longValue() == recordId.longValue()) {
|
|
|
+ String monitorRecord = ExamRecordCacheUtil.getMonitorRecord(recordId);
|
|
|
+ if (Objects.isNull(monitorRecord)) {
|
|
|
+ TOeExamRecord tOeExamRecord = SystemConstant.getExamRecord(recordId);
|
|
|
+ monitorRecord = tOeExamRecord.getMonitorRecord();
|
|
|
+ }
|
|
|
+ Map<String, String> monitorRecordMap = SystemConstant.getMonitorRecordMap(monitorRecord);
|
|
|
+ if (Objects.isNull(monitorRecordMap)) {
|
|
|
+ return ResultUtil.ok();
|
|
|
+ } else {
|
|
|
+ String monitorRecordStr = monitorRecordMap.get(source.name());
|
|
|
+ if (Objects.isNull(monitorRecordStr)) {
|
|
|
+ return ResultUtil.ok();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ return ResultUtil.ok();
|
|
|
+ }
|
|
|
//获取考试记录缓存
|
|
|
String liveUrl = SystemConstant.setStreamId(dictionaryConfig.monitorDomain().getPrefix(), recordId, source);
|
|
|
MonitorCallStatusSourceEnum callStatus = Objects.nonNull(ExamRecordCacheUtil.getMonitorCallStatus(recordId, source)) ? ExamRecordCacheUtil.getMonitorCallStatus(recordId, source) : null;
|
|
@@ -191,7 +238,7 @@ public class TIeInvigilateCallMobileController {
|
|
|
|
|
|
Map mqMap = new HashMap<>();
|
|
|
mqMap.put(SystemConstant.RECORD_ID, recordId);
|
|
|
- mqMap.put("source", source.name());
|
|
|
+ mqMap.put(Constants.HEADER_SOURCE, source.name());
|
|
|
if (Objects.equals(status.name(), MonitorStatusSourceEnum.START.name())) {
|
|
|
//监控开始
|
|
|
MqDto mqDtoStart = new MqDto(mqUtil.getMqGroupDomain().getTopic(), MqTagEnum.MONITOR_START.name(), recordId, MqTagEnum.MONITOR_START, String.valueOf(recordId), mqMap, String.valueOf(recordId));
|
|
@@ -219,10 +266,10 @@ public class TIeInvigilateCallMobileController {
|
|
|
throw new BusinessException(ExceptionResultEnum.RECORD_ID_IS_NULL);
|
|
|
}
|
|
|
Long recordId = Long.parseLong(String.valueOf(mapParameter.get(SystemConstant.RECORD_ID)));
|
|
|
- if (Objects.isNull(mapParameter.get("source")) || Objects.equals(mapParameter.get("source"), "")) {
|
|
|
+ if (Objects.isNull(mapParameter.get(Constants.HEADER_SOURCE)) || Objects.equals(mapParameter.get(Constants.HEADER_SOURCE), "")) {
|
|
|
throw new BusinessException("来源不能为空!");
|
|
|
}
|
|
|
- MonitorVideoSourceEnum source = MonitorVideoSourceEnum.valueOf(String.valueOf(mapParameter.get("source")));
|
|
|
+ MonitorVideoSourceEnum source = MonitorVideoSourceEnum.valueOf(String.valueOf(mapParameter.get(Constants.HEADER_SOURCE)));
|
|
|
//获取考试记录缓存
|
|
|
ExamRecordStatusEnum statusEnum = ExamRecordCacheUtil.getStatus(recordId);
|
|
|
if (Objects.isNull(statusEnum) || Objects.equals(statusEnum, ExamRecordStatusEnum.FINISHED) || Objects.equals(statusEnum, ExamRecordStatusEnum.PERSISTED)) {
|
|
@@ -230,6 +277,27 @@ public class TIeInvigilateCallMobileController {
|
|
|
} else if (Objects.isNull(ExamRecordCacheUtil.getMonitorStatus(recordId, source))) {
|
|
|
throw new BusinessException("推流状态为空");
|
|
|
}
|
|
|
+ //2022/04/21加入校验
|
|
|
+ TEStudentCacheDto teStudentCacheDto = (TEStudentCacheDto) ServletUtil.getRequestStudentAccount();
|
|
|
+ if (Objects.nonNull(teStudentCacheDto) && Objects.nonNull(teStudentCacheDto.getExamingRecordId())
|
|
|
+ && teStudentCacheDto.getExamingRecordId().longValue() == recordId.longValue()) {
|
|
|
+ String monitorRecord = ExamRecordCacheUtil.getMonitorRecord(recordId);
|
|
|
+ if (Objects.isNull(monitorRecord)) {
|
|
|
+ TOeExamRecord tOeExamRecord = SystemConstant.getExamRecord(recordId);
|
|
|
+ monitorRecord = tOeExamRecord.getMonitorRecord();
|
|
|
+ }
|
|
|
+ Map<String, String> monitorRecordMap = SystemConstant.getMonitorRecordMap(monitorRecord);
|
|
|
+ if (Objects.isNull(monitorRecordMap)) {
|
|
|
+ return ResultUtil.ok();
|
|
|
+ } else {
|
|
|
+ String monitorRecordStr = monitorRecordMap.get(source.name());
|
|
|
+ if (Objects.isNull(monitorRecordStr)) {
|
|
|
+ return ResultUtil.ok();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ return ResultUtil.ok();
|
|
|
+ }
|
|
|
String liveUrl = SystemConstant.setStreamId(dictionaryConfig.monitorDomain().getPrefix(), recordId, source);
|
|
|
Long timestamp = System.currentTimeMillis();
|
|
|
ExamRecordCacheUtil.setMonitorCallStatus(recordId, source, MonitorCallStatusSourceEnum.STOP, timestamp);
|