|
@@ -63,6 +63,7 @@ public class TEExamActivityController {
|
|
|
if (Objects.isNull(teExamActivityList) || teExamActivityList.size() == 0) {
|
|
|
throw new BusinessException(ExceptionResultEnum.EXAM_INFO_IS_NULL);
|
|
|
}
|
|
|
+ Long examId = null;
|
|
|
try {
|
|
|
TBUser tbUser = (TBUser) ServletUtil.getRequestAccount();
|
|
|
teExamActivityList.forEach(s -> {
|
|
@@ -71,9 +72,10 @@ public class TEExamActivityController {
|
|
|
} else {
|
|
|
s.setId(Constants.idGen.next());
|
|
|
s.setCreateId(tbUser.getId());
|
|
|
- s.setCode(String.valueOf(redisUtil.getRedisActivityCodeSequence()));
|
|
|
+ s.setCode(String.valueOf(redisUtil.getRedisActivityCodeSequence(s.getExamId())));
|
|
|
}
|
|
|
});
|
|
|
+ examId = teExamActivityList.get(0).getExamId();
|
|
|
teExamActivityService.saveOrUpdateBatch(teExamActivityList);
|
|
|
TEExam teExam = teExamService.getById(teExamActivityList.get(0).getExamId());
|
|
|
//新增quartz任务,发送mq消息start
|
|
@@ -90,6 +92,9 @@ public class TEExamActivityController {
|
|
|
});
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
+ if (Objects.nonNull(examId) && Objects.nonNull(teExamActivityList) && (Objects.nonNull(teExamActivityList) && teExamActivityList.size() > 0 && Objects.nonNull(teExamActivityList.get(0)))) {
|
|
|
+ redisUtil.setRedisActivityCodeSequence(examId, Integer.parseInt(teExamActivityList.get(0).getCode()) - 1);
|
|
|
+ }
|
|
|
if (e instanceof DuplicateKeyException) {
|
|
|
String errorColumn = e.getCause().toString();
|
|
|
String columnStr = errorColumn.substring(errorColumn.lastIndexOf("key") + 3, errorColumn.length()).replaceAll("'", "");
|
|
@@ -106,8 +111,8 @@ public class TEExamActivityController {
|
|
|
@ApiOperation(value = "考试场次查询接口")
|
|
|
@RequestMapping(value = "/query", method = RequestMethod.POST)
|
|
|
@ApiResponses({@ApiResponse(code = 200, message = "考试场次信息", response = TEExamActivity.class)})
|
|
|
- public Result query(@ApiParam(value = "主键", required = false) @RequestParam(required = false) Long id,@ApiParam(value = "考试批次id", required = false) @RequestParam(required = false) Long examId, @ApiParam(value = "考试场次编码", required = false) @RequestParam(required = false) String code, @ApiParam(value = "开始日期", required = false) @RequestParam(required = false) String startDate, @ApiParam(value = "结束日期", required = false) @RequestParam(required = false) String finishDate, @ApiParam(value = "分页页码", required = true) @RequestParam int pageNumber, @ApiParam(value = "分页数", required = true) @RequestParam int pageSize) {
|
|
|
- IPage<TEExamActivityQueryDto> teExamActivityIPage = teExamActivityService.examActivityQuery(new Page<>(pageNumber, pageSize), id,examId, code, startDate, finishDate);
|
|
|
+ public Result query(@ApiParam(value = "主键", required = false) @RequestParam(required = false) Long id, @ApiParam(value = "考试批次id", required = false) @RequestParam(required = false) Long examId, @ApiParam(value = "考试场次编码", required = false) @RequestParam(required = false) String code, @ApiParam(value = "开始日期", required = false) @RequestParam(required = false) String startDate, @ApiParam(value = "结束日期", required = false) @RequestParam(required = false) String finishDate, @ApiParam(value = "分页页码", required = true) @RequestParam int pageNumber, @ApiParam(value = "分页数", required = true) @RequestParam int pageSize) {
|
|
|
+ IPage<TEExamActivityQueryDto> teExamActivityIPage = teExamActivityService.examActivityQuery(new Page<>(pageNumber, pageSize), id, examId, code, startDate, finishDate);
|
|
|
BasePage basePage = new BasePage(teExamActivityIPage.getRecords(), teExamActivityIPage.getCurrent(), teExamActivityIPage.getSize(), teExamActivityIPage.getTotal());
|
|
|
return ResultUtil.ok(basePage);
|
|
|
}
|