|
@@ -0,0 +1,125 @@
|
|
|
+package com.qmth.themis.backend.api;
|
|
|
+
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.qmth.themis.business.annotation.ApiJsonObject;
|
|
|
+import com.qmth.themis.business.annotation.ApiJsonProperty;
|
|
|
+import com.qmth.themis.business.constant.SystemConstant;
|
|
|
+import com.qmth.themis.business.entity.TBUser;
|
|
|
+import com.qmth.themis.business.entity.TIeExamInvigilateCall;
|
|
|
+import com.qmth.themis.business.service.TIeExamInvigilateCallService;
|
|
|
+import com.qmth.themis.business.util.ServletUtil;
|
|
|
+import com.qmth.themis.common.enums.ExceptionResultEnum;
|
|
|
+import com.qmth.themis.common.exception.BusinessException;
|
|
|
+import com.qmth.themis.common.util.Result;
|
|
|
+import com.qmth.themis.common.util.ResultUtil;
|
|
|
+import io.swagger.annotations.*;
|
|
|
+import org.slf4j.Logger;
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
+import org.springframework.web.bind.annotation.RequestBody;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+
|
|
|
+import javax.annotation.Resource;
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+import java.util.Objects;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @Description: 监考监控通话信息 前端控制器
|
|
|
+ * @Param:
|
|
|
+ * @return:
|
|
|
+ * @Author: wangliang
|
|
|
+ * @Date: 2020/6/25
|
|
|
+ */
|
|
|
+@Api(tags = "监考监控通话信息Controller")
|
|
|
+@RestController
|
|
|
+@RequestMapping("/${prefix.url.admin}/monitor")
|
|
|
+public class TIeInvigilateCallController {
|
|
|
+ private final static Logger log = LoggerFactory.getLogger(TIeInvigilateCallController.class);
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ TIeExamInvigilateCallService tIeExamInvigilateCallService;
|
|
|
+
|
|
|
+ @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 = "liveUrl", 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 = Long.parseLong(String.valueOf(mapParameter.get("recordId")));
|
|
|
+ if (Objects.isNull(mapParameter.get("source")) || Objects.equals(mapParameter.get("source"), "")) {
|
|
|
+ throw new BusinessException("监考视频源不能为空");
|
|
|
+ }
|
|
|
+ String source = String.valueOf(mapParameter.get("source"));
|
|
|
+ if (Objects.isNull(mapParameter.get("liveUrl")) || Objects.equals(mapParameter.get("liveUrl"), "")) {
|
|
|
+ throw new BusinessException("观看地址不能为空");
|
|
|
+ }
|
|
|
+ String liveUrl = String.valueOf(mapParameter.get("liveUrl"));
|
|
|
+ TIeExamInvigilateCall tIeExamInvigilateCall = new TIeExamInvigilateCall(recordId, source, liveUrl);
|
|
|
+ tIeExamInvigilateCallService.save(tIeExamInvigilateCall);
|
|
|
+ return ResultUtil.ok(SystemConstant.SUCCESS);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "发送通话申请接口")
|
|
|
+ @RequestMapping(value = "/call/apply", method = RequestMethod.POST)
|
|
|
+ @ApiResponses({@ApiResponse(code = 200, message = "{\"success\":true}", response = Result.class)})
|
|
|
+ @Transactional
|
|
|
+ public Result callApply(@ApiJsonObject(name = "callApply", value = {
|
|
|
+ @ApiJsonProperty(key = "recordId", type = "long", example = "1", description = "考试记录id", 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);
|
|
|
+ }
|
|
|
+ TBUser tbUser = (TBUser) ServletUtil.getRequestAccount();
|
|
|
+ Long recordId = Long.parseLong(String.valueOf(mapParameter.get("recordId")));
|
|
|
+ QueryWrapper<TIeExamInvigilateCall> tIeExamInvigilateCallQueryWrapper = new QueryWrapper<>();
|
|
|
+ tIeExamInvigilateCallQueryWrapper.lambda().eq(TIeExamInvigilateCall::getExamRecordId, recordId);
|
|
|
+ TIeExamInvigilateCall tIeExamInvigilateCall = tIeExamInvigilateCallService.getOne(tIeExamInvigilateCallQueryWrapper);
|
|
|
+ tIeExamInvigilateCall.setStatus("apply");
|
|
|
+ tIeExamInvigilateCall.setCreateId(tbUser.getId());
|
|
|
+ tIeExamInvigilateCallService.updateById(tIeExamInvigilateCall);
|
|
|
+ return ResultUtil.ok(SystemConstant.SUCCESS);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "撤销通话申请接口")
|
|
|
+ @RequestMapping(value = "/call/cancel", method = RequestMethod.POST)
|
|
|
+ @ApiResponses({@ApiResponse(code = 200, message = "{\"success\":true}", response = Result.class)})
|
|
|
+ @Transactional
|
|
|
+ public Result callCancel(@ApiJsonObject(name = "callCancel", value = {
|
|
|
+ @ApiJsonProperty(key = "recordId", type = "long", example = "1", description = "考试记录id", 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);
|
|
|
+ }
|
|
|
+ TBUser tbUser = (TBUser) ServletUtil.getRequestAccount();
|
|
|
+ Long recordId = Long.parseLong(String.valueOf(mapParameter.get("recordId")));
|
|
|
+ QueryWrapper<TIeExamInvigilateCall> tIeExamInvigilateCallQueryWrapper = new QueryWrapper<>();
|
|
|
+ tIeExamInvigilateCallQueryWrapper.lambda().eq(TIeExamInvigilateCall::getExamRecordId, recordId);
|
|
|
+ TIeExamInvigilateCall tIeExamInvigilateCall = tIeExamInvigilateCallService.getOne(tIeExamInvigilateCallQueryWrapper);
|
|
|
+ tIeExamInvigilateCall.setStatus("cancel");
|
|
|
+ tIeExamInvigilateCall.setUpdateId(tbUser.getId());
|
|
|
+ tIeExamInvigilateCallService.updateById(tIeExamInvigilateCall);
|
|
|
+ return ResultUtil.ok(SystemConstant.SUCCESS);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "监考监控通话查询接口")
|
|
|
+ @RequestMapping(value = "/call/list", method = RequestMethod.POST)
|
|
|
+ @ApiResponses({@ApiResponse(code = 200, message = "监考监控信息", response = TIeExamInvigilateCall.class)})
|
|
|
+ public Result callList() {
|
|
|
+ QueryWrapper<TIeExamInvigilateCall> tIeExamInvigilateCallQueryWrapper = new QueryWrapper<>();
|
|
|
+ tIeExamInvigilateCallQueryWrapper.lambda().eq(TIeExamInvigilateCall::getSource, "apply");
|
|
|
+ List<TIeExamInvigilateCall> tIeExamInvigilateCallList = tIeExamInvigilateCallService.list(tIeExamInvigilateCallQueryWrapper);
|
|
|
+ Map map = new HashMap<>();
|
|
|
+ map.put(SystemConstant.RECORDS, tIeExamInvigilateCallList);
|
|
|
+ return ResultUtil.ok(map);
|
|
|
+ }
|
|
|
+}
|