wangliang 4 жил өмнө
parent
commit
ea9de7914a

+ 9 - 0
themis-business/src/main/java/com/qmth/themis/business/dao/TEExamMapper.java

@@ -6,6 +6,7 @@ import com.qmth.themis.business.entity.TEExam;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 
+import java.util.List;
 import java.util.Map;
 
 /**
@@ -30,4 +31,12 @@ public interface TEExamMapper extends BaseMapper<TEExam> {
      * @return
      */
     public IPage<TEExam> examQuery(IPage<Map> iPage, @Param("id") Long id, @Param("code") String code, @Param("name") String name, @Param("mode") Integer mode, @Param("enable") Integer enable);
+
+    /**
+     * 获取考试待考列表
+     *
+     * @param studentId
+     * @return
+     */
+    public List<Map> getWaitingExam(@Param("studentId") Long studentId);
 }

+ 11 - 0
themis-business/src/main/java/com/qmth/themis/business/dao/TOeExamRecordMapper.java

@@ -3,6 +3,10 @@ package com.qmth.themis.business.dao;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.qmth.themis.business.entity.TOeExamRecord;
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+import java.util.Map;
 
 /**
  * @Description: 考试记录 Mapper 接口
@@ -14,4 +18,11 @@ import org.apache.ibatis.annotations.Mapper;
 @Mapper
 public interface TOeExamRecordMapper extends BaseMapper<TOeExamRecord> {
 
+    /**
+     * 获取考试未完列表
+     *
+     * @param studentId
+     * @return
+     */
+    public Map getUnFinishExam(@Param("studentId") Long studentId);
 }

+ 10 - 0
themis-business/src/main/java/com/qmth/themis/business/service/TEExamService.java

@@ -3,7 +3,9 @@ package com.qmth.themis.business.service;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.qmth.themis.business.entity.TEExam;
+import org.apache.ibatis.annotations.Param;
 
+import java.util.List;
 import java.util.Map;
 
 /**
@@ -27,4 +29,12 @@ public interface TEExamService extends IService<TEExam> {
      * @return
      */
     public IPage<TEExam> examQuery(IPage<Map> iPage, Long id, String code, String name, Integer mode, Integer enable);
+
+    /**
+     * 获取考试待考列表
+     *
+     * @param studentId
+     * @return
+     */
+    public List<Map> getWaitingExam(Long studentId);
 }

+ 9 - 0
themis-business/src/main/java/com/qmth/themis/business/service/TOeExamRecordService.java

@@ -3,6 +3,8 @@ package com.qmth.themis.business.service;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.qmth.themis.business.entity.TOeExamRecord;
 
+import java.util.Map;
+
 /**
  * @Description: 考试记录 服务类
  * @Param:
@@ -12,4 +14,11 @@ import com.qmth.themis.business.entity.TOeExamRecord;
  */
 public interface TOeExamRecordService extends IService<TOeExamRecord> {
 
+    /**
+     * 获取考试未完列表
+     *
+     * @param studentId
+     * @return
+     */
+    public Map getUnFinishExam(Long studentId);
 }

+ 12 - 0
themis-business/src/main/java/com/qmth/themis/business/service/impl/TEExamServiceImpl.java

@@ -8,6 +8,7 @@ import com.qmth.themis.business.service.TEExamService;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
+import java.util.List;
 import java.util.Map;
 
 /**
@@ -38,4 +39,15 @@ public class TEExamServiceImpl extends ServiceImpl<TEExamMapper, TEExam> impleme
     public IPage<TEExam> examQuery(IPage<Map> iPage, Long id, String code, String name, Integer mode, Integer enable) {
         return teExamMapper.examQuery(iPage, id, code, name, mode, enable);
     }
+
+    /**
+     * 获取考试待考列表
+     *
+     * @param studentId
+     * @return
+     */
+    @Override
+    public List<Map> getWaitingExam(Long studentId) {
+        return teExamMapper.getWaitingExam(studentId);
+    }
 }

+ 10 - 0
themis-business/src/main/java/com/qmth/themis/business/service/impl/TOeExamRecordServiceImpl.java

@@ -6,6 +6,9 @@ import com.qmth.themis.business.entity.TOeExamRecord;
 import com.qmth.themis.business.service.TOeExamRecordService;
 import org.springframework.stereotype.Service;
 
