|
@@ -7,9 +7,14 @@ import com.qmth.exam.reserve.bean.RichTextBean;
|
|
|
import com.qmth.exam.reserve.bean.apply.ApplyTimePeriodResult;
|
|
|
import com.qmth.exam.reserve.bean.apply.ApplyVO;
|
|
|
import com.qmth.exam.reserve.bean.apply.TicketInfo;
|
|
|
+import com.qmth.exam.reserve.bean.apply.TimePeriodInfo;
|
|
|
import com.qmth.exam.reserve.dao.StudentApplyDao;
|
|
|
+import com.qmth.exam.reserve.entity.ApplyTaskEntity;
|
|
|
+import com.qmth.exam.reserve.entity.ExamSiteEntity;
|
|
|
import com.qmth.exam.reserve.entity.StudentApplyEntity;
|
|
|
+import com.qmth.exam.reserve.service.ApplyTaskService;
|
|
|
import com.qmth.exam.reserve.service.ExamReserveService;
|
|
|
+import com.qmth.exam.reserve.service.ExamSiteService;
|
|
|
import com.qmth.exam.reserve.service.StudentApplyService;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.slf4j.Logger;
|
|
@@ -18,6 +23,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
|
|
|
@Service
|
|
@@ -28,9 +34,22 @@ public class ExamReserveServiceImpl implements ExamReserveService {
|
|
|
@Autowired
|
|
|
private StudentApplyService studentApplyService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private ApplyTaskService applyTaskService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ExamSiteService examSiteService;
|
|
|
+
|
|
|
@Override
|
|
|
@Transactional
|
|
|
public void saveStudentApply(Long studentId, Long examSiteId, Long timePeriodId) {
|
|
|
+ if (examSiteId == null) {
|
|
|
+ throw new StatusException("考点ID不能为空");
|
|
|
+ }
|
|
|
+ if (timePeriodId == null) {
|
|
|
+ throw new StatusException("预约时段ID不能为空");
|
|
|
+ }
|
|
|
+
|
|
|
LambdaQueryWrapper<StudentApplyEntity> wrapper = new LambdaQueryWrapper<>();
|
|
|
wrapper.eq(StudentApplyEntity::getStudentId, studentId);
|
|
|
wrapper.eq(StudentApplyEntity::getExamSiteId, examSiteId);
|
|
@@ -116,22 +135,70 @@ public class ExamReserveServiceImpl implements ExamReserveService {
|
|
|
|
|
|
@Override
|
|
|
public List<String> getApplyDateList(Long studentId) {
|
|
|
- return null;
|
|
|
+ List<String> dateList = new ArrayList<>();
|
|
|
+ dateList.add("20240410");
|
|
|
+ dateList.add("20240411");
|
|
|
+ dateList.add("20240412");
|
|
|
+ // todo
|
|
|
+ return dateList;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public ApplyTimePeriodResult getApplyTimePeriodList(Long studentId, Long examSiteId, String date) {
|
|
|
- return null;
|
|
|
+ if (examSiteId == null) {
|
|
|
+ throw new StatusException("考点ID不能为空");
|
|
|
+ }
|
|
|
+ if (StringUtils.isEmpty(date)) {
|
|
|
+ throw new StatusException("预约日期不能为空");
|
|
|
+ }
|
|
|
+
|
|
|
+ ApplyTimePeriodResult result = new ApplyTimePeriodResult();
|
|
|
+ result.setUnApplyNumber(1);
|
|
|
+
|
|
|
+ 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);
|
|
|
+ result.setPeriodList(periodList);
|
|
|
+
|
|
|
+ // todo
|
|
|
+ return result;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public RichTextBean getExamNotice(Long studentId, Long applyTaskId) {
|
|
|
- return null;
|
|
|
+ public RichTextBean getExamNotice(Long applyTaskId) {
|
|
|
+ if (applyTaskId == null) {
|
|
|
+ throw new StatusException("预约任务ID不能为空");
|
|
|
+ }
|
|
|
+
|
|
|
+ ApplyTaskEntity applyTask = applyTaskService.getById(applyTaskId);
|
|
|
+ if (applyTask == null) {
|
|
|
+ throw new StatusException("考试须知信息不存在");
|
|
|
+ }
|
|
|
+
|
|
|
+ RichTextBean bean = new RichTextBean();
|
|
|
+ bean.setContent(applyTask.getNotice());
|
|
|
+ return bean;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public RichTextBean getExamRoomGuide(Long studentId, Long examRoomId) {
|
|
|
- return null;
|
|
|
+ public RichTextBean getExamSiteGuide(Long examSiteId) {
|
|
|
+ if (examSiteId == null) {
|
|
|
+ throw new StatusException("考点ID不能为空");
|
|
|
+ }
|
|
|
+
|
|
|
+ ExamSiteEntity examSite = examSiteService.getById(examSiteId);
|
|
|
+ if (examSite == null) {
|
|
|
+ throw new StatusException("考场引导信息不存在");
|
|
|
+ }
|
|
|
+
|
|
|
+ RichTextBean bean = new RichTextBean();
|
|
|
+ bean.setContent(examSite.getGuide());
|
|
|
+ return bean;
|
|
|
}
|
|
|
|
|
|
}
|