|
@@ -31,6 +31,7 @@ import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import java.util.*;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* @Description: 监考信息 前端控制器
|
|
@@ -69,6 +70,9 @@ public class TIeInvigilateController {
|
|
|
@Resource
|
|
|
TEExamStudentLogService teExamStudentLogService;
|
|
|
|
|
|
+ @Resource
|
|
|
+ TBExamInvigilateUserService tbExamInvigilateUserService;
|
|
|
+
|
|
|
@ApiOperation(value = "实时监控台列表接口")
|
|
|
@RequestMapping(value = "/list", method = RequestMethod.POST)
|
|
|
@ApiResponses({@ApiResponse(code = 200, message = "监考监控信息", response = InvigilateListBean.class)})
|
|
@@ -426,11 +430,29 @@ public class TIeInvigilateController {
|
|
|
@ApiOperation(value = "结束监考接口")
|
|
|
@RequestMapping(value = "/exam/finish", method = RequestMethod.POST)
|
|
|
@ApiResponses({@ApiResponse(code = 200, message = "{\"success\":true}", response = Result.class)})
|
|
|
- public Result examFinish(@ApiJsonObject(name = "invigilateExamFinish", value = {
|
|
|
- @ApiJsonProperty(key = "examId", type = "long", example = "1", description = "考试批次id", required = true),
|
|
|
- @ApiJsonProperty(key = "examActivityId", type = "long", example = "1", description = "考试场次id", required = true),
|
|
|
- @ApiJsonProperty(key = "roomCode", description = "虚拟考场代码", required = true)
|
|
|
- }) @ApiParam(value = "考试记录信息", required = true) @RequestBody Map<String, Object> mapParameter) {
|
|
|
+ public Result examFinish(@ApiParam(value = "考试id", required = true) @RequestParam Long examId) {
|
|
|
+ if (Objects.isNull(examId) || Objects.equals(examId, "")) {
|
|
|
+ throw new BusinessException(ExceptionResultEnum.EXAM_ID_IS_NULL);
|
|
|
+ }
|
|
|
+ TBUser tbUser = (TBUser) ServletUtil.getRequestAccount();
|
|
|
+ TBSession tbSession = (TBSession) ServletUtil.getRequestSession();
|
|
|
+ if (Objects.isNull(tbSession)) {
|
|
|
+ throw new BusinessException(ExceptionResultEnum.LOGIN_NO);
|
|
|
+ }
|
|
|
+ QueryWrapper<TBExamInvigilateUser> examInvigilateUserQueryWrapper = new QueryWrapper<>();
|
|
|
+ //如果有监考员角色,只能查看自己所监考的考场,巡考员和管理员则可以查看全部考场
|
|
|
+ examInvigilateUserQueryWrapper.lambda().eq(TBExamInvigilateUser::getOrgId, tbUser.getOrgId())
|
|
|
+ .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());
|
|
|
+ }
|
|
|
+ //根据roomCode获取当前老师所要监考的全部应考学生数
|
|
|
+ QueryWrapper<TEExamStudent> teExamStudentQueryWrapper = new QueryWrapper<>();
|
|
|
+ teExamStudentQueryWrapper.lambda().in(TEExamStudent::getRoomCode, roomCodeSet);
|
|
|
+ List<TEExamStudent> teExamStudentList = teExamStudentService.list(teExamStudentQueryWrapper);
|
|
|
+
|
|
|
return ResultUtil.ok(Collections.singletonMap("success", true));
|
|
|
}
|
|
|
}
|