+import javax.annotation.Resource;
+import java.util.Map;
+
 /**
  * @Description: 考试记录 服务实现类
  * @Param:
@@ -16,4 +19,11 @@ import org.springframework.stereotype.Service;
 @Service
 public class TOeExamRecordServiceImpl extends ServiceImpl<TOeExamRecordMapper, TOeExamRecord> implements TOeExamRecordService {
 
+    @Resource
+    TOeExamRecordMapper tOeExamRecordMapper;
+
+    @Override
+    public Map getUnFinishExam(Long studentId) {
+        return tOeExamRecordMapper.getUnFinishExam(studentId);
+    }
 }

+ 54 - 0
themis-business/src/main/resources/mapper/TEExamMapper.xml

@@ -22,4 +22,58 @@
             </if>
         </where>
     </select>
+
+    <select id="getWaitingExam" resultType="java.util.Map">
+        select
+            tee.id,
+            teea.id as examActivityId,
+            tee.name,
+            tee.mode,
+            tee.pre_notice as preNotice,
+            tee.pre_notice_stay_seconds as preNoticeStaySeconds,
+            tee.post_notice as postNotice,
+            tee.code as examCode,
+            teea.code as examActivityCode,
+            tee.start_time as examStartTime,
+            tee.end_time as examEndTime,
+            teea.start_time as examActivityStartTime,
+            teea.finish_time as examActivityFinishTime,
+            tees.course_code as courseCode,
+            teec.course_name as courseName,
+            tee.prepare_seconds as prepareSeconds,
+            tee.min_duration_seconds as minDurationSeconds,
+            tee.max_duration_seconds as maxDurationSeconds,
+            tee.exam_count as examCount,
+            tee.force_finish as fouceFinish,
+            tee.entry_authentication_policy as entryAuthenticationPolicy,
+            tee.in_process_face_verify as inProcessFaceVerify,
+            tee.in_process_face_stranger_ignore as inProcessFaceStrangerIgnore,
+            tee.in_process_liveness_verify as inProcessLivenessVerify,
+            tee.in_process_liveness_interval_seconds as inProcessLivenessIntervalSeconds,
+            tee.in_process_liveness_judge_policy as inProcessLivenessJudgePolicy,
+            tee.in_process_liveness_retry_count as inProcessLivenessRetryCount,
+            tee.client_video_push as clientVideoPush,
+            tee.wxapp_video_push as wxappVideoPush,
+            tee.camera_photo_upload as cameraPhotoUpload,
+            tee.wxapp_photo_upload as wxappPhotoUpload,
+            tee.wxapp_video_record as wxappVideoRecord
+        from
+        t_e_exam_student tees
+        left join t_e_exam_course teec on
+        teec.course_code = tees.course_code
+        left join t_e_exam tee on
+        tee.id = tees.exam_id
+        left join t_e_exam_activity teea on
+        teea.id = tees.exam_activity_id
+        <where>
+            <if test="studentId != null and studentId != ''">
+                and tees.student_id = #{studentId}
+            </if>
+            and tee.enable = 1
+            and teea.enable = 1
+            and tees.enable = 1
+            and teea.start_time <![CDATA[ <= ]]> now()
+            and teea.finish_time <![CDATA[ >= ]]> now()
+        </where>
+    </select>
 </mapper>

+ 55 - 0
themis-business/src/main/resources/mapper/TOeExamRecordMapper.xml

@@ -2,4 +2,59 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.qmth.themis.business.dao.TOeExamRecordMapper">
 
+    <select id="getUnFinishExam" resultType="java.util.Map">
+        select
+            tee.id,
+            teea.id as examActivityId,
+            tee.name,
+            tee.mode,
+            tee.pre_notice as preNotice,
+            tee.pre_notice_stay_seconds as preNoticeStaySeconds,
+            tee.post_notice as postNotice,
+            tee.code as examCode,
+            teea.code as examActivityCode,
+            tee.start_time as examStartTime,
+            tee.end_time as examEndTime,
+            teea.start_time as examActivityStartTime,
+            teea.finish_time as examActivityFinishTime,
+            tees.course_code as courseCode,
+            teec.course_name as courseName,
+            tee.prepare_seconds as prepareSeconds,
+            tee.min_duration_seconds as minDurationSeconds,
+            tee.max_duration_seconds as maxDurationSeconds,
+            tee.exam_count as examCount,
+            tee.force_finish as fouceFinish,
+            tee.entry_authentication_policy as entryAuthenticationPolicy,
+            tee.in_process_face_verify as inProcessFaceVerify,
+            tee.in_process_face_stranger_ignore as inProcessFaceStrangerIgnore,
+            tee.in_process_liveness_verify as inProcessLivenessVerify,
+            tee.in_process_liveness_interval_seconds as inProcessLivenessIntervalSeconds,
+            tee.in_process_liveness_judge_policy as inProcessLivenessJudgePolicy,
+            tee.in_process_liveness_retry_count as inProcessLivenessRetryCount,
+            tee.client_video_push as clientVideoPush,
+            tee.wxapp_video_push as wxappVideoPush,
+            tee.camera_photo_upload as cameraPhotoUpload,
+            tee.wxapp_photo_upload as wxappPhotoUpload,
+            tee.wxapp_video_record as wxappVideoRecord
+            from
+            t_oe_exam_record toer
+            left join t_e_exam_student tees on
+            tees.id = toer.exam_student_id
+            left join t_e_exam_course teec on
+            teec.course_code = tees.course_code
+            left join t_e_exam tee on
+            tee.id = tees.exam_id
+            left join t_e_exam_activity teea on
+            teea.id = tees.exam_activity_id
+        <where>
+            <if test="studentId != null and studentId != ''">
+                and tees.student_id = #{studentId}
+            </if>
+            and tee.enable = 1
+            and teea.enable = 1
+            and tees.enable = 1
+            and teea.start_time <![CDATA[ <= ]]> now()
+            and teea.finish_time <![CDATA[ >= ]]> now()
+        </where>
+    </select>
 </mapper>

+ 16 - 9
themis-exam/src/main/java/com/qmth/themis/exam/api/TEStudentController.java

@@ -9,9 +9,7 @@ import com.qmth.themis.business.entity.TEStudent;
 import com.qmth.themis.business.enums.MqEnum;
 import com.qmth.themis.business.enums.RoleEnum;
 import com.qmth.themis.business.enums.SystemOperationEnum;
-import com.qmth.themis.business.service.EhcacheService;
-import com.qmth.themis.business.service.TEConfigService;
-import com.qmth.themis.business.service.TEStudentService;
+import com.qmth.themis.business.service.*;
 import com.qmth.themis.business.util.EhcacheUtil;
 import com.qmth.themis.business.util.JacksonUtil;
 import com.qmth.themis.business.util.RedisUtil;
@@ -39,10 +37,7 @@ import org.springframework.web.bind.annotation.RestController;
 
 import javax.annotation.Resource;
 import java.security.NoSuchAlgorithmException;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Objects;
+import java.util.*;
 
 /**
  * @Description: 考生 前端控制器
@@ -74,6 +69,12 @@ public class TEStudentController {
     @Resource
     TEConfigService teConfigService;
 
+    @Resource
+    TEExamService teExamService;
+
+    @Resource
+    TOeExamRecordService tOeExamRecordService;
+
     @ApiOperation(value = "学生登录接口")
     @RequestMapping(value = "/login", method = RequestMethod.POST)
     @ApiResponses({@ApiResponse(code = 200, message = "学生信息", response = TEStudent.class)})
@@ -138,11 +139,17 @@ public class TEStudentController {
         //mq发送消息end
         //测试
         String test = SignatureInfo.build(SignatureType.TOKEN, sessionId, token);
+        Map<String, Object> map = new HashMap<>();
         //获取未完/待考列表
-
+        Map unFinishExam = tOeExamRecordService.getUnFinishExam(teStudent.getId());
+        if (Objects.isNull(unFinishExam)) {
+            List<Map> list = teExamService.getWaitingExam(teStudent.getId());
+            map.put("waiting", list);
+        } else {
+            map.put("unFinished", unFinishExam);
+        }
         //获取全局考试配置
         TEConfig teConfig = teConfigService.getGlobalConfig();
-        Map<String, Object> map = new HashMap<>();
 //        map.put(SystemConstant.ACCESS_TOKEN, token);
         map.put(SystemConstant.GLOBAL, teConfig);
         map.put(SystemConstant.ACCESS_TOKEN, test);