Browse Source

清除未阅优化

wangliang 1 year ago
parent
commit
992ad856d3

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

@@ -203,14 +203,7 @@ public class TIeInvigilateWarnInfoController {
         }
         //2020/11/24新增管理员不清除预警状态
         if (!authDto.getRoleCodes().toString().contains(RoleEnum.ADMIN.name())) {
-            QueryWrapper<TOeExamRecord> tOeExamRecordQueryWrapper = new QueryWrapper<>();
-            if (Objects.nonNull(examId)) {
-                tOeExamRecordQueryWrapper.lambda().eq(TOeExamRecord::getExamId, examId);
-            } else if (Objects.nonNull(examActivityId)) {
-                tOeExamRecordQueryWrapper.lambda().eq(TOeExamRecord::getExamActivityId, examActivityId);
-            }
-            //TODO 查询条件补足
-            List<TOeExamRecord> tOeExamRecordList = tOeExamRecordService.list(tOeExamRecordQueryWrapper);
+            List<TOeExamRecord> tOeExamRecordList = tOeExamRecordService.findExamRecordByWarning(examId, examActivityId, roomCode, name, identity, minMultipleFaceCount, maxMultipleFaceCount, minExceptionCount, maxExceptionCount, minWarningCount, maxWarningCount, userId, tbUser.getOrgId());
             for (TOeExamRecord t : tOeExamRecordList) {
                 tOeExamRecordService.updateWarningUnreadByDb(t.getId(), 0);
                 tOeExamRecordService.updateWarningUnreadCache(t.getId(), 0, false);

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

@@ -601,4 +601,36 @@ public interface TOeExamRecordMapper extends BaseMapper<TOeExamRecord> {
      * @param number
      */
     void updateWarningUnread(@Param("id") Long id, @Param("number") Integer number);
+
+    /**
+     * 根据预警条件清除未阅
+     *
+     * @param examId
+     * @param examActivityId
+     * @param roomCode
+     * @param name
+     * @param identity
+     * @param minMultipleFaceCount
+     * @param maxMultipleFaceCount
+     * @param minExceptionCount
+     * @param maxExceptionCount
+     * @param minWarningCount
+     * @param maxWarningCount
+     * @param userId
+     * @param orgId
+     * @return
+     */
+    List<TOeExamRecord> findExamRecordByWarning(@Param("examId") Long examId,
+                                                @Param("examActivityId") Long examActivityId,
+                                                @Param("roomCode") String roomCode,
+                                                @Param("name") String name,
+                                                @Param("identity") String identity,
+                                                @Param("minMultipleFaceCount") Integer minMultipleFaceCount,
+                                                @Param("maxMultipleFaceCount") Integer maxMultipleFaceCount,
+                                                @Param("minExceptionCount") Integer minExceptionCount,
+                                                @Param("maxExceptionCount") Integer maxExceptionCount,
+                                                @Param("minWarningCount") Integer minWarningCount,
+                                                @Param("maxWarningCount") Integer maxWarningCount,
+                                                @Param("userId") Long userId,
+                                                @Param("orgId") Long orgId);
 }

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

@@ -672,4 +672,36 @@ public interface TOeExamRecordService extends IService<TOeExamRecord> {
      * @param id
      */
     void updateExceptionCountCache(Long id);
+
+    /**
+     * 根据预警条件清除未阅
+     *
+     * @param examId
+     * @param examActivityId
+     * @param roomCode
+     * @param name
+     * @param identity
+     * @param minMultipleFaceCount
+     * @param maxMultipleFaceCount
+     * @param minExceptionCount
+     * @param maxExceptionCount
+     * @param minWarningCount
+     * @param maxWarningCount
+     * @param userId
+     * @param orgId
+     * @return
+     */
+    List<TOeExamRecord> findExamRecordByWarning(Long examId,
+                                                Long examActivityId,
+                                                String roomCode,
+                                                String name,
+                                                String identity,
+                                                Integer minMultipleFaceCount,
+                                                Integer maxMultipleFaceCount,
+                                                Integer minExceptionCount,
+                                                Integer maxExceptionCount,
+                                                Integer minWarningCount,
+                                                Integer maxWarningCount,
+                                                Long userId,
+                                                Long orgId);
 }

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

@@ -674,6 +674,29 @@ public class TOeExamRecordServiceImpl extends ServiceImpl<TOeExamRecordMapper, T
         }
     }
 
