|
@@ -20,7 +20,6 @@ import com.qmth.exam.reserve.service.*;
|
|
import com.qmth.exam.reserve.util.DateUtil;
|
|
import com.qmth.exam.reserve.util.DateUtil;
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
-import org.apache.commons.lang3.time.DateUtils;
|
|
|
|
import org.apache.commons.lang3.time.FastDateFormat;
|
|
import org.apache.commons.lang3.time.FastDateFormat;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.slf4j.LoggerFactory;
|
|
@@ -102,26 +101,42 @@ public class ExamReserveServiceImpl implements ExamReserveService {
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public List<ApplyVO> getStudentApplyList(Long studentId, Boolean cancel) {
|
|
|
|
|
|
+ public List<ApplyVO> getStudentApplyList(LoginUser student, Boolean cancel) {
|
|
|
|
+ CurrentApplyTaskVO curApplyTask = applyTaskService.currentApplyTask(student.getOrgId());
|
|
|
|
+ if (curApplyTask == null) {
|
|
|
|
+ return new ArrayList<>();
|
|
|
|
+ }
|
|
|
|
+
|
|
StudentApplyDao baseMapper = (StudentApplyDao) studentApplyService.getBaseMapper();
|
|
StudentApplyDao baseMapper = (StudentApplyDao) studentApplyService.getBaseMapper();
|
|
- List<ApplyVO> list = baseMapper.getStudentApplyList(studentId, cancel);
|
|
|
|
|
|
+ List<ApplyVO> list = baseMapper.getStudentApplyList(student.getId(), cancel);
|
|
|
|
+
|
|
|
|
+ // 考前N天,禁止考生自主取消预约
|
|
|
|
+ Date allowDate = DateUtil.changeDateAndTimeEnd(new Date(), curApplyTask.getAllowApplyCancelDays());
|
|
|
|
|
|
for (ApplyVO vo : list) {
|
|
for (ApplyVO vo : list) {
|
|
vo.setShowTicket(false);
|
|
vo.setShowTicket(false);
|
|
- vo.setAllowCancel(true);
|
|
|
|
|
|
+ vo.setAllowCancel(false);
|
|
|
|
+
|
|
if (StringUtils.isNotEmpty(vo.getTicketNumber())) {
|
|
if (StringUtils.isNotEmpty(vo.getTicketNumber())) {
|
|
|
|
+ // 准考证号已生成,则可查看
|
|
vo.setShowTicket(true);
|
|
vo.setShowTicket(true);
|
|
}
|
|
}
|
|
- // todo
|
|
|
|
|
|
+
|
|
|
|
+ Date curDate = new Date(vo.getTimePeriodStart());
|
|
|
|
+ if (curDate.after(allowDate)) {
|
|
|
|
+ // “当前时段开始时间”在“允许取消时间”之后,可以取消预约
|
|
|
|
+ vo.setAllowCancel(true);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
return list;
|
|
return list;
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public List<ApplyVO> getStudentApplyListForCurrent(Long studentId) {
|
|
|
|
- List<ApplyVO> list = this.getStudentApplyList(studentId, null);
|
|
|
|
|
|
+ public List<ApplyVO> getStudentApplyListForCurrent(LoginUser student) {
|
|
|
|
+ List<ApplyVO> list = this.getStudentApplyList(student, null);
|
|
// todo
|
|
// todo
|
|
|
|
+
|
|
return list;
|
|
return list;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -152,7 +167,7 @@ public class ExamReserveServiceImpl implements ExamReserveService {
|
|
}
|
|
}
|
|
|
|
|
|
LambdaQueryWrapper<TimePeriodEntity> wrapper = new LambdaQueryWrapper<>();
|
|
LambdaQueryWrapper<TimePeriodEntity> wrapper = new LambdaQueryWrapper<>();
|
|
- wrapper.select(TimePeriodEntity::getStartTime);
|
|
|
|
|
|
+ wrapper.select(TimePeriodEntity::getStartTime);// 只查询startTime等字段
|
|
wrapper.eq(TimePeriodEntity::getApplyTaskId, curApplyTask.getTaskId());
|
|
wrapper.eq(TimePeriodEntity::getApplyTaskId, curApplyTask.getTaskId());
|
|
List<TimePeriodEntity> timePeriods = timePeriodService.list(wrapper);
|
|
List<TimePeriodEntity> timePeriods = timePeriodService.list(wrapper);
|
|
if (CollectionUtils.isEmpty(timePeriods)) {
|
|
if (CollectionUtils.isEmpty(timePeriods)) {
|
|
@@ -160,17 +175,13 @@ public class ExamReserveServiceImpl implements ExamReserveService {
|
|
}
|
|
}
|
|
|
|
|
|
// 考前N天,禁止考生自主预约
|
|
// 考前N天,禁止考生自主预约
|
|
- Date allowDate = DateUtil.changeDateAndBeginZeroTime(curApplyTask.getAllowApplyDays());
|
|
|
|
|
|
+ Date allowDate = DateUtil.changeDateAndTimeEnd(new Date(), curApplyTask.getAllowApplyDays());
|
|
Set<String> dates = new HashSet<>();
|
|
Set<String> dates = new HashSet<>();
|
|
FastDateFormat fdf = FastDateFormat.getInstance("yyyyMMdd");
|
|
FastDateFormat fdf = FastDateFormat.getInstance("yyyyMMdd");
|
|
for (TimePeriodEntity timePeriod : timePeriods) {
|
|
for (TimePeriodEntity timePeriod : timePeriods) {
|
|
Date curDate = new Date(timePeriod.getStartTime());
|
|
Date curDate = new Date(timePeriod.getStartTime());
|
|
- if (allowDate.after(curDate)) {
|
|
|
|
- // 跳过,不在允许的时间内的
|
|
|
|
- continue;
|
|
|
|
- }
|
|
|
|
- if (DateUtils.isSameDay(allowDate, curDate)) {
|
|
|
|
- // 跳过,同一天内的
|
|
|
|
|
|
+ if (curDate.before(allowDate)) {
|
|
|
|
+ // 跳过过期时段,“当前时段开始时间”在“允许预约时间”之前,则禁止预约
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
|
|
|