|
@@ -12,11 +12,12 @@ import com.qmth.themis.business.cache.RedisKeyHelper;
|
|
|
import com.qmth.themis.business.constant.SystemConstant;
|
|
|
import com.qmth.themis.business.dto.AuthDto;
|
|
|
import com.qmth.themis.business.dto.MqDto;
|
|
|
-import com.qmth.themis.business.entity.*;
|
|
|
+import com.qmth.themis.business.entity.TBSession;
|
|
|
+import com.qmth.themis.business.entity.TBUser;
|
|
|
+import com.qmth.themis.business.entity.TIeExamInvigilateCall;
|
|
|
+import com.qmth.themis.business.entity.TIeExamInvigilateCallLog;
|
|
|
import com.qmth.themis.business.enums.*;
|
|
|
import com.qmth.themis.business.service.MqDtoService;
|
|
|
-import com.qmth.themis.business.service.TBExamInvigilateUserService;
|
|
|
-import com.qmth.themis.business.service.TEExamStudentService;
|
|
|
import com.qmth.themis.business.service.TIeExamInvigilateCallService;
|
|
|
import com.qmth.themis.business.util.RedisUtil;
|
|
|
import com.qmth.themis.business.util.ServletUtil;
|
|
@@ -32,8 +33,10 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
-import java.util.*;
|
|
|
-import java.util.stream.Collectors;
|
|
|
+import java.util.Collections;
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.Map;
|
|
|
+import java.util.Objects;
|
|
|
|
|
|
/**
|
|
|
* @Description: mobile监考监控通话信息 前端控制器
|
|
@@ -60,12 +63,6 @@ public class TIeInvigilateCallMobileController {
|
|
|
@Resource
|
|
|
TencentYunUtil tencentYunUtil;
|
|
|
|
|
|
- @Resource
|
|
|
- TBExamInvigilateUserService tbExamInvigilateUserService;
|
|
|
-
|
|
|
- @Resource
|
|
|
- TEExamStudentService teExamStudentService;
|
|
|
-
|
|
|
@ApiOperation(value = "监考监控通话查询接口")
|
|
|
@RequestMapping(value = "/call/list", method = RequestMethod.POST)
|
|
|
@ApiResponses({@ApiResponse(code = 200, message = "监考监控信息", response = TIeExamInvigilateCall.class)})
|
|
@@ -73,8 +70,14 @@ public class TIeInvigilateCallMobileController {
|
|
|
if (Objects.isNull(examId) || Objects.equals(examId, "")) {
|
|
|
throw new BusinessException(ExceptionResultEnum.EXAM_ID_IS_NULL);
|
|
|
}
|
|
|
- Set<Long> examActivityIdSet = this.getExamActivityIds(examId);
|
|
|
- IPage<TIeExamInvigilateCall> tIeExamInvigilateCallIPage = tIeExamInvigilateCallService.examInvigilateCallQuery(new Page<>(pageNumber, pageSize), examActivityIdSet, MonitorStatusSourceEnum.START.name());
|
|
|
+ TBUser tbUser = (TBUser) ServletUtil.getRequestAccount();
|
|
|
+ AuthDto authDto = (AuthDto) redisUtil.get(SystemConstant.userOauth + "::" + tbUser.getId());
|
|
|
+ //如果有监考员角色,只能查看自己所监考的考场,巡考员和管理员则可以查看全部考场
|
|
|
+ Long userId = null;
|
|
|
+ if (authDto.getRoleCodes().toString().contains(RoleEnum.INVIGILATE.name())) {
|
|
|
+ userId = tbUser.getId();
|
|
|
+ }
|
|
|
+ IPage<TIeExamInvigilateCall> tIeExamInvigilateCallIPage = tIeExamInvigilateCallService.examInvigilateCallQuery(new Page<>(pageNumber, pageSize), examId, userId, tbUser.getOrgId(), MonitorStatusSourceEnum.START.name());
|
|
|
BasePage basePage = new BasePage(tIeExamInvigilateCallIPage.getRecords(), tIeExamInvigilateCallIPage.getCurrent(), tIeExamInvigilateCallIPage.getSize(), tIeExamInvigilateCallIPage.getTotal());
|
|
|
return ResultUtil.ok(basePage);
|
|
|
}
|
|
@@ -86,10 +89,14 @@ public class TIeInvigilateCallMobileController {
|
|
|
if (Objects.isNull(examId) || Objects.equals(examId, "")) {
|
|
|
throw new BusinessException(ExceptionResultEnum.EXAM_ID_IS_NULL);
|
|
|
}
|
|
|
- Set<Long> examActivityIdSet = this.getExamActivityIds(examId);
|
|
|
- QueryWrapper<TIeExamInvigilateCall> examInvigilateCallQueryWrapper = new QueryWrapper<>();
|
|
|
- examInvigilateCallQueryWrapper.lambda().in(TIeExamInvigilateCall::getExamActivityId, examActivityIdSet).eq(TIeExamInvigilateCall::getStatus, MonitorStatusSourceEnum.START.name());
|
|
|
- int count = tIeExamInvigilateCallService.count(examInvigilateCallQueryWrapper);
|
|
|
+ TBUser tbUser = (TBUser) ServletUtil.getRequestAccount();
|
|
|
+ AuthDto authDto = (AuthDto) redisUtil.get(SystemConstant.userOauth + "::" + tbUser.getId());
|
|
|
+ //如果有监考员角色,只能查看自己所监考的考场,巡考员和管理员则可以查看全部考场
|
|
|
+ Long userId = null;
|
|
|
+ if (authDto.getRoleCodes().toString().contains(RoleEnum.INVIGILATE.name())) {
|
|
|
+ userId = tbUser.getId();
|
|
|
+ }
|
|
|
+ int count = tIeExamInvigilateCallService.examInvigilateCallQueryCount(examId, userId, tbUser.getOrgId(), MonitorStatusSourceEnum.START.name());
|
|
|
return ResultUtil.ok(Collections.singletonMap("count", count));
|
|
|
}
|
|
|
|
|
@@ -160,50 +167,4 @@ public class TIeInvigilateCallMobileController {
|
|
|
map.put("monitorUserSig", monitorUserSig);
|
|
|
return ResultUtil.ok(map);
|
|
|
}
|
|
|
-
|
|
|
- /**
|
|
|
- * 获取考试批次
|
|
|
- *
|
|
|
- * @param examId
|
|
|
- * @return
|
|
|
- */
|
|
|
- public Set<Long> getExamActivityIds(Long examId) {
|
|
|
- TBUser tbUser = (TBUser) ServletUtil.getRequestAccount();
|
|
|
- TBSession tbSession = (TBSession) ServletUtil.getRequestSession();
|
|
|
- if (Objects.isNull(tbSession)) {
|
|
|
- throw new BusinessException(ExceptionResultEnum.LOGIN_NO);
|
|
|
- }
|
|
|
- //首先查询当前用户所要监控的roomCode
|
|
|
- QueryWrapper<TBExamInvigilateUser> examInvigilateUserQueryWrapper = new QueryWrapper<>();
|
|
|
- AuthDto authDto = (AuthDto) redisUtil.get(SystemConstant.userOauth + "::" + tbUser.getId());
|
|
|
- //如果有监考员角色,只能查看自己所监考的考场,巡考员和管理员则可以查看全部考场
|
|
|
- examInvigilateUserQueryWrapper.lambda().eq(TBExamInvigilateUser::getOrgId, tbUser.getOrgId())
|
|
|
- .eq(TBExamInvigilateUser::getExamId, examId);
|
|
|
- if (authDto.getRoleCodes().toString().contains(RoleEnum.INVIGILATE.name())) {
|
|
|
- examInvigilateUserQueryWrapper.lambda().eq(TBExamInvigilateUser::getUserId, tbUser.getId());
|
|
|
- }
|
|
|
- List<TBExamInvigilateUser> tbExamInvigilateUserList = tbExamInvigilateUserService.list(examInvigilateUserQueryWrapper);
|
|
|
- Set<String> roomCodeSet = null;
|
|
|
- if (Objects.nonNull(tbExamInvigilateUserList) && tbExamInvigilateUserList.size() > 0) {
|
|
|
- roomCodeSet = tbExamInvigilateUserList.stream().map(s -> s.getRoomCode()).collect(Collectors.toSet());
|
|
|
- }
|
|
|
- if (authDto.getRoleCodes().toString().contains(RoleEnum.INVIGILATE.name()) && (Objects.isNull(roomCodeSet) || roomCodeSet.size() == 0)) {
|
|
|
- throw new BusinessException("当前监考老师未设置任何监考考场");
|
|
|
- } else if (Objects.isNull(roomCodeSet) || roomCodeSet.size() == 0) {
|
|
|
- throw new BusinessException("当前考试批次未设置任何监考考场");
|
|
|
- }
|
|
|
- //根据roomCode获取当前老师所要监考的全部应考学生数
|
|
|
- QueryWrapper<TEExamStudent> teExamStudentQueryWrapper = new QueryWrapper<>();
|
|
|
- teExamStudentQueryWrapper.lambda().in(TEExamStudent::getRoomCode, roomCodeSet);
|
|
|
- List<TEExamStudent> teExamStudentList = teExamStudentService.list(teExamStudentQueryWrapper);
|
|
|
- Set<Long> examActivityIdSet = null;
|
|
|
- if (Objects.nonNull(teExamStudentList) && teExamStudentList.size() > 0) {
|
|
|
- examActivityIdSet = new HashSet<>();
|
|
|
- Set<Long> finalExamActivityIdSet = examActivityIdSet;
|
|
|
- teExamStudentList.forEach(s -> {
|
|
|
- finalExamActivityIdSet.add(s.getExamActivityId());
|
|
|
- });
|
|
|
- }
|
|
|
- return examActivityIdSet;
|
|
|
- }
|
|
|
}
|