|
@@ -5,7 +5,6 @@ import com.qmth.themis.business.annotation.ApiJsonObject;
|
|
|
import com.qmth.themis.business.annotation.ApiJsonProperty;
|
|
|
import com.qmth.themis.business.bean.backend.ReexamListRequestBean;
|
|
|
import com.qmth.themis.business.cache.ExamRecordCacheUtil;
|
|
|
-import com.qmth.themis.business.cache.RedisKeyHelper;
|
|
|
import com.qmth.themis.business.cache.bean.ExamCacheBean;
|
|
|
import com.qmth.themis.business.constant.SystemConstant;
|
|
|
import com.qmth.themis.business.dto.AuthDto;
|
|
@@ -83,47 +82,49 @@ public class TEExamReexamController {
|
|
|
if (Objects.isNull(mapParameter.get("reason")) || Objects.equals(mapParameter.get("reason"), "")) {
|
|
|
throw new BusinessException("重考原因不能为空");
|
|
|
}
|
|
|
- TBUser tbUser = (TBUser) ServletUtil.getRequestAccount();
|
|
|
- ReexamReasonEnum reason = ReexamReasonEnum.valueOf(String.valueOf(mapParameter.get("reason")));
|
|
|
- Long examId = null, examStudentId = null, examActivityId = null;
|
|
|
- Integer reexamAuditing = null, status;
|
|
|
- List<TEExamReexamAuditing> teExamReexamAuditingList = new ArrayList<>();
|
|
|
- for (String s : recordIdList) {
|
|
|
- //获取考试记录缓存
|
|
|
- Long recordId = Long.parseLong(s);
|
|
|
- examId = ExamRecordCacheUtil.getExamId(recordId);
|
|
|
- if (Objects.isNull(examId)) {
|
|
|
- TOeExamRecord tOeExamRecord = tOeExamRecordService.getById(Long.parseLong(s));
|
|
|
- examId = tOeExamRecord.getExamId();
|
|
|
- examStudentId = tOeExamRecord.getExamStudentId();
|
|
|
- examActivityId = tOeExamRecord.getExamActivityId();
|
|
|
- } else {
|
|
|
+ if (recordIdList.size() > 0) {
|
|
|
+ TBUser tbUser = (TBUser) ServletUtil.getRequestAccount();
|
|
|
+ ReexamReasonEnum reason = ReexamReasonEnum.valueOf(String.valueOf(mapParameter.get("reason")));
|
|
|
+ Long examId = null, examStudentId = null, examActivityId = null;
|
|
|
+ Integer reexamAuditing = null, status;
|
|
|
+ List<TEExamReexamAuditing> teExamReexamAuditingList = new ArrayList<>();
|
|
|
+ for (String s : recordIdList) {
|
|
|
+ //获取考试记录缓存
|
|
|
+ Long recordId = Long.parseLong(s);
|
|
|
examId = ExamRecordCacheUtil.getExamId(recordId);
|
|
|
- examStudentId = ExamRecordCacheUtil.getExamStudentId(recordId);
|
|
|
- examActivityId = ExamRecordCacheUtil.getExamActivityId(recordId);
|
|
|
- }
|
|
|
- ExamCacheBean examCacheBean = teExamService.getExamCacheBean(examId);//考试缓存
|
|
|
- if (Objects.isNull(examCacheBean)) {
|
|
|
- throw new BusinessException("考试批次[" + examCacheBean + "]不存在");
|
|
|
- }
|
|
|
- reexamAuditing = examCacheBean.getReexamAuditing();
|
|
|
- status = Objects.isNull(reexamAuditing) || reexamAuditing.intValue() == 0 ? 0 : 1;
|
|
|
- TEExamReexam teExamReexam = new TEExamReexam(examId, examActivityId, Long.parseLong(s), examStudentId, model, reason, status, Objects.isNull(mapParameter.get("remark")) ? null : String.valueOf(mapParameter.get("remark")));
|
|
|
- teExamReexam.setCreateId(tbUser.getId());
|
|
|
- teExamReexamService.save(teExamReexam);
|
|
|
- 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);
|
|
|
+ if (Objects.isNull(examId)) {
|
|
|
+ TOeExamRecord tOeExamRecord = tOeExamRecordService.getById(Long.parseLong(s));
|
|
|
+ examId = tOeExamRecord.getExamId();
|
|
|
+ examStudentId = tOeExamRecord.getExamStudentId();
|
|
|
+ examActivityId = tOeExamRecord.getExamActivityId();
|
|
|
+ } else {
|
|
|
+ examId = ExamRecordCacheUtil.getExamId(recordId);
|
|
|
+ examStudentId = ExamRecordCacheUtil.getExamStudentId(recordId);
|
|
|
+ examActivityId = ExamRecordCacheUtil.getExamActivityId(recordId);
|
|
|
+ }
|
|
|
+ ExamCacheBean examCacheBean = teExamService.getExamCacheBean(examId);//考试缓存
|
|
|
+ if (Objects.isNull(examCacheBean)) {
|
|
|
+ throw new BusinessException("考试批次[" + examCacheBean + "]不存在");
|
|
|
+ }
|
|
|
+ reexamAuditing = examCacheBean.getReexamAuditing();
|
|
|
+ status = Objects.isNull(reexamAuditing) || reexamAuditing.intValue() == 0 ? 0 : 1;
|
|
|
+ TEExamReexam teExamReexam = new TEExamReexam(examId, examActivityId, Long.parseLong(s), examStudentId, model, reason, status, Objects.isNull(mapParameter.get("remark")) ? null : String.valueOf(mapParameter.get("remark")));
|
|
|
+ teExamReexam.setCreateId(tbUser.getId());
|
|
|
+ teExamReexamService.save(teExamReexam);
|
|
|
+ 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);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
- if (Objects.nonNull(teExamReexamAuditingList) && teExamReexamAuditingList.size() > 0) {
|
|
|
- teExamReexamAuditingService.saveBatch(teExamReexamAuditingList);
|
|
|
+ if (Objects.nonNull(teExamReexamAuditingList) && teExamReexamAuditingList.size() > 0) {
|
|
|
+ teExamReexamAuditingService.saveBatch(teExamReexamAuditingList);
|
|
|
+ }
|
|
|
}
|
|
|
return ResultUtil.ok(Collections.singletonMap("success", true));
|
|
|
}
|
|
@@ -146,30 +147,32 @@ public class TEExamReexamController {
|
|
|
if (Objects.isNull(mapParameter.get("auditingStatus")) || Objects.equals(mapParameter.get("auditingStatus"), "")) {
|
|
|
throw new BusinessException("审批状态不能为空");
|
|
|
}
|
|
|
- Integer auditingStatus = Integer.parseInt(String.valueOf(mapParameter.get("auditingStatus")));
|
|
|
- TBUser tbUser = (TBUser) ServletUtil.getRequestAccount();
|
|
|
- List<TEExamReexam> teExamReexamUpdateList = new ArrayList<>();
|
|
|
- for (String reexamId : reexamIdList) {
|
|
|
- if (redisUtil.lock(SystemConstant.REDIS_LOCK_REEXAM_AUDITING + 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);
|
|
|
- teExamReexamService.updateById(teExamReexam);
|
|
|
+ if (reexamIdList.size() > 0) {
|
|
|
+ Integer auditingStatus = Integer.parseInt(String.valueOf(mapParameter.get("auditingStatus")));
|
|
|
+ TBUser tbUser = (TBUser) ServletUtil.getRequestAccount();
|
|
|
+ List<TEExamReexam> teExamReexamUpdateList = new ArrayList<>();
|
|
|
+ for (String reexamId : reexamIdList) {
|
|
|
+ if (redisUtil.lock(SystemConstant.REDIS_LOCK_REEXAM_AUDITING + 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);
|
|
|
+ teExamReexamService.updateById(teExamReexam);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
+ teExamReexamService.updateBatchById(teExamReexamUpdateList);
|
|
|
}
|
|
|
- teExamReexamService.updateBatchById(teExamReexamUpdateList);
|
|
|
} catch (Exception e) {
|
|
|
log.error("请求出错", e);
|
|
|
if (e instanceof BusinessException) {
|