|
@@ -5,12 +5,14 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.qmth.themis.business.annotation.ApiJsonObject;
|
|
import com.qmth.themis.business.annotation.ApiJsonObject;
|
|
import com.qmth.themis.business.annotation.ApiJsonProperty;
|
|
import com.qmth.themis.business.annotation.ApiJsonProperty;
|
|
import com.qmth.themis.business.bean.backend.ReexamListRequestBean;
|
|
import com.qmth.themis.business.bean.backend.ReexamListRequestBean;
|
|
-import com.qmth.themis.business.cache.ExamRecordCacheUtil;
|
|
|
|
import com.qmth.themis.business.cache.bean.ExamCacheBean;
|
|
import com.qmth.themis.business.cache.bean.ExamCacheBean;
|
|
import com.qmth.themis.business.cache.bean.ExamStudentCacheBean;
|
|
import com.qmth.themis.business.cache.bean.ExamStudentCacheBean;
|
|
import com.qmth.themis.business.constant.SystemConstant;
|
|
import com.qmth.themis.business.constant.SystemConstant;
|
|
import com.qmth.themis.business.dto.AuthDto;
|
|
import com.qmth.themis.business.dto.AuthDto;
|
|
-import com.qmth.themis.business.entity.*;
|
|
|
|
|
|
+import com.qmth.themis.business.entity.TBUser;
|
|
|
|
+import com.qmth.themis.business.entity.TEExamReexam;
|
|
|
|
+import com.qmth.themis.business.entity.TEExamReexamAuditing;
|
|
|
|
+import com.qmth.themis.business.entity.TEExamStudent;
|
|
import com.qmth.themis.business.enums.ReexamReasonEnum;
|
|
import com.qmth.themis.business.enums.ReexamReasonEnum;
|
|
import com.qmth.themis.business.enums.RoleEnum;
|
|
import com.qmth.themis.business.enums.RoleEnum;
|
|
import com.qmth.themis.business.service.*;
|
|
import com.qmth.themis.business.service.*;
|
|
@@ -48,9 +50,6 @@ public class TEExamReexamController {
|
|
@Resource
|
|
@Resource
|
|
RedisUtil redisUtil;
|
|
RedisUtil redisUtil;
|
|
|
|
|
|
- @Resource
|
|
|
|
- TOeExamRecordService tOeExamRecordService;
|
|
|
|
-
|
|
|
|
@Resource
|
|
@Resource
|
|
TEExamService teExamService;
|
|
TEExamService teExamService;
|
|
|
|
|
|
@@ -68,15 +67,15 @@ public class TEExamReexamController {
|
|
@ApiResponses({@ApiResponse(code = 200, message = "{\"success\":true}", response = Result.class)})
|
|
@ApiResponses({@ApiResponse(code = 200, message = "{\"success\":true}", response = Result.class)})
|
|
@Transactional
|
|
@Transactional
|
|
public Result apply(@ApiJsonObject(name = "reexamApply", value = {
|
|
public Result apply(@ApiJsonObject(name = "reexamApply", value = {
|
|
- @ApiJsonProperty(key = "examRecordId", description = "考试记录id数组", required = true),
|
|
|
|
|
|
+ @ApiJsonProperty(key = "examStudentId", description = "考生id数组", required = true),
|
|
@ApiJsonProperty(key = "model", type = "int", example = "1", description = "重考方式", required = true),
|
|
@ApiJsonProperty(key = "model", type = "int", example = "1", description = "重考方式", required = true),
|
|
@ApiJsonProperty(key = "reason", description = "重考原因", required = true),
|
|
@ApiJsonProperty(key = "reason", description = "重考原因", required = true),
|
|
@ApiJsonProperty(key = "remark", description = "备注")
|
|
@ApiJsonProperty(key = "remark", description = "备注")
|
|
}) @ApiParam(value = "重考信息", required = true) @RequestBody Map<String, Object> mapParameter) {
|
|
}) @ApiParam(value = "重考信息", required = true) @RequestBody Map<String, Object> mapParameter) {
|
|
- if (Objects.isNull(mapParameter.get("examRecordId")) || Objects.equals(mapParameter.get("examRecordId"), "")) {
|
|
|
|
- throw new BusinessException(ExceptionResultEnum.RECORD_ID_IS_NULL);
|
|
|
|
|
|
+ if (Objects.isNull(mapParameter.get("examStudentId")) || Objects.equals(mapParameter.get("examStudentId"), "")) {
|
|
|
|
+ throw new BusinessException(ExceptionResultEnum.EXAM_STUDENT_ID_IS_NULL);
|
|
}
|
|
}
|
|
- List<String> recordIdList = (List<String>) mapParameter.get("examRecordId");
|
|
|
|
|
|
+ List<String> examStudentIdList = (List<String>) mapParameter.get("examStudentId");
|
|
if (Objects.isNull(mapParameter.get("model")) || Objects.equals(mapParameter.get("model"), "")) {
|
|
if (Objects.isNull(mapParameter.get("model")) || Objects.equals(mapParameter.get("model"), "")) {
|
|
throw new BusinessException("重考方式不能为空");
|
|
throw new BusinessException("重考方式不能为空");
|
|
}
|
|
}
|
|
@@ -84,35 +83,23 @@ public class TEExamReexamController {
|
|
if (Objects.isNull(mapParameter.get("reason")) || Objects.equals(mapParameter.get("reason"), "")) {
|
|
if (Objects.isNull(mapParameter.get("reason")) || Objects.equals(mapParameter.get("reason"), "")) {
|
|
throw new BusinessException("重考原因不能为空");
|
|
throw new BusinessException("重考原因不能为空");
|
|
}
|
|
}
|
|
- if (recordIdList.size() > 0) {
|
|
|
|
|
|
+ List<Long> examStudentIdNotAuditingList = null;
|
|
|
|
+ if (examStudentIdList.size() > 0) {
|
|
|
|
+ examStudentIdNotAuditingList = new ArrayList<>();
|
|
TBUser tbUser = (TBUser) ServletUtil.getRequestAccount();
|
|
TBUser tbUser = (TBUser) ServletUtil.getRequestAccount();
|
|
ReexamReasonEnum reason = ReexamReasonEnum.valueOf(String.valueOf(mapParameter.get("reason")));
|
|
ReexamReasonEnum reason = ReexamReasonEnum.valueOf(String.valueOf(mapParameter.get("reason")));
|
|
- Long examId = null, examStudentId = null, examActivityId = null;
|
|
|
|
Integer reexamAuditing = null, status;
|
|
Integer reexamAuditing = null, status;
|
|
List<TEExamReexamAuditing> teExamReexamAuditingList = new ArrayList<>();
|
|
List<TEExamReexamAuditing> teExamReexamAuditingList = new ArrayList<>();
|
|
- Set<Long> examStudentIdList = new HashSet<>();
|
|
|
|
- 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 {
|
|
|
|
- examId = ExamRecordCacheUtil.getExamId(recordId);
|
|
|
|
- examStudentId = ExamRecordCacheUtil.getExamStudentId(recordId);
|
|
|
|
- examActivityId = ExamRecordCacheUtil.getExamActivityId(recordId);
|
|
|
|
- }
|
|
|
|
- if (redisUtil.lock(SystemConstant.REDIS_LOCK_EXAM_STUDENT_PREFIX + examStudentId, SystemConstant.REDIS_LOCK_REEXAM_EXAM_STUDENT_TIME_OUT)) {
|
|
|
|
- ExamCacheBean examCacheBean = teExamService.getExamCacheBean(examId);//考试缓存
|
|
|
|
|
|
+ List<TEExamStudent> teExamStudentList = teExamStudentService.listByIds(examStudentIdList);
|
|
|
|
+ for (TEExamStudent teExamStudent : teExamStudentList) {
|
|
|
|
+ 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)) {
|
|
if (Objects.isNull(examCacheBean)) {
|
|
throw new BusinessException("考试批次[" + examCacheBean + "]不存在");
|
|
throw new BusinessException("考试批次[" + examCacheBean + "]不存在");
|
|
}
|
|
}
|
|
reexamAuditing = examCacheBean.getReexamAuditing();
|
|
reexamAuditing = examCacheBean.getReexamAuditing();
|
|
status = Objects.isNull(reexamAuditing) || reexamAuditing.intValue() == 0 ? 0 : 1;
|
|
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 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());
|
|
teExamReexam.setCreateId(tbUser.getId());
|
|
teExamReexamService.save(teExamReexam);
|
|
teExamReexamService.save(teExamReexam);
|
|
if (Objects.nonNull(status) && status.intValue() == 1) {
|
|
if (Objects.nonNull(status) && status.intValue() == 1) {
|
|
@@ -125,15 +112,15 @@ public class TEExamReexamController {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} else if (Objects.nonNull(status) && status.intValue() == 0) {//无需审核时考生已考次数-1
|
|
} else if (Objects.nonNull(status) && status.intValue() == 0) {//无需审核时考生已考次数-1
|
|
- examStudentIdList.add(examStudentId);
|
|
|
|
|
|
+ examStudentIdNotAuditingList.add(teExamStudent.getId());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (Objects.nonNull(teExamReexamAuditingList) && teExamReexamAuditingList.size() > 0) {
|
|
if (Objects.nonNull(teExamReexamAuditingList) && teExamReexamAuditingList.size() > 0) {
|
|
teExamReexamAuditingService.saveBatch(teExamReexamAuditingList);
|
|
teExamReexamAuditingService.saveBatch(teExamReexamAuditingList);
|
|
}
|
|
}
|
|
- if (Objects.nonNull(examStudentIdList) && examStudentIdList.size() > 0) {
|
|
|
|
- examStudentIdList.forEach(s -> {
|
|
|
|
|
|
+ if (Objects.nonNull(examStudentIdNotAuditingList) && examStudentIdNotAuditingList.size() > 0) {
|
|
|
|
+ examStudentIdNotAuditingList.forEach(s -> {
|
|
ExamStudentCacheBean examStudentCacheBean = teExamStudentService.getExamStudentCacheBean(s);
|
|
ExamStudentCacheBean examStudentCacheBean = teExamStudentService.getExamStudentCacheBean(s);
|
|
if (Objects.nonNull(examStudentCacheBean)) {
|
|
if (Objects.nonNull(examStudentCacheBean)) {
|
|
Integer alreadyExamCount = Objects.nonNull(examStudentCacheBean.getAlreadyExamCount()) ? examStudentCacheBean.getAlreadyExamCount() : 0;
|
|
Integer alreadyExamCount = Objects.nonNull(examStudentCacheBean.getAlreadyExamCount()) ? examStudentCacheBean.getAlreadyExamCount() : 0;
|