|
@@ -1,18 +1,19 @@
|
|
|
package com.qmth.themis.exam.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.qmth.themis.business.annotation.ApiJsonObject;
|
|
|
import com.qmth.themis.business.annotation.ApiJsonProperty;
|
|
|
+import com.qmth.themis.business.base.BasePage;
|
|
|
import com.qmth.themis.business.cache.RedisKeyHelper;
|
|
|
import com.qmth.themis.business.constant.SystemConstant;
|
|
|
import com.qmth.themis.business.dto.MqDto;
|
|
|
+import com.qmth.themis.business.entity.TIeExamInvigilateCall;
|
|
|
import com.qmth.themis.business.entity.TIeExamInvigilateCallLog;
|
|
|
-import com.qmth.themis.business.enums.MonitorStatusSourceEnum;
|
|
|
-import com.qmth.themis.business.enums.MonitorVideoSourceEnum;
|
|
|
-import com.qmth.themis.business.enums.MqTagEnum;
|
|
|
-import com.qmth.themis.business.enums.MqTopicEnum;
|
|
|
+import com.qmth.themis.business.enums.*;
|
|
|
import com.qmth.themis.business.service.MqDtoService;
|
|
|
-import com.qmth.themis.business.service.TIeExamInvigilateCallLogService;
|
|
|
+import com.qmth.themis.business.service.TIeExamInvigilateCallService;
|
|
|
import com.qmth.themis.business.util.RedisUtil;
|
|
|
import com.qmth.themis.common.enums.ExceptionResultEnum;
|
|
|
import com.qmth.themis.common.exception.BusinessException;
|
|
@@ -21,6 +22,7 @@ import com.qmth.themis.common.util.ResultUtil;
|
|
|
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.*;
|
|
|
|
|
@@ -31,27 +33,27 @@ import java.util.Map;
|
|
|
import java.util.Objects;
|
|
|
|
|
|
/**
|
|
|
- * @Description: oe监考监控通话信息 前端控制器
|
|
|
+ * @Description: mobile监考监控通话信息 前端控制器
|
|
|
* @Param:
|
|
|
* @return:
|
|
|
* @Author: wangliang
|
|
|
* @Date: 2020/6/25
|
|
|
*/
|
|
|
-@Api(tags = "oe监考监控通话信息Controller")
|
|
|
+@Api(tags = "mobile监考监控通话信息Controller")
|
|
|
@RestController
|
|
|
@RequestMapping("/${prefix.url.exam}/monitor")
|
|
|
public class TIeInvigilateCallOeController {
|
|
|
private final static Logger log = LoggerFactory.getLogger(TIeInvigilateCallOeController.class);
|
|
|
|
|
|
- @Resource
|
|
|
- TIeExamInvigilateCallLogService tIeExamInvigilateCallLogService;
|
|
|
-
|
|
|
@Resource
|
|
|
RedisUtil redisUtil;
|
|
|
|
|
|
@Resource
|
|
|
MqDtoService mqDtoService;
|
|
|
|
|
|
+ @Resource
|
|
|
+ TIeExamInvigilateCallService tIeExamInvigilateCallService;
|
|
|
+
|
|
|
@ApiOperation(value = "监控观看地址更新接口")
|
|
|
@RequestMapping(value = "/live_url", method = RequestMethod.POST)
|
|
|
@ApiResponses({@ApiResponse(code = 200, message = "{\"success\":true}", response = Result.class)})
|
|
@@ -65,25 +67,39 @@ public class TIeInvigilateCallOeController {
|
|
|
throw new BusinessException(ExceptionResultEnum.RECORD_ID_IS_NULL);
|
|
|
}
|
|
|
Long recordId = null;
|
|
|
- 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("观看地址不能为空");
|
|
|
+ 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"));
|
|
|
+ TIeExamInvigilateCallLog tIeExamInvigilateCallLog = new TIeExamInvigilateCallLog(recordId, source, liveUrl, MonitorStatusSourceEnum.INIT);
|
|
|
+ //获取考试记录缓存
|
|
|
+ Map<String, Object> objectMap = redisUtil.getHashEntries(RedisKeyHelper.examRecordCacheKey(recordId));
|
|
|
+ objectMap.put(SystemConstant.MONITOR_LIVE_URL_ + source.name(), liveUrl);
|
|
|
+ objectMap.put(SystemConstant.MONITOR_STATUS_ + source.name(), tIeExamInvigilateCallLog.getStatus().name());
|
|
|
+ redisUtil.setForHash(RedisKeyHelper.examRecordCacheKey(recordId), objectMap);
|
|
|
+
|
|
|
+ //监考监控通话信息 发送mq start
|
|
|
+ MqDto mqDto = new MqDto(MqTopicEnum.themisTopic.getCode(), MqTagEnum.monitorLog.name(), tIeExamInvigilateCallLog, MqTagEnum.monitorLog, String.valueOf(tIeExamInvigilateCallLog.getId()), source.name());
|
|
|
+ mqDtoService.assembleSendOneWayMsg(mqDto);
|
|
|
+ //监考监控通话信息 发送mq end
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ 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);
|
|
|
+ }
|
|
|
}
|
|
|
- String liveUrl = String.valueOf(mapParameter.get("liveUrl"));
|
|
|
- TIeExamInvigilateCallLog tIeExamInvigilateCallLog = new TIeExamInvigilateCallLog(recordId, source, liveUrl, MonitorStatusSourceEnum.INIT);
|
|
|
- //获取考试记录缓存
|
|
|
- Map<String, Object> objectMap = redisUtil.getHashEntries(RedisKeyHelper.examRecordCacheKey(recordId));
|
|
|
- objectMap.put(SystemConstant.MONITOR_LIVE_URL_ + source.name(), liveUrl);
|
|
|
- objectMap.put(SystemConstant.MONITOR_STATUS_ + source.name(), tIeExamInvigilateCallLog.getStatus().name());
|
|
|
- redisUtil.setForHash(RedisKeyHelper.examRecordCacheKey(recordId), objectMap);
|
|
|
- //监考监控通话信息 发送mq start
|
|
|
- MqDto mqDto = new MqDto(MqTopicEnum.themisTopic.getCode(), MqTagEnum.monitorLog.name(), tIeExamInvigilateCallLog, MqTagEnum.monitorLog, String.valueOf(tIeExamInvigilateCallLog.getId()), source.name());
|
|
|
- mqDtoService.assembleSendOneWayMsg(mqDto);
|
|
|
- //监考监控通话信息 发送mq end
|
|
|
return ResultUtil.ok(SystemConstant.SUCCESS);
|
|
|
}
|
|
|
|
|
@@ -102,16 +118,17 @@ public class TIeInvigilateCallOeController {
|
|
|
Map<String, Object> objectMap = redisUtil.getHashEntries(RedisKeyHelper.examRecordCacheKey(recordId));
|
|
|
String liveUrl = null;
|
|
|
MonitorVideoSourceEnum source = null;
|
|
|
- if (Objects.nonNull(objectMap.get(SystemConstant.MONITOR_LIVE_URL_ + MonitorVideoSourceEnum.MOBILE_FIRST.name()))) {
|
|
|
- source = MonitorVideoSourceEnum.MOBILE_FIRST;
|
|
|
- liveUrl = String.valueOf(objectMap.get(SystemConstant.MONITOR_LIVE_URL_ + MonitorVideoSourceEnum.MOBILE_FIRST.name()));
|
|
|
- } else if (Objects.nonNull(objectMap.get(SystemConstant.MONITOR_LIVE_URL_ + MonitorVideoSourceEnum.MOBILE_SECOND.name()))) {
|
|
|
- source = MonitorVideoSourceEnum.MOBILE_SECOND;
|
|
|
- liveUrl = String.valueOf(objectMap.get(SystemConstant.MONITOR_LIVE_URL_ + MonitorVideoSourceEnum.MOBILE_SECOND.name()));
|
|
|
+ if (Objects.nonNull(objectMap.get(SystemConstant.MONITOR_LIVE_URL_ + MonitorVideoSourceEnum.CLIENT_SCREEN.name()))) {
|
|
|
+ source = MonitorVideoSourceEnum.CLIENT_SCREEN;
|
|
|
+ liveUrl = String.valueOf(objectMap.get(SystemConstant.MONITOR_LIVE_URL_ + MonitorVideoSourceEnum.CLIENT_SCREEN.name()));
|
|
|
+ } else if (Objects.nonNull(objectMap.get(SystemConstant.MONITOR_LIVE_URL_ + MonitorVideoSourceEnum.CLIENT_CAMERA.name()))) {
|
|
|
+ source = MonitorVideoSourceEnum.CLIENT_CAMERA;
|
|
|
+ liveUrl = String.valueOf(objectMap.get(SystemConstant.MONITOR_LIVE_URL_ + MonitorVideoSourceEnum.CLIENT_CAMERA.name()));
|
|
|
}
|
|
|
objectMap.put(SystemConstant.MONITOR_STATUS_ + source, MonitorStatusSourceEnum.START.name());
|
|
|
TIeExamInvigilateCallLog tIeExamInvigilateCallLog = new TIeExamInvigilateCallLog(recordId, source, liveUrl, MonitorStatusSourceEnum.START);
|
|
|
redisUtil.setForHash(RedisKeyHelper.examRecordCacheKey(recordId), objectMap);
|
|
|
+
|
|
|
//监考监控通话信息 发送mq start
|
|
|
MqDto mqDto = new MqDto(MqTopicEnum.themisTopic.getCode(), MqTagEnum.monitorLog.name(), tIeExamInvigilateCallLog, MqTagEnum.monitorLog, String.valueOf(tIeExamInvigilateCallLog.getId()), source.name());
|
|
|
mqDtoService.assembleSendOneWayMsg(mqDto);
|
|
@@ -134,12 +151,12 @@ public class TIeInvigilateCallOeController {
|
|
|
Map<String, Object> objectMap = redisUtil.getHashEntries(RedisKeyHelper.examRecordCacheKey(recordId));
|
|
|
String liveUrl = null;
|
|
|
MonitorVideoSourceEnum source = null;
|
|
|
- if (Objects.nonNull(objectMap.get(SystemConstant.MONITOR_LIVE_URL_ + MonitorVideoSourceEnum.MOBILE_FIRST.name()))) {
|
|
|
- source = MonitorVideoSourceEnum.MOBILE_FIRST;
|
|
|
- liveUrl = String.valueOf(objectMap.get(SystemConstant.MONITOR_LIVE_URL_ + MonitorVideoSourceEnum.MOBILE_FIRST.name()));
|
|
|
- } else if (Objects.nonNull(objectMap.get(SystemConstant.MONITOR_LIVE_URL_ + MonitorVideoSourceEnum.MOBILE_SECOND.name()))) {
|
|
|
- source = MonitorVideoSourceEnum.MOBILE_SECOND;
|
|
|
- liveUrl = String.valueOf(objectMap.get(SystemConstant.MONITOR_LIVE_URL_ + MonitorVideoSourceEnum.MOBILE_SECOND.name()));
|
|
|
+ if (Objects.nonNull(objectMap.get(SystemConstant.MONITOR_LIVE_URL_ + MonitorVideoSourceEnum.CLIENT_SCREEN.name()))) {
|
|
|
+ source = MonitorVideoSourceEnum.CLIENT_SCREEN;
|
|
|
+ liveUrl = String.valueOf(objectMap.get(SystemConstant.MONITOR_LIVE_URL_ + MonitorVideoSourceEnum.CLIENT_SCREEN.name()));
|
|
|
+ } else if (Objects.nonNull(objectMap.get(SystemConstant.MONITOR_LIVE_URL_ + MonitorVideoSourceEnum.CLIENT_CAMERA.name()))) {
|
|
|
+ source = MonitorVideoSourceEnum.CLIENT_CAMERA;
|
|
|
+ liveUrl = String.valueOf(objectMap.get(SystemConstant.MONITOR_LIVE_URL_ + MonitorVideoSourceEnum.CLIENT_CAMERA.name()));
|
|
|
}
|
|
|
objectMap.put(SystemConstant.MONITOR_STATUS_ + source, MonitorStatusSourceEnum.STOP.name());
|
|
|
TIeExamInvigilateCallLog tIeExamInvigilateCallLog = new TIeExamInvigilateCallLog(recordId, source, liveUrl, MonitorStatusSourceEnum.STOP);
|
|
@@ -153,23 +170,22 @@ public class TIeInvigilateCallOeController {
|
|
|
|
|
|
@ApiOperation(value = "监考监控通话查询接口")
|
|
|
@RequestMapping(value = "/call/list", method = RequestMethod.POST)
|
|
|
- @ApiResponses({@ApiResponse(code = 200, message = "监考监控信息", response = TIeExamInvigilateCallLog.class)})
|
|
|
- public Result callList(@ApiParam(value = "场次id", required = true) @RequestParam Long examActivityId) {
|
|
|
- QueryWrapper<TIeExamInvigilateCallLog> tIeExamInvigilateCallQueryWrapper = new QueryWrapper<>();
|
|
|
- tIeExamInvigilateCallQueryWrapper.lambda().eq(TIeExamInvigilateCallLog::getSource, "apply");
|
|
|
- List<TIeExamInvigilateCallLog> tIeExamInvigilateCallList = tIeExamInvigilateCallLogService.list(tIeExamInvigilateCallQueryWrapper);
|
|
|
+ @ApiResponses({@ApiResponse(code = 200, message = "监考监控信息", response = TIeExamInvigilateCall.class)})
|
|
|
+ public Result callList(@ApiParam(value = "场次id", required = true) @RequestParam Long examActivityId, @ApiParam(value = "分页页码", required = true) @RequestParam int pageNumber, @ApiParam(value = "分页数", required = true) @RequestParam int pageSize) {
|
|
|
+ IPage<TIeExamInvigilateCall> tIeExamInvigilateCallIPage = tIeExamInvigilateCallService.examInvigilateCallQuery(new Page<>(pageNumber, pageSize), examActivityId, MonitorStatusSourceEnum.START.name());
|
|
|
+ BasePage basePage = new BasePage(tIeExamInvigilateCallIPage.getRecords(), tIeExamInvigilateCallIPage.getCurrent(), tIeExamInvigilateCallIPage.getSize(), tIeExamInvigilateCallIPage.getTotal());
|
|
|
Map map = new HashMap<>();
|
|
|
- map.put(SystemConstant.RECORDS, tIeExamInvigilateCallList);
|
|
|
+ map.put(SystemConstant.RECORDS, basePage);
|
|
|
return ResultUtil.ok(map);
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "监考监控通话查询来源接口")
|
|
|
@RequestMapping(value = "/call/query", method = RequestMethod.POST)
|
|
|
- @ApiResponses({@ApiResponse(code = 200, message = "监考监控信息", response = TIeExamInvigilateCallLog.class)})
|
|
|
+ @ApiResponses({@ApiResponse(code = 200, message = "监考监控信息", response = TIeExamInvigilateCall.class)})
|
|
|
public Result callQuery(@ApiParam(value = "考试记录id", required = true) @RequestParam(required = true) Long recordId) {
|
|
|
- QueryWrapper<TIeExamInvigilateCallLog> tIeExamInvigilateCallQueryWrapper = new QueryWrapper<>();
|
|
|
- tIeExamInvigilateCallQueryWrapper.lambda().eq(TIeExamInvigilateCallLog::getExamRecordId, recordId);
|
|
|
- List<TIeExamInvigilateCallLog> tIeExamInvigilateCallList = tIeExamInvigilateCallLogService.list(tIeExamInvigilateCallQueryWrapper);
|
|
|
+ QueryWrapper<TIeExamInvigilateCall> tIeExamInvigilateCallQueryWrapper = new QueryWrapper<>();
|
|
|
+ tIeExamInvigilateCallQueryWrapper.lambda().eq(TIeExamInvigilateCall::getExamRecordId, recordId);
|
|
|
+ List<TIeExamInvigilateCall> tIeExamInvigilateCallList = tIeExamInvigilateCallService.list(tIeExamInvigilateCallQueryWrapper);
|
|
|
Map map = new HashMap<>();
|
|
|
map.put(SystemConstant.RECORDS, tIeExamInvigilateCallList);
|
|
|
return ResultUtil.ok(map);
|