deason hai 1 ano
pai
achega
58a185c80b

+ 41 - 15
src/main/java/com/qmth/exam/reserve/bean/apply/TicketInfo.java

@@ -1,5 +1,6 @@
 package com.qmth.exam.reserve.bean.apply;
 
+import com.fasterxml.jackson.annotation.JsonIgnore;
 import com.qmth.exam.reserve.bean.IModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Getter;
@@ -14,8 +15,21 @@ public class TicketInfo implements IModel {
     @ApiModelProperty(value = "预约ID")
     private Long applyId;
 
-    @ApiModelProperty(value = "姓名")
-    private String name;
+    @JsonIgnore
+    @ApiModelProperty(value = "是否已取消预约", hidden = true)
+    private Boolean cancel;
+
+    @ApiModelProperty(value = "准考证号码")
+    private String ticketNumber;
+
+    @ApiModelProperty(value = "座位号")
+    private String seatNumber;
+
+    @ApiModelProperty(value = "考生ID")
+    private Long studentId;
+
+    @ApiModelProperty(value = "考生姓名")
+    private String studentName;
 
     @ApiModelProperty(value = "考生学号")
     private String studentCode;
@@ -23,31 +37,43 @@ public class TicketInfo implements IModel {
     @ApiModelProperty(value = "考生证件号")
     private String identityNumber;
 
+    @ApiModelProperty(value = "性别")
+    private String gender;
+
     @ApiModelProperty(value = "考生头像相对路径")
     private String photoPath;
 
-    @ApiModelProperty(value = "性别")
-    private String gender;
+    @ApiModelProperty(value = "预约任务ID")
+    private Long applyTaskId;
 
-    @ApiModelProperty(value = "考试开始时间")
+    @ApiModelProperty(value = "预约时段ID")
+    private Long timePeriodId;
+
+    @ApiModelProperty(value = "考试预约的开始时间")
     private Long timePeriodStart;
 
-    @ApiModelProperty(value = "考试结束时间")
+    @ApiModelProperty(value = "考试预约的结束时间")
     private Long timePeriodEnd;
 
+    @ApiModelProperty(value = "考点ID")
+    private Long examSiteId;
+
+    @ApiModelProperty(value = "考点名称")
+    private String examSiteName;
+
+    @ApiModelProperty(value = "考点地址")
+    private String examSiteAddress;
+
+    @ApiModelProperty(value = "考场ID")
+    private Long examRoomId;
+
     @ApiModelProperty(value = "考场代码")
     private String examRoomCode;
 
+    @ApiModelProperty(value = "考场名称")
+    private String examRoomName;
+
     @ApiModelProperty(value = "考场地址")
     private String examRoomAddress;
 
-    @ApiModelProperty(value = "座位号")
-    private String seatNumber;
-
-    @ApiModelProperty(value = "准考证号码")
-    private String ticketNumber;
-
-    @ApiModelProperty(value = "准考证标题")
-    private String ticketTitle;
-
 }

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

@@ -65,14 +65,14 @@ public class StudentApplyController extends BaseController {
 
     @ApiOperation(value = "获取考试须知")
     @PostMapping(value = "/exam/notice")
-    public RichTextBean examNotice(@ApiParam("预约ID") @RequestParam Long applyId) {
-        return examReserveService.getExamNotice(curLoginStudent().getId(), applyId);
+    public RichTextBean examNotice(@ApiParam("预约任务ID") @RequestParam Long applyTaskId) {
+        return examReserveService.getExamNotice(curLoginStudent().getId(), applyTaskId);
     }
 
     @ApiOperation(value = "获取考场引导")
     @PostMapping(value = "/exam/room/guide")
-    public RichTextBean examRoomGuide(@ApiParam("预约ID") @RequestParam Long applyId) {
-        return examReserveService.getExamRoomGuide(curLoginStudent().getId(), applyId);
+    public RichTextBean examRoomGuide(@ApiParam("考场ID") @RequestParam Long examRoomId) {
+        return examReserveService.getExamRoomGuide(curLoginStudent().getId(), examRoomId);
     }
 
     @ApiOperation(value = "获取可预约的“日期”列表")

+ 3 - 0
src/main/java/com/qmth/exam/reserve/dao/StudentApplyDao.java

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.qmth.exam.reserve.bean.apply.ApplyVO;
+import com.qmth.exam.reserve.bean.apply.TicketInfo;
 import com.qmth.exam.reserve.bean.stdapply.StudentApplyReq;
 import com.qmth.exam.reserve.bean.stdapply.StudentApplyVO;
 import com.qmth.exam.reserve.entity.StudentApplyEntity;
@@ -19,4 +20,6 @@ public interface StudentApplyDao extends BaseMapper<StudentApplyEntity> {
 
     List<ApplyVO> getStudentApplyList(@Param("studentId") Long studentId, @Param("cancel") Boolean cancel);
 
+    TicketInfo getStudentApplyTicket(@Param("applyId") Long applyId);
+
 }

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

@@ -23,8 +23,8 @@ public interface ExamReserveService {
 
     ApplyTimePeriodResult getApplyTimePeriodList(Long studentId, Long examSiteId, String date);
 
-    RichTextBean getExamNotice(Long studentId, Long applyId);
+    RichTextBean getExamNotice(Long studentId, Long applyTaskId);
 
-    RichTextBean getExamRoomGuide(Long studentId, Long applyId);
+    RichTextBean getExamRoomGuide(Long studentId, Long examRoomId);
 
 }

+ 16 - 4
src/main/java/com/qmth/exam/reserve/service/impl/ExamReserveServiceImpl.java

@@ -2,6 +2,7 @@ package com.qmth.exam.reserve.service.impl;
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import com.qmth.boot.core.exception.StatusException;
 import com.qmth.exam.reserve.bean.RichTextBean;
 import com.qmth.exam.reserve.bean.apply.ApplyTimePeriodResult;
 import com.qmth.exam.reserve.bean.apply.ApplyVO;
@@ -80,7 +81,7 @@ public class ExamReserveServiceImpl implements ExamReserveService {
 
         for (ApplyVO vo : list) {
             vo.setShowTicket(false);
-            vo.setAllowCancel(false);
+            vo.setAllowCancel(true);
             if (StringUtils.isNotEmpty(vo.getTicketNumber())) {
                 vo.setShowTicket(true);
             }
@@ -99,7 +100,18 @@ public class ExamReserveServiceImpl implements ExamReserveService {
 
     @Override
     public TicketInfo getApplyTicket(Long studentId, Long applyId) {
-        return null;
+        StudentApplyDao baseMapper = (StudentApplyDao) studentApplyService.getBaseMapper();
+        TicketInfo info = baseMapper.getStudentApplyTicket(applyId);
+        if (info == null || info.getCancel()) {
+            throw new StatusException("准考证信息不存在");
+        }
+        if (!info.getStudentId().equals(studentId)) {
+            throw new StatusException("准考证信息不匹配");
+        }
+        if (StringUtils.isEmpty(info.getTicketNumber())) {
+            throw new StatusException("准考证信息尚未生成");
+        }
+        return info;
     }
 
     @Override
@@ -113,12 +125,12 @@ public class ExamReserveServiceImpl implements ExamReserveService {
     }
 
     @Override
-    public RichTextBean getExamNotice(Long studentId, Long applyId) {
+    public RichTextBean getExamNotice(Long studentId, Long applyTaskId) {
         return null;
     }
 
     @Override
-    public RichTextBean getExamRoomGuide(Long studentId, Long applyId) {
+    public RichTextBean getExamRoomGuide(Long studentId, Long examRoomId) {
         return null;
     }
 

+ 33 - 3
src/main/resources/mapper/StudentApplyMapper.xml

@@ -47,9 +47,9 @@
     </select>
 
     <select id="getStudentApplyList" resultType="com.qmth.exam.reserve.bean.apply.ApplyVO">
-        select sa.id applyId,sa.time_period_id,sa.exam_site_id,sa.cancel,sa.ticket_number,
-        tp.start_time timePeriodStart,tp.end_time timePeriodEnd,
-        es.name examSiteName,es.address examSiteAddress,
+        select sa.id applyId,sa.cancel,sa.ticket_number,
+        sa.time_period_id,tp.start_time timePeriodStart,tp.end_time timePeriodEnd,
+        sa.exam_site_id,es.name examSiteName,es.address examSiteAddress,
         c.id categoryId,c.name categoryName
         from t_student_apply sa
         inner join t_time_period tp on tp.id=sa.time_period_id
@@ -61,4 +61,34 @@
         </if>
     </select>
 
+    <select id="getStudentApplyTicket" resultType="com.qmth.exam.reserve.bean.apply.TicketInfo">
+        select sa.id         applyId,
+               sa.cancel,
+               sa.ticket_number,
+               sa.seat_number,
+               sa.student_id,
+               stu.name      studentName,
+               stu.student_code,
+               stu.identity_number,
+               stu.gender,
+               stu.photo_path,
+               stu.apply_task_id,
+               sa.time_period_id,
+               tp.start_time timePeriodStart,
+               tp.end_time   timePeriodEnd,
+               sa.exam_site_id,
+               es.name       examSiteName,
+               es.address    examSiteAddress,
+               sa.exam_room_id,
+               ec.name       examRoomName,
+               ec.code       examRoomCode,
+               ec.address    examRoomAddress
+        from t_student_apply sa
+                 inner join t_student stu on stu.id = sa.student_id
+                 inner join t_time_period tp on tp.id = sa.time_period_id
+                 inner join t_exam_site es on es.id = sa.exam_site_id
+                 left join t_exam_room ec on ec.id = sa.exam_room_id
+        where sa.id = #{applyId}
+    </select>
+
 </mapper>