Przeglądaj źródła

需求:按照所预约教学点查询

haogh 1 rok temu
rodzic
commit
fc13cb47d9

+ 6 - 1
src/main/java/com/qmth/exam/reserve/bean/stdapply/StudentApplyReq.java

@@ -1,5 +1,7 @@
 package com.qmth.exam.reserve.bean.stdapply;
 
+import java.util.List;
+
 import com.qmth.exam.reserve.bean.PagerReq;
 
 import io.swagger.annotations.ApiModelProperty;
@@ -12,7 +14,7 @@ public class StudentApplyReq extends PagerReq {
 
     private static final long serialVersionUID = -4945630927057518990L;
 
-    @ApiModelProperty("教学点ID")
+    @ApiModelProperty("所预约教学点ID")
     private Long teachingId;
 
     @ApiModelProperty("考点ID")
@@ -35,4 +37,7 @@ public class StudentApplyReq extends PagerReq {
 
     @ApiModelProperty("任务ID")
     private Long taskId;
+
+    @ApiModelProperty("所有考点")
+    private List<Long> examSiteIds;
 }

+ 3 - 0
src/main/java/com/qmth/exam/reserve/bean/stdapply/StudentApplyVO.java

@@ -50,4 +50,7 @@ public class StudentApplyVO implements IModel {
 
     @ApiModelProperty("后台操作人员名称")
     private String userName;
+
+    @ApiModelProperty("考生所预约教学点")
+    private String applyTeachingName;
 }

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

@@ -42,6 +42,7 @@ import com.qmth.exam.reserve.bean.Constants;
 import com.qmth.exam.reserve.bean.apply.ApplyRecordCacheBean;
 import com.qmth.exam.reserve.bean.login.LoginUser;
 import com.qmth.exam.reserve.bean.stdapply.AgentAndTimeVO;
+import com.qmth.exam.reserve.bean.stdapply.CategoryVO;
 import com.qmth.exam.reserve.bean.stdapply.MaterialTitleInfo;
 import com.qmth.exam.reserve.bean.stdapply.SignInVO;
 import com.qmth.exam.reserve.bean.stdapply.StudentApplyReq;
@@ -117,8 +118,21 @@ public class StudentApplyServiceImpl extends ServiceImpl<StudentApplyDao, Studen
             ApplyTaskEntity task = getApplyTask();
             req.setTaskId(task.getId());
         }
+        String applyTeachingName = null;
+        if (req.getTeachingId() != null) {
+            List<CategoryVO> listExamSite = examSiteService.listExamSite(req.getTeachingId());
+            List<Long> examSiteIds = listExamSite.stream().map(CategoryVO::getId).collect(Collectors.toList());
+            if (!examSiteIds.isEmpty()) {
+                req.setExamSiteIds(examSiteIds);
+                applyTeachingName = categoryService.getById(req.getTeachingId()).getName();
+            }
+        }
         IPage<StudentApplyVO> iPage = this.baseMapper
                 .page(new Page<StudentApplyVO>(req.getPageNumber(), req.getPageSize()), req);
+        List<StudentApplyVO> records = iPage.getRecords();
+        for (StudentApplyVO vo : records) {
+            vo.setApplyTeachingName(applyTeachingName);
+        }
         return PageUtil.of(iPage);
     }
 
@@ -522,7 +536,7 @@ public class StudentApplyServiceImpl extends ServiceImpl<StudentApplyDao, Studen
     }
 
     private TimePeriodEntity checkTimePeriod(String timePeriod, Map<String, TimePeriodEntity> timeCache) {
-        if (timePeriod.split(" ").length != 2) {
+        if (timePeriod == null || timePeriod.split(" ").length != 2) {
             throw new StatusException(" 预约时段格式不正确");
         }
         String[] arr = timePeriod.split("-");
@@ -567,13 +581,11 @@ public class StudentApplyServiceImpl extends ServiceImpl<StudentApplyDao, Studen
         lm.eq(StudentEntity::getStudentCode, studentCode);
         lm.eq(StudentEntity::getName, name);
         lm.eq(StudentEntity::getIdentityNumber, identityNumber);
+        lm.eq(StudentEntity::getApplyTaskId, task.getId());
         StudentEntity student = studentService.getOne(lm);
         if (student == null) {
             throw new StatusException(" 考生信息填写错误");
         }
-        if (!student.getApplyTaskId().equals(task.getId())) {
-            throw new StatusException(" 当前任务下不存在该考生");
-        }
         return student;
     }
 

+ 5 - 1
src/main/resources/mapper/StudentApplyMapper.xml

@@ -16,7 +16,11 @@
         left join t_user u on u.id=a.operate_id 
         where a.student_id=s.id and s.category_id=o.id and a.cancel=0
         <if test="req.teachingId != null">
-            and s.category_id=#{req.teachingId}
+            <!-- and s.category_id=#{req.teachingId} -->
+            and a.exam_site_id in 
+            <foreach collection="req.examSiteIds" item="item" index="index" separator="," open="(" close=")">
+           	 	#{item}
+        	</foreach>
         </if>
         <if test="req.agentId != null">
             and a.exam_site_id=#{req.agentId}