|
@@ -3,12 +3,14 @@ package com.qmth.themis.backend.api;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
+import com.google.common.collect.Sets;
|
|
|
import com.qmth.themis.backend.config.DictionaryConfig;
|
|
|
import com.qmth.themis.business.annotation.ApiJsonObject;
|
|
|
import com.qmth.themis.business.annotation.ApiJsonProperty;
|
|
|
import com.qmth.themis.business.bean.mobile.MobileAuthorizationMonitorBean;
|
|
|
import com.qmth.themis.business.cache.ExamRecordCacheUtil;
|
|
|
import com.qmth.themis.business.cache.bean.ExamCacheBean;
|
|
|
+import com.qmth.themis.business.cache.bean.ExamStudentCacheBean;
|
|
|
import com.qmth.themis.business.config.SystemConfig;
|
|
|
import com.qmth.themis.business.constant.SystemConstant;
|
|
|
import com.qmth.themis.business.dto.AuthDto;
|
|
@@ -16,10 +18,7 @@ import com.qmth.themis.business.dto.MqDto;
|
|
|
import com.qmth.themis.business.dto.response.TIeExamInvigilateCallDto;
|
|
|
import com.qmth.themis.business.entity.*;
|
|
|
import com.qmth.themis.business.enums.*;
|
|
|
-import com.qmth.themis.business.service.MqDtoService;
|
|
|
-import com.qmth.themis.business.service.TEExamService;
|
|
|
-import com.qmth.themis.business.service.TIeExamInvigilateCallService;
|
|
|
-import com.qmth.themis.business.service.TOeExamRecordService;
|
|
|
+import com.qmth.themis.business.service.*;
|
|
|
import com.qmth.themis.business.util.RedisUtil;
|
|
|
import com.qmth.themis.business.util.ServletUtil;
|
|
|
import com.qmth.themis.business.util.SessionUtil;
|
|
@@ -78,6 +77,9 @@ public class TIeInvigilateCallMobileController {
|
|
|
@Resource
|
|
|
TOeExamRecordService tOeExamRecordService;
|
|
|
|
|
|
+ @Resource
|
|
|
+ TEExamStudentService teExamStudentService;
|
|
|
+
|
|
|
@ApiOperation(value = "监考监控通话查询接口")
|
|
|
@RequestMapping(value = "/call/list", method = RequestMethod.POST)
|
|
|
@ApiResponses({@ApiResponse(code = 200, message = "监考监控信息", response = TIeExamInvigilateCallDto.class)})
|
|
@@ -99,6 +101,11 @@ public class TIeInvigilateCallMobileController {
|
|
|
IPage<TIeExamInvigilateCallDto> tIeExamInvigilateCallIPage = tIeExamInvigilateCallService.examInvigilateCallQuery(new Page<>(pageNumber, pageSize), examId, userId, tbUser.getOrgId(), MonitorStatusSourceEnum.START.name(), callStatus);
|
|
|
tIeExamInvigilateCallIPage.getRecords().forEach(s -> {
|
|
|
s.setBasePhotoPath(systemConfig.getProperty("aliyun.oss.url") + File.separator + s.getBasePhotoPath());
|
|
|
+ try {
|
|
|
+ s.setSourceUserId(this.getSourceUserId(s.getExamRecordId()));
|
|
|
+ } catch (NoSuchAlgorithmException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
});
|
|
|
return ResultUtil.ok(tIeExamInvigilateCallIPage);
|
|
|
}
|
|
@@ -208,13 +215,41 @@ public class TIeInvigilateCallMobileController {
|
|
|
String monitorKey = ExamRecordCacheUtil.getMonitorKey(recordId);
|
|
|
AuthDto authDto = (AuthDto) redisUtil.get(SystemConstant.userOauth + "::" + tbUser.getId());
|
|
|
String monitorUserId = null;
|
|
|
+ String sourceUserId = this.getSourceUserId(recordId);
|
|
|
+ if (Objects.nonNull(authDto) && !authDto.toString().contains(RoleEnum.STUDENT.name())) {
|
|
|
+ monitorUserId = "s_" + tbSession.getId();
|
|
|
+ } else {
|
|
|
+ monitorUserId = "m_" + tbSession.getId();
|
|
|
+ }
|
|
|
+ String monitorUserSig = tencentYunUtil.getSign(monitorUserId, SystemConstant.TENCENT_EXPIRE_TIME);
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ map.put("monitorKey", monitorKey);
|
|
|
+ map.put("monitorUserId", monitorUserId);
|
|
|
+ map.put("sourceUserId", sourceUserId);
|
|
|
+ map.put("monitorUserSig", monitorUserSig);
|
|
|
+ map.put("appId", dictionaryConfig.tencentYunDomain().getAppId());
|
|
|
+ map.put("key", dictionaryConfig.tencentYunDomain().getKey());
|
|
|
+ return ResultUtil.ok(map);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取来源userId
|
|
|
+ *
|
|
|
+ * @param recordId
|
|
|
+ * @return
|
|
|
+ * @throws NoSuchAlgorithmException
|
|
|
+ */
|
|
|
+ private String getSourceUserId(Long recordId) throws NoSuchAlgorithmException {
|
|
|
String sourceUserId = null;
|
|
|
Long examId = ExamRecordCacheUtil.getExamId(recordId);
|
|
|
+ Long examStudentId = ExamRecordCacheUtil.getExamStudentId(recordId);
|
|
|
if (Objects.isNull(examId)) {
|
|
|
TOeExamRecord tOeExamRecord = tOeExamRecordService.getById(recordId);
|
|
|
examId = tOeExamRecord.getExamId();
|
|
|
+ examStudentId = ExamRecordCacheUtil.getExamStudentId(recordId);
|
|
|
}
|
|
|
ExamCacheBean ec = teExamService.getExamCacheBean(examId);//考试缓存
|
|
|
+ ExamStudentCacheBean examStudentCacheBean = teExamStudentService.getExamStudentCacheBean(examStudentId);
|
|
|
ec.getMonitorVideoSource();
|
|
|
List<String> monitorVideoSourceList = null;
|
|
|
if (Objects.nonNull(ec.getMonitorVideoSource()) && !Objects.equals(ec.getMonitorVideoSource().toString().trim().replaceAll(" ", ""), "")) {
|
|
@@ -224,7 +259,7 @@ public class TIeInvigilateCallMobileController {
|
|
|
if (Objects.nonNull(monitorVideoSourceList)) {
|
|
|
if (monitorVideoSourceList.size() == 4 || (ec.getMonitorVideoSource().toUpperCase().contains(MonitorVideoSourceEnum.CLIENT_SCREEN.name()) || ec.getMonitorVideoSource().toUpperCase().contains(MonitorVideoSourceEnum.CLIENT_CAMERA.name()))) {
|
|
|
for (Source s : Source.values()) {
|
|
|
- String sessionId = SessionUtil.digest(tbUser.getId(), Math.abs(authDto.getRoleCodes().toString().hashCode()), s.name());
|
|
|
+ String sessionId = SessionUtil.digest(examStudentCacheBean.getIdentity(), Math.abs(Sets.newHashSet(RoleEnum.STUDENT.name()).toString().hashCode()), s.name());
|
|
|
TBSession tbSessionClient = (TBSession) redisUtil.getUserSession(sessionId);
|
|
|
if (Objects.nonNull(tbSessionClient) && tbSessionClient.getExpireTime() > System.currentTimeMillis() && (Objects.equals(tbSessionClient.getSource(), Source.OE_CLIENT.name()) || Objects.equals(tbSessionClient.getSource(), Source.ADMIN_CLIENT.name())) && (Objects.equals(tbSessionClient.getPlatform(), Platform.WIN.name()) || Objects.equals(tbSessionClient.getPlatform(), Platform.MAC.name()))) {
|
|
|
if (Objects.nonNull(ExamRecordCacheUtil.getMonitorStatus(recordId, MonitorVideoSourceEnum.CLIENT_CAMERA.name()))) {
|
|
@@ -238,7 +273,7 @@ public class TIeInvigilateCallMobileController {
|
|
|
}
|
|
|
} else {
|
|
|
for (Source s : Source.values()) {
|
|
|
- String sessionId = SessionUtil.digest(tbUser.getId(), Math.abs(authDto.getRoleCodes().toString().hashCode()), s.name());
|
|
|
+ String sessionId = SessionUtil.digest(examStudentCacheBean.getIdentity(), Math.abs(Sets.newHashSet(RoleEnum.STUDENT.name()).toString().hashCode()), s.name());
|
|
|
TBSession tbSessionPhone = (TBSession) redisUtil.getUserSession(sessionId);
|
|
|
if (Objects.nonNull(tbSessionPhone) && tbSessionPhone.getExpireTime() > System.currentTimeMillis() && (Objects.equals(tbSessionPhone.getSource(), Source.MOBILE_FIRST.name()) || Objects.equals(tbSessionPhone.getSource(), Source.MOBILE_SECOND.name())) && (Objects.equals(tbSessionPhone.getPlatform(), Platform.ANDROID.name()) || Objects.equals(tbSessionPhone.getPlatform(), Platform.IOS.name()))) {
|
|
|
if (Objects.nonNull(ExamRecordCacheUtil.getMonitorStatus(recordId, MonitorVideoSourceEnum.MOBILE_FIRST.name()))) {
|
|
@@ -252,19 +287,6 @@ public class TIeInvigilateCallMobileController {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- if (Objects.nonNull(authDto) && authDto.toString().contains(RoleEnum.STUDENT.name())) {
|
|
|
- monitorUserId = "s_" + tbSession.getId();
|
|
|
- } else {
|
|
|
- monitorUserId = "m_" + tbSession.getId();
|
|
|
- }
|
|
|
- String monitorUserSig = tencentYunUtil.getSign(monitorUserId, SystemConstant.TENCENT_EXPIRE_TIME);
|
|
|
- Map<String, Object> map = new HashMap<>();
|
|
|
- map.put("monitorKey", monitorKey);
|
|
|
- map.put("monitorUserId", monitorUserId);
|
|
|
- map.put("sourceUserId", sourceUserId);
|
|
|
- map.put("monitorUserSig", monitorUserSig);
|
|
|
- map.put("appId", dictionaryConfig.tencentYunDomain().getAppId());
|
|
|
- map.put("key", dictionaryConfig.tencentYunDomain().getKey());
|
|
|
- return ResultUtil.ok(map);
|
|
|
+ return sourceUserId;
|
|
|
}
|
|
|
}
|