|
@@ -32,6 +32,7 @@ import javax.annotation.Resource;
|
|
|
import java.io.File;
|
|
|
import java.io.IOException;
|
|
|
import java.util.*;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* @Description: 系统信息 前端控制器
|
|
@@ -75,6 +76,9 @@ public class SysController {
|
|
|
@Resource
|
|
|
TBExamInvigilateUserService tbExamInvigilateUserService;
|
|
|
|
|
|
+ @Resource
|
|
|
+ TEExamStudentService teExamStudentService;
|
|
|
+
|
|
|
@ApiOperation(value = "菜单查询接口")
|
|
|
@RequestMapping(value = "/getMenu", method = RequestMethod.POST)
|
|
|
@ApiResponses({@ApiResponse(code = 200, message = "菜单信息", response = TBPrivilege.class)})
|
|
@@ -270,4 +274,45 @@ public class SysController {
|
|
|
public Result examRoomQuery(@ApiParam(value = "考场名称", required = false) @RequestParam(required = false) String roomName) {
|
|
|
return ResultUtil.ok(tbExamInvigilateUserService.examRoomQuery(roomName));
|
|
|
}
|
|
|
+
|
|
|
+ @ApiOperation(value = "根据权限获取场次和考场接口")
|
|
|
+ @RequestMapping(value = "/exam/privilegeQuery", method = RequestMethod.POST)
|
|
|
+ @ApiResponses({@ApiResponse(code = 200, message = "场次和考场信息", response = Result.class)})
|
|
|
+ public Result examPrivilegeQuery(@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);
|
|
|
+ }
|
|
|
+ //首先查询当前用户所要监控的roomCode
|
|
|
+ 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);
|
|
|
+ Set<Long> examActivityIdSet = null;
|
|
|
+ List<TEExamActivity> teExamActivityList = null;
|
|
|
+ if (Objects.nonNull(teExamStudentList) && teExamStudentList.size() > 0) {
|
|
|
+ examActivityIdSet = new HashSet<>();
|
|
|
+ Set<Long> finalExamActivityIdSet = examActivityIdSet;
|
|
|
+ teExamStudentList.forEach(s -> {
|
|
|
+ finalExamActivityIdSet.add(s.getExamActivityId());
|
|
|
+ });
|
|
|
+ teExamActivityList = teExamActivityService.listByIds(examActivityIdSet);
|
|
|
+ }
|
|
|
+ Map map = new HashMap();
|
|
|
+ map.put("examActivitys", teExamActivityList);
|
|
|
+ map.put("examRooms", tbExamInvigilateUserList);
|
|
|
+ return ResultUtil.ok(map);
|
|
|
+ }
|
|
|
}
|