|
@@ -14,6 +14,7 @@ import com.qmth.exam.reserve.entity.ApplyTaskEntity;
|
|
import com.qmth.exam.reserve.entity.ExamSiteEntity;
|
|
import com.qmth.exam.reserve.entity.ExamSiteEntity;
|
|
import com.qmth.exam.reserve.entity.StudentApplyEntity;
|
|
import com.qmth.exam.reserve.entity.StudentApplyEntity;
|
|
import com.qmth.exam.reserve.entity.TimePeriodEntity;
|
|
import com.qmth.exam.reserve.entity.TimePeriodEntity;
|
|
|
|
+import com.qmth.exam.reserve.enums.ApplyStatus;
|
|
import com.qmth.exam.reserve.service.*;
|
|
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;
|
|
@@ -26,6 +27,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
+import java.text.ParseException;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
|
|
|
@Service
|
|
@Service
|
|
@@ -189,20 +191,46 @@ public class ExamReserveServiceImpl implements ExamReserveService {
|
|
throw new StatusException("预约日期不能为空");
|
|
throw new StatusException("预约日期不能为空");
|
|
}
|
|
}
|
|
|
|
|
|
- ApplyTimePeriodResult result = new ApplyTimePeriodResult();
|
|
|
|
- result.setUnApplyNumber(1);
|
|
|
|
|
|
+ Date startTime, endTime;
|
|
|
|
+ try {
|
|
|
|
+ FastDateFormat fdf = FastDateFormat.getInstance("yyyyMMddHHmmss");
|
|
|
|
+ startTime = fdf.parse(date + "000000");
|
|
|
|
+ endTime = fdf.parse(date + "235959");
|
|
|
|
+ } catch (ParseException e) {
|
|
|
|
+ log.error(e.getMessage(), e);
|
|
|
|
+ throw new StatusException("预约日期值的格式不正确");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 获取当前启用的预约任务
|
|
|
|
+ CurrentApplyTaskVO curApplyTask = applyTaskService.currentApplyTask();
|
|
|
|
+ if (curApplyTask == null) {
|
|
|
|
+ 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);
|
|
|
|
|
|
List<TimePeriodInfo> periodList = new ArrayList<>();
|
|
List<TimePeriodInfo> periodList = new ArrayList<>();
|
|
- TimePeriodInfo period = new TimePeriodInfo();
|
|
|
|
- period.setTimePeriodId(1L);
|
|
|
|
- period.setTimePeriodStart(System.currentTimeMillis());
|
|
|
|
- period.setTimePeriodEnd(System.currentTimeMillis() + 10000);
|
|
|
|
- period.setStatus("");
|
|
|
|
- period.setAvailableCount(1);
|
|
|
|
- periodList.add(period);
|
|
|
|
|
|
+ if (CollectionUtils.isNotEmpty(timePeriods)) {
|
|
|
|
+ for (TimePeriodEntity timePeriod : timePeriods) {
|
|
|
|
+ TimePeriodInfo info = new TimePeriodInfo();
|
|
|
|
+ info.setTimePeriodId(timePeriod.getId());
|
|
|
|
+ info.setTimePeriodStart(timePeriod.getStartTime());
|
|
|
|
+ info.setTimePeriodEnd(timePeriod.getEndTime());
|
|
|
|
+ info.setStatus(ApplyStatus.AVAILABLE);
|
|
|
|
+ info.setAvailableCount(1);
|
|
|
|
+ periodList.add(info);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ // todo
|
|
|
|
+
|
|
|
|
+ ApplyTimePeriodResult result = new ApplyTimePeriodResult();
|
|
|
|
+ result.setUnApplyNumber(1);
|
|
result.setPeriodList(periodList);
|
|
result.setPeriodList(periodList);
|
|
|
|
|
|
- // todo
|
|
|
|
return result;
|
|
return result;
|
|
}
|
|
}
|
|
|
|
|