Эх сурвалжийг харах

成绩导出标准版本加入缺考考生

wangliang 2 жил өмнө
parent
commit
a10b9c58ba

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

@@ -416,7 +416,7 @@ public interface TOeExamRecordMapper extends BaseMapper<TOeExamRecord> {
      * @param examStudentId
      * @return
      */
-    public List<TOeExamRecord> findMaxObjectiveScore(@Param("examId") Long examId, @Param("examStudentId") Long examStudentId);
+    public List<TOeExamRecord> findMaxObjectiveScore(@Param("examId") Long examId, @Param("examStudentId") Long examStudentId, @Param("examStudentBreachPush") Boolean examStudentBreachPush)
 
     /**
      * 根据orgId查找 在线人数/已待考/考试人数

+ 2 - 1
themis-business/src/main/java/com/qmth/themis/business/service/impl/TOeExamRecordServiceImpl.java

@@ -1003,7 +1003,8 @@ public class TOeExamRecordServiceImpl extends ServiceImpl<TOeExamRecordMapper, T
      */
     @Override
     public List<TOeExamRecord> findMaxObjectiveScore(Long examId, Long examStudentId) {
-        return tOeExamRecordMapper.findMaxObjectiveScore(examId, examStudentId);
+        ExamCacheBean examCacheBean = examService.getExamCacheBean(examId);
+        return tOeExamRecordMapper.findMaxObjectiveScore(examId, examStudentId, examCacheBean.getExamStudentBreachPush());
     }
 
     /**

+ 479 - 336
themis-business/src/main/resources/mapper/TOeExamRecordMapper.xml

@@ -10,22 +10,185 @@
                         teea.code as       examActivityCode,
                         t.exam_student_id  examStudentId,
                         t.id               examRecordId,
-        INSERT(rpad(substring(s.identity, 1, 2), char_length(s.identity), '*'),char_length(s.identity)-1,char_length(s.identity),substring(s.identity, char_length(s.identity) - 1 , char_length(s.identity) - 2)) as identity,
-		s.room_code roomCode,
-		s.room_name roomName,
-		s.name name,
-		s.course_name courseName,
-		s.course_code courseCode,
-		IFNULL(t.paper_download,1) paperDownload,
-		t.status statusCode,
-	    TRUNCATE(t.answer_progress,2) progress,
-		IFNULL(t.client_current_ip,'无') clientCurrentIp,
-		IFNULL(t.warning_count,0) as warningCount,
-		IFNULL(t.breach_status,1) as breachStatus,
-		IFNULL(t.client_websocket_status,'OFF_LINE') as clientWebsocketStatus,
-		t.client_last_sync_time as updateTime,
-		t.monitor_video_source as monitorVideoSource,
-        t.monitor_record as monitorRecord
+        INSERT
+        (
+        rpad
+        (
+        substring
+        (
+        s
+        .
+        identity
+        ,
+        1
+        ,
+        2
+        )
+        ,
+        char_length
+        (
+        s
+        .
+        identity
+        )
+        ,
+        '*'
+        )
+        ,
+        char_length
+        (
+        s
+        .
+        identity
+        )
+        -
+        1
+        ,
+        char_length
+        (
+        s
+        .
+        identity
+        )
+        ,
+        substring
+        (
+        s
+        .
+        identity
+        ,
+        char_length
+        (
+        s
+        .
+        identity
+        )
+        -
+        1
+        ,
+        char_length
+        (
+        s
+        .
+        identity
+        )
+        -
+        2
+        )
+        )
+        as
+        identity
+        ,
+        s
+        .
+        room_code
+        roomCode
+        ,
+        s
+        .
+        room_name
+        roomName
+        ,
+        s
+        .
+        name
+        name
+        ,
+        s
+        .
+        course_name
+        courseName
+        ,
+        s
+        .
+        course_code
+        courseCode
+        ,
+        IFNULL
+        (
+        t
+        .
+        paper_download
+        ,
+        1
+        )
+        paperDownload
+        ,
+        t
+        .
+        status
+        statusCode
+        ,
+        TRUNCATE
+        (
+        t
+        .
+        answer_progress
+        ,
+        2
+        )
+        progress
+        ,
+        IFNULL
+        (
+        t
+        .
+        client_current_ip
+        ,
+        '无'
+        )
+        clientCurrentIp
+        ,
+        IFNULL
+        (
+        t
+        .
+        warning_count
+        ,
+        0
+        )
+        as
+        warningCount
+        ,
+        IFNULL
+        (
+        t
+        .
+        breach_status
+        ,
+        1
+        )
+        as
+        breachStatus
+        ,
+        IFNULL
+        (
+        t
+        .
+        client_websocket_status
+        ,
+        'OFF_LINE'
+        )
+        as
+        clientWebsocketStatus
+        ,
+        t
+        .
+        client_last_sync_time
+        as
+        updateTime
+        ,
+        t
+        .
+        monitor_video_source
+        as
+        monitorVideoSource
+        ,
+        t
+        .
+        monitor_record
+        as
+        monitorRecord
     </sql>
 
     <sql id="invigilatePageMiddle">
@@ -67,7 +230,7 @@
         <if test="examId != null and examId != ''">
             and tiiwi.exam_id = #{examId}
         </if>
-            and tiiwi.exam_record_id = toer.id and tiiwi.approve_status = 0) as warningNew
+        and tiiwi.exam_record_id = toer.id and tiiwi.approve_status = 0) as warningNew
         from
         t_e_exam_student s
         left join t_e_exam tee on tee.id = s.exam_id
@@ -107,7 +270,7 @@
         <if test="identity != null and identity !=''">
             and s.identity like CONCAT('%', #{identity},'%')
         </if>
-            and teea.finish_time > unix_timestamp(current_timestamp()) * 1000
+        and teea.finish_time > unix_timestamp(current_timestamp()) * 1000
         <if test="status != null and status != '' and status != 'UN_FINISH'">
             <choose>
                 <when test="status == 'EXAMING'">
@@ -154,10 +317,10 @@
         <include refid="invigilatePageHead"/>
         <!--,t.monitor_live_url as monitorLiveUrl-->
         ,(select count(1) from t_ie_invigilate_warn_info tiiwi where 1 = 1
-            <if test="examId != null and examId != ''">
-                and tiiwi.exam_id = #{examId}
-            </if>
-            and tiiwi.exam_record_id = t.id and
+        <if test="examId != null and examId != ''">
+            and tiiwi.exam_id = #{examId}
+        </if>
+        and tiiwi.exam_record_id = t.id and
         tiiwi.approve_status = 0) as warningNew
         <include refid="invigilatePageMiddle"/>
         <where>1 = 1
@@ -174,51 +337,52 @@
 
     <select id="invigilatePagePatrolList" resultType="com.qmth.themis.business.bean.admin.InvigilateListPatrolBean">
         select (@i := @i + 1) as seq,t.* from(
-            select
-            distinct s.exam_id as examId,
-            tee.name as examName,
-            s.exam_activity_id as examActivityId,
-            teea.code as examActivityCode,
-            s.id as examStudentId,
-            s.identity,
-            s.room_code as roomCode,
-            s.room_name as roomName,
-            s.name,
-            s.course_name as courseName,
-            s.course_code as courseCode,
-            tes.mobile_number as mobileNumber,
-            toer.id as examRecordId,
-            IFNULL(toer.paper_download,1) as paperDownload,
-            toer.status as statusCode,
-            TRUNCATE(toer.answer_progress,2) as progress,
-            IFNULL(toer.client_current_ip,'无') as clientCurrentIp,
-            IFNULL(toer.warning_count,0) as warningCount,
-            IFNULL(toer.breach_status,1) as breachStatus,
-            IFNULL(toer.client_websocket_status,'OFF_LINE') as clientWebsocketStatus,
-            toer.client_last_sync_time as updateTime,
-            toer.monitor_video_source as monitorVideoSource,
-            toer.monitor_record as monitorRecord,
-            toer.finish_type as finishType
-            ,(select count(1) from t_ie_invigilate_exception_info tiiei where 1 = 1
-                <if test="examId != null and examId != ''">
-                    and tiiei.exam_id = #{examId}
-                </if>
-                    and tiiei.exam_record_id = toer.id) as
-            exceptionCount
-            ,(select count(1) from t_ie_invigilate_warn_info tiiwi where 1 = 1
-                <if test="examId != null and examId != ''">
-                    and tiiwi.exam_id = #{examId}
-                </if>
-                    and tiiwi.exam_record_id = toer.id and tiiwi.`type` = 'FACE_COUNT_ERROR' and tiiwi.`level` = 'D8') as multipleFaceCount
-            from
-            t_e_exam_student s
-            left join t_e_exam tee on tee.id = s.exam_id
-            left join t_e_exam_activity teea on teea.id = s.exam_activity_id
-            left join t_e_student tes on s.student_id = tes.id
-            LEFT JOIN t_oe_exam_record toer on toer.exam_student_id = s.id
-            <if test="userId != null and userId != ''">
-                left join t_b_exam_invigilate_user tbeiu on tbeiu.exam_id = s.exam_id
-            </if>
+        select
+        distinct s.exam_id as examId,
+        tee.name as examName,
+        s.exam_activity_id as examActivityId,
+        teea.code as examActivityCode,
+        s.id as examStudentId,
+        s.identity,
+        s.room_code as roomCode,
+        s.room_name as roomName,
+        s.name,
+        s.course_name as courseName,
+        s.course_code as courseCode,
+        tes.mobile_number as mobileNumber,
+        toer.id as examRecordId,
+        IFNULL(toer.paper_download,1) as paperDownload,
+        toer.status as statusCode,
+        TRUNCATE(toer.answer_progress,2) as progress,
+        IFNULL(toer.client_current_ip,'无') as clientCurrentIp,
+        IFNULL(toer.warning_count,0) as warningCount,
+        IFNULL(toer.breach_status,1) as breachStatus,
+        IFNULL(toer.client_websocket_status,'OFF_LINE') as clientWebsocketStatus,
+        toer.client_last_sync_time as updateTime,
+        toer.monitor_video_source as monitorVideoSource,
+        toer.monitor_record as monitorRecord,
+        toer.finish_type as finishType
+        ,(select count(1) from t_ie_invigilate_exception_info tiiei where 1 = 1
+        <if test="examId != null and examId != ''">
+            and tiiei.exam_id = #{examId}
+        </if>
+        and tiiei.exam_record_id = toer.id) as
+        exceptionCount
+        ,(select count(1) from t_ie_invigilate_warn_info tiiwi where 1 = 1
+        <if test="examId != null and examId != ''">
+            and tiiwi.exam_id = #{examId}
+        </if>
+        and tiiwi.exam_record_id = toer.id and tiiwi.`type` = 'FACE_COUNT_ERROR' and tiiwi.`level` = 'D8') as
+        multipleFaceCount
+        from
+        t_e_exam_student s
+        left join t_e_exam tee on tee.id = s.exam_id
+        left join t_e_exam_activity teea on teea.id = s.exam_activity_id
+        left join t_e_student tes on s.student_id = tes.id
+        LEFT JOIN t_oe_exam_record toer on toer.exam_student_id = s.id
+        <if test="userId != null and userId != ''">
+            left join t_b_exam_invigilate_user tbeiu on tbeiu.exam_id = s.exam_id
+        </if>
         WHERE 1 = 1
         <if test="examId != null and examId != ''">
             and s.exam_id = #{examId}
@@ -274,7 +438,7 @@
         </if>
         ) t,
         (SELECT @i := 0) as i
-        <where> 1 = 1
+        <where>1 = 1
             <if test="minMultipleFaceCount != null and minMultipleFaceCount != '' or minMultipleFaceCount == 0">
                 and t.multipleFaceCount &gt;= #{minMultipleFaceCount}
             </if>
@@ -314,13 +478,13 @@
         <if test="examId != null and examId != ''">
             and tiiwi.exam_id = #{examId}
         </if>
-            and tiiwi.exam_record_id = toer.id and tiiwi.`type` =
+        and tiiwi.exam_record_id = toer.id and tiiwi.`type` =
         'FACE_COUNT_ERROR' and tiiwi.`level` = 'D8') as multipleFaceCount
         ,(select count(1) from t_ie_invigilate_exception_info tiiei where 1 = 1
         <if test="examId != null and examId != ''">
             and tiiei.exam_id = #{examId}
         </if>
-            and tiiei.exam_record_id = toer.id) as exceptionCount
+        and tiiei.exam_record_id = toer.id) as exceptionCount
         from t_ie_invigilate_warn_info tiiwi
         left join t_e_exam tee on tee.id = tiiwi.exam_id
         left join t_e_exam_activity teea on teea.id = tiiwi.exam_activity_id
@@ -329,7 +493,7 @@
         <if test="userId != null and userId != ''">
             left join t_b_exam_invigilate_user tbeiu on tbeiu.exam_id = tees.exam_id
         </if>
-        <where> 1 = 1
+        <where>1 = 1
             and tee.monitor_status <![CDATA[ <> ]]> 'FINISHED'
             <if test="examId != null and examId != ''">
                 and tiiwi.exam_id = #{examId}
@@ -467,7 +631,8 @@
         <if test="examId != null and examId != ''">
             and toer.exam_id = #{examId}
         </if>
-            and toer.exam_student_id = tees.id and toer.status in ('FINISHED','PERSISTED') and toer.first_start_time is not null) as
+        and toer.exam_student_id = tees.id and toer.status in ('FINISHED','PERSISTED') and toer.first_start_time is not
+        null) as
         statusTemp,
         <!--tes.mobile_number as mobileNumber,-->
         t.id as examRecordId,
@@ -479,7 +644,8 @@
         where
         tmtvm.exam_record_id = t.id)) as videoCount,
         t.monitor_record as monitorRecord,
-        (select GROUP_CONCAT(tmtvm.video_source) from t_m_tencent_video_message tmtvm where tmtvm.exam_record_id = t.id) as videoSource,
+        (select GROUP_CONCAT(tmtvm.video_source) from t_m_tencent_video_message tmtvm where tmtvm.exam_record_id = t.id)
+        as videoSource,
         t.tencent_video_url as tencentVideoUrl,
         IFNULL(t.breach_status,1) as breachStatus
         from
@@ -568,7 +734,8 @@
         <if test="examId != null and examId != ''">
             and toer.exam_id = #{examId}
         </if>
-            and toer.exam_student_id = tees.id and toer.status in ('FINISHED','PERSISTED') and toer.first_start_time is not null) as
+        and toer.exam_student_id = tees.id and toer.status in ('FINISHED','PERSISTED') and toer.first_start_time is not
+        null) as
         statusTemp,
         <!--tes.mobile_number as mobileNumber,-->
         t.breach_status as breachStatusTemp
@@ -579,11 +746,12 @@
         left join t_e_exam_activity teea on
         teea.id = tees.exam_activity_id
         left join t_e_student tes on tees.student_id = tes.id
-        left join t_oe_exam_record t on t.exam_id = tees.exam_id and t.exam_activity_id = tees.exam_activity_id and t.exam_student_id = tees.id
+        left join t_oe_exam_record t on t.exam_id = tees.exam_id and t.exam_activity_id = tees.exam_activity_id and
+        t.exam_student_id = tees.id
         <if test="userId != null and userId != ''">
             left join t_b_exam_invigilate_user tbeiu on tbeiu.exam_id = tees.exam_id
         </if>
-        <where> 1 = 1
+        <where>1 = 1
             <if test="examId != null and examId != ''">
                 and tees.exam_id = #{examId}
             </if>
@@ -670,7 +838,8 @@
         <if test="examId != null and examId != ''">
             and tiiwi.exam_id = #{examId}
         </if>
-        and tiiwi.exam_record_id = toer.id and tiiwi.`type` = 'FACE_COUNT_ERROR' and tiiwi.`level` = 'D8') as multipleFaceCount
+        and tiiwi.exam_record_id = toer.id and tiiwi.`type` = 'FACE_COUNT_ERROR' and tiiwi.`level` = 'D8') as
+        multipleFaceCount
         ,(select count(1) from t_ie_invigilate_exception_info tiiei where 1 = 1
         <if test="examId != null and examId != ''">
             and tiiei.exam_id = #{examId}
@@ -849,7 +1018,8 @@
     <select id="patrolReport" resultType="com.qmth.themis.business.bean.admin.InvigilateListPatrolReportBean">
         select
         s.room_code roomCode, s.room_name roomName, sum(IFNULL(t.warning_count, 0)) as warningCount,
-        count((t.client_websocket_status = 'OFF_LINE' or t.client_websocket_status is null) or null) as clientWebsocketStatusCount
+        count((t.client_websocket_status = 'OFF_LINE' or t.client_websocket_status is null) or null) as
+        clientWebsocketStatusCount
         from
         t_oe_exam_record t
         left join t_e_exam_student s on
@@ -1082,9 +1252,10 @@
         toer.id,toer.paper_id as paperId,toer.finish_time as finishTime,toer.first_start_time as firstStartTime
         from
         t_oe_exam_record toer
-        <where>
-            (toer.breach_status = 1
-            or breach_status is null)
+        <where> 1 = 1
+            <if test="examStudentBreachPush != null and (examStudentBreachPush == false or examStudentBreachPush == 0)">
+                and (toer.breach_status = 1 or breach_status is null)
+            </if>
             and toer.status in ('FINISHED','PERSISTED')
             <if test="examId != null and examId != ''">
                 and toer.exam_id = #{examId}
@@ -1100,16 +1271,16 @@
     <select id="findByOrgId" resultType="java.lang.Long">
         select count(1) as c
         from t_oe_exam_record toer
-        join t_e_exam tee on tee.id = toer.exam_id
+                 join t_e_exam tee on tee.id = toer.exam_id
         where 1 = 1
           and tee.org_id = #{orgId}
           and tee.monitor_status <![CDATA[ <> ]]> 'FINISHED'
-          and toer.STATUS in ('FIRST_PREPARE','ANSWERING','BREAK_OFF','RESUME_PREPARE')
+          and toer.STATUS in ('FIRST_PREPARE', 'ANSWERING', 'BREAK_OFF', 'RESUME_PREPARE')
           and toer.client_websocket_status = 'ON_LINE'
         union all
         select count(1) as c
         from t_oe_exam_record toer
-        join t_e_exam tee on tee.id = toer.exam_id
+                 join t_e_exam tee on tee.id = toer.exam_id
         where 1 = 1
           and tee.org_id = #{orgId}
           and tee.monitor_status <![CDATA[ <> ]]> 'FINISHED'
@@ -1118,7 +1289,7 @@
         union all
         select count(1) as c
         from t_oe_exam_record toer
-        join t_e_exam tee on tee.id = toer.exam_id
+                 join t_e_exam tee on tee.id = toer.exam_id
         where 1 = 1
           and tee.org_id = #{orgId}
           and toer.exam_id = tee.id
@@ -1148,15 +1319,15 @@
         left join t_e_exam_student s on
         t.exam_student_id = s.id
         <where>
-        t.exam_id = #{examId}
-        and s.room_code in
-        <foreach collection="roomCodeSet" item="roomCode" index="index" open="(" close=")" separator=",">
-            #{roomCode}
-        </foreach>
-        <if test="examActivityId != null and examActivityId != ''">
-            and t.exam_activity_id = #{examActivityId}
-        </if>
-        and t.STATUS in ('FIRST_PREPARE','ANSWERING','BREAK_OFF','RESUME_PREPARE')
+            t.exam_id = #{examId}
+            and s.room_code in
+            <foreach collection="roomCodeSet" item="roomCode" index="index" open="(" close=")" separator=",">
+                #{roomCode}
+            </foreach>
+            <if test="examActivityId != null and examActivityId != ''">
+                and t.exam_activity_id = #{examActivityId}
+            </if>
+            and t.STATUS in ('FIRST_PREPARE','ANSWERING','BREAK_OFF','RESUME_PREPARE')
         </where>
         UNION all
         select
@@ -1170,15 +1341,16 @@
         from
         t_e_exam_student t
         <where>
-        t.exam_id = #{examId}
-        and t.room_code in
-        <foreach collection="roomCodeSet" item="roomCode" index="index" open="(" close=")" separator=",">
-            #{roomCode}
-        </foreach>
-        <if test="examActivityId != null and examActivityId != ''">
-            and t.exam_activity_id = #{examActivityId}
-        </if>
-        </where>) t
+            t.exam_id = #{examId}
+            and t.room_code in
+            <foreach collection="roomCodeSet" item="roomCode" index="index" open="(" close=")" separator=",">
+                #{roomCode}
+            </foreach>
+            <if test="examActivityId != null and examActivityId != ''">
+                and t.exam_activity_id = #{examActivityId}
+            </if>
+        </where>
+        ) t
     </select>
 
     <select id="findByOnlineInfo" resultType="java.lang.Integer">
@@ -1189,15 +1361,15 @@
         left join t_e_exam_student s on
         t.exam_student_id = s.id
         <where>
-        t.exam_id = #{examId}
-        and s.room_code in
-        <foreach collection="roomCodeSet" item="roomCode" index="index" open="(" close=")" separator=",">
-            #{roomCode}
-        </foreach>
-        <if test="examActivityId != null and examActivityId != ''">
-            and t.exam_activity_id = #{examActivityId}
-        </if>
-        and t.STATUS = 'FIRST_PREPARE'
+            t.exam_id = #{examId}
+            and s.room_code in
+            <foreach collection="roomCodeSet" item="roomCode" index="index" open="(" close=")" separator=",">
+                #{roomCode}
+            </foreach>
+            <if test="examActivityId != null and examActivityId != ''">
+                and t.exam_activity_id = #{examActivityId}
+            </if>
+            and t.STATUS = 'FIRST_PREPARE'
         </where>
         union all
         select
@@ -1207,16 +1379,16 @@
         left join t_e_exam_student s on
         t.exam_student_id = s.id
         <where>
-        t.exam_id = #{examId}
-        and s.room_code in
-        <foreach collection="roomCodeSet" item="roomCode" index="index" open="(" close=")" separator=",">
-            #{roomCode}
-        </foreach>
-        <if test="examActivityId != null and examActivityId != ''">
-            and t.exam_activity_id = #{examActivityId}
-        </if>
-        and (t.STATUS = 'ANSWERING' and t.client_websocket_status = 'ON_LINE')
-        or t.STATUS in ('RESUME_PREPARE','BREAK_OFF')
+            t.exam_id = #{examId}
+            and s.room_code in
+            <foreach collection="roomCodeSet" item="roomCode" index="index" open="(" close=")" separator=",">
+                #{roomCode}
+            </foreach>
+            <if test="examActivityId != null and examActivityId != ''">
+                and t.exam_activity_id = #{examActivityId}
+            </if>
+            and (t.STATUS = 'ANSWERING' and t.client_websocket_status = 'ON_LINE')
+            or t.STATUS in ('RESUME_PREPARE','BREAK_OFF')
         </where>
         union all
         select
@@ -1226,15 +1398,15 @@
         left join t_e_exam_student s on
         t.exam_student_id = s.id
         <where>
-        t.exam_id = #{examId}
-        and s.room_code in
-        <foreach collection="roomCodeSet" item="roomCode" index="index" open="(" close=")" separator=",">
-            #{roomCode}
-        </foreach>
-        <if test="examActivityId != null and examActivityId != ''">
-            and t.exam_activity_id = #{examActivityId}
-        </if>
-        and t.STATUS in ('FINISHED','PERSISTED') and t.first_start_time is not null
+            t.exam_id = #{examId}
+            and s.room_code in
+            <foreach collection="roomCodeSet" item="roomCode" index="index" open="(" close=")" separator=",">
+                #{roomCode}
+            </foreach>
+            <if test="examActivityId != null and examActivityId != ''">
+                and t.exam_activity_id = #{examActivityId}
+            </if>
+            and t.STATUS in ('FINISHED','PERSISTED') and t.first_start_time is not null
         </where>
         union all
         select
@@ -1530,28 +1702,22 @@
     </sql>
 
     <select id="findExamRecordByNotVideoUrl" resultType="com.qmth.themis.business.entity.TOeExamRecord">
-        select
-            toer.*
-        from
-            t_oe_exam_record toer
-        where
-            not EXISTS(
-                    select
-                        tmtvm.exam_record_id
-                    from
-                        t_m_tencent_video_message tmtvm
-                    where
-                        tmtvm.exam_record_id = toer.id
-                )
+        select toer.*
+        from t_oe_exam_record toer
+        where not EXISTS(
+                select tmtvm.exam_record_id
+                from t_m_tencent_video_message tmtvm
+                where tmtvm.exam_record_id = toer.id
+            )
           and toer.exam_id = #{examId}
     </select>
 
     <select id="findExamRecordByExamIdAndExamActivityId" resultType="com.qmth.themis.business.entity.TOeExamRecord">
-        select * from t_oe_exam_record toer
-        where
-            toer.exam_id = #{examId}
-            and toer.exam_activity_id = #{examActivityId}
-            and toer.status in ('FIRST_PREPARE','ANSWERING','BREAK_OFF','RESUME_PREPARE')
+        select *
+        from t_oe_exam_record toer
+        where toer.exam_id = #{examId}
+          and toer.exam_activity_id = #{examActivityId}
+          and toer.status in ('FIRST_PREPARE', 'ANSWERING', 'BREAK_OFF', 'RESUME_PREPARE')
     </select>
 
     <select id="findByExamIdOrExamActivityIdCount" resultType="java.lang.Integer">
@@ -1569,98 +1735,99 @@
 
     <select id="findExamRecordNeedMarkAll" resultType="com.qmth.themis.business.entity.TOeExamRecord">
         select
-            t1.*
+        t1.*
         from
-            (
-                select
-                    t.exam_student_id
-                from
-                    t_oe_exam_record t
-                where
-                    exists(
-                            select
-                                tees.id
-                            from
-                                t_e_exam_student tees
-                                    join t_oe_exam_record toer on
-                                            toer.exam_id = tees.exam_id
-                                        and toer.exam_activity_id = tees.exam_activity_id
-                                        and toer.exam_student_id = tees.id
-                              <where>
-                                  <if test="examId != null and examId != ''">
-                                      and tees.exam_id = #{examId}
-                                  </if>
-                              and tees.enable = 1
-                              and tees.already_exam_count is not null
-                              and tees.already_exam_count <![CDATA[ > ]]> 0
-                              <if test="examPaperIdSet != null and examPaperIdSet != '' and examPaperIdSet.size > 0">
-                                  and toer.paper_id in
-                                  <foreach collection="examPaperIdSet" item="paperId" index="index" open="(" close=")" separator=",">
-                                      #{paperId}
-                                  </foreach>
-                              </if>
-                              and toer.status in ('FINISHED','PERSISTED')
-                              and toer.first_start_time is not null
-                              and toer.finish_time is not null
-                              <if test="examStudentBreachPush != null and (examStudentBreachPush == false or examStudentBreachPush == 0)">
-                                and (toer.breach_status is null or toer.breach_status = 1)
-                              </if>
-                              and t.exam_student_id = tees.id
-                        </where>)
-                group by
-                    t.exam_student_id
-                <if test="many != null and many != '' or many == 0">
-                    <choose>
-                        <when test="many == true">
-                            HAVING count(t.exam_student_id) <![CDATA[ > ]]> 1
-                        </when>
-                        <otherwise>
-                            HAVING count(t.exam_student_id) = 1
-                        </otherwise>
-                    </choose>
-                </if>
-                ) t
-                join t_oe_exam_record t1 on
-                t1.exam_student_id = t.exam_student_id
-                where t1.status in ('FINISHED','PERSISTED')
-                and t1.first_start_time is not null
-                and t1.finish_time is not null
-                <if test="examStudentBreachPush != null and (examStudentBreachPush == false or examStudentBreachPush == 0)">
-                    and (t1.breach_status is null or t1.breach_status = 1)
-                </if>
-                <!--<if test="many != null and many != '' or many == 0">
-                    <choose>
-                        <when test="many == true">
-                            order by t1.id limit 510
-                        </when>
-                        <otherwise>
-                            order by t1.id limit 500
-                        </otherwise>
-                    </choose>
-                </if>-->
-                order by t1.id
+        (
+        select
+        t.exam_student_id
+        from
+        t_oe_exam_record t
+        where
+        exists(
+        select
+        tees.id
+        from
+        t_e_exam_student tees
+        join t_oe_exam_record toer on
+        toer.exam_id = tees.exam_id
+        and toer.exam_activity_id = tees.exam_activity_id
+        and toer.exam_student_id = tees.id
+        <where>
+            <if test="examId != null and examId != ''">
+                and tees.exam_id = #{examId}
+            </if>
+            and tees.enable = 1
+            and tees.already_exam_count is not null
+            and tees.already_exam_count <![CDATA[ > ]]> 0
+            <if test="examPaperIdSet != null and examPaperIdSet != '' and examPaperIdSet.size > 0">
+                and toer.paper_id in
+                <foreach collection="examPaperIdSet" item="paperId" index="index" open="(" close=")" separator=",">
+                    #{paperId}
+                </foreach>
+            </if>
+            and toer.status in ('FINISHED','PERSISTED')
+            and toer.first_start_time is not null
+            and toer.finish_time is not null
+            <if test="examStudentBreachPush != null and (examStudentBreachPush == false or examStudentBreachPush == 0)">
+                and (toer.breach_status is null or toer.breach_status = 1)
+            </if>
+            and t.exam_student_id = tees.id
+        </where>
+        )
+        group by
+        t.exam_student_id
+        <if test="many != null and many != '' or many == 0">
+            <choose>
+                <when test="many == true">
+                    HAVING count(t.exam_student_id) <![CDATA[ > ]]> 1
+                </when>
+                <otherwise>
+                    HAVING count(t.exam_student_id) = 1
+                </otherwise>
+            </choose>
+        </if>
+        ) t
+        join t_oe_exam_record t1 on
+        t1.exam_student_id = t.exam_student_id
+        where t1.status in ('FINISHED','PERSISTED')
+        and t1.first_start_time is not null
+        and t1.finish_time is not null
+        <if test="examStudentBreachPush != null and (examStudentBreachPush == false or examStudentBreachPush == 0)">
+            and (t1.breach_status is null or t1.breach_status = 1)
+        </if>
+        <!--<if test="many != null and many != '' or many == 0">
+            <choose>
+                <when test="many == true">
+                    order by t1.id limit 510
+                </when>
+                <otherwise>
+                    order by t1.id limit 500
+                </otherwise>
+            </choose>
+        </if>-->
+        order by t1.id
     </select>
 
     <select id="persistedAnswerBatch" resultType="com.qmth.themis.business.entity.TOeExamRecord">
-            select toer.* from t_oe_exam_record toer
-                left join t_oe_exam_answer toea on toea.exam_record_id = toer.id
-            <where>
-                <if test="examId != null and examId != ''">
-                    and toer.exam_id = #{examId}
-                </if>
-                <if test="examActivityId != null and examActivityId != ''">
-                    and toer.exam_activity_id = #{examActivityId}
-                </if>
-                <if test="status != null and status != ''">
-                    and toer.status = #{status}
-                </if>
-              and toer.objective_score > 0
-              and toea.id is null
-              and toer.first_start_time is not null
-              and toer.finish_time is not null
-            </where>
-            group by toer.id
-            having count(toea.id) = 0
+        select toer.* from t_oe_exam_record toer
+        left join t_oe_exam_answer toea on toea.exam_record_id = toer.id
+        <where>
+            <if test="examId != null and examId != ''">
+                and toer.exam_id = #{examId}
+            </if>
+            <if test="examActivityId != null and examActivityId != ''">
+                and toer.exam_activity_id = #{examActivityId}
+            </if>
+            <if test="status != null and status != ''">
+                and toer.status = #{status}
+            </if>
+            and toer.objective_score > 0
+            and toea.id is null
+            and toer.first_start_time is not null
+            and toer.finish_time is not null
+        </where>
+        group by toer.id
+        having count(toea.id) = 0
     </select>
 
     <select id="cleanExamFirstPrepareCache" resultType="java.util.Map">
@@ -1669,30 +1836,30 @@
         from
         (
         select
-            tes.id as studentId,
-            toer.id as examRecordId,
-            DATE_FORMAT(FROM_UNIXTIME(toer.first_prepare_time  / 1000), '%Y-%m-%d %H:%i:%s') as 'firstPrepareTime',
-            DATE_FORMAT(FROM_UNIXTIME(toer.finish_time / 1000), '%Y-%m-%d %H:%i:%s') as 'finishTime',
-            DATE_FORMAT(FROM_UNIXTIME(toer.first_start_time / 1000), '%Y-%m-%d %H:%i:%s') as 'firstStartTime',
-            DATE_FORMAT(FROM_UNIXTIME(toer.start_time / 1000), '%Y-%m-%d %H:%i:%s') as 'startTime',
-            DATE_FORMAT(FROM_UNIXTIME(toer.end_time / 1000), '%Y-%m-%d %H:%i:%s') as 'endTime'
+        tes.id as studentId,
+        toer.id as examRecordId,
+        DATE_FORMAT(FROM_UNIXTIME(toer.first_prepare_time / 1000), '%Y-%m-%d %H:%i:%s') as 'firstPrepareTime',
+        DATE_FORMAT(FROM_UNIXTIME(toer.finish_time / 1000), '%Y-%m-%d %H:%i:%s') as 'finishTime',
+        DATE_FORMAT(FROM_UNIXTIME(toer.first_start_time / 1000), '%Y-%m-%d %H:%i:%s') as 'firstStartTime',
+        DATE_FORMAT(FROM_UNIXTIME(toer.start_time / 1000), '%Y-%m-%d %H:%i:%s') as 'startTime',
+        DATE_FORMAT(FROM_UNIXTIME(toer.end_time / 1000), '%Y-%m-%d %H:%i:%s') as 'endTime'
         from
         t_oe_exam_record toer
         join t_e_exam_student tees on tees.id = toer.exam_student_id
         join t_e_student tes on tes.id = tees.student_id
         <where>
-        toer.status = 'FIRST_PREPARE'
-        <if test="examIds != null and examIds != ''">
-            and toer.exam_id in
-            <foreach collection="examIds" item="examId" index="index" open="(" close=")" separator=",">
-                #{examId}
-            </foreach>
-        </if>
-        and toer.first_prepare_time is not null
-        and toer.first_start_time is null
-        and toer.finish_time is null
-        and (toer.objective_score is null
-        or toer.objective_score = 0)
+            toer.status = 'FIRST_PREPARE'
+            <if test="examIds != null and examIds != ''">
+                and toer.exam_id in
+                <foreach collection="examIds" item="examId" index="index" open="(" close=")" separator=",">
+                    #{examId}
+                </foreach>
+            </if>
+            and toer.first_prepare_time is not null
+            and toer.first_start_time is null
+            and toer.finish_time is null
+            and (toer.objective_score is null
+            or toer.objective_score = 0)
         </where>
         group by
         toer.id
@@ -1701,96 +1868,72 @@
     </select>
 
     <select id="dataCount" resultType="java.lang.Long">
-        select
-            count(1) as c
-        from
-            t_oe_exam_record toer
-        where
-            toer.client_websocket_status = 'ON_LINE'
+        select count(1) as c
+        from t_oe_exam_record toer
+        where toer.client_websocket_status = 'ON_LINE'
         union all
-        select
-            count(1) as c
-        from
-            t_oe_exam_record toer
-        where
-            toer.STATUS in ('ANSWERING','RESUME_PREPARE')
+        select count(1) as c
+        from t_oe_exam_record toer
+        where toer.STATUS in ('ANSWERING', 'RESUME_PREPARE')
           and toer.client_websocket_status = 'ON_LINE'
         union all
-        select
-            count(1) as c
-        from
-            t_oe_exam_record toer
-        where
-            toer.STATUS in ('FINISHED','PERSISTED')
+        select count(1) as c
+        from t_oe_exam_record toer
+        where toer.STATUS in ('FINISHED', 'PERSISTED')
         union all
-        select
-            count(distinct tees.id) as c
-        from
-            t_e_exam_student tees
-        left join t_oe_exam_record toer on toer.exam_student_id = tees.id
-        where
-            toer.STATUS in ('FINISHED', 'PERSISTED') and toer.id is not null
+        select count(distinct tees.id) as c
+        from t_e_exam_student tees
+                 left join t_oe_exam_record toer on toer.exam_student_id = tees.id
+        where toer.STATUS in ('FINISHED', 'PERSISTED')
+          and toer.id is not null
     </select>
 
     <select id="orgDataCount" resultType="com.qmth.themis.business.bean.admin.OrgDataCountBean">
-        select
-            t.name as name,
-            t.code as code,
-            sum(onlineCount) as onlineCount,
-            sum(examCount) as examCount
-        from
-            (select
-            tbo.name,
-            tbo.code,
-            count(toer.id) as onlineCount,
-            0 as examCount
-        from
-            t_b_org tbo
-                join t_e_exam tee on
-                tbo.id = tee.org_id
-                join t_oe_exam_record toer on
-                tee.id = toer.exam_id
-        WHERE
-            toer.client_websocket_status = 'ON_LINE'
-        group by
-            tbo.name,
-            tbo.code
-        union all
-        select
-            tbo.name,
-            tbo.code,
-            0 as onlineCount,
-            count(toer.id) as examCount
-        from
-            t_b_org tbo
-                join t_e_exam tee on
-                tbo.id = tee.org_id
-                join t_oe_exam_record toer on
-                tee.id = toer.exam_id
-        WHERE
-            toer.STATUS in ('ANSWERING','RESUME_PREPARE')
-          and toer.client_websocket_status = 'ON_LINE'
-        group by
-            tbo.name,
-            tbo.code) t group by
-                            t.name,
-                            t.code
+        select t.name           as name,
+               t.code           as code,
+               sum(onlineCount) as onlineCount,
+               sum(examCount)   as examCount
+        from (select tbo.name,
+                     tbo.code,
+                     count(toer.id) as onlineCount,
+                     0              as examCount
+              from t_b_org tbo
+                       join t_e_exam tee on
+                  tbo.id = tee.org_id
+                       join t_oe_exam_record toer on
+                  tee.id = toer.exam_id
+              WHERE toer.client_websocket_status = 'ON_LINE'
+              group by tbo.name,
+                       tbo.code
+              union all
+              select tbo.name,
+                     tbo.code,
+                     0              as onlineCount,
+                     count(toer.id) as examCount
+              from t_b_org tbo
+                       join t_e_exam tee on
+                  tbo.id = tee.org_id
+                       join t_oe_exam_record toer on
+                  tee.id = toer.exam_id
+              WHERE toer.STATUS in ('ANSWERING', 'RESUME_PREPARE')
+                and toer.client_websocket_status = 'ON_LINE'
+              group by tbo.name,
+                       tbo.code) t
+        group by t.name,
+                 t.code
     </select>
 
     <select id="mapDataCount" resultType="com.qmth.themis.business.bean.admin.MapDataCountBean">
-        select
-            tir.country,
-            tir.province,
-            count(toer.id) as onlineCount
-        from
-            t_ip_region tir
-                join t_oe_exam_record toer on
-                tir.exam_record_id = toer.id
-                join t_e_exam tee on
-                toer.exam_id = tee.id
-        WHERE
-            toer.client_websocket_status = 'ON_LINE'
-            and tir.country != '0'
+        select tir.country,
+               tir.province,
+               count(toer.id) as onlineCount
+        from t_ip_region tir
+                 join t_oe_exam_record toer on
+            tir.exam_record_id = toer.id
+                 join t_e_exam tee on
+            toer.exam_id = tee.id
+        WHERE toer.client_websocket_status = 'ON_LINE'
+          and tir.country != '0'
 	        and tir.province != '0'
         group by
             tir.country,