wangliang 1 рік тому
батько
коміт
b866b581b0

+ 3 - 3
themis-admin/src/main/java/com/qmth/themis/admin/api/TEExamController.java

@@ -503,7 +503,7 @@ public class TEExamController {
         List<TEExamSummary> teExamSummaryAllList = new ArrayList<>();
         if (Objects.nonNull(examId) && Objects.nonNull(examActivityId) && !CollectionUtils.isEmpty(roomCodeSet)) {
             for (String s : roomCodeSet) {
-                if (freshen) {
+                if (freshen && authDto.getRoleCodes().toString().contains(RoleEnum.ADMIN.name())) {
                     teExamSummaryService.examSummary(examId, examActivityId, Objects.nonNull(s) ? new HashSet<>(Arrays.asList(s)) : null, true);
                 }
                 List<TEExamSummary> teExamSummaryList = themisCacheService.getExamSummaryCache(examId, examActivityId, s);
@@ -514,7 +514,7 @@ public class TEExamController {
                 teExamSummaryAllList.addAll(teExamSummaryList);
             }
         } else if (Objects.nonNull(examId) && Objects.nonNull(examActivityId)) {
-            if (freshen) {
+            if (freshen && authDto.getRoleCodes().toString().contains(RoleEnum.ADMIN.name())) {
                 teExamSummaryService.examSummary(examId, examActivityId, null, true);
             }
             List<TEExamSummary> teExamSummaryList = themisCacheService.getExamSummaryCache(examId, examActivityId);
@@ -524,7 +524,7 @@ public class TEExamController {
             }
             teExamSummaryAllList.addAll(teExamSummaryList);
         } else {
-            if (freshen) {
+            if (freshen && authDto.getRoleCodes().toString().contains(RoleEnum.ADMIN.name())) {
                 teExamSummaryService.examSummary(examId, null, null, true);
             }
             List<TEExamSummary> teExamSummaryList = themisCacheService.getExamSummaryCache(examId);

+ 1 - 1
themis-admin/src/main/java/com/qmth/themis/admin/api/TIeInvigilateCallMobileController.java

@@ -173,7 +173,7 @@ public class TIeInvigilateCallMobileController {
         }
         Map<String, String> monitorRecordMap = SystemConstant.getMonitorRecordMap(monitorRecord);
         List<TIeExamInvigilateCall> tIeExamInvigilateCallList = new ArrayList<>();
-        for (TIeExamInvigilateCall t : tIeExamInvigilateCallTempList) {
+        for (TIeExamInvigilateCall t : tIeExamInvigilateCallList) {
             if (!CollectionUtils.isEmpty(monitorRecordMap) && Objects.nonNull(monitorRecordMap.get(t.getSource().name()))) {
                 tIeExamInvigilateCallList.add(t);
             }

+ 4 - 2
themis-admin/src/main/java/com/qmth/themis/admin/api/TIeInvigilateController.java

@@ -393,8 +393,10 @@ public class TIeInvigilateController {
             tOeExamRecordService.updateWarningUnreadByDb(examRecordId, 0);
             tOeExamRecordService.updateWarningUnreadCache(examRecordId, 0, false);
 
-            Set<String> roomCodeSet = new HashSet<>(Arrays.asList(examStudentCacheBean.getRoomCode().split(", ")));
-            teExamSummaryService.examSummary(examId, examActivityId, roomCodeSet, true);
+            teExamSummaryService.updateExamSummaryWarningUnread(examId, examActivityId, examStudentCacheBean.getRoomCode());
+            themisCacheService.updateExamSummaryCache(examId);
+            themisCacheService.updateExamSummaryCache(examId, examActivityId);
+            themisCacheService.updateExamSummaryCache(examId, examActivityId, examStudentCacheBean.getRoomCode());
         }
         invigilateListDetailBean.setMonitorVideoSource(examCacheBean.getMonitorVideoSource());
         invigilateListDetailBean.setMonitorRecord(examCacheBean.getMonitorRecord());

+ 22 - 2
themis-admin/src/main/java/com/qmth/themis/admin/api/TIeInvigilateWarnInfoController.java

@@ -58,10 +58,10 @@ public class TIeInvigilateWarnInfoController {
     TEExamActivityService teExamActivityService;
 
     @Resource
-    TEExamService teExamService;
+    TEExamStudentService teExamStudentService;
 
     @Resource
-    TEExamStudentService teExamStudentService;
+    TEExamSummaryService teExamSummaryService;
 
     @ApiOperation(value = "预警提醒接口")
     @RequestMapping(value = "/notify", method = RequestMethod.POST)
@@ -207,6 +207,26 @@ public class TIeInvigilateWarnInfoController {
             for (TOeExamRecord t : tOeExamRecordList) {
                 tOeExamRecordService.updateWarningUnreadCache(t.getId(), 0, true);
             }
+            if (Objects.nonNull(examId)) {
+                QueryWrapper<TEExamStudent> teExamStudentQueryWrapper = new QueryWrapper<>();
+                teExamStudentQueryWrapper.lambda().eq(TEExamStudent::getExamId, examId);
+                if (Objects.nonNull(examActivityId)) {
+                    teExamStudentQueryWrapper.lambda().eq(TEExamStudent::getExamActivityId, examActivityId);
+                }
+                if (Objects.nonNull(roomCode)) {
+                    teExamStudentQueryWrapper.lambda().eq(TEExamStudent::getRoomCode, roomCode);
+                }
+                List<TEExamStudent> teExamStudentList = teExamStudentService.list(teExamStudentQueryWrapper);
+                if (!CollectionUtils.isEmpty(teExamStudentList)) {
+                    Set<String> roomCodeSet = teExamStudentList.stream().map(s -> s.getRoomCode()).collect(Collectors.toSet());
+                    for (String s : roomCodeSet) {
+                        teExamSummaryService.updateExamSummaryWarningUnread(examId, examActivityId, s);
+                        themisCacheService.updateExamSummaryCache(examId, examActivityId, s);
+                    }
+                    themisCacheService.updateExamSummaryCache(examId);
+                    themisCacheService.updateExamSummaryCache(examId, examActivityId);
+                }
+            }
             tOeExamRecordService.approveStatusListUpdate(examId, examActivityId, roomCode, approveStatus, name, identity, minMultipleFaceCount, maxMultipleFaceCount, minExceptionCount, maxExceptionCount, minWarningCount, maxWarningCount, userId, tbUser.getOrgId());
         }
         return ResultUtil.ok(true);

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

@@ -31,7 +31,16 @@ public interface TEExamSummaryMapper extends BaseMapper<TEExamSummary> {
      * @param examActivityId
      * @param roomCode
      */
-    void updateExamSummaryFinishCount(Long examId, Long examActivityId, String roomCode);
+    void updateExamSummaryFinishCount(@Param("examId") Long examId, @Param("examActivityId") Long examActivityId, @Param("roomCode") String roomCode);
+
+    /**
+     * 更新预警未读数
+     *
+     * @param examId
+     * @param examActivityId
+     * @param roomCode
+     */
+    void updateExamSummaryWarningUnread(@Param("examId") Long examId, @Param("examActivityId") Long examActivityId, @Param("roomCode") String roomCode);
 
     /**
      * 保存统计考试信息

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

@@ -34,4 +34,13 @@ public interface TEExamSummaryService extends IService<TEExamSummary> {
      * @param roomCode
      */
     void updateExamSummaryFinishCount(Long examId, Long examActivityId, String roomCode);
+
+    /**
+     * 更新预警未读数
+     *
+     * @param examId
+     * @param examActivityId
+     * @param roomCode
+     */
+    void updateExamSummaryWarningUnread(Long examId, Long examActivityId, String roomCode);
 }

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

@@ -89,6 +89,18 @@ public class TEExamSummaryServiceImpl extends ServiceImpl<TEExamSummaryMapper, T
         this.baseMapper.updateExamSummaryFinishCount(examId, examActivityId, roomCode);
     }
 
+    /**
+     * 更新预警未读数
+     *
+     * @param examId
+     * @param examActivityId
+     * @param roomCode
+     */
+    @Override
+    public void updateExamSummaryWarningUnread(Long examId, Long examActivityId, String roomCode) {
+        this.baseMapper.updateExamSummaryWarningUnread(examId, examActivityId, roomCode);
+    }
+
     /**
      * 考试计算公用
      *

+ 15 - 0
themis-business/src/main/resources/mapper/TEExamSummaryMapper.xml

@@ -52,6 +52,21 @@
         </where>
     </update>
 
+    <update id="updateExamSummaryWarningUnread">
+        update t_e_exam_summary set warning_unread = 0
+        <where> 1 = 1
+            <if test="examId != null and examId != ''">
+                and exam_id = #{examId}
+            </if>
+            <if test="examActivityId != null and examActivityId != ''">
+                and exam_activity_id = #{examActivityId}
+            </if>
+            <if test="roomCode != null and roomCode != ''">
+                and room_code = #{roomCode}
+            </if>
+        </where>
+    </update>
+
     <update id="updateExamSummary">
         update t_e_exam_summary
         set ${fieldValue}

+ 26 - 41
themis-business/src/main/resources/mapper/TOeExamRecordMapper.xml

@@ -36,7 +36,6 @@
     </sql>
 
     <select id="invigilatePageListVideo" resultType="com.qmth.themis.business.bean.admin.InvigilateListVideoBean">
-        select (@i := @i + 1) as seq,t.* from(
         select s.exam_id as examId,
         tee.name as examName,
         s.exam_activity_id as examActivityId,
@@ -142,8 +141,6 @@
             and toer.mobile_second_monitor_status = upper(#{mobileSecondMonitorStatus})
         </if>
         order by s.identity desc
-        ) t,
-        (SELECT @i := 0) as i
     </select>
 
     <select id="invigilatePageListVideoRandom" resultType="com.qmth.themis.business.bean.admin.InvigilateListVideoBean">
@@ -165,9 +162,7 @@
     </select>
 
     <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,
+        select distinct s.exam_id as examId,
         tee.name as examName,
         s.exam_activity_id as examActivityId,
         teea.code as examActivityCode,
@@ -202,7 +197,7 @@
         <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
+        <where> 1 = 1
         <if test="examId != null and examId != ''">
             and s.exam_id = #{examId}
         </if>
@@ -255,26 +250,23 @@
         <if test="status == null or status == ''">
             and toer.status in ('FIRST_PREPARE','ANSWERING','BREAK_OFF','RESUME_PREPARE')
         </if>
-        ) t,
-        (SELECT @i := 0) as i
-        <where>1 = 1
-            <if test="minMultipleFaceCount != null and minMultipleFaceCount != '' or minMultipleFaceCount == 0">
-                and t.multipleFaceCount &gt;= #{minMultipleFaceCount}
-            </if>
-            <if test="maxMultipleFaceCount != null and maxMultipleFaceCount != '' or maxMultipleFaceCount == 0">
-                and t.multipleFaceCount &lt;= #{maxMultipleFaceCount}
-            </if>
-            <if test="minExceptionCount != null and minExceptionCount != '' or minExceptionCount == 0">
-                and t.exceptionCount &gt;= #{minExceptionCount}
-            </if>
-            <if test="maxExceptionCount != null and maxExceptionCount != '' or maxExceptionCount == 0">
-                and t.exceptionCount &lt;= #{maxExceptionCount}
-            </if>
+        <if test="minMultipleFaceCount != null and minMultipleFaceCount != '' or minMultipleFaceCount == 0">
+            and toer.warning_multiple_face_count &gt;= #{minMultipleFaceCount}
+        </if>
+        <if test="maxMultipleFaceCount != null and maxMultipleFaceCount != '' or maxMultipleFaceCount == 0">
+            and toer.warning_multiple_face_count &lt;= #{maxMultipleFaceCount}
+        </if>
+        <if test="minExceptionCount != null and minExceptionCount != '' or minExceptionCount == 0">
+            and toer.exception_count &gt;= #{minExceptionCount}
+        </if>
+        <if test="maxExceptionCount != null and maxExceptionCount != '' or maxExceptionCount == 0">
+            and toer.exception_count &lt;= #{maxExceptionCount}
+        </if>
         </where>
     </select>
 
     <select id="invigilatePageWarningList" resultType="com.qmth.themis.business.bean.admin.InvigilateListWarningBean">
-        select (@i := @i + 1) as seq,t.* from(select distinct
+        select distinct
         tee.id as examId,
         tee.name as examName,
         teea.id as examActivityId,
@@ -302,7 +294,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}
@@ -334,23 +326,20 @@
             <if test="minWarningCount != null and minWarningCount != '' or minWarningCount == 0">
                 and toer.warning_count &gt;= #{minWarningCount}
             </if>
-        </where>
-        ) t,(SELECT @i := 0) as i
-        <where>1 = 1
             <if test="minMultipleFaceCount != null and minMultipleFaceCount != '' or minMultipleFaceCount == 0">
-                and t.multipleFaceCount &gt;= #{minMultipleFaceCount}
+                and toer.warning_multiple_face_count &gt;= #{minMultipleFaceCount}
             </if>
             <if test="maxMultipleFaceCount != null and maxMultipleFaceCount != '' or maxMultipleFaceCount == 0">
-                and t.multipleFaceCount &lt;= #{maxMultipleFaceCount}
+                and toer.warning_multiple_face_count &lt;= #{maxMultipleFaceCount}
             </if>
             <if test="minExceptionCount != null and minExceptionCount != '' or minExceptionCount == 0">
-                and t.exceptionCount &gt;= #{minExceptionCount}
+                and toer.exception_count &gt;= #{minExceptionCount}
             </if>
             <if test="maxExceptionCount != null and maxExceptionCount != '' or maxExceptionCount == 0">
-                and t.exceptionCount &lt;= #{maxExceptionCount}
+                and toer.exception_count &lt;= #{maxExceptionCount}
             </if>
         </where>
-        order by t.approveStatus,CAST(t.examActivityCode AS UNSIGNED),CAST(t.roomCode AS UNSIGNED)
+        order by tiiwi.approve_status,CAST(teea.code AS UNSIGNED),CAST(tees.room_code AS UNSIGNED)
     </select>
 
     <update id="approveStatusListUpdate">
@@ -580,7 +569,6 @@
     </select>
 
     <sql id="invigilatePageListHistorySql">
-        select (@i := @i + 1) as seq,t.* from(
         select s.exam_id as examId,
         tee.name as examName,
         s.exam_activity_id as examActivityId,
@@ -620,7 +608,7 @@
         <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
+        <where> 1 = 1
         <choose>
             <when test="status != null and status != '' and status == 'UN_FINISH'">
                 and toer.id is null
@@ -692,20 +680,17 @@
                 </otherwise>
             </choose>
         </if>
-        ) t,
-        (SELECT @i := 0) as i
-        <where>1 = 1
             <if test="minMultipleFaceCount != null and minMultipleFaceCount != '' or minMultipleFaceCount == 0">
-                and t.multipleFaceCount &gt;= #{minMultipleFaceCount}
+                and toer.warning_multiple_face_count &gt;= #{minMultipleFaceCount}
             </if>
             <if test="maxMultipleFaceCount != null and maxMultipleFaceCount != '' or maxMultipleFaceCount == 0">
-                and t.multipleFaceCount &lt;= #{maxMultipleFaceCount}
+                and toer.warning_multiple_face_count &lt;= #{maxMultipleFaceCount}
             </if>
             <if test="minExceptionCount != null and minExceptionCount != '' or minExceptionCount == 0">
-                and t.exceptionCount &gt;= #{minExceptionCount}
+                and toer.exception_count &gt;= #{minExceptionCount}
             </if>
             <if test="maxExceptionCount != null and maxExceptionCount != '' or maxExceptionCount == 0">
-                and t.exceptionCount &lt;= #{maxExceptionCount}
+                and toer.exception_count &lt;= #{maxExceptionCount}
             </if>
         </where>
     </sql>