|
@@ -59,25 +59,30 @@ public class ExamReserveServiceImpl implements ExamReserveService {
|
|
|
|
|
|
CurrentApplyTaskVO curApplyTask = applyTaskService.currentApplyTask(student.getOrgId());
|
|
CurrentApplyTaskVO curApplyTask = applyTaskService.currentApplyTask(student.getOrgId());
|
|
if (curApplyTask == null) {
|
|
if (curApplyTask == null) {
|
|
|
|
+ log.warn("预约失败,尚未开启预约任务!stuApplyTaskId:{}", student.getApplyTaskId());
|
|
throw new StatusException("尚未开启预约任务");
|
|
throw new StatusException("尚未开启预约任务");
|
|
}
|
|
}
|
|
|
|
|
|
if (!curApplyTask.getTaskId().equals(student.getApplyTaskId())) {
|
|
if (!curApplyTask.getTaskId().equals(student.getApplyTaskId())) {
|
|
|
|
+ log.warn("预约失败,当前预约任务与学生的不匹配!curApplyTaskId:{} stuApplyTaskId:{}", curApplyTask.getTaskId(), student.getApplyTaskId());
|
|
throw new StatusException("当前预约任务与学生的不匹配");
|
|
throw new StatusException("当前预约任务与学生的不匹配");
|
|
}
|
|
}
|
|
|
|
|
|
StudentEntity stu = studentService.findLessInfoByStudentId(student.getId());
|
|
StudentEntity stu = studentService.findLessInfoByStudentId(student.getId());
|
|
if (stu == null) {
|
|
if (stu == null) {
|
|
|
|
+ log.warn("预约失败,学生信息不存在!studentId:{}", student.getId());
|
|
throw new StatusException("学生信息不存在");
|
|
throw new StatusException("学生信息不存在");
|
|
}
|
|
}
|
|
|
|
|
|
if (stu.getApplyFinished()) {
|
|
if (stu.getApplyFinished()) {
|
|
- String msg = "当前已完成预约时段" + stu.getApplyNumber() + "次,无剩余可约时段";
|
|
|
|
- throw new StatusException(msg);
|
|
|
|
|
|
+ String msg = "当前学生无剩余可约时段,已完成预约" + stu.getApplyNumber() + "次";
|
|
|
|
+ log.warn(msg);
|
|
|
|
+ // throw new StatusException(msg);
|
|
}
|
|
}
|
|
|
|
|
|
TimePeriodEntity timePeriod = timePeriodService.getById(timePeriodId);
|
|
TimePeriodEntity timePeriod = timePeriodService.getById(timePeriodId);
|
|
if (timePeriod == null || !curApplyTask.getTaskId().equals(timePeriod.getApplyTaskId())) {
|
|
if (timePeriod == null || !curApplyTask.getTaskId().equals(timePeriod.getApplyTaskId())) {
|
|
|
|
+ log.warn("预约失败,当前预约时段信息有误!timePeriodId:{}", timePeriodId);
|
|
throw new StatusException("当前预约时段信息有误");
|
|
throw new StatusException("当前预约时段信息有误");
|
|
}
|
|
}
|
|
|
|
|
|
@@ -86,6 +91,8 @@ public class ExamReserveServiceImpl implements ExamReserveService {
|
|
Date curDate = new Date(timePeriod.getStartTime());
|
|
Date curDate = new Date(timePeriod.getStartTime());
|
|
if (curDate.before(allowDate)) {
|
|
if (curDate.before(allowDate)) {
|
|
// 跳过过期时段,“当前时段开始时间”在“允许预约时间”之前,则禁止预约
|
|
// 跳过过期时段,“当前时段开始时间”在“允许预约时间”之前,则禁止预约
|
|
|
|
+ log.warn("预约失败,当前预约时段已禁止预约!allowApplyDays:{} timePeriodStart:{}",
|
|
|
|
+ curApplyTask.getAllowApplyDays(), timePeriod.getStartTime());
|
|
throw new StatusException("当前预约时段已禁止预约");
|
|
throw new StatusException("当前预约时段已禁止预约");
|
|
}
|
|
}
|
|
|
|
|
|
@@ -106,6 +113,7 @@ public class ExamReserveServiceImpl implements ExamReserveService {
|
|
StudentApplyEntity existEntity = studentApplyService.getOne(wrapper);
|
|
StudentApplyEntity existEntity = studentApplyService.getOne(wrapper);
|
|
if (existEntity != null) {
|
|
if (existEntity != null) {
|
|
if (!existEntity.getCancel()) {
|
|
if (!existEntity.getCancel()) {
|
|
|
|
+ log.warn("预约失败,当前时段已预约,请勿重复预约!applyId:{}", existEntity.getId());
|
|
throw new StatusException("当前时段已预约,请勿重复预约");
|
|
throw new StatusException("当前时段已预约,请勿重复预约");
|
|
}
|
|
}
|
|
|
|
|
|
@@ -120,9 +128,9 @@ public class ExamReserveServiceImpl implements ExamReserveService {
|
|
entity.setOperateId(student.getId());
|
|
entity.setOperateId(student.getId());
|
|
entity.setCancel(false);
|
|
entity.setCancel(false);
|
|
studentApplyService.save(entity);
|
|
studentApplyService.save(entity);
|
|
|
|
+ log.warn("新增考生预约记录!applyId:{} examSiteId:{} timePeriodId:{}", entity.getId(), examSiteId, timePeriodId);
|
|
}
|
|
}
|
|
|
|
|
|
- // todo
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -134,12 +142,50 @@ public class ExamReserveServiceImpl implements ExamReserveService {
|
|
|
|
|
|
CurrentApplyTaskVO curApplyTask = applyTaskService.currentApplyTask(student.getOrgId());
|
|
CurrentApplyTaskVO curApplyTask = applyTaskService.currentApplyTask(student.getOrgId());
|
|
if (curApplyTask == null) {
|
|
if (curApplyTask == null) {
|
|
- throw new StatusException("尚未开启预约任务");
|
|
|
|
|
|
+ log.warn("取消预约失败,尚未开启预约任务!stuApplyTaskId:{} applyId:{}", student.getApplyTaskId(), applyId);
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ if (!curApplyTask.getTaskId().equals(student.getApplyTaskId())) {
|
|
|
|
+ log.warn("取消预约失败,当前预约任务与学生的不匹配!curApplyTaskId:{} stuApplyTaskId:{}", curApplyTask.getTaskId(), student.getApplyTaskId());
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ StudentApplyEntity studentApply = studentApplyService.getById(applyId);
|
|
|
|
+ if (studentApply == null) {
|
|
|
|
+ log.warn("取消预约失败,预约记录不存在!applyId:{}", applyId);
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ if (!studentApply.getStudentId().equals(student.getId())) {
|
|
|
|
+ log.warn("取消预约失败,预约记录与当前学生的不匹配!applyId:{} {}!={}", applyId, studentApply.getStudentId(), student.getId());
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (studentApply.getCancel()) {
|
|
|
|
+ log.warn("当前时段已取消预约,忽略重复取消!applyId:{}", applyId);
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ TimePeriodEntity timePeriod = timePeriodService.getById(studentApply.getTimePeriodId());
|
|
|
|
+ if (timePeriod == null) {
|
|
|
|
+ log.warn("取消预约失败,预约时段不存在!applyId:{} timePeriodId:{}", applyId, studentApply.getTimePeriodId());
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 考前N天,禁止考生自主取消预约
|
|
|
|
+ Date allowDate = DateUtil.changeDateAndTimeEnd(new Date(), curApplyTask.getAllowApplyCancelDays());
|
|
|
|
+ Date curDate = new Date(timePeriod.getStartTime());
|
|
|
|
+ if (curDate.before(allowDate)) {
|
|
|
|
+ // “当前时段开始时间”在“允许取消时间”之前,禁止取消预约
|
|
|
|
+ log.warn("取消预约失败,当前预约记录已禁止取消预约!allowApplyCancelDays:{} timePeriodStart:{}",
|
|
|
|
+ curApplyTask.getAllowApplyCancelDays(), timePeriod.getStartTime());
|
|
|
|
+ throw new StatusException("当前预约记录已禁止取消预约");
|
|
}
|
|
}
|
|
|
|
|
|
// todo
|
|
// todo
|
|
- // 考前多少天,禁止考生自主取消预约(考前是指已预约时段的开始时间)
|
|
|
|
|
|
+ // 考生预约操作锁
|
|
|
|
+ // 更新预约时段、机房容量等操作
|
|
// 系统自动预约“任务执行期间”不允许取消预约
|
|
// 系统自动预约“任务执行期间”不允许取消预约
|
|
|
|
+
|
|
this.updateStudentApplyForCancel(applyId, true, student.getId());
|
|
this.updateStudentApplyForCancel(applyId, true, student.getId());
|
|
}
|
|
}
|
|
|
|
|
|
@@ -150,7 +196,7 @@ public class ExamReserveServiceImpl implements ExamReserveService {
|
|
updateWrapper.set(StudentApplyEntity::getUpdateTime, System.currentTimeMillis());
|
|
updateWrapper.set(StudentApplyEntity::getUpdateTime, System.currentTimeMillis());
|
|
updateWrapper.eq(StudentApplyEntity::getId, applyId);
|
|
updateWrapper.eq(StudentApplyEntity::getId, applyId);
|
|
studentApplyService.update(updateWrapper);
|
|
studentApplyService.update(updateWrapper);
|
|
- log.warn("更新考生预约记录,ID:{},取消状态:{}", applyId, cancel);
|
|
|
|
|
|
+ log.warn("更新考生预约记录!applyId:{} cancel:{}", applyId, cancel);
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|