|
@@ -67,7 +67,7 @@ public class TIeInvigilateWarnInfoController {
|
|
@RequestMapping(value = "/notify", method = RequestMethod.POST)
|
|
@RequestMapping(value = "/notify", method = RequestMethod.POST)
|
|
@ApiResponses({@ApiResponse(code = 200, message = "{\"count\":1}", response = Result.class)})
|
|
@ApiResponses({@ApiResponse(code = 200, message = "{\"count\":1}", response = Result.class)})
|
|
// @RedisLimitAnnotation(key = "warnNotify", period = 1, count = 1)
|
|
// @RedisLimitAnnotation(key = "warnNotify", period = 1, count = 1)
|
|
- public Result notify(@ApiParam(value = "考试批次id", required = false) @RequestParam(required = false) Long examId,
|
|
|
|
|
|
+ public Result notify(@ApiParam(value = "考试批次id", required = true) @RequestParam Long examId,
|
|
@ApiParam(value = "考试场次id", required = false) @RequestParam(required = false) Long examActivityId,
|
|
@ApiParam(value = "考试场次id", required = false) @RequestParam(required = false) Long examActivityId,
|
|
@ApiParam(value = "虚拟考场代码", required = false) @RequestParam(required = false) String roomCode) {
|
|
@ApiParam(value = "虚拟考场代码", required = false) @RequestParam(required = false) String roomCode) {
|
|
TBUser tbUser = (TBUser) ServletUtil.getRequestAccount();
|
|
TBUser tbUser = (TBUser) ServletUtil.getRequestAccount();
|
|
@@ -77,34 +77,57 @@ public class TIeInvigilateWarnInfoController {
|
|
Long userId = null;
|
|
Long userId = null;
|
|
if (authDto.getRoleCodes().toString().contains(RoleEnum.INVIGILATE.name())) {
|
|
if (authDto.getRoleCodes().toString().contains(RoleEnum.INVIGILATE.name())) {
|
|
userId = tbUser.getId();
|
|
userId = tbUser.getId();
|
|
- List<TBExamInvigilateUser> tbExamInvigilateUserList = tbExamInvigilateUserService.list(new QueryWrapper<TBExamInvigilateUser>().lambda()
|
|
|
|
- .eq(TBExamInvigilateUser::getOrgId, tbUser.getOrgId())
|
|
|
|
- .eq(TBExamInvigilateUser::getUserId, userId));
|
|
|
|
- if (!CollectionUtils.isEmpty(tbExamInvigilateUserList)) {
|
|
|
|
- List<TEExamSummary> teExamSummaryAllList = new ArrayList<>();
|
|
|
|
- for (TBExamInvigilateUser t : tbExamInvigilateUserList) {
|
|
|
|
- List<TEExamActivity> teExamActivityList = teExamActivityService.list(new QueryWrapper<TEExamActivity>().lambda().eq(TEExamActivity::getExamId, t.getExamId()));
|
|
|
|
- for (TEExamActivity teExamActivity : teExamActivityList) {
|
|
|
|
- teExamSummaryAllList.addAll(themisCacheService.getExamSummaryCache(t.getExamId(), teExamActivity.getId(), t.getRoomCode()));
|
|
|
|
|
|
+ List<TEExamSummary> teExamSummaryAllList = new ArrayList<>();
|
|
|
|
+ if (Objects.nonNull(examId) && Objects.nonNull(examActivityId) && Objects.nonNull(roomCode)) {
|
|
|
|
+ teExamSummaryAllList.addAll(themisCacheService.getExamSummaryCache(examId, examActivityId, roomCode));
|
|
|
|
+ } else {
|
|
|
|
+ QueryWrapper<TBExamInvigilateUser> tbExamInvigilateUserQueryWrapper = new QueryWrapper<TBExamInvigilateUser>();
|
|
|
|
+ tbExamInvigilateUserQueryWrapper.lambda()
|
|
|
|
+ .eq(TBExamInvigilateUser::getOrgId, tbUser.getOrgId())
|
|
|
|
+ .eq(TBExamInvigilateUser::getUserId, userId);
|
|
|
|
+ if (Objects.nonNull(examId)) {
|
|
|
|
+ tbExamInvigilateUserQueryWrapper.lambda().eq(TBExamInvigilateUser::getExamId, examId);
|
|
|
|
+ }
|
|
|
|
+ if (Objects.nonNull(roomCode)) {
|
|
|
|
+ tbExamInvigilateUserQueryWrapper.lambda().eq(TBExamInvigilateUser::getRoomCode, roomCode);
|
|
|
|
+ }
|
|
|
|
+ List<TBExamInvigilateUser> tbExamInvigilateUserList = tbExamInvigilateUserService.list(tbExamInvigilateUserQueryWrapper);
|
|
|
|
+ if (!CollectionUtils.isEmpty(tbExamInvigilateUserList)) {
|
|
|
|
+ Map<Long, List<TEExamActivity>> examActivityMap = new HashMap<>();
|
|
|
|
+ for (TBExamInvigilateUser t : tbExamInvigilateUserList) {
|
|
|
|
+ List<TEExamActivity> teExamActivityList = null;
|
|
|
|
+ if (CollectionUtils.isEmpty(examActivityMap.get(t.getExamId()))) {
|
|
|
|
+ teExamActivityList = teExamActivityService.list(new QueryWrapper<TEExamActivity>().lambda().eq(TEExamActivity::getExamId, t.getExamId()));
|
|
|
|
+ examActivityMap.put(t.getExamId(), teExamActivityList);
|
|
|
|
+ } else {
|
|
|
|
+ teExamActivityList = examActivityMap.get(t.getExamId());
|
|
|
|
+ }
|
|
|
|
+ for (TEExamActivity teExamActivity : teExamActivityList) {
|
|
|
|
+ teExamSummaryAllList.addAll(themisCacheService.getExamSummaryCache(t.getExamId(), teExamActivity.getId(), t.getRoomCode()));
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- count = teExamSummaryAllList.stream().mapToInt(s -> s.getWarningStudentUnread()).sum();
|
|
|
|
}
|
|
}
|
|
|
|
+ count = teExamSummaryAllList.stream().mapToInt(s -> s.getWarningStudentUnread()).sum();
|
|
} else {
|
|
} else {
|
|
//取当前用户机构id所属考试id集合
|
|
//取当前用户机构id所属考试id集合
|
|
- List<ExamInfoBean> examInfoBeanList = teExamStudentService.getExamInfo(tbUser.getOrgId());
|
|
|
|
- if (!CollectionUtils.isEmpty(examInfoBeanList)) {
|
|
|
|
- List<TEExamSummary> teExamSummaryAllList = new ArrayList<>();
|
|
|
|
- for (ExamInfoBean t : examInfoBeanList) {
|
|
|
|
- if (Objects.nonNull(t.getRoomCodes())) {
|
|
|
|
- Set<String> roomCodeSet = new HashSet<>(Arrays.asList(t.getRoomCodes().split(", ")));
|
|
|
|
- for (String s : roomCodeSet) {
|
|
|
|
- teExamSummaryAllList.addAll(themisCacheService.getExamSummaryCache(t.getExamId(), t.getExamActivityId(), s));
|
|
|
|
|
|
+ List<TEExamSummary> teExamSummaryAllList = new ArrayList<>();
|
|
|
|
+ if (Objects.nonNull(examId) && Objects.nonNull(examActivityId) && Objects.nonNull(roomCode)) {
|
|
|
|
+ teExamSummaryAllList.addAll(themisCacheService.getExamSummaryCache(examId, examActivityId, roomCode));
|
|
|
|
+ } else {
|
|
|
|
+ List<ExamInfoBean> examInfoBeanList = teExamStudentService.getExamInfo(tbUser.getOrgId(), examId, roomCode);
|
|
|
|
+ if (!CollectionUtils.isEmpty(examInfoBeanList)) {
|
|
|
|
+ for (ExamInfoBean t : examInfoBeanList) {
|
|
|
|
+ if (Objects.nonNull(t.getRoomCodes())) {
|
|
|
|
+ Set<String> roomCodeSet = new HashSet<>(Arrays.asList(t.getRoomCodes().split(", ")));
|
|
|
|
+ for (String s : roomCodeSet) {
|
|
|
|
+ teExamSummaryAllList.addAll(themisCacheService.getExamSummaryCache(t.getExamId(), t.getExamActivityId(), s));
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- count = teExamSummaryAllList.stream().mapToInt(s -> s.getWarningStudentUnread()).sum();
|
|
|
|
}
|
|
}
|
|
|
|
+ count = teExamSummaryAllList.stream().mapToInt(s -> s.getWarningStudentUnread()).sum();
|
|
}
|
|
}
|
|
return ResultUtil.ok(Collections.singletonMap(SystemConstant.COUNT, Objects.isNull(count) ? 0 : count));
|
|
return ResultUtil.ok(Collections.singletonMap(SystemConstant.COUNT, Objects.isNull(count) ? 0 : count));
|
|
}
|
|
}
|