|
@@ -179,14 +179,17 @@ public class ExamReserveServiceImpl implements ExamReserveService {
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@Transactional
|
|
@Transactional
|
|
- public void cancelStudentApply(LoginUser student, Long applyId) {
|
|
|
|
- if (applyId == null) {
|
|
|
|
- throw new StatusException("预约记录ID不能为空");
|
|
|
|
|
|
+ public void cancelStudentApply(LoginUser student, Long examSiteId, Long timePeriodId) {
|
|
|
|
+ if (examSiteId == null) {
|
|
|
|
+ throw new StatusException("考点ID不能为空");
|
|
|
|
+ }
|
|
|
|
+ if (timePeriodId == null) {
|
|
|
|
+ throw new StatusException("预约时段ID不能为空");
|
|
}
|
|
}
|
|
|
|
|
|
CurrentApplyTaskVO curApplyTask = applyTaskCacheService.currentApplyTask(student.getOrgId());
|
|
CurrentApplyTaskVO curApplyTask = applyTaskCacheService.currentApplyTask(student.getOrgId());
|
|
if (curApplyTask == null) {
|
|
if (curApplyTask == null) {
|
|
- log.warn("取消预约失败,尚未开启预约任务!stuApplyTaskId:{} applyId:{}", student.getApplyTaskId(), applyId);
|
|
|
|
|
|
+ log.warn("取消预约失败,尚未开启预约任务!stuApplyTaskId:{}", student.getApplyTaskId());
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
if (!curApplyTask.getTaskId().equals(student.getApplyTaskId())) {
|
|
if (!curApplyTask.getTaskId().equals(student.getApplyTaskId())) {
|
|
@@ -194,24 +197,24 @@ public class ExamReserveServiceImpl implements ExamReserveService {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
- StudentApplyEntity studentApply = studentApplyService.getById(applyId);
|
|
|
|
|
|
+ LambdaQueryWrapper<StudentApplyEntity> wrapper = new LambdaQueryWrapper<>();
|
|
|
|
+ wrapper.eq(StudentApplyEntity::getExamSiteId, examSiteId);
|
|
|
|
+ wrapper.eq(StudentApplyEntity::getTimePeriodId, timePeriodId);
|
|
|
|
+ wrapper.eq(StudentApplyEntity::getStudentId, student.getId());
|
|
|
|
+ StudentApplyEntity studentApply = studentApplyService.getOne(wrapper);
|
|
if (studentApply == null) {
|
|
if (studentApply == null) {
|
|
- log.warn("取消预约失败,预约记录不存在!applyId:{}", applyId);
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
- if (!studentApply.getStudentId().equals(student.getId())) {
|
|
|
|
- log.warn("取消预约失败,预约记录与当前学生的不匹配!applyId:{} {}!={}", applyId, studentApply.getStudentId(), student.getId());
|
|
|
|
|
|
+ log.warn("取消预约失败,预约记录不存在!examSiteId:{} timePeriodId:{}", examSiteId, timePeriodId);
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
if (studentApply.getCancel()) {
|
|
if (studentApply.getCancel()) {
|
|
- log.warn("当前时段已取消预约,忽略重复取消!applyId:{}", applyId);
|
|
|
|
|
|
+ log.warn("当前时段已取消预约,忽略重复取消!examSiteId:{} timePeriodId:{}", examSiteId, timePeriodId);
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
- TimePeriodEntity timePeriod = timePeriodService.getById(studentApply.getTimePeriodId());
|
|
|
|
|
|
+ TimePeriodEntity timePeriod = timePeriodService.getById(timePeriodId);
|
|
if (timePeriod == null) {
|
|
if (timePeriod == null) {
|
|
- log.warn("取消预约失败,预约时段不存在!applyId:{} timePeriodId:{}", applyId, studentApply.getTimePeriodId());
|
|
|
|
|
|
+ log.warn("取消预约失败,预约时段不存在!examSiteId:{} timePeriodId:{}", examSiteId, timePeriodId);
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -240,7 +243,7 @@ public class ExamReserveServiceImpl implements ExamReserveService {
|
|
throw new StatusException(Constants.SYSTEM_BUSY);
|
|
throw new StatusException(Constants.SYSTEM_BUSY);
|
|
}
|
|
}
|
|
|
|
|
|
- this.updateStudentApplyForCancel(applyId, true, student.getId());
|
|
|
|
|
|
+ this.updateStudentApplyForCancel(studentApply.getId(), true, student.getId());
|
|
|
|
|
|
// 某考点某时段的“已预约数量” 累减1
|
|
// 某考点某时段的“已预约数量” 累减1
|
|
applyTaskCacheService.decreaseApplyFinishCount(studentApply.getExamSiteId(), studentApply.getTimePeriodId());
|
|
applyTaskCacheService.decreaseApplyFinishCount(studentApply.getExamSiteId(), studentApply.getTimePeriodId());
|
|
@@ -328,15 +331,19 @@ public class ExamReserveServiceImpl implements ExamReserveService {
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public TicketInfo getApplyTicket(Long studentId, Long applyId) {
|
|
|
|
|
|
+ public TicketInfo getApplyTicket(Long studentId, Long examSiteId, Long timePeriodId) {
|
|
|
|
+ if (examSiteId == null) {
|
|
|
|
+ throw new StatusException("考点ID不能为空");
|
|
|
|
+ }
|
|
|
|
+ if (timePeriodId == null) {
|
|
|
|
+ throw new StatusException("预约时段ID不能为空");
|
|
|
|
+ }
|
|
|
|
+
|
|
StudentApplyDao baseMapper = (StudentApplyDao) studentApplyService.getBaseMapper();
|
|
StudentApplyDao baseMapper = (StudentApplyDao) studentApplyService.getBaseMapper();
|
|
- TicketInfo info = baseMapper.getStudentApplyTicket(applyId);
|
|
|
|
|
|
+ TicketInfo info = baseMapper.getStudentApplyTicket(studentId, examSiteId, timePeriodId);
|
|
if (info == null || info.getCancel()) {
|
|
if (info == null || info.getCancel()) {
|
|
throw new StatusException("准考证信息不存在");
|
|
throw new StatusException("准考证信息不存在");
|
|
}
|
|
}
|
|
- if (!info.getStudentId().equals(studentId)) {
|
|
|
|
- throw new StatusException("准考证信息不匹配");
|
|
|
|
- }
|
|
|
|
if (StringUtils.isEmpty(info.getTicketNumber())) {
|
|
if (StringUtils.isEmpty(info.getTicketNumber())) {
|
|
throw new StatusException("准考证信息尚未生成");
|
|
throw new StatusException("准考证信息尚未生成");
|
|
}
|
|
}
|