Browse Source

增加日期范围选择

haogh 1 year ago
parent
commit
846637fb69

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

@@ -26,4 +26,10 @@ public class StudentApplyReq extends PagerReq {
 
     @ApiModelProperty("考生学号")
     private String studentCode;
+
+    @ApiModelProperty("考试日期")
+    private Long startDate;
+
+    @ApiModelProperty("结束日期")
+    private Long endDate;
 }

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

@@ -328,7 +328,7 @@ public class StudentApplyServiceImpl extends ServiceImpl<StudentApplyDao, Studen
                 toBeUpdateAgentTimeList.addAll(vo.getAgentTimeList());
             }
             try {
-                saveStdApply(i, vo, failRecords);
+                saveStdApply(i, vo, userId, failRecords);
             } catch (StatusException e) {
                 failRecords.add(newError(i + 1, " 系统异常"));
                 log.error("导入异常", e);
@@ -431,7 +431,8 @@ public class StudentApplyServiceImpl extends ServiceImpl<StudentApplyDao, Studen
         return task;
     }
 
-    private List<StudentApplyEntity> saveStdApply(int row, StudentImportVO vo, List<Map<String, Object>> failRecords) {
+    private List<StudentApplyEntity> saveStdApply(int row, StudentImportVO vo, Long userId,
+            List<Map<String, Object>> failRecords) {
         List<StudentApplyEntity> ApplyList = new ArrayList<>();
         List<AgentAndTimeVO> agentTimeList = vo.getAgentTimeList();
         for (AgentAndTimeVO agentTime : agentTimeList) {
@@ -440,6 +441,7 @@ public class StudentApplyServiceImpl extends ServiceImpl<StudentApplyDao, Studen
             entity.setExamSiteId(agentTime.getAgentId());
             entity.setTimePeriodId(agentTime.getTimePeriodId());
             entity.setCancel(Boolean.FALSE);
+            entity.setOperateId(userId);
             int haveApplyCount = countApplyFinishForExamSiteAndTimePeriod(agentTime.getAgentId(),
                     agentTime.getTimePeriodId());
             ExamSiteEntity examSite = examSiteService.getById(agentTime.getAgentId());

+ 10 - 8
src/main/resources/mapper/StudentApplyMapper.xml

@@ -11,15 +11,11 @@
         r.name roomName, a.cancel,a.update_time
         updateTime,u.name userName
         from t_student s,t_category o,t_student_apply a
-        left join t_exam_site es on
-        es.id=a.exam_site_id
-        left join t_time_period
-        p on p.id=a.time_period_id
-        left join t_exam_room r on
-        r.id=a.exam_room_id
+        left join t_exam_site es on es.id=a.exam_site_id
+        left join t_time_period p on p.id=a.time_period_id
+        left join t_exam_room r on r.id=a.exam_room_id
         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
+        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}
         </if>
@@ -35,6 +31,12 @@
         <if test="req.studentCode != null and req.studentCode !=''">
             and s.student_code like concat('%',#{req.studentCode},'%')
         </if>
+        <if test="req.startDate != null and req.startDate !=''">
+            and p.start_time&gt;=#{req.startDate}
+        </if>
+        <if test="req.endDate != null and req.endDate !=''">
+            and p.start_time&lt;= #{req.endDate}
+        </if>
         order by a.id
     </select>