+    /**
+     * 根据预警条件清除未阅
+     *
+     * @param examId
+     * @param examActivityId
+     * @param roomCode
+     * @param name
+     * @param identity
+     * @param minMultipleFaceCount
+     * @param maxMultipleFaceCount
+     * @param minExceptionCount
+     * @param maxExceptionCount
+     * @param minWarningCount
+     * @param maxWarningCount
+     * @param userId
+     * @param orgId
+     * @return
+     */
+    @Override
+    public List<TOeExamRecord> findExamRecordByWarning(Long examId, Long examActivityId, String roomCode, String name, String identity, Integer minMultipleFaceCount, Integer maxMultipleFaceCount, Integer minExceptionCount, Integer maxExceptionCount, Integer minWarningCount, Integer maxWarningCount, Long userId, Long orgId) {
+        return this.baseMapper.findExamRecordByWarning(examId, examActivityId, roomCode, name, identity, minMultipleFaceCount, maxMultipleFaceCount, minExceptionCount, maxExceptionCount, minWarningCount, maxWarningCount, userId, orgId);
+    }
+
     @Override
     public void saveFaceVerify(ExamTypeEnum type, Long recordId, Long entryAuthenticationId,
                                VerifyExceptionEnum entryAuthenticationResult) {

+ 62 - 11
themis-business/src/main/resources/mapper/TOeExamRecordMapper.xml

@@ -362,11 +362,11 @@
         left join t_oe_exam_record toer on toer.id = tiiwi.exam_record_id
         left join t_e_exam_student tees on tees.id = tiiwi.exam_student_id
         <if test="userId != null and userId != ''">
-            left join t_b_exam_invigilate_user tbeiu on tbeiu.exam_id = tees.exam_id
+            left join t_b_exam_invigilate_user tbeiu on tbeiu.exam_id = tee.id
         </if>
         <where>1 = 1
             <if test="examId != null and examId != ''">
-                and tiiwi.exam_id = #{examId}
+                and tee.id = #{examId}
             </if>
             <if test="userId != null and userId != ''">
                 and tbeiu.user_id = #{userId}
@@ -375,7 +375,7 @@
                 and tee.org_id = #{orgId}
             </if>
             <if test="examActivityId != null and examActivityId != ''">
-                and tiiwi.exam_activity_id = #{examActivityId}
+                and teea.id = #{examActivityId}
             </if>
             <if test="roomCode != null and roomCode != ''">
                 and tees.room_code = #{roomCode}
@@ -395,23 +395,23 @@
             <if test="minWarningCount != null and minWarningCount != '' or minWarningCount == 0">
                 and toer.warning_count &gt;= #{minWarningCount}
             </if>
-        </where>
-        ) t
-        <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>
-        and t.warningId = tiiwi.id)
+        ) t
+        <where> 1 = 1
+            and t.warningId = tiiwi.id
+        </where>)
     </update>
 
     <select id="invigilatePageProgressList" resultType="com.qmth.themis.business.bean.admin.InvigilateListProgressBean">
@@ -1694,4 +1694,55 @@
         </choose>
             where id = #{id}
     </update>
+
+    <select id="findExamRecordByWarning" resultType="com.qmth.themis.business.entity.TOeExamRecord">
+        select toer.* from t_oe_exam_record toer
+             left join t_e_exam tee on tee.id = toer.exam_id
+             left join t_e_exam_activity teea on teea.id = toer.exam_activity_id
+             left join t_e_exam_student tees on tees.id = toer.exam_student_id
+            <if test="userId != null and userId != ''">
+                left join t_b_exam_invigilate_user tbeiu on tbeiu.exam_id = tee.id
+            </if>
+        <where>1 = 1
+            <if test="examId != null and examId != ''">
+                and tee.id = #{examId}
+            </if>
+            <if test="userId != null and userId != ''">
+                and tbeiu.user_id = #{userId}
+            </if>
+            <if test="orgId != null and orgId != ''">
+                and tee.org_id = #{orgId}
+            </if>
+            <if test="examActivityId != null and examActivityId != ''">
+                and teea.id = #{examActivityId}
+            </if>
+            <if test="roomCode != null and roomCode != ''">
+                and tees.room_code = #{roomCode}
+            </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="maxWarningCount != null and maxWarningCount != '' or maxWarningCount == 0">
+                and toer.warning_count &lt;= #{maxWarningCount}
+            </if>
+            <if test="minWarningCount != null and minWarningCount != '' or minWarningCount == 0">
+                and toer.warning_count &gt;= #{minWarningCount}
+            </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>
 </mapper>