|
@@ -17,7 +17,6 @@ import com.qmth.themis.exam.config.DictionaryConfig;
|
|
|
import io.swagger.annotations.*;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
-import org.springframework.dao.DuplicateKeyException;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
@@ -55,57 +54,57 @@ public class TIeInvigilateCallOeController {
|
|
|
@Resource
|
|
|
DictionaryConfig dictionaryConfig;
|
|
|
|
|
|
- @Deprecated
|
|
|
- @ApiOperation(value = "监控观看地址更新接口")
|
|
|
- @RequestMapping(value = "/live_url", method = RequestMethod.POST)
|
|
|
- @ApiResponses({@ApiResponse(code = 200, message = "{\"success\":true}", response = Result.class)})
|
|
|
- @Transactional
|
|
|
- public Result liveUrl(@ApiJsonObject(name = "liveUrlOe", value = {
|
|
|
- @ApiJsonProperty(key = "recordId", type = "long", example = "1", description = "考试记录id", required = true),
|
|
|
- @ApiJsonProperty(key = "source", description = "监考视频源", required = true),
|
|
|
- @ApiJsonProperty(key = "liveUrl", description = "观看地址", required = true)
|
|
|
- }) @ApiParam(value = "监控信息", required = true) @RequestBody Map<String, Object> mapParameter) {
|
|
|
- if (Objects.isNull(mapParameter.get("recordId")) || Objects.equals(mapParameter.get("recordId"), "")) {
|
|
|
- throw new BusinessException(ExceptionResultEnum.RECORD_ID_IS_NULL);
|
|
|
- }
|
|
|
- Long recordId = null;
|
|
|
- try {
|
|
|
- recordId = Long.parseLong(String.valueOf(mapParameter.get("recordId")));
|
|
|
- if (Objects.isNull(mapParameter.get("source")) || Objects.equals(mapParameter.get("source"), "")) {
|
|
|
- throw new BusinessException("监考视频源不能为空");
|
|
|
- }
|
|
|
- MonitorVideoSourceEnum source = MonitorVideoSourceEnum.valueOf(String.valueOf(mapParameter.get("source")).toUpperCase());
|
|
|
- if (Objects.isNull(mapParameter.get("liveUrl")) || Objects.equals(mapParameter.get("liveUrl"), "")) {
|
|
|
- throw new BusinessException("观看地址不能为空");
|
|
|
- }
|
|
|
- String liveUrl = String.valueOf(mapParameter.get("liveUrl"));
|
|
|
- String monitorKey = ExamRecordCacheUtil.getMonitorKey(recordId);
|
|
|
- TIeExamInvigilateCallLog tIeExamInvigilateCallLog = new TIeExamInvigilateCallLog(recordId, source, liveUrl, MonitorStatusSourceEnum.INIT, monitorKey,null);
|
|
|
- //获取考试记录缓存
|
|
|
- ExamRecordCacheUtil.setMonitorLiveUrl(recordId, source, liveUrl, false);
|
|
|
- ExamRecordCacheUtil.setMonitorStatus(recordId, source, tIeExamInvigilateCallLog.getStatus(), false);
|
|
|
- String[] columns = new String[]{ExamRecordFieldEnum.monitor_live_url.name(), ExamRecordFieldEnum.monitor_status_source.name()};
|
|
|
- Object[] values = new Object[]{liveUrl, tIeExamInvigilateCallLog.getStatus()};
|
|
|
- tOeExamRecordService.dataUpdatesMq(recordId, columns, values);
|
|
|
-
|
|
|
- //监考监控通话信息 发送mq start
|
|
|
- MqDto mqDto = new MqDto(mqUtil.getMqGroupDomain().getTopic(), MqTagEnum.MONITOR_LOG.name(), tIeExamInvigilateCallLog, MqTagEnum.MONITOR_LOG, String.valueOf(tIeExamInvigilateCallLog.getId()), source.name());
|
|
|
- mqDtoService.assembleSendOneWayMsg(mqDto);
|
|
|
- //监考监控通话信息 发送mq end
|
|
|
- } catch (Exception e) {
|
|
|
- log.error("请求出错", e);
|
|
|
- if (e instanceof DuplicateKeyException) {
|
|
|
- String errorColumn = e.getCause().toString();
|
|
|
- String columnStr = errorColumn.substring(errorColumn.lastIndexOf("key") + 3, errorColumn.length()).replaceAll("'", "");
|
|
|
- throw new BusinessException("考试记录id[" + recordId + "]下的" + FieldUniqueEnum.convertToCode(columnStr) + "数据不允许重复插入");
|
|
|
- } else if (e instanceof BusinessException) {
|
|
|
- throw new BusinessException(e.getMessage());
|
|
|
- } else {
|
|
|
- throw new RuntimeException(e);
|
|
|
- }
|
|
|
- }
|
|
|
- return ResultUtil.ok(Collections.singletonMap("updateTime", System.currentTimeMillis()));
|
|
|
- }
|
|
|
+// @Deprecated
|
|
|
+// @ApiOperation(value = "监控观看地址更新接口")
|
|
|
+// @RequestMapping(value = "/live_url", method = RequestMethod.POST)
|
|
|
+// @ApiResponses({@ApiResponse(code = 200, message = "{\"success\":true}", response = Result.class)})
|
|
|
+// @Transactional
|
|
|
+// public Result liveUrl(@ApiJsonObject(name = "liveUrlOe", value = {
|
|
|
+// @ApiJsonProperty(key = "recordId", type = "long", example = "1", description = "考试记录id", required = true),
|
|
|
+// @ApiJsonProperty(key = "source", description = "监考视频源", required = true),
|
|
|
+// @ApiJsonProperty(key = "liveUrl", description = "观看地址", required = true)
|
|
|
+// }) @ApiParam(value = "监控信息", required = true) @RequestBody Map<String, Object> mapParameter) {
|
|
|
+// if (Objects.isNull(mapParameter.get("recordId")) || Objects.equals(mapParameter.get("recordId"), "")) {
|
|
|
+// throw new BusinessException(ExceptionResultEnum.RECORD_ID_IS_NULL);
|
|
|
+// }
|
|
|
+// Long recordId = null;
|
|
|
+// try {
|
|
|
+// recordId = Long.parseLong(String.valueOf(mapParameter.get("recordId")));
|
|
|
+// if (Objects.isNull(mapParameter.get("source")) || Objects.equals(mapParameter.get("source"), "")) {
|
|
|
+// throw new BusinessException("监考视频源不能为空");
|
|
|
+// }
|
|
|
+// MonitorVideoSourceEnum source = MonitorVideoSourceEnum.valueOf(String.valueOf(mapParameter.get("source")).toUpperCase());
|
|
|
+// if (Objects.isNull(mapParameter.get("liveUrl")) || Objects.equals(mapParameter.get("liveUrl"), "")) {
|
|
|
+// throw new BusinessException("观看地址不能为空");
|
|
|
+// }
|
|
|
+// String liveUrl = String.valueOf(mapParameter.get("liveUrl"));
|
|
|
+// String monitorKey = ExamRecordCacheUtil.getMonitorKey(recordId);
|
|
|
+// TIeExamInvigilateCallLog tIeExamInvigilateCallLog = new TIeExamInvigilateCallLog(recordId, source, liveUrl, MonitorStatusSourceEnum.INIT, monitorKey,null);
|
|
|
+// //获取考试记录缓存
|
|
|
+// ExamRecordCacheUtil.setMonitorLiveUrl(recordId, source, liveUrl, false);
|
|
|
+// ExamRecordCacheUtil.setMonitorStatus(recordId, source, tIeExamInvigilateCallLog.getStatus(), false);
|
|
|
+// String[] columns = new String[]{ExamRecordFieldEnum.monitor_live_url.name(), ExamRecordFieldEnum.monitor_status_source.name()};
|
|
|
+// Object[] values = new Object[]{liveUrl, tIeExamInvigilateCallLog.getStatus()};
|
|
|
+// tOeExamRecordService.dataUpdatesMq(recordId, columns, values);
|
|
|
+//
|
|
|
+// //监考监控通话信息 发送mq start
|
|
|
+// MqDto mqDto = new MqDto(mqUtil.getMqGroupDomain().getTopic(), MqTagEnum.MONITOR_LOG.name(), tIeExamInvigilateCallLog, MqTagEnum.MONITOR_LOG, String.valueOf(tIeExamInvigilateCallLog.getId()), source.name());
|
|
|
+// mqDtoService.assembleSendOneWayMsg(mqDto);
|
|
|
+// //监考监控通话信息 发送mq end
|
|
|
+// } catch (Exception e) {
|
|
|
+// log.error("请求出错", e);
|
|
|
+// if (e instanceof DuplicateKeyException) {
|
|
|
+// String errorColumn = e.getCause().toString();
|
|
|
+// String columnStr = errorColumn.substring(errorColumn.lastIndexOf("key") + 3, errorColumn.length()).replaceAll("'", "");
|
|
|
+// throw new BusinessException("考试记录id[" + recordId + "]下的" + FieldUniqueEnum.convertToCode(columnStr) + "数据不允许重复插入");
|
|
|
+// } else if (e instanceof BusinessException) {
|
|
|
+// throw new BusinessException(e.getMessage());
|
|
|
+// } else {
|
|
|
+// throw new RuntimeException(e);
|
|
|
+// }
|
|
|
+// }
|
|
|
+// return ResultUtil.ok(Collections.singletonMap("updateTime", System.currentTimeMillis()));
|
|
|
+// }
|
|
|
|
|
|
@ApiOperation(value = "监控状态更新接口")
|
|
|
@RequestMapping(value = "/status", method = RequestMethod.POST)
|
|
@@ -133,13 +132,12 @@ public class TIeInvigilateCallOeController {
|
|
|
throw new BusinessException("异常类型不能为空");
|
|
|
}
|
|
|
//获取考试记录缓存
|
|
|
- String liveUrl = Objects.nonNull(ExamRecordCacheUtil.getMonitorLiveUrl(recordId, source)) ? ExamRecordCacheUtil.getMonitorLiveUrl(recordId, source) : null;
|
|
|
+ String liveUrl = dictionaryConfig.monitorDomain().getPrefix() + "_" + recordId + "_" + source.name().toLowerCase();
|
|
|
MonitorCallStatusSourceEnum callStatus = Objects.nonNull(ExamRecordCacheUtil.getMonitorCallStatus(recordId, source)) ? ExamRecordCacheUtil.getMonitorCallStatus(recordId, source) : null;
|
|
|
ExamRecordCacheUtil.setMonitorStatus(recordId, source, status, true);
|
|
|
ExamRecordCacheUtil.setMonitorCallStatus(recordId, source, callStatus);
|
|
|
String monitorKey = ExamRecordCacheUtil.getMonitorKey(recordId);
|
|
|
- String streamName = dictionaryConfig.monitorDomain().getPrefix() + "_" + recordId + "_" + ExamRecordCacheUtil.getMonitorVideoSource(recordId);
|
|
|
- TIeExamInvigilateCallLog tIeExamInvigilateCallLog = new TIeExamInvigilateCallLog(recordId, source, liveUrl, MonitorStatusSourceEnum.START, monitorKey, callStatus, streamName);
|
|
|
+ TIeExamInvigilateCallLog tIeExamInvigilateCallLog = new TIeExamInvigilateCallLog(recordId, source, liveUrl, MonitorStatusSourceEnum.START, monitorKey, callStatus);
|
|
|
if (Objects.nonNull(mapParameter.get("type")) && !Objects.equals(mapParameter.get("type"), "")) {
|
|
|
tIeExamInvigilateCallLog.setType(ExceptionEnum.valueOf(String.valueOf(mapParameter.get("type"))));
|
|
|
}
|
|
@@ -166,12 +164,8 @@ public class TIeInvigilateCallOeController {
|
|
|
}
|
|
|
Long recordId = Long.parseLong(String.valueOf(mapParameter.get("recordId")));
|
|
|
//获取考试记录缓存
|
|
|
- String liveUrl = null;
|
|
|
- MonitorVideoSourceEnum source = null;
|
|
|
- if (Objects.nonNull(ExamRecordCacheUtil.getMonitorLiveUrlClientCamera(recordId))) {
|
|
|
- source = MonitorVideoSourceEnum.CLIENT_CAMERA;
|
|
|
- liveUrl = ExamRecordCacheUtil.getMonitorLiveUrlClientCamera(recordId);
|
|
|
- }
|
|
|
+ MonitorVideoSourceEnum source = MonitorVideoSourceEnum.CLIENT_CAMERA;
|
|
|
+ String liveUrl = dictionaryConfig.monitorDomain().getPrefix() + "_" + recordId + "_" + source.name().toLowerCase();
|
|
|
if (Objects.isNull(source) || Objects.isNull(ExamRecordCacheUtil.getMonitorStatus(recordId, source))) {
|
|
|
throw new BusinessException("推流状态为空");
|
|
|
}
|
|
@@ -181,8 +175,7 @@ public class TIeInvigilateCallOeController {
|
|
|
}
|
|
|
ExamRecordCacheUtil.setMonitorCallStatus(recordId, source, MonitorCallStatusSourceEnum.START);
|
|
|
String monitorKey = ExamRecordCacheUtil.getMonitorKey(recordId);
|
|
|
- String streamName = dictionaryConfig.monitorDomain().getPrefix() + "_" + recordId + "_" + ExamRecordCacheUtil.getMonitorVideoSource(recordId);
|
|
|
- TIeExamInvigilateCallLog tIeExamInvigilateCallLog = new TIeExamInvigilateCallLog(recordId, source, liveUrl, status, monitorKey, MonitorCallStatusSourceEnum.START, streamName);
|
|
|
+ TIeExamInvigilateCallLog tIeExamInvigilateCallLog = new TIeExamInvigilateCallLog(recordId, source, liveUrl, status, monitorKey, MonitorCallStatusSourceEnum.START);
|
|
|
tIeExamInvigilateCallLog.setStartTime(System.currentTimeMillis());
|
|
|
//监考监控通话信息 发送mq start
|
|
|
MqDto mqDto = new MqDto(mqUtil.getMqGroupDomain().getTopic(), MqTagEnum.MONITOR_LOG.name(), tIeExamInvigilateCallLog, MqTagEnum.MONITOR_LOG, String.valueOf(tIeExamInvigilateCallLog.getId()), source.name());
|
|
@@ -203,12 +196,8 @@ public class TIeInvigilateCallOeController {
|
|
|
}
|
|
|
Long recordId = Long.parseLong(String.valueOf(mapParameter.get("recordId")));
|
|
|
//获取考试记录缓存
|
|
|
- String liveUrl = null;
|
|
|
- MonitorVideoSourceEnum source = null;
|
|
|
- if (Objects.nonNull(ExamRecordCacheUtil.getMonitorLiveUrlClientCamera(recordId))) {
|
|
|
- source = MonitorVideoSourceEnum.CLIENT_CAMERA;
|
|
|
- liveUrl = ExamRecordCacheUtil.getMonitorLiveUrlClientCamera(recordId);
|
|
|
- }
|
|
|
+ MonitorVideoSourceEnum source = MonitorVideoSourceEnum.CLIENT_CAMERA;
|
|
|
+ String liveUrl = dictionaryConfig.monitorDomain().getPrefix() + "_" + recordId + "_" + source.name().toLowerCase();
|
|
|
ExamRecordStatusEnum statusEnum = ExamRecordCacheUtil.getStatus(recordId);
|
|
|
if (Objects.isNull(statusEnum) || Objects.equals(statusEnum, ExamRecordStatusEnum.FINISHED) || Objects.equals(statusEnum, ExamRecordStatusEnum.PERSISTED)) {
|
|
|
return ResultUtil.ok(Collections.singletonMap("updateTime", System.currentTimeMillis()));
|
|
@@ -218,8 +207,7 @@ public class TIeInvigilateCallOeController {
|
|
|
MonitorStatusSourceEnum status = ExamRecordCacheUtil.getMonitorStatus(recordId, source);
|
|
|
ExamRecordCacheUtil.setMonitorCallStatus(recordId, source, MonitorCallStatusSourceEnum.STOP);
|
|
|
String monitorKey = ExamRecordCacheUtil.getMonitorKey(recordId);
|
|
|
- String streamName = dictionaryConfig.monitorDomain().getPrefix() + "_" + recordId + "_" + ExamRecordCacheUtil.getMonitorVideoSource(recordId);
|
|
|
- TIeExamInvigilateCallLog tIeExamInvigilateCallLog = new TIeExamInvigilateCallLog(recordId, source, liveUrl, status, monitorKey, MonitorCallStatusSourceEnum.STOP, streamName);
|
|
|
+ TIeExamInvigilateCallLog tIeExamInvigilateCallLog = new TIeExamInvigilateCallLog(recordId, source, liveUrl, status, monitorKey, MonitorCallStatusSourceEnum.STOP);
|
|
|
tIeExamInvigilateCallLog.setEndTime(System.currentTimeMillis());
|
|
|
//监考监控通话信息 发送mq start
|
|
|
MqDto mqDto = new MqDto(mqUtil.getMqGroupDomain().getTopic(), MqTagEnum.MONITOR_LOG.name(), tIeExamInvigilateCallLog, MqTagEnum.MONITOR_LOG, String.valueOf(tIeExamInvigilateCallLog.getId()), source.name());
|