|
@@ -4,14 +4,12 @@ import com.alibaba.fastjson.JSONObject;
|
|
|
import com.qmth.themis.business.bean.admin.TencentEventBean;
|
|
|
import com.qmth.themis.business.bean.status.MonitorStatusBean;
|
|
|
import com.qmth.themis.business.cache.ExamRecordCacheUtil;
|
|
|
+import com.qmth.themis.business.cache.bean.ExamCacheBean;
|
|
|
import com.qmth.themis.business.constant.SystemConstant;
|
|
|
import com.qmth.themis.business.dto.MqDto;
|
|
|
import com.qmth.themis.business.entity.*;
|
|
|
import com.qmth.themis.business.enums.*;
|
|
|
-import com.qmth.themis.business.service.ThemisCacheService;
|
|
|
-import com.qmth.themis.business.service.MqDtoService;
|
|
|
-import com.qmth.themis.business.service.TMTencentVideoMessageService;
|
|
|
-import com.qmth.themis.business.service.TOeExamRecordService;
|
|
|
+import com.qmth.themis.business.service.*;
|
|
|
import com.qmth.themis.business.util.MqUtil;
|
|
|
import com.qmth.themis.business.util.RedisUtil;
|
|
|
import com.qmth.themis.business.util.ServletUtil;
|
|
@@ -77,6 +75,9 @@ public class TENotifyController {
|
|
|
@Resource
|
|
|
ThemisCacheService themisCacheService;
|
|
|
|
|
|
+ @Resource
|
|
|
+ TEExamService teExamService;
|
|
|
+
|
|
|
@ApiOperation(value = "腾讯云视频接口回调")
|
|
|
@RequestMapping(value = "/record/tencent", method = RequestMethod.POST)
|
|
|
@ApiResponses({@ApiResponse(code = 200, message = "结果信息")})
|
|
@@ -161,11 +162,11 @@ public class TENotifyController {
|
|
|
Platform platform = null;
|
|
|
Source source = null;
|
|
|
//s是客户端和移动端,m是监控端
|
|
|
- if (Objects.equals(userIds[0], "s")) {
|
|
|
- tbSession = (TBSession) redisUtil.getUserSession(sessionId);
|
|
|
- platform = Platform.valueOf(tbSession.getPlatform());
|
|
|
- source = Source.valueOf(tbSession.getSource());
|
|
|
- }
|
|
|
+// if (Objects.equals(userIds[0], "s")) {
|
|
|
+ tbSession = (TBSession) redisUtil.getUserSession(sessionId);
|
|
|
+ platform = Platform.valueOf(tbSession.getPlatform());
|
|
|
+ source = Source.valueOf(tbSession.getSource());
|
|
|
+// }
|
|
|
String monitorRecord = ExamRecordCacheUtil.getMonitorVideoSource(recordId);
|
|
|
if (Objects.isNull(monitorRecord)) {
|
|
|
TOeExamRecord tOeExamRecord = SystemConstant.getExamRecord(recordId);
|
|
@@ -177,10 +178,18 @@ public class TENotifyController {
|
|
|
case EVENT_GROUP_ROOM://房间事件组
|
|
|
switch (tencentEventTypeEnum) {
|
|
|
case EVENT_TYPE_ENTER_ROOM://进入房间
|
|
|
- this.startLogic(userIds[0], source, platform, recordId, monitorRecordMap, eventTime);
|
|
|
+ if (Objects.equals(userIds[0], "s")) {
|
|
|
+ this.startLogic(userIds[0], source, platform, recordId, monitorRecordMap, eventTime);
|
|
|
+ } else if (Objects.equals(userIds[0], "m")) {
|
|
|
+ this.updateInvigilateCallLog(recordId, MonitorCallStatusSourceEnum.CALLING, eventTime);
|
|
|
+ }
|
|
|
break;
|
|
|
case EVENT_TYPE_EXIT_ROOM://退出房间
|
|
|
- this.stopLogic(userIds[0], source, platform, recordId, monitorRecordMap, eventTime);
|
|
|
+ if (Objects.equals(userIds[0], "s")) {
|
|
|
+ this.stopLogic(userIds[0], source, platform, recordId, monitorRecordMap, eventTime);
|
|
|
+ } else if (Objects.equals(userIds[0], "m")) {
|
|
|
+ this.updateInvigilateCallLog(recordId, MonitorCallStatusSourceEnum.STOP, eventTime);
|
|
|
+ }
|
|
|
break;
|
|
|
default:
|
|
|
break;
|
|
@@ -309,18 +318,43 @@ public class TENotifyController {
|
|
|
ExamRecordCacheUtil.setMonitorStatus(recordId, MonitorVideoSourceEnum.valueOf(source), monitorStatusSourceEnum, eventTime);
|
|
|
MonitorCallStatusSourceEnum callStatus = Objects.nonNull(ExamRecordCacheUtil.getMonitorCallStatus(recordId, MonitorVideoSourceEnum.valueOf(source))) ? ExamRecordCacheUtil.getMonitorCallStatus(recordId, MonitorVideoSourceEnum.valueOf(source)) : null;
|
|
|
ExamRecordCacheUtil.setMonitorCallStatus(recordId, MonitorVideoSourceEnum.valueOf(source), callStatus, eventTime);
|
|
|
+ }
|
|
|
|
|
|
+ /**
|
|
|
+ * 更新通话记录log
|
|
|
+ *
|
|
|
+ * @param recordId
|
|
|
+ * @param callStatus
|
|
|
+ * @param eventTime
|
|
|
+ */
|
|
|
+ protected void updateInvigilateCallLog(Long recordId, MonitorCallStatusSourceEnum callStatus, Long eventTime) {
|
|
|
SysConfig sysConfig = themisCacheService.addSysConfigCache(SystemConstant.MONITOR_CONFIG_PREFIX);
|
|
|
Optional.ofNullable(sysConfig).orElseThrow(() -> new BusinessException("未配置监控前缀"));
|
|
|
-
|
|
|
- String liveUrl = SystemConstant.setStreamId(sysConfig.getConfigValue(), recordId, MonitorVideoSourceEnum.valueOf(source));
|
|
|
+ ExamCacheBean examCacheBean = teExamService.getExamCacheBean(ExamRecordCacheUtil.getExamId(recordId));
|
|
|
+ String monitorVideoSource = examCacheBean.getMonitorVideoSource();
|
|
|
+ MonitorVideoSourceEnum source = null;
|
|
|
+ if (Objects.nonNull(monitorVideoSource) && (!monitorVideoSource.toUpperCase().contains(MonitorVideoSourceEnum.CLIENT_SCREEN.name())
|
|
|
+ && !monitorVideoSource.toUpperCase().contains(MonitorVideoSourceEnum.CLIENT_CAMERA.name())
|
|
|
+ && monitorVideoSource.toUpperCase().contains(MonitorVideoSourceEnum.MOBILE_FIRST.name()))) {
|
|
|
+ source = MonitorVideoSourceEnum.MOBILE_FIRST;
|
|
|
+ } else if (Objects.nonNull(monitorVideoSource) && (monitorVideoSource.toUpperCase().contains(MonitorVideoSourceEnum.CLIENT_SCREEN.name())
|
|
|
+ || monitorVideoSource.toUpperCase()
|
|
|
+ .contains(MonitorVideoSourceEnum.CLIENT_CAMERA.name()))) {
|
|
|
+ source = MonitorVideoSourceEnum.CLIENT_CAMERA;
|
|
|
+ }
|
|
|
+ String liveUrl = SystemConstant.setStreamId(sysConfig.getConfigValue(), recordId, source);
|
|
|
String monitorKey = ExamRecordCacheUtil.getMonitorKey(recordId);
|
|
|
- TIeExamInvigilateCallLog tIeExamInvigilateCallLog = new TIeExamInvigilateCallLog(recordId, MonitorVideoSourceEnum.valueOf(source), liveUrl, MonitorStatusSourceEnum.START, monitorKey, callStatus);
|
|
|
-
|
|
|
+// TIeExamInvigilateCallLog tIeExamInvigilateCallLog = new TIeExamInvigilateCallLog(recordId, source, liveUrl, MonitorStatusSourceEnum.START, monitorKey, callStatus, null, null, ExamInvigilateCallCacheUtil.getBatchId(recordId));
|
|
|
+ TIeExamInvigilateCallLog tIeExamInvigilateCallLog = new TIeExamInvigilateCallLog(recordId, source, liveUrl, MonitorStatusSourceEnum.START, monitorKey, callStatus, null, null);
|
|
|
+ if (callStatus == MonitorCallStatusSourceEnum.CALLING) {
|
|
|
+ tIeExamInvigilateCallLog.setStartTime(eventTime);
|
|
|
+ } else if (callStatus == MonitorCallStatusSourceEnum.STOP) {
|
|
|
+ tIeExamInvigilateCallLog.setEndTime(eventTime);
|
|
|
+ }
|
|
|
tOeExamRecordService.sendExamRecordDataSaveMqNotIp(recordId, eventTime);
|
|
|
|
|
|
//监考监控通话信息 发送mq start
|
|
|
- MqDto mqDto = new MqDto(mqUtil.getTopic(), MqTagEnum.MONITOR_LOG.name(), tIeExamInvigilateCallLog, MqTagEnum.MONITOR_LOG, String.valueOf(tIeExamInvigilateCallLog.getId()), MonitorVideoSourceEnum.valueOf(source).name());
|
|
|
+ MqDto mqDto = new MqDto(mqUtil.getTopic(), MqTagEnum.MONITOR_LOG.name(), tIeExamInvigilateCallLog, MqTagEnum.MONITOR_LOG, String.valueOf(tIeExamInvigilateCallLog.getId()), source.name());
|
|
|
mqDtoService.assembleSendAsyncMsg(mqDto);
|
|
|
//监考监控通话信息 发送mq end
|
|
|
}
|