deason 1 anno fa
parent
commit
fc866ef931

+ 17 - 3
src/main/java/com/qmth/exam/reserve/service/impl/ExamReserveServiceImpl.java

@@ -109,6 +109,9 @@ public class ExamReserveServiceImpl implements ExamReserveService {
 
         StudentApplyDao baseMapper = (StudentApplyDao) studentApplyService.getBaseMapper();
         List<ApplyVO> list = baseMapper.getStudentApplyList(student.getId(), cancel);
+        if (CollectionUtils.isEmpty(list)) {
+            return new ArrayList<>();
+        }
 
         // 考前N天,禁止考生自主取消预约
         Date allowDate = DateUtil.changeDateAndTimeEnd(new Date(), curApplyTask.getAllowApplyCancelDays());
@@ -134,10 +137,21 @@ public class ExamReserveServiceImpl implements ExamReserveService {
 
     @Override
     public List<ApplyVO> getStudentApplyListForCurrent(LoginUser student) {
-        List<ApplyVO> list = this.getStudentApplyList(student, null);
-        // todo
+        // 默认过滤掉“已取消预约”的记录
+        List<ApplyVO> list = this.getStudentApplyList(student, false);
 
-        return list;
+        Date now = new Date();
+        List<ApplyVO> newList = new ArrayList<>();
+        for (ApplyVO vo : list) {
+            Date curDate = new Date(vo.getTimePeriodEnd());
+            if (curDate.before(now)) {
+                // “当前时段结束时间”在“当前时间”之前,则过滤掉
+                continue;
+            }
+            newList.add(vo);
+        }
+
+        return newList;
     }
 
     @Override