|
@@ -93,32 +93,38 @@ public class TEExamReexamController {
|
|
List<TEExamStudent> teExamStudentList = teExamStudentService.listByIds(examStudentIdList);
|
|
List<TEExamStudent> teExamStudentList = teExamStudentService.listByIds(examStudentIdList);
|
|
for (TEExamStudent teExamStudent : teExamStudentList) {
|
|
for (TEExamStudent teExamStudent : teExamStudentList) {
|
|
if (redisUtil.lock(SystemConstant.REDIS_LOCK_EXAM_STUDENT_PREFIX + teExamStudent.getId(), SystemConstant.REDIS_LOCK_REEXAM_EXAM_STUDENT_TIME_OUT)) {
|
|
if (redisUtil.lock(SystemConstant.REDIS_LOCK_EXAM_STUDENT_PREFIX + teExamStudent.getId(), SystemConstant.REDIS_LOCK_REEXAM_EXAM_STUDENT_TIME_OUT)) {
|
|
- ExamCacheBean examCacheBean = teExamService.getExamCacheBean(teExamStudent.getExamId());//考试缓存
|
|
|
|
- if (Objects.isNull(examCacheBean)) {
|
|
|
|
- throw new BusinessException("考试批次[" + examCacheBean + "]不存在");
|
|
|
|
- }
|
|
|
|
- reexamAuditing = examCacheBean.getReexamAuditing();
|
|
|
|
- status = Objects.isNull(reexamAuditing) || reexamAuditing.intValue() == 0 ? 0 : 1;
|
|
|
|
- TEExamReexam teExamReexam = new TEExamReexam(teExamStudent.getExamId(), teExamStudent.getExamActivityId(), teExamStudent.getId(), model, reason, status, Objects.isNull(mapParameter.get("remark")) ? null : String.valueOf(mapParameter.get("remark")));
|
|
|
|
- teExamReexam.setCreateId(tbUser.getId());
|
|
|
|
- if (Objects.nonNull(status) && status.intValue() == 1) {
|
|
|
|
- //这里查询该机构下所有为管理员角色的账号
|
|
|
|
- List<TBUser> tbUserList = tbUserRoleService.userQueryByRole(tbUser.getOrgId(), RoleEnum.ADMIN.name());
|
|
|
|
- if (Objects.nonNull(tbUserList) && tbUserList.size() > 0) {
|
|
|
|
- for (TBUser t : tbUserList) {
|
|
|
|
- TEExamReexamAuditing teExamReexamAuditing = new TEExamReexamAuditing(teExamReexam.getId(), t.getId());
|
|
|
|
- teExamReexamAuditingList.add(teExamReexamAuditing);
|
|
|
|
|
|
+ try {
|
|
|
|
+ ExamCacheBean examCacheBean = teExamService.getExamCacheBean(teExamStudent.getExamId());//考试缓存
|
|
|
|
+ if (Objects.isNull(examCacheBean)) {
|
|
|
|
+ throw new BusinessException("考试批次[" + examCacheBean + "]不存在");
|
|
|
|
+ }
|
|
|
|
+ reexamAuditing = examCacheBean.getReexamAuditing();
|
|
|
|
+ status = Objects.isNull(reexamAuditing) || reexamAuditing.intValue() == 0 ? 0 : 1;
|
|
|
|
+ TEExamReexam teExamReexam = new TEExamReexam(teExamStudent.getExamId(), teExamStudent.getExamActivityId(), teExamStudent.getId(), model, reason, status, Objects.isNull(mapParameter.get("remark")) ? null : String.valueOf(mapParameter.get("remark")));
|
|
|
|
+ teExamReexam.setCreateId(tbUser.getId());
|
|
|
|
+ if (Objects.nonNull(status) && status.intValue() == 1) {
|
|
|
|
+ //这里查询该机构下所有为管理员角色的账号
|
|
|
|
+ List<TBUser> tbUserList = tbUserRoleService.userQueryByRole(tbUser.getOrgId(), RoleEnum.ADMIN.name());
|
|
|
|
+ if (Objects.nonNull(tbUserList) && tbUserList.size() > 0) {
|
|
|
|
+ for (TBUser t : tbUserList) {
|
|
|
|
+ TEExamReexamAuditing teExamReexamAuditing = new TEExamReexamAuditing(teExamReexam.getId(), t.getId());
|
|
|
|
+ teExamReexamAuditingList.add(teExamReexamAuditing);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+ } else if (Objects.nonNull(status) && status.intValue() == 0) {//无需审核时考生已考次数-1
|
|
|
|
+ examStudentIdNotAuditingList.add(teExamStudent.getId());
|
|
|
|
+ teExamReexam.setAuditingId(tbUser.getId());
|
|
|
|
+ teExamReexam.setAuditingStatus(0);
|
|
|
|
+ teExamReexam.setAuditingTime(System.currentTimeMillis());
|
|
|
|
+ teExamReexam.setAuditingSuggest("无需审核");
|
|
|
|
+ teExamReexam.setUpdateId(tbUser.getId());
|
|
|
|
+ }
|
|
|
|
+ teExamReexamService.save(teExamReexam);
|
|
|
|
+ } finally {
|
|
|
|
+ if (Objects.nonNull(teExamStudent)) {
|
|
|
|
+ redisUtil.releaseLock(SystemConstant.REDIS_LOCK_EXAM_STUDENT_PREFIX + teExamStudent.getId());
|
|
}
|
|
}
|
|
- } else if (Objects.nonNull(status) && status.intValue() == 0) {//无需审核时考生已考次数-1
|
|
|
|
- examStudentIdNotAuditingList.add(teExamStudent.getId());
|
|
|
|
- teExamReexam.setAuditingId(tbUser.getId());
|
|
|
|
- teExamReexam.setAuditingStatus(0);
|
|
|
|
- teExamReexam.setAuditingTime(System.currentTimeMillis());
|
|
|
|
- teExamReexam.setAuditingSuggest("无需审核");
|
|
|
|
- teExamReexam.setUpdateId(tbUser.getId());
|
|
|
|
}
|
|
}
|
|
- teExamReexamService.save(teExamReexam);
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (Objects.nonNull(teExamReexamAuditingList) && teExamReexamAuditingList.size() > 0) {
|
|
if (Objects.nonNull(teExamReexamAuditingList) && teExamReexamAuditingList.size() > 0) {
|
|
@@ -172,38 +178,42 @@ public class TEExamReexamController {
|
|
List<TEExamReexam> teExamReexamUpdateList = new ArrayList<>();
|
|
List<TEExamReexam> teExamReexamUpdateList = new ArrayList<>();
|
|
for (String reexamId : reexamIdList) {
|
|
for (String reexamId : reexamIdList) {
|
|
if (redisUtil.lock(SystemConstant.REDIS_LOCK_REEXAM_AUDITING_PREFIX + Long.parseLong(reexamId), SystemConstant.REDIS_LOCK_REEXAM_TIME_OUT)) {
|
|
if (redisUtil.lock(SystemConstant.REDIS_LOCK_REEXAM_AUDITING_PREFIX + Long.parseLong(reexamId), SystemConstant.REDIS_LOCK_REEXAM_TIME_OUT)) {
|
|
- TEExamReexam teExamReexam = teExamReexamService.getById(Long.parseLong(reexamId));
|
|
|
|
- if (Objects.isNull(teExamReexam)) {
|
|
|
|
- throw new BusinessException("重考id[" + reexamId + "]记录不存在");
|
|
|
|
- }
|
|
|
|
- if (Objects.nonNull(teExamReexam.getStatus()) && teExamReexam.getStatus().intValue() == 2) {
|
|
|
|
- throw new BusinessException("重考id[" + reexamId + "]已经审核");
|
|
|
|
- } else {
|
|
|
|
- teExamReexam.setAuditingId(tbUser.getId());
|
|
|
|
- teExamReexam.setAuditingStatus(auditingStatus);
|
|
|
|
- teExamReexam.setAuditingTime(System.currentTimeMillis());
|
|
|
|
- teExamReexam.setAuditingSuggest(Objects.isNull(mapParameter.get("auditingSuggest")) ? null : String.valueOf(mapParameter.get("auditingSuggest")));
|
|
|
|
- teExamReexam.setStatus(2);
|
|
|
|
- teExamReexam.setUpdateId(tbUser.getId());
|
|
|
|
- teExamReexamUpdateList.add(teExamReexam);
|
|
|
|
- if (auditingStatus.intValue() == 0) {
|
|
|
|
- ExamStudentCacheBean examStudentCacheBean = teExamStudentService.getExamStudentCacheBean(teExamReexam.getExamStudentId());
|
|
|
|
- if (Objects.nonNull(examStudentCacheBean)) {
|
|
|
|
- Integer alreadyExamCount = Objects.nonNull(examStudentCacheBean.getAlreadyExamCount()) ? examStudentCacheBean.getAlreadyExamCount() : 0;
|
|
|
|
- if (alreadyExamCount > 0) {
|
|
|
|
- alreadyExamCount = alreadyExamCount - 1;
|
|
|
|
- ExamCacheBean ec = teExamService.getExamCacheBean(teExamReexam.getExamId());//考试缓存
|
|
|
|
- if (alreadyExamCount.intValue() >= ec.getExamCount().intValue()) {
|
|
|
|
- alreadyExamCount = 0;
|
|
|
|
|
|
+ try {
|
|
|
|
+ TEExamReexam teExamReexam = teExamReexamService.getById(Long.parseLong(reexamId));
|
|
|
|
+ if (Objects.isNull(teExamReexam)) {
|
|
|
|
+ throw new BusinessException("重考id[" + reexamId + "]记录不存在");
|
|
|
|
+ }
|
|
|
|
+ if (Objects.nonNull(teExamReexam.getStatus()) && teExamReexam.getStatus().intValue() == 2) {
|
|
|
|
+ throw new BusinessException("重考id[" + reexamId + "]已经审核");
|
|
|
|
+ } else {
|
|
|
|
+ teExamReexam.setAuditingId(tbUser.getId());
|
|
|
|
+ teExamReexam.setAuditingStatus(auditingStatus);
|
|
|
|
+ teExamReexam.setAuditingTime(System.currentTimeMillis());
|
|
|
|
+ teExamReexam.setAuditingSuggest(Objects.isNull(mapParameter.get("auditingSuggest")) ? null : String.valueOf(mapParameter.get("auditingSuggest")));
|
|
|
|
+ teExamReexam.setStatus(2);
|
|
|
|
+ teExamReexam.setUpdateId(tbUser.getId());
|
|
|
|
+ teExamReexamUpdateList.add(teExamReexam);
|
|
|
|
+ if (auditingStatus.intValue() == 0) {
|
|
|
|
+ ExamStudentCacheBean examStudentCacheBean = teExamStudentService.getExamStudentCacheBean(teExamReexam.getExamStudentId());
|
|
|
|
+ if (Objects.nonNull(examStudentCacheBean)) {
|
|
|
|
+ Integer alreadyExamCount = Objects.nonNull(examStudentCacheBean.getAlreadyExamCount()) ? examStudentCacheBean.getAlreadyExamCount() : 0;
|
|
|
|
+ if (alreadyExamCount > 0) {
|
|
|
|
+ alreadyExamCount = alreadyExamCount - 1;
|
|
|
|
+ ExamCacheBean ec = teExamService.getExamCacheBean(teExamReexam.getExamId());//考试缓存
|
|
|
|
+ if (alreadyExamCount.intValue() >= ec.getExamCount().intValue()) {
|
|
|
|
+ alreadyExamCount = 0;
|
|
|
|
+ }
|
|
|
|
+ UpdateWrapper<TEExamStudent> teExamStudentUpdateWrapper = new UpdateWrapper<>();
|
|
|
|
+ teExamStudentUpdateWrapper.lambda().set(TEExamStudent::getAlreadyExamCount, alreadyExamCount)
|
|
|
|
+ .eq(TEExamStudent::getId, teExamReexam.getExamStudentId());
|
|
|
|
+ teExamStudentService.update(teExamStudentUpdateWrapper);
|
|
|
|
+ teExamStudentService.updateExamStudentCacheBean(teExamReexam.getExamStudentId());
|
|
}
|
|
}
|
|
- UpdateWrapper<TEExamStudent> teExamStudentUpdateWrapper = new UpdateWrapper<>();
|
|
|
|
- teExamStudentUpdateWrapper.lambda().set(TEExamStudent::getAlreadyExamCount, alreadyExamCount)
|
|
|
|
- .eq(TEExamStudent::getId, teExamReexam.getExamStudentId());
|
|
|
|
- teExamStudentService.update(teExamStudentUpdateWrapper);
|
|
|
|
- teExamStudentService.updateExamStudentCacheBean(teExamReexam.getExamStudentId());
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ } finally {
|
|
|
|
+ redisUtil.releaseLock(SystemConstant.REDIS_LOCK_REEXAM_AUDITING_PREFIX + Long.parseLong(reexamId));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -216,12 +226,6 @@ public class TEExamReexamController {
|
|
} else {
|
|
} else {
|
|
throw new RuntimeException(e);
|
|
throw new RuntimeException(e);
|
|
}
|
|
}
|
|
- } finally {
|
|
|
|
- if (Objects.nonNull(reexamIdList)) {
|
|
|
|
- reexamIdList.forEach(s -> {
|
|
|
|
- redisUtil.releaseLock(SystemConstant.REDIS_LOCK_REEXAM_AUDITING_PREFIX + s);
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
}
|
|
}
|
|
return ResultUtil.ok(Collections.singletonMap(SystemConstant.SUCCESS, true));
|
|
return ResultUtil.ok(Collections.singletonMap(SystemConstant.SUCCESS, true));
|
|
}
|
|
}
|