浏览代码

考试统计修改1

wangliang 1 年之前
父节点
当前提交
f3ed703580

+ 1 - 1
themis-business/src/main/java/com/qmth/themis/business/constant/SystemConstant.java

@@ -209,7 +209,7 @@ public class SystemConstant {
     public static final Long AFTER_AUDIO_ATTACHMENT_ID = 2L;
     public static final Integer BEFORE_AUDIO_SECOND = 60;
     public static final Integer AFTER_AUDIO_SECOND = 900;
-    public static final long FINISH_DELAY_TIME = 1000 * 60 * 1;
+    public static final long FINISH_DELAY_TIME = 1000 * 60 * 5;
     //    public static final String AUTH_INFO_CACHE = "auth:info:cache";
     public static final String EXAM_AUDIO_CACHE = "exam:audio:cache";
     public static final String ATTACHMENT_CACHE = "attachment:cache";

+ 1 - 9
themis-business/src/main/java/com/qmth/themis/business/service/impl/TEExamSummaryServiceImpl.java

@@ -3,7 +3,6 @@ package com.qmth.themis.business.service.impl;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.qmth.themis.business.cache.bean.ExamActivityCacheBean;
-import com.qmth.themis.business.constant.SystemConstant;
 import com.qmth.themis.business.dao.TEExamSummaryMapper;
 import com.qmth.themis.business.entity.TEExamSummary;
 import com.qmth.themis.business.service.TEExamActivityService;
@@ -74,15 +73,8 @@ public class TEExamSummaryServiceImpl extends ServiceImpl<TEExamSummaryMapper, T
             teExamSummary.setExamActivityId(examActivityId);
             teExamSummary.setRoomCode(s);
             ExamActivityCacheBean ac = teExamActivityService.getExamActivityCacheBean(examActivityId);
-//            //换算开始时间、侯考时间、结束时间
-//            Long startTime = ac.getStartTime() - (ac.getPrepareSeconds() * 1000);
-//            Integer openingSecondsTemp = ac.getOpeningSeconds();
-//            openingSecondsTemp = Objects.nonNull(openingSecondsTemp) && openingSecondsTemp.intValue() == 0 ? SystemConstant.DEFAULT_OPENING_SECONDS : openingSecondsTemp;
-//            Long finalPrepareTime = ac.getStartTime() + (openingSecondsTemp * 1000);
-            Long endTime = ac.getFinishTime() + SystemConstant.FINISH_DELAY_TIME;//交卷时间加5分钟,后台交卷可能未完成
             long timestamp = System.currentTimeMillis();
-//            //交卷
-            if (endTime <= timestamp) {//当考试场次结束时间已过,缺考=全部应考-已完成考试
+            if (ac.getFinishTime() <= timestamp) {//当考试场次结束时间已过,缺考=全部应考-已完成考试
                 teExamSummary.setAbsentCount(teExamSummary.getTotalCount() - teExamSummary.getFinishCount());
             } else {
                 Integer absentCount = teExamStudentService.getAbsentCount(examId, examActivityId, s);

+ 3 - 25
themis-business/src/main/resources/mapper/TEExamStudentMapper.xml

@@ -482,10 +482,8 @@
     </select>
 
     <select id="getAbsentCount" resultType="java.lang.Integer">
-        select sum(t.c) from(select
-        count(distinct t.id) as c
-        from
-        t_e_exam_student t
+        select count(distinct t.id) as c
+        from t_e_exam_student t
         left join t_oe_exam_record toer on
         toer.exam_student_id = t.id
         <where> 1 = 1
@@ -498,27 +496,7 @@
             <if test="roomCode != null and roomCode != ''">
                 and t.room_code = #{roomCode}
             </if>
-            and toer.id is null
+            and (toer.id is null or (toer.status in ('FIRST_PREPARE', 'JUNK') and toer.client_websocket_status = 'OFF_LINE' and t.already_exam_count = 0))
         </where>
-        union all
-        select
-        count(distinct t.id) as c
-        from
-        t_e_exam_student t
-        left join t_oe_exam_record toer on
-        toer.exam_student_id = t.id
-        <where> 1 = 1
-            <if test="examId != null and examId != ''">
-                and t.exam_id = #{examId}
-            </if>
-            <if test="examActivityId != null and examActivityId != ''">
-                and t.exam_activity_id = #{examActivityId}
-            </if>
-            <if test="roomCode != null and roomCode != ''">
-                and t.room_code = #{roomCode}
-            </if>
-            and toer.status in ('FIRST_PREPARE', 'JUNK')
-            and toer.client_websocket_status = 'OFF_LINE' and t.already_exam_count = 0
-        </where>) t
     </select>
 </mapper>