|
@@ -93,10 +93,10 @@ public class ExamReserveServiceImpl implements ExamReserveService {
|
|
|
throw new StatusException("当前预约任务与学生的不匹配");
|
|
|
}
|
|
|
|
|
|
- ExamSiteTimePeriodInfo timePeriod = timePeriodExamSiteService.findOneTimePeriodForApply(curApplyTask.getTaskId(), examSiteId, timePeriodId);
|
|
|
+ ExamSiteTimePeriodInfo timePeriod = timePeriodExamSiteService.findOneExamSiteTimePeriod(curApplyTask.getTaskId(), examSiteId, timePeriodId);
|
|
|
if (timePeriod == null || !timePeriod.getEnable()) {
|
|
|
- log.warn("预约失败,当前预约时段信息有误!timePeriodId:{}", timePeriodId);
|
|
|
- throw new StatusException("当前预约时段信息有误");
|
|
|
+ log.warn("预约失败,当前预约时段不存在或未启用!timePeriodId:{}", timePeriodId);
|
|
|
+ throw new StatusException("当前预约时段不存在或未启用");
|
|
|
}
|
|
|
|
|
|
// 考前N天,禁止考生自主预约
|
|
@@ -502,7 +502,10 @@ public class ExamReserveServiceImpl implements ExamReserveService {
|
|
|
return dateList;
|
|
|
}
|
|
|
|
|
|
- List<ExamSiteTimePeriodInfo> timePeriods = timePeriodExamSiteService.findAllTimePeriodsForApply(curApplyTask.getTaskId(), examSiteId);
|
|
|
+ ExamSiteTimePeriodQuery periodQuery = new ExamSiteTimePeriodQuery();
|
|
|
+ periodQuery.setApplyTaskId(curApplyTask.getTaskId());
|
|
|
+ periodQuery.setExamSiteId(examSiteId);
|
|
|
+ List<ExamSiteTimePeriodInfo> timePeriods = timePeriodExamSiteService.findExamSiteTimePeriods(periodQuery);
|
|
|
if (CollectionUtils.isEmpty(timePeriods)) {
|
|
|
return dateList;
|
|
|
}
|
|
@@ -540,11 +543,11 @@ public class ExamReserveServiceImpl implements ExamReserveService {
|
|
|
throw new StatusException("预约日期不能为空");
|
|
|
}
|
|
|
|
|
|
- Date startTime, endTime;
|
|
|
+ Date timeBegin, timeEnd;
|
|
|
try {
|
|
|
FastDateFormat fdf = FastDateFormat.getInstance("yyyyMMddHHmmss");
|
|
|
- startTime = fdf.parse(date + "000000");
|
|
|
- endTime = fdf.parse(date + "235959");
|
|
|
+ timeBegin = fdf.parse(date + "000000");
|
|
|
+ timeEnd = fdf.parse(date + "235959");
|
|
|
} catch (ParseException e) {
|
|
|
log.error(e.getMessage(), e);
|
|
|
throw new StatusException("预约日期值的格式不正确");
|
|
@@ -560,11 +563,12 @@ public class ExamReserveServiceImpl implements ExamReserveService {
|
|
|
throw new StatusException("未到预约时间");
|
|
|
}
|
|
|
|
|
|
- LambdaQueryWrapper<TimePeriodEntity> wrapper = new LambdaQueryWrapper<>();
|
|
|
- wrapper.select(TimePeriodEntity::getId, TimePeriodEntity::getStartTime, TimePeriodEntity::getEndTime);
|
|
|
- wrapper.eq(TimePeriodEntity::getApplyTaskId, curApplyTask.getTaskId());
|
|
|
- wrapper.between(TimePeriodEntity::getStartTime, startTime.getTime(), endTime.getTime());
|
|
|
- List<TimePeriodEntity> timePeriods = timePeriodService.list(wrapper);
|
|
|
+ ExamSiteTimePeriodQuery periodQuery = new ExamSiteTimePeriodQuery();
|
|
|
+ periodQuery.setApplyTaskId(curApplyTask.getTaskId());
|
|
|
+ periodQuery.setExamSiteId(examSiteId);
|
|
|
+ periodQuery.setTimeBegin(timeBegin.getTime());
|
|
|
+ periodQuery.setTimeEnd(timeEnd.getTime());
|
|
|
+ List<ExamSiteTimePeriodInfo> timePeriods = timePeriodExamSiteService.findExamSiteTimePeriods(periodQuery);
|
|
|
|
|
|
// 获取某考生的 所有的“预约记录”
|
|
|
Map<String, ApplyRecordCacheBean> maps = applyTaskCacheService.getStudentApplyRecordsFromDB(student.getId());
|
|
@@ -581,13 +585,14 @@ public class ExamReserveServiceImpl implements ExamReserveService {
|
|
|
|
|
|
List<TimePeriodInfo> periodList = new ArrayList<>();
|
|
|
if (CollectionUtils.isNotEmpty(timePeriods)) {
|
|
|
- for (TimePeriodEntity timePeriod : timePeriods) {
|
|
|
+ for (ExamSiteTimePeriodInfo timePeriod : timePeriods) {
|
|
|
TimePeriodInfo info = new TimePeriodInfo();
|
|
|
- info.setTimePeriodId(timePeriod.getId());
|
|
|
+ info.setTimePeriodId(timePeriod.getTimePeriodId());
|
|
|
info.setTimePeriodStart(timePeriod.getStartTime());
|
|
|
info.setTimePeriodEnd(timePeriod.getEndTime());
|
|
|
+ info.setEnable(timePeriod.getEnable());
|
|
|
|
|
|
- int availableCount = applyTaskCacheService.getApplyAvailableCount(examSiteId, timePeriod.getId());
|
|
|
+ int availableCount = applyTaskCacheService.getApplyAvailableCount(examSiteId, timePeriod.getTimePeriodId());
|
|
|
info.setAvailableCount(availableCount);
|
|
|
if (availableCount < 1) {
|
|
|
info.setStatus(ApplyStatus.FULL);
|
|
@@ -595,7 +600,7 @@ public class ExamReserveServiceImpl implements ExamReserveService {
|
|
|
info.setStatus(ApplyStatus.AVAILABLE);
|
|
|
}
|
|
|
|
|
|
- String hashKey = String.format("%s_%s", examSiteId, timePeriod.getId());
|
|
|
+ String hashKey = String.format("%s_%s", examSiteId, timePeriod.getTimePeriodId());
|
|
|
ApplyRecordCacheBean existApply = maps.get(hashKey);
|
|
|
if (existApply != null && !existApply.getCancel()) {
|
|
|
info.setStatus(ApplyStatus.FINISHED);
|