Selaa lähdekoodia

监考端接口

wangliang 4 vuotta sitten
vanhempi
commit
939335477d

+ 41 - 35
themis-backend/src/main/java/com/qmth/themis/backend/api/TEExamReexamController.java

@@ -144,26 +144,32 @@ public class TEExamReexamController {
         if (Objects.isNull(mapParameter.get("reexamId")) || Objects.equals(mapParameter.get("reexamId"), "")) {
         if (Objects.isNull(mapParameter.get("reexamId")) || Objects.equals(mapParameter.get("reexamId"), "")) {
             throw new BusinessException("重考id不能为空");
             throw new BusinessException("重考id不能为空");
         }
         }
-        Long reexamId = null;
+        List<Long> reexamIdList = null;
         try {
         try {
-            reexamId = Long.parseLong(String.valueOf(mapParameter.get("reexamId")));
+            reexamIdList = (List<Long>) mapParameter.get("reexamId");
             if (Objects.isNull(mapParameter.get("auditingStatus")) || Objects.equals(mapParameter.get("auditingStatus"), "")) {
             if (Objects.isNull(mapParameter.get("auditingStatus")) || Objects.equals(mapParameter.get("auditingStatus"), "")) {
                 throw new BusinessException("审批状态不能为空");
                 throw new BusinessException("审批状态不能为空");
             }
             }
             Integer auditingStatus = Integer.parseInt(String.valueOf(mapParameter.get("auditingStatus")));
             Integer auditingStatus = Integer.parseInt(String.valueOf(mapParameter.get("auditingStatus")));
             TBUser tbUser = (TBUser) ServletUtil.getRequestAccount();
             TBUser tbUser = (TBUser) ServletUtil.getRequestAccount();
-            if (redisUtil.lock(SystemConstant.REDIS_LOCK_REEXAM_AUDITING + reexamId, SystemConstant.REDIS_LOCK_REEXAM_TIME_OUT)) {
-                TEExamReexam teExamReexam = teExamReexamService.getById(reexamId);
-                if (Objects.isNull(teExamReexam.getUpdateId())) {
-                    teExamReexam.setAuditingStatus(auditingStatus);
-                    teExamReexam.setAuditingTime(new Date());
-                    teExamReexam.setAuditingSuggest(Objects.isNull(mapParameter.get("auditingSuggest")) ? null : String.valueOf(mapParameter.get("auditingSuggest")));
-                    teExamReexam.setUpdateId(tbUser.getId());
-                    teExamReexamService.updateById(teExamReexam);
-                } else {
-                    throw new BusinessException("重考id[" + reexamId + "]已经审核");
+            List<TEExamReexam> teExamReexamUpdateList = new ArrayList<>();
+            for (Long reexamId : reexamIdList) {
+                if (redisUtil.lock(SystemConstant.REDIS_LOCK_REEXAM_AUDITING + reexamId, SystemConstant.REDIS_LOCK_REEXAM_TIME_OUT)) {
+                    TEExamReexam teExamReexam = teExamReexamService.getById(reexamId);
+                    if (Objects.nonNull(teExamReexam.getStatus()) && teExamReexam.getStatus().intValue() == 2) {
+                        throw new BusinessException("重考id[" + reexamId + "]已经审核");
+                    } else {
+                        teExamReexam.setAuditingStatus(auditingStatus);
+                        teExamReexam.setAuditingTime(new Date());
+                        teExamReexam.setAuditingSuggest(Objects.isNull(mapParameter.get("auditingSuggest")) ? null : String.valueOf(mapParameter.get("auditingSuggest")));
+                        teExamReexam.setStatus(2);
+                        teExamReexam.setUpdateId(tbUser.getId());
+                        teExamReexamUpdateList.add(teExamReexam);
+                        teExamReexamService.updateById(teExamReexam);
+                    }
                 }
                 }
             }
             }
+            teExamReexamService.updateBatchById(teExamReexamUpdateList);
         } catch (Exception e) {
         } catch (Exception e) {
             e.printStackTrace();
             e.printStackTrace();
             if (e instanceof BusinessException) {
             if (e instanceof BusinessException) {
@@ -172,8 +178,10 @@ public class TEExamReexamController {
                 throw new RuntimeException(e);
                 throw new RuntimeException(e);
             }
             }
         } finally {
         } finally {
-            if (Objects.nonNull(reexamId)) {
-                redisUtil.releaseLock(SystemConstant.REDIS_LOCK_REEXAM_AUDITING + reexamId);
+            if (Objects.nonNull(reexamIdList)) {
+                reexamIdList.forEach(s -> {
+                    redisUtil.releaseLock(SystemConstant.REDIS_LOCK_REEXAM_AUDITING + s);
+                });
             }
             }
         }
         }
         return ResultUtil.ok(SystemConstant.SUCCESS);
         return ResultUtil.ok(SystemConstant.SUCCESS);
@@ -221,24 +229,22 @@ public class TEExamReexamController {
     @RequestMapping(value = "/list_not_done", method = RequestMethod.POST)
     @RequestMapping(value = "/list_not_done", method = RequestMethod.POST)
     @ApiResponses({@ApiResponse(code = 200, message = "{\"success\":true}", response = ReexamListRequestBean.class)})
     @ApiResponses({@ApiResponse(code = 200, message = "{\"success\":true}", response = ReexamListRequestBean.class)})
     public Result listNotDone(@ApiParam(value = "考试批次id") @RequestParam Long examId,
     public Result listNotDone(@ApiParam(value = "考试批次id") @RequestParam Long examId,
-                       @ApiParam(value = "考试场次id", required = false) @RequestParam(required = false) Long examActivityId,
-                       @ApiParam(value = "虚拟考场代码", required = false) @RequestParam(required = false) String roomCode,
-                       @ApiParam(value = "科目代码", required = false) @RequestParam(required = false) String courseCode,
-                       @ApiParam(value = "姓名", required = false) @RequestParam(required = false) String name,
-                       @ApiParam(value = "证件号", required = false) @RequestParam(required = false) String identity,
-                       @ApiParam(value = "分页页码", required = true) @RequestParam int pageNumber,
-                       @ApiParam(value = "分页数", required = true) @RequestParam int pageSize) {
+                              @ApiParam(value = "考试场次id", required = false) @RequestParam(required = false) Long examActivityId,
+                              @ApiParam(value = "虚拟考场代码", required = false) @RequestParam(required = false) String roomCode,
+                              @ApiParam(value = "科目代码", required = false) @RequestParam(required = false) String courseCode,
+                              @ApiParam(value = "姓名", required = false) @RequestParam(required = false) String name,
+                              @ApiParam(value = "证件号", required = false) @RequestParam(required = false) String identity,
+                              @ApiParam(value = "申请理由", required = false) @RequestParam(required = false) String reason,
+                              @ApiParam(value = "申请开始时间", required = false) @RequestParam(required = false) String reasonStartTime,
+                              @ApiParam(value = "申请结束时间", required = false) @RequestParam(required = false) String reasonEndTime,
+                              @ApiParam(value = "申请人", required = false) @RequestParam(required = false) String applyName,
+                              @ApiParam(value = "分页页码", required = true) @RequestParam int pageNumber,
+                              @ApiParam(value = "分页数", required = true) @RequestParam int pageSize) {
         if (Objects.isNull(examId) || Objects.equals(examId, "")) {
         if (Objects.isNull(examId) || Objects.equals(examId, "")) {
             throw new BusinessException(ExceptionResultEnum.EXAM_ID_IS_NULL);
             throw new BusinessException(ExceptionResultEnum.EXAM_ID_IS_NULL);
         }
         }
         TBUser tbUser = (TBUser) ServletUtil.getRequestAccount();
         TBUser tbUser = (TBUser) ServletUtil.getRequestAccount();
-        AuthDto authDto = (AuthDto) redisUtil.get(SystemConstant.userOauth + "::" + tbUser.getId());
-        //如果有监考员角色,只能查看自己所监考的考场,巡考员和管理员则可以查看全部考场
-        Long userId = null;
-        if (authDto.getRoleCodes().toString().contains(RoleEnum.INVIGILATE.name())) {
-            userId = tbUser.getId();
-        }
-        IPage<ReexamListRequestBean> reexamListRequestBeanIPage = teExamReexamService.reexamPageRequestList(new Page<>(pageNumber, pageSize), examId, examActivityId, roomCode, courseCode, name, identity, userId);
+        IPage<ReexamListRequestBean> reexamListRequestBeanIPage = teExamReexamService.reexamPageRequestList(new Page<>(pageNumber, pageSize), examId, examActivityId, roomCode, courseCode, name, identity, tbUser.getId());
         BasePage basePage = new BasePage(reexamListRequestBeanIPage.getRecords(), reexamListRequestBeanIPage.getCurrent(), reexamListRequestBeanIPage.getSize(), reexamListRequestBeanIPage.getTotal());
         BasePage basePage = new BasePage(reexamListRequestBeanIPage.getRecords(), reexamListRequestBeanIPage.getCurrent(), reexamListRequestBeanIPage.getSize(), reexamListRequestBeanIPage.getTotal());
         Map map = new HashMap<>();
         Map map = new HashMap<>();
         map.put(SystemConstant.RECORDS, basePage);
         map.put(SystemConstant.RECORDS, basePage);
@@ -249,13 +255,13 @@ public class TEExamReexamController {
     @RequestMapping(value = "/list_done", method = RequestMethod.POST)
     @RequestMapping(value = "/list_done", method = RequestMethod.POST)
     @ApiResponses({@ApiResponse(code = 200, message = "{\"success\":true}", response = ReexamListRequestBean.class)})
     @ApiResponses({@ApiResponse(code = 200, message = "{\"success\":true}", response = ReexamListRequestBean.class)})
     public Result listDone(@ApiParam(value = "考试批次id") @RequestParam Long examId,
     public Result listDone(@ApiParam(value = "考试批次id") @RequestParam Long examId,
-                              @ApiParam(value = "考试场次id", required = false) @RequestParam(required = false) Long examActivityId,
-                              @ApiParam(value = "虚拟考场代码", required = false) @RequestParam(required = false) String roomCode,
-                              @ApiParam(value = "科目代码", required = false) @RequestParam(required = false) String courseCode,
-                              @ApiParam(value = "姓名", required = false) @RequestParam(required = false) String name,
-                              @ApiParam(value = "证件号", required = false) @RequestParam(required = false) String identity,
-                              @ApiParam(value = "分页页码", required = true) @RequestParam int pageNumber,
-                              @ApiParam(value = "分页数", required = true) @RequestParam int pageSize) {
+                           @ApiParam(value = "考试场次id", required = false) @RequestParam(required = false) Long examActivityId,
+                           @ApiParam(value = "虚拟考场代码", required = false) @RequestParam(required = false) String roomCode,
+                           @ApiParam(value = "科目代码", required = false) @RequestParam(required = false) String courseCode,
+                           @ApiParam(value = "姓名", required = false) @RequestParam(required = false) String name,
+                           @ApiParam(value = "证件号", required = false) @RequestParam(required = false) String identity,
+                           @ApiParam(value = "分页页码", required = true) @RequestParam int pageNumber,
+                           @ApiParam(value = "分页数", required = true) @RequestParam int pageSize) {
         if (Objects.isNull(examId) || Objects.equals(examId, "")) {
         if (Objects.isNull(examId) || Objects.equals(examId, "")) {
             throw new BusinessException(ExceptionResultEnum.EXAM_ID_IS_NULL);
             throw new BusinessException(ExceptionResultEnum.EXAM_ID_IS_NULL);
         }
         }

+ 194 - 0
themis-business/src/main/java/com/qmth/themis/business/bean/backend/ReexamListNotDongBean.java

@@ -0,0 +1,194 @@
+package com.qmth.themis.business.bean.backend;
+
+import com.qmth.themis.business.enums.ReexamReasonEnum;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+import java.io.Serializable;
+
+/**
+ * @Description: 重考待审列表返回对象
+ * @Param:
+ * @return:
+ * @Author: wangliang
+ * @Date: 2020/8/22
+ */
+@ApiModel("重考待审列表返回对象")
+public class ReexamListNotDongBean implements Serializable {
+
+    @ApiModelProperty(name = "重考id")
+    private Long reexamId;
+
+    @ApiModelProperty(name = "考试id")
+    private Long examId;
+
+    @ApiModelProperty(name = "场次id")
+    private Long examActivityId;
+
+    @ApiModelProperty(name = "考生id")
+    private Long examStudentId;
+
+    @ApiModelProperty(name = "考试记录id")
+    private Long examRecordId;
+
+    @ApiModelProperty(name = "证件号")
+    private String identity;
+
+    @ApiModelProperty(name = "虚拟考场代码")
+    private String roomCode;
+
+    @ApiModelProperty(name = "虚拟考场名称")
+    private String roomName;
+
+    @ApiModelProperty(name = "姓名")
+    private String name;
+
+    @ApiModelProperty(name = "科目名称")
+    private String courseName;
+
+    @ApiModelProperty(name = "科目编码")
+    private String courseCode;
+
+    @ApiModelProperty(name = "原批次")
+    private String examName;
+
+    @ApiModelProperty(name = "原场次")
+    private String examActivityCode;
+
+    @ApiModelProperty(name = "申请理由")
+    private String reason;
+
+    @ApiModelProperty(name = "申请时间")
+    private String applyTime;
+
+    @ApiModelProperty(name = "申请人")
+    private String applyName;
+
+    public String getExamName() {
+        return examName;
+    }
+
+    public void setExamName(String examName) {
+        this.examName = examName;
+    }
+
+    public String getExamActivityCode() {
+        return examActivityCode;
+    }
+
+    public void setExamActivityCode(String examActivityCode) {
+        this.examActivityCode = examActivityCode;
+    }
+
+    public String getReason() {
+        return ReexamReasonEnum.valueOf(reason).getCode();
+    }
+
+    public void setReason(String reason) {
+        this.reason = reason;
+    }
+
+    public String getApplyTime() {
+        return applyTime;
+    }
+
+    public void setApplyTime(String applyTime) {
+        this.applyTime = applyTime;
+    }
+
+    public String getApplyName() {
+        return applyName;
+    }
+
+    public void setApplyName(String applyName) {
+        this.applyName = applyName;
+    }
+
+    public Long getReexamId() {
+        return reexamId;
+    }
+
+    public void setReexamId(Long reexamId) {
+        this.reexamId = reexamId;
+    }
+
+    public String getRoomName() {
+        return roomName;
+    }
+
+    public void setRoomName(String roomName) {
+        this.roomName = roomName;
+    }
+
+    public String getCourseName() {
+        return courseName;
+    }
+
+    public void setCourseName(String courseName) {
+        this.courseName = courseName;
+    }
+
+    public String getCourseCode() {
+        return courseCode;
+    }
+
+    public void setCourseCode(String courseCode) {
+        this.courseCode = courseCode;
+    }
+
+    public Long getExamId() {
+        return examId;
+    }
+
+    public void setExamId(Long examId) {
+        this.examId = examId;
+    }
+
+    public Long getExamActivityId() {
+        return examActivityId;
+    }
+
+    public void setExamActivityId(Long examActivityId) {
+        this.examActivityId = examActivityId;
+    }
+
+    public Long getExamStudentId() {
+        return examStudentId;
+    }
+
+    public void setExamStudentId(Long examStudentId) {
+        this.examStudentId = examStudentId;
+    }
+
+    public Long getExamRecordId() {
+        return examRecordId;
+    }
+
+    public void setExamRecordId(Long examRecordId) {
+        this.examRecordId = examRecordId;
+    }
+
+    public String getIdentity() {
+        return identity;
+    }
+
+    public void setIdentity(String identity) {
+        this.identity = identity;
+    }
+
+    public String getRoomCode() {
+        return roomCode;
+    }
+
+    public void setRoomCode(String roomCode) {
+        this.roomCode = roomCode;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+}

+ 30 - 0
themis-business/src/main/java/com/qmth/themis/business/dao/TEExamReexamMapper.java

@@ -2,6 +2,7 @@ package com.qmth.themis.business.dao;
 
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.qmth.themis.business.bean.backend.ReexamListNotDongBean;
 import com.qmth.themis.business.bean.backend.ReexamListRequestBean;
 import com.qmth.themis.business.bean.backend.ReexamListRequestBean;
 import com.qmth.themis.business.entity.TEExamReexam;
 import com.qmth.themis.business.entity.TEExamReexam;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Mapper;
@@ -39,4 +40,33 @@ public interface TEExamReexamMapper extends BaseMapper<TEExamReexam> {
                                                               @Param("name") String name,
                                                               @Param("name") String name,
                                                               @Param("identity") String identity,
                                                               @Param("identity") String identity,
                                                               @Param("userId") Long userId);
                                                               @Param("userId") Long userId);
+
+    /**
+     * 重考待审列表
+     *
+     * @param iPage
+     * @param examId
+     * @param examActivityId
+     * @param roomCode
+     * @param courseCode
+     * @param name
+     * @param identity
+     * @param reason
+     * @param reasonStartTime
+     * @param reasonEndTime
+     * @param applyName
+     * @param userId
+     * @return
+     */
+    public IPage<ReexamListNotDongBean> reexamPageNotDoneList(IPage<Map> iPage, @Param("examId") Long examId,
+                                                              @Param("examActivityId") Long examActivityId,
+                                                              @Param("roomCode") String roomCode,
+                                                              @Param("courseCode") String courseCode,
+                                                              @Param("name") String name,
+                                                              @Param("identity") String identity,
+                                                              @Param("reason") String reason,
+                                                              @Param("reasonStartTime") String reasonStartTime,
+                                                              @Param("reasonEndTime") String reasonEndTime,
+                                                              @Param("applyName") String applyName,
+                                                              @Param("userId") Long userId);
 }
 }

+ 30 - 0
themis-business/src/main/java/com/qmth/themis/business/service/TEExamReexamService.java

@@ -2,6 +2,7 @@ package com.qmth.themis.business.service;
 
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.qmth.themis.business.bean.backend.ReexamListNotDongBean;
 import com.qmth.themis.business.bean.backend.ReexamListRequestBean;
 import com.qmth.themis.business.bean.backend.ReexamListRequestBean;
 import com.qmth.themis.business.entity.TEExamReexam;
 import com.qmth.themis.business.entity.TEExamReexam;
 
 
@@ -36,4 +37,33 @@ public interface TEExamReexamService extends IService<TEExamReexam> {
                                                               String name,
                                                               String name,
                                                               String identity,
                                                               String identity,
                                                               Long userId);
                                                               Long userId);
+
+    /**
+     * 重考待审列表
+     *
+     * @param iPage
+     * @param examId
+     * @param examActivityId
+     * @param roomCode
+     * @param courseCode
+     * @param name
+     * @param identity
+     * @param reason
+     * @param reasonStartTime
+     * @param reasonEndTime
+     * @param applyName
+     * @param userId
+     * @return
+     */
+    public IPage<ReexamListNotDongBean> reexamPageNotDoneList(IPage<Map> iPage, Long examId,
+                                                                   Long examActivityId,
+                                                                   String roomCode,
+                                                                   String courseCode,
+                                                                   String name,
+                                                                   String identity,
+                                                                   String reason,
+                                                                   String reasonStartTime,
+                                                                   String reasonEndTime,
+                                                                   String applyName,
+                                                                   Long userId);
 }
 }

+ 23 - 0
themis-business/src/main/java/com/qmth/themis/business/service/impl/TEExamReexamServiceImpl.java

@@ -2,6 +2,7 @@ package com.qmth.themis.business.service.impl;
 
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.qmth.themis.business.bean.backend.ReexamListNotDongBean;
 import com.qmth.themis.business.bean.backend.ReexamListRequestBean;
 import com.qmth.themis.business.bean.backend.ReexamListRequestBean;
 import com.qmth.themis.business.dao.TEExamReexamMapper;
 import com.qmth.themis.business.dao.TEExamReexamMapper;
 import com.qmth.themis.business.entity.TEExamReexam;
 import com.qmth.themis.business.entity.TEExamReexam;
@@ -41,4 +42,26 @@ public class TEExamReexamServiceImpl extends ServiceImpl<TEExamReexamMapper, TEE
     public IPage<ReexamListRequestBean> reexamPageRequestList(IPage<Map> iPage, Long examId, Long examActivityId, String roomCode, String courseCode, String name, String identity, Long userId) {
     public IPage<ReexamListRequestBean> reexamPageRequestList(IPage<Map> iPage, Long examId, Long examActivityId, String roomCode, String courseCode, String name, String identity, Long userId) {
         return teExamReexamMapper.reexamPageRequestList(iPage, examId, examActivityId, roomCode, courseCode, name, identity, userId);
         return teExamReexamMapper.reexamPageRequestList(iPage, examId, examActivityId, roomCode, courseCode, name, identity, userId);
     }
     }
+
+    /**
+     * 重考待审列表
+     *
+     * @param iPage
+     * @param examId
+     * @param examActivityId
+     * @param roomCode
+     * @param courseCode
+     * @param name
+     * @param identity
+     * @param reason
+     * @param reasonStartTime
+     * @param reasonEndTime
+     * @param applyName
+     * @param userId
+     * @return
+     */
+    @Override
+    public IPage<ReexamListNotDongBean> reexamPageNotDoneList(IPage<Map> iPage, Long examId, Long examActivityId, String roomCode, String courseCode, String name, String identity, String reason, String reasonStartTime, String reasonEndTime, String applyName, Long userId) {
+        return teExamReexamMapper.reexamPageNotDoneList(iPage, examId, examActivityId, roomCode, courseCode, name, identity, reason, reasonStartTime, reasonEndTime, applyName, userId);
+    }
 }
 }

+ 106 - 37
themis-business/src/main/resources/mapper/TEExamReexamMapper.xml

@@ -3,47 +3,116 @@
 <mapper namespace="com.qmth.themis.business.dao.TEExamReexamMapper">
 <mapper namespace="com.qmth.themis.business.dao.TEExamReexamMapper">
 
 
     <select id="reexamPageRequestList" resultType="com.qmth.themis.business.bean.backend.ReexamListRequestBean">
     <select id="reexamPageRequestList" resultType="com.qmth.themis.business.bean.backend.ReexamListRequestBean">
-    select
-        teer.id as reexamId,
-        tees.room_code as roomCode,
-        tees.room_name as roomName,
-        tees.`identity`,
-        tees.name,
-        teer.exam_activity_id as examActivityId,
-        teer.exam_student_id as examStudentId,
-        teer.exam_record_id as examRecordId,
-        tees.course_code as courseCode,
-        tees.course_name as courseName
-    from
-        t_e_exam_reexam teer
+        select
+            teer.id as reexamId,
+            tees.room_code as roomCode,
+            tees.room_name as roomName,
+            tees.`identity`,
+            tees.name,
+            teer.exam_activity_id as examActivityId,
+            teer.exam_student_id as examStudentId,
+            teer.exam_record_id as examRecordId,
+            tees.course_code as courseCode,
+            tees.course_name as courseName
+        from
+            t_e_exam_reexam teer
+            left join t_e_exam_student tees on
+                tees.id = teer.exam_student_id
+            inner join (select distinct tbeiu.room_code from t_b_exam_invigilate_user tbeiu
+            <if test="userId != null and userId != ''">
+                where tbeiu.user_id = #{userId}
+            </if>
+            ) t on t.room_code = tees.room_code
+            <where>
+                <if test="examId != null and examId != ''">
+                    and tees.exam_id = #{examId}
+                </if>
+                <if test="examActivityId != null and examActivityId != ''">
+                    and tees.exam_activity_id = #{examActivityId}
+                </if>
+                <if test="roomCode != null and roomCode != ''">
+                    and tees.room_code = #{roomCode}
+                </if>
+                <if test="courseCode != null and courseCode != ''">
+                    and tees.course_code like CONCAT(#{courseCode},'%')
+                </if>
+                <if test="name != null and name !=''">
+                    and tees.name like CONCAT(#{name},'%')
+                </if>
+                <if test="identity != null and identity !=''">
+                    and tees.identity like CONCAT(#{identity},'%')
+                </if>
+                and tees.enable = 1
+            </where>
+            order by tees.room_code
+    </select>
+
+    <select id="reexamPageNotDoneList" resultType="com.qmth.themis.business.bean.backend.ReexamListNotDongBean">
+        select * from(select
+            teer.id as reexamId,
+            teer.exam_id as examId,
+            teer.exam_activity_id as examActivityId,
+            teea.code as examActivityCode,
+            tees.room_code as roomCode,
+            tees.room_name as roomName,
+            tees.course_code as courseCode,
+            tees.course_name as courseName,
+            tees.`identity`,
+            tee.name as examName,
+            tees.name,
+            teer.reason,
+            teer.create_time as applyTime,
+            (select tbu.name from t_b_user tbu where tbu.id = teer.create_id) as applyName
+        from
+            t_e_exam_reexam teer
         left join t_e_exam_student tees on
         left join t_e_exam_student tees on
             tees.id = teer.exam_student_id
             tees.id = teer.exam_student_id
-        inner join (select distinct tbeiu.room_code from t_b_exam_invigilate_user tbeiu
-        <if test="userId != null and userId != ''">
-            where tbeiu.user_id = #{userId}
-        </if>
-        ) t on t.room_code = tees.room_code
+        left join t_e_exam tee on
+            tee.id = teer.exam_id
+        left join t_e_exam_activity teea on
+            teea.id = teer.exam_activity_id
+         <where>
+             <if test="userId != null and userId !=''">
+                 and CONVERT((teer.auditing_id->>CONCAT('$.",#{userId},"')) USING utf8) = #{userId}
+             </if>
+             <if test="examId != null and examId != ''">
+                 and tees.exam_id = #{examId}
+             </if>
+             <if test="examActivityId != null and examActivityId != ''">
+                 and tees.exam_activity_id = #{examActivityId}
+             </if>
+             <if test="roomCode != null and roomCode != ''">
+                 and tees.room_code = #{roomCode}
+             </if>
+             <if test="courseCode != null and courseCode != ''">
+                 and tees.course_code like CONCAT(#{courseCode},'%')
+             </if>
+             <if test="name != null and name !=''">
+                 and tees.name like CONCAT(#{name},'%')
+             </if>
+             <if test="identity != null and identity !=''">
+                 and tees.identity like CONCAT(#{identity},'%')
+             </if>
+             <if test="reason != null and reason !=''">
+                 and teer.reason = #{reason}
+             </if>
+             <if test="reasonStartTime != null and reasonStartTime != ''">
+                 and teer.create_time &gt;= #{reasonStartTime}
+             </if>
+             <if test="reasonEndTime != null and reasonEndTime != ''">
+                 and teer.create_time &lt;= #{reasonEndTime}
+             </if>
+             and tee.enable = 1
+             and teea.enable = 1
+             and tees.enable = 1
+             and teer.status = 1
+         </where>
+        ) t
         <where>
         <where>
-            <if test="examId != null and examId != ''">
-                and tees.exam_id = #{examId}
-            </if>
-            <if test="examActivityId != null and examActivityId != ''">
-                and tees.exam_activity_id = #{examActivityId}
-            </if>
-            <if test="roomCode != null and roomCode != ''">
-                and tees.room_code = #{roomCode}
-            </if>
-            <if test="courseCode != null and courseCode != ''">
-                and tees.course_code like CONCAT(#{courseCode},'%')
-            </if>
-            <if test="name != null and name !=''">
-                and tees.name like CONCAT(#{name},'%')
-            </if>
-            <if test="identity != null and identity !=''">
-                and tees.identity like CONCAT(#{identity},'%')
+            <if test="applyName != null and applyName !=''">
+                and t.applyName like CONCAT(#{applyName},'%')
             </if>
             </if>
-            and tees.enable = 1
         </where>
         </where>
-        order by tees.room_code
+         order by t.roomCode
     </select>
     </select>
 </mapper>
 </mapper>