|
@@ -104,6 +104,9 @@ public class SysController {
|
|
|
@Resource
|
|
|
AuthInfoService authInfoService;
|
|
|
|
|
|
+ @Resource
|
|
|
+ TIeInvigilateWarnInfoService tIeInvigilateWarnInfoService;
|
|
|
+
|
|
|
@ApiOperation(value = "菜单查询接口")
|
|
|
@RequestMapping(value = "/getMenu", method = RequestMethod.POST)
|
|
|
@ApiResponses({@ApiResponse(code = 200, message = "菜单信息", response = TBPrivilege.class)})
|
|
@@ -285,9 +288,10 @@ public class SysController {
|
|
|
@ApiOperation(value = "考试批次查询接口")
|
|
|
@RequestMapping(value = "/exam/query", method = RequestMethod.POST)
|
|
|
@ApiResponses({@ApiResponse(code = 200, message = "角色信息", response = TEExamQueryDto.class)})
|
|
|
- public Result examQuery(@ApiParam(value = "用户id", required = false) @RequestParam(required = false) Long userId,
|
|
|
- @ApiParam(value = "批次名称", required = false) @RequestParam(required = false) String name,
|
|
|
- @ApiParam(value = "类型(区分实时监考台和考务)", required = false) @RequestParam(required = false) String type) {
|
|
|
+ public Result examQuery(@ApiParam(value = "用户id") @RequestParam(required = false) Long userId,
|
|
|
+ @ApiParam(value = "批次名称") @RequestParam(required = false) String name,
|
|
|
+ @ApiParam(value = "类型(区分实时监考台和考务)") @RequestParam(required = false) String type,
|
|
|
+ @ApiParam(value = "是否查询预警消息条数") @RequestParam(required = false) Boolean warnCount) {
|
|
|
TBUser tbUser = (TBUser) ServletUtil.getRequestAccount();
|
|
|
AuthDto authDto = cacheService.addAccountAuthCache(tbUser.getId());
|
|
|
List<TEExam> teExamList = null;
|
|
@@ -318,10 +322,31 @@ public class SysController {
|
|
|
}
|
|
|
}
|
|
|
List<TEExamQueryDto> teExamQueryDtoList = null;
|
|
|
- if (Objects.nonNull(teExamList) && teExamList.size() > 0) {
|
|
|
+ if (!CollectionUtils.isEmpty(teExamList)) {
|
|
|
Gson gson = new Gson();
|
|
|
teExamQueryDtoList = gson.fromJson(gson.toJson(teExamList), new TypeToken<List<TEExamQueryDto>>() {
|
|
|
}.getType());
|
|
|
+ if (Objects.nonNull(warnCount) && warnCount) {
|
|
|
+ List<Long> examIdList = new ArrayList<>(teExamQueryDtoList.size());
|
|
|
+ Map<Long, TEExamQueryDto> map = new HashMap<>(teExamQueryDtoList.size());
|
|
|
+ for (TEExamQueryDto t : teExamQueryDtoList) {
|
|
|
+ examIdList.add(t.getId());
|
|
|
+ map.computeIfAbsent(t.getId(), v -> t);
|
|
|
+ }
|
|
|
+ Long warnUserId = null, warnOrgId = null;
|
|
|
+ if (authDto.getRoleCodes().toString().contains(RoleEnum.INSPECTION.name()) || authDto.getRoleCodes().toString()
|
|
|
+ .contains(RoleEnum.INVIGILATE.name())) {
|
|
|
+ warnUserId = tbUser.getId();
|
|
|
+ warnOrgId = tbUser.getOrgId();
|
|
|
+ }
|
|
|
+ List<TEExamQueryDto> warnCountList = tIeInvigilateWarnInfoService.warningCountByList(examIdList, warnUserId, warnOrgId);
|
|
|
+ if (!CollectionUtils.isEmpty(warnCountList)) {
|
|
|
+ for (TEExamQueryDto t : warnCountList) {
|
|
|
+ map.get(t.getId()).setWarnCount(t.getWarnCount());
|
|
|
+ }
|
|
|
+ teExamQueryDtoList = new ArrayList<>(map.values());
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
return ResultUtil.ok(teExamQueryDtoList);
|
|
|
}
|