deason 8 hónapja
szülő
commit
fd3cc3992f

+ 6 - 0
src/main/java/com/qmth/exam/reserve/bean/apply/TicketInfo.java

@@ -2,10 +2,13 @@ package com.qmth.exam.reserve.bean.apply;
 
 import com.fasterxml.jackson.annotation.JsonIgnore;
 import com.qmth.exam.reserve.bean.IModel;
+import com.qmth.exam.reserve.bean.course.CourseVO;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Getter;
 import lombok.Setter;
 
+import java.util.List;
+
 @Getter
 @Setter
 public class TicketInfo implements IModel {
@@ -76,4 +79,7 @@ public class TicketInfo implements IModel {
     @ApiModelProperty(value = "考场地址")
     private String examRoomAddress;
 
+    @ApiModelProperty(value = "科目列表")
+    private List<CourseVO> courses;
+
 }

+ 20 - 0
src/main/java/com/qmth/exam/reserve/bean/course/CourseVO.java

@@ -0,0 +1,20 @@
+package com.qmth.exam.reserve.bean.course;
+
+import com.qmth.exam.reserve.bean.IModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+
+@Getter
+@Setter
+public class CourseVO implements IModel {
+
+    private static final long serialVersionUID = 8158455040867688700L;
+
+    @ApiModelProperty(value = "科目代码")
+    private String courseCode;
+
+    @ApiModelProperty(value = "科目名称")
+    private String courseName;
+
+}

+ 2 - 2
src/main/java/com/qmth/exam/reserve/controller/student/StudentApplyController.java

@@ -110,8 +110,8 @@ public class StudentApplyController extends BaseController {
 
     @ApiOperation(value = "获取可预约的“日期”列表", notes = "日期格式:yyyyMMdd")
     @PostMapping(value = "/apply/date/list")
-    public List<String> dateList() {
-        return examReserveService.getApplyDateList(curLoginStudent());
+    public List<String> dateList(@ApiParam("考点ID") @RequestParam Long examSiteId) {
+        return examReserveService.getApplyDateList(curLoginStudent(), examSiteId);
     }
 
     @ApiOperation(value = "获取可预约的“时段”列表")

+ 1 - 1
src/main/java/com/qmth/exam/reserve/service/ExamReserveService.java

@@ -22,7 +22,7 @@ public interface ExamReserveService {
 
     TicketInfo getApplyTicket(Long studentId, Long examSiteId, Long timePeriodId);
 
-    List<String> getApplyDateList(LoginUser student);
+    List<String> getApplyDateList(LoginUser student, Long examSiteId);
 
     ApplyTimePeriodResult getApplyTimePeriodList(LoginUser student, Long examSiteId, String date);
 

+ 5 - 0
src/main/java/com/qmth/exam/reserve/service/StudentCourseService.java

@@ -1,8 +1,13 @@
 package com.qmth.exam.reserve.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.qmth.exam.reserve.bean.course.CourseVO;
 import com.qmth.exam.reserve.entity.StudentCourseEntity;
 
+import java.util.List;
+
 public interface StudentCourseService extends IService<StudentCourseEntity> {
 
+    List<CourseVO> getStudentCourses(Long studentId);
+
 }

+ 12 - 1
src/main/java/com/qmth/exam/reserve/service/impl/ExamReserveServiceImpl.java

@@ -8,6 +8,7 @@ import com.qmth.exam.reserve.bean.Constants;
 import com.qmth.exam.reserve.bean.RichTextBean;
 import com.qmth.exam.reserve.bean.apply.*;
 import com.qmth.exam.reserve.bean.applytask.CurrentApplyTaskVO;
+import com.qmth.exam.reserve.bean.course.CourseVO;
 import com.qmth.exam.reserve.bean.examsite.ExamSiteCacheBean;
 import com.qmth.exam.reserve.bean.login.LoginUser;
 import com.qmth.exam.reserve.cache.CacheConstants;
@@ -58,6 +59,9 @@ public class ExamReserveServiceImpl implements ExamReserveService {
     @Autowired
     private StudentApplyService studentApplyService;
 
+    @Autowired
+    private StudentCourseService studentCourseService;
+
     @Autowired
     private ConcurrentService concurrentService;
 
@@ -475,11 +479,18 @@ public class ExamReserveServiceImpl implements ExamReserveService {
         if (StringUtils.isEmpty(info.getTicketNumber())) {
             throw new StatusException("准考证信息尚未生成");
         }
+
+        List<CourseVO> courses = studentCourseService.getStudentCourses(studentId);
+        info.setCourses(courses);
         return info;
     }
 
     @Override
-    public List<String> getApplyDateList(LoginUser student) {
+    public List<String> getApplyDateList(LoginUser student, Long examSiteId) {
+        if (examSiteId == null) {
+            throw new StatusException("考点ID不能为空");
+        }
+
         // 日期格式:yyyyMMdd
         List<String> dateList = new ArrayList<>();
 

+ 28 - 0
src/main/java/com/qmth/exam/reserve/service/impl/StudentCourseServiceImpl.java

@@ -1,12 +1,40 @@
 package com.qmth.exam.reserve.service.impl;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.qmth.exam.reserve.bean.course.CourseVO;
 import com.qmth.exam.reserve.dao.StudentCourseDao;
 import com.qmth.exam.reserve.entity.StudentCourseEntity;
 import com.qmth.exam.reserve.service.StudentCourseService;
+import org.apache.commons.collections4.CollectionUtils;
 import org.springframework.stereotype.Service;
 
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
 @Service
 public class StudentCourseServiceImpl extends ServiceImpl<StudentCourseDao, StudentCourseEntity> implements StudentCourseService {
 
+    @Override
+    public List<CourseVO> getStudentCourses(Long studentId) {
+        LambdaQueryWrapper<StudentCourseEntity> wrapper = new LambdaQueryWrapper<>();
+        wrapper.select(StudentCourseEntity::getCourseCode, StudentCourseEntity::getCourseName);
+        wrapper.eq(StudentCourseEntity::getStudentId, studentId);
+        List<StudentCourseEntity> entities = this.list(wrapper);
+
+        if (CollectionUtils.isEmpty(entities)) {
+            return Collections.emptyList();
+        }
+
+        List<CourseVO> courses = new ArrayList<>();
+        for (StudentCourseEntity entity : entities) {
+            CourseVO vo = new CourseVO();
+            vo.setCourseCode(entity.getCourseCode());
+            vo.setCourseName(entity.getCourseName());
+            courses.add(vo);
+        }
+        return courses;
+    }
+
 }