Преглед на файлове

考试记录新增陌生人脸预警总数

wangliang преди 1 година
родител
ревизия
6632e27d6d
променени са 15 файла, в които са добавени 500 реда и са изтрити 170 реда
  1. 41 0
      themis-business/src/main/java/com/qmth/themis/business/bean/status/AlreadyBreakCountBean.java
  2. 41 0
      themis-business/src/main/java/com/qmth/themis/business/bean/status/ExceptionCountBean.java
  3. 41 0
      themis-business/src/main/java/com/qmth/themis/business/bean/status/InProcessLivenessVerifyCountBean.java
  4. 41 0
      themis-business/src/main/java/com/qmth/themis/business/bean/status/WarningMultipleFaceCountBean.java
  5. 112 13
      themis-business/src/main/java/com/qmth/themis/business/cache/ExamRecordCacheUtil.java
  6. 14 14
      themis-business/src/main/java/com/qmth/themis/business/dao/TOeExamRecordMapper.java
  7. 22 0
      themis-business/src/main/java/com/qmth/themis/business/entity/TOeExamRecord.java
  8. 4 0
      themis-business/src/main/java/com/qmth/themis/business/enums/ExamRecordFieldEnum.java
  9. 25 9
      themis-business/src/main/java/com/qmth/themis/business/service/TOeExamRecordService.java
  10. 2 2
      themis-business/src/main/java/com/qmth/themis/business/service/impl/TEExamActivityServiceImpl.java
  11. 116 59
      themis-business/src/main/java/com/qmth/themis/business/service/impl/TOeExamRecordServiceImpl.java
  12. 9 8
      themis-business/src/main/java/com/qmth/themis/business/service/impl/WarningServiceImpl.java
  13. 2 0
      themis-business/src/main/resources/db/log/1.2.8.log
  14. 27 65
      themis-business/src/main/resources/mapper/TOeExamRecordMapper.xml
  15. 3 0
      themis-mq/src/main/java/com/qmth/themis/mq/service/impl/MqLogicServiceImpl.java

+ 41 - 0
themis-business/src/main/java/com/qmth/themis/business/bean/status/AlreadyBreakCountBean.java

@@ -0,0 +1,41 @@
+package com.qmth.themis.business.bean.status;
+
+import java.io.Serializable;
+
+/**
+ * @Description: 已断点续考次数bean
+ * @Param:
+ * @return:
+ * @Author: wangliang
+ * @Date: 2022/5/5
+ */
+public class AlreadyBreakCountBean implements Serializable {
+
+    Integer number;
+    Long timestamp;//时间戳
+
+    public AlreadyBreakCountBean() {
+
+    }
+
+    public AlreadyBreakCountBean(Integer number, Long timestamp) {
+        this.number = number;
+        this.timestamp = timestamp;
+    }
+
+    public Integer getNumber() {
+        return number;
+    }
+
+    public void setNumber(Integer number) {
+        this.number = number;
+    }
+
+    public Long getTimestamp() {
+        return timestamp;
+    }
+
+    public void setTimestamp(Long timestamp) {
+        this.timestamp = timestamp;
+    }
+}

+ 41 - 0
themis-business/src/main/java/com/qmth/themis/business/bean/status/ExceptionCountBean.java

@@ -0,0 +1,41 @@
+package com.qmth.themis.business.bean.status;
+
+import java.io.Serializable;
+
+/**
+ * @Description: 异常数bean
+ * @Param:
+ * @return:
+ * @Author: wangliang
+ * @Date: 2022/5/5
+ */
+public class ExceptionCountBean implements Serializable {
+
+    Integer number;
+    Long timestamp;//时间戳
+
+    public ExceptionCountBean() {
+
+    }
+
+    public ExceptionCountBean(Integer number, Long timestamp) {
+        this.number = number;
+        this.timestamp = timestamp;
+    }
+
+    public Integer getNumber() {
+        return number;
+    }
+
+    public void setNumber(Integer number) {
+        this.number = number;
+    }
+
+    public Long getTimestamp() {
+        return timestamp;
+    }
+
+    public void setTimestamp(Long timestamp) {
+        this.timestamp = timestamp;
+    }
+}

+ 41 - 0
themis-business/src/main/java/com/qmth/themis/business/bean/status/InProcessLivenessVerifyCountBean.java

@@ -0,0 +1,41 @@
+package com.qmth.themis.business.bean.status;
+
+import java.io.Serializable;
+
+/**
+ * @Description: 已完成过程活体验证次数bean
+ * @Param:
+ * @return:
+ * @Author: wangliang
+ * @Date: 2022/5/5
+ */
+public class InProcessLivenessVerifyCountBean implements Serializable {
+
+    Integer number;
+    Long timestamp;//时间戳
+
+    public InProcessLivenessVerifyCountBean() {
+
+    }
+
+    public InProcessLivenessVerifyCountBean(Integer number, Long timestamp) {
+        this.number = number;
+        this.timestamp = timestamp;
+    }
+
+    public Integer getNumber() {
+        return number;
+    }
+
+    public void setNumber(Integer number) {
+        this.number = number;
+    }
+
+    public Long getTimestamp() {
+        return timestamp;
+    }
+
+    public void setTimestamp(Long timestamp) {
+        this.timestamp = timestamp;
+    }
+}

+ 41 - 0
themis-business/src/main/java/com/qmth/themis/business/bean/status/WarningMultipleFaceCountBean.java

@@ -0,0 +1,41 @@
+package com.qmth.themis.business.bean.status;
+
+import java.io.Serializable;
+
+/**
+ * @Description: 陌生人脸预警数bean
+ * @Param:
+ * @return:
+ * @Author: wangliang
+ * @Date: 2022/5/5
+ */
+public class WarningMultipleFaceCountBean implements Serializable {
+
+    Integer number;
+    Long timestamp;//时间戳
+
+    public WarningMultipleFaceCountBean() {
+
+    }
+
+    public WarningMultipleFaceCountBean(Integer number, Long timestamp) {
+        this.number = number;
+        this.timestamp = timestamp;
+    }
+
+    public Integer getNumber() {
+        return number;
+    }
+
+    public void setNumber(Integer number) {
+        this.number = number;
+    }
+
+    public Long getTimestamp() {
+        return timestamp;
+    }
+
+    public void setTimestamp(Long timestamp) {
+        this.timestamp = timestamp;
+    }
+}

+ 112 - 13
themis-business/src/main/java/com/qmth/themis/business/cache/ExamRecordCacheUtil.java

@@ -242,16 +242,42 @@ public class ExamRecordCacheUtil {
     }
 
     public static Integer getAlreadyBreakCount(Long recordId) {
-        return (Integer) redisUtil
-                .get(RedisKeyHelper.examRecordCacheKey(recordId), ExamRecordFieldEnum.already_break_count.getCode());
+        AlreadyBreakCountBean alreadyBreakCountBean = getAlreadyBreakCountBean(recordId);
+        if (Objects.isNull(alreadyBreakCountBean) || Objects.isNull(alreadyBreakCountBean.getNumber())) {
+            return null;
+        } else {
+            return alreadyBreakCountBean.getNumber();
+        }
     }
 
-    public static void setAlreadyBreakCount(Long recordId, Integer alreadyBreakCount) {
-        if (Objects.nonNull(getId(recordId))) {
-            redisUtil
-                    .set(RedisKeyHelper.examRecordCacheKey(recordId), ExamRecordFieldEnum.already_break_count.getCode(),
-                            alreadyBreakCount);
+    public static void setAlreadyBreakCount(Long recordId, Integer alreadyBreakCount, Long timestamp) {
+        AlreadyBreakCountBean alreadyBreakCountBean = getAlreadyBreakCountBean(recordId);
+        if (Objects.isNull(alreadyBreakCountBean)) {
+            alreadyBreakCountBean = new AlreadyBreakCountBean(alreadyBreakCount, timestamp);
+        } else {
+            if (Objects.nonNull(alreadyBreakCountBean.getTimestamp()) && alreadyBreakCountBean.getTimestamp().longValue() < timestamp
+                    .longValue()) {
+                alreadyBreakCountBean.setNumber(alreadyBreakCount);
+                alreadyBreakCountBean.setTimestamp(timestamp);
+            }
         }
+        redisUtil.set(RedisKeyHelper.examRecordCacheKey(recordId), ExamRecordFieldEnum.already_break_count.getCode(), alreadyBreakCountBean);
+    }
+
+    public static AlreadyBreakCountBean getAlreadyBreakCountBean(Long recordId) {
+        return Objects.nonNull(
+                redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), ExamRecordFieldEnum.already_break_count.getCode())) ?
+                (AlreadyBreakCountBean) redisUtil
+                        .get(RedisKeyHelper.examRecordCacheKey(recordId), ExamRecordFieldEnum.already_break_count.getCode()) :
+                null;
+    }
+
+    public static InProcessLivenessVerifyCountBean getInProcessLivenessVerifyCountBean(Long recordId) {
+        return Objects.nonNull(
+                redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), ExamRecordFieldEnum.in_process_liveness_verify_count.getCode())) ?
+                (InProcessLivenessVerifyCountBean) redisUtil
+                        .get(RedisKeyHelper.examRecordCacheKey(recordId), ExamRecordFieldEnum.in_process_liveness_verify_count.getCode()) :
+                null;
     }
 
     public static WarningCountBean getWarningCountBean(Long recordId) {
@@ -270,6 +296,22 @@ public class ExamRecordCacheUtil {
                 null;
     }
 
+    public static WarningMultipleFaceCountBean getWarningMultipleFaceCountBean(Long recordId) {
+        return Objects.nonNull(
+                redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), ExamRecordFieldEnum.warning_multiple_face_count.getCode())) ?
+                (WarningMultipleFaceCountBean) redisUtil
+                        .get(RedisKeyHelper.examRecordCacheKey(recordId), ExamRecordFieldEnum.warning_multiple_face_count.getCode()) :
+                null;
+    }
+
+    public static ExceptionCountBean getExceptionCountBean(Long recordId) {
+        return Objects.nonNull(
+                redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), ExamRecordFieldEnum.exception_count.getCode())) ?
+                (ExceptionCountBean) redisUtil
+                        .get(RedisKeyHelper.examRecordCacheKey(recordId), ExamRecordFieldEnum.exception_count.getCode()) :
+                null;
+    }
+
     public static ExamStatusBean getStatusBean(Long recordId) {
         return Objects.nonNull(
                 redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), ExamRecordFieldEnum.status.getCode())) ?
@@ -363,6 +405,52 @@ public class ExamRecordCacheUtil {
         }
     }
 
+    public static void setWarningMultipleFaceCount(Long recordId, Integer warningMultipleFaceCount, Long timestamp) {
+        WarningMultipleFaceCountBean warningMultipleFaceCountBean = getWarningMultipleFaceCountBean(recordId);
+        if (Objects.isNull(warningMultipleFaceCountBean)) {
+            warningMultipleFaceCountBean = new WarningMultipleFaceCountBean(warningMultipleFaceCount, timestamp);
+        } else {
+            if (Objects.nonNull(warningMultipleFaceCountBean.getTimestamp()) && warningMultipleFaceCountBean.getTimestamp().longValue() < timestamp
+                    .longValue()) {
+                warningMultipleFaceCountBean.setNumber(warningMultipleFaceCount);
+                warningMultipleFaceCountBean.setTimestamp(timestamp);
+            }
+        }
+        redisUtil.set(RedisKeyHelper.examRecordCacheKey(recordId), ExamRecordFieldEnum.warning_multiple_face_count.getCode(), warningMultipleFaceCountBean);
+    }
+
+    public static Integer getWarningMultipleFaceCount(Long recordId) {
+        WarningMultipleFaceCountBean warningMultipleFaceCountBean = getWarningMultipleFaceCountBean(recordId);
+        if (Objects.isNull(warningMultipleFaceCountBean) || Objects.isNull(warningMultipleFaceCountBean.getNumber())) {
+            return null;
+        } else {
+            return warningMultipleFaceCountBean.getNumber();
+        }
+    }
+
+    public static void setExceptionCount(Long recordId, Integer exceptionCount, Long timestamp) {
+        ExceptionCountBean exceptionCountBean = getExceptionCountBean(recordId);
+        if (Objects.isNull(exceptionCountBean)) {
+            exceptionCountBean = new ExceptionCountBean(exceptionCount, timestamp);
+        } else {
+            if (Objects.nonNull(exceptionCountBean.getTimestamp()) && exceptionCountBean.getTimestamp().longValue() < timestamp
+                    .longValue()) {
+                exceptionCountBean.setNumber(exceptionCount);
+                exceptionCountBean.setTimestamp(timestamp);
+            }
+        }
+        redisUtil.set(RedisKeyHelper.examRecordCacheKey(recordId), ExamRecordFieldEnum.exception_count.getCode(), exceptionCountBean);
+    }
+
+    public static Integer getExceptionCount(Long recordId) {
+        ExceptionCountBean exceptionCountBean = getExceptionCountBean(recordId);
+        if (Objects.isNull(exceptionCountBean) || Objects.isNull(exceptionCountBean.getNumber())) {
+            return null;
+        } else {
+            return exceptionCountBean.getNumber();
+        }
+    }
+
     public static void setBreachStatus(Long recordId, Integer breachStatus, Long timestamp) {
         BreachStatusBean breachStatusBean = getBreachStatusBean(recordId);
         if (Objects.isNull(breachStatusBean)) {
@@ -386,16 +474,27 @@ public class ExamRecordCacheUtil {
         }
     }
 
-    public static void setInProcessLivenessVerifyCount(Long recordId, Integer inProcessLivenessVerifyCount) {
-        if (Objects.nonNull(getId(recordId))) {
-            redisUtil.set(RedisKeyHelper.examRecordCacheKey(recordId),
-                    ExamRecordFieldEnum.in_process_liveness_verify_count.getCode(), inProcessLivenessVerifyCount);
+    public static void setInProcessLivenessVerifyCount(Long recordId, Integer inProcessLivenessVerifyCount, Long timestamp) {
+        InProcessLivenessVerifyCountBean inProcessLivenessVerifyCountBean = getInProcessLivenessVerifyCountBean(recordId);
+        if (Objects.isNull(inProcessLivenessVerifyCountBean)) {
+            inProcessLivenessVerifyCountBean = new InProcessLivenessVerifyCountBean(inProcessLivenessVerifyCount, timestamp);
+        } else {
+            if (Objects.nonNull(inProcessLivenessVerifyCountBean.getTimestamp()) && inProcessLivenessVerifyCountBean.getTimestamp().longValue() < timestamp
+                    .longValue()) {
+                inProcessLivenessVerifyCountBean.setNumber(inProcessLivenessVerifyCount);
+                inProcessLivenessVerifyCountBean.setTimestamp(timestamp);
+            }
         }
+        redisUtil.set(RedisKeyHelper.examRecordCacheKey(recordId), ExamRecordFieldEnum.in_process_liveness_verify_count.getCode(), inProcessLivenessVerifyCountBean);
     }
 
     public static Integer getInProcessLivenessVerifyCount(Long recordId) {
-        return (Integer) redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId),
-                ExamRecordFieldEnum.in_process_liveness_verify_count.getCode());
+        InProcessLivenessVerifyCountBean inProcessLivenessVerifyCountBean = getInProcessLivenessVerifyCountBean(recordId);
+        if (Objects.isNull(inProcessLivenessVerifyCountBean) || Objects.isNull(inProcessLivenessVerifyCountBean.getNumber())) {
+            return null;
+        } else {
+            return inProcessLivenessVerifyCountBean.getNumber();
+        }
     }
 
     public static void setMonitorKey(Long recordId, String monitorKey) {

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

@@ -587,18 +587,18 @@ public interface TOeExamRecordMapper extends BaseMapper<TOeExamRecord> {
      */
     List<MapDataCountBean> mapDataCount();
 
-    /**
-     * 根据id更新预警数量
-     *
-     * @param id
-     */
-    void updateWarningCount(@Param("id") Long id);
-
-    /**
-     * 更新预警未读数
-     *
-     * @param id
-     * @param number
-     */
-    void updateWarningUnread(@Param("id") Long id, @Param("number") Integer number);
+//    /**
+//     * 根据id更新预警数量
+//     *
+//     * @param id
+//     */
+//    void updateWarningCount(@Param("id") Long id);
+//
+//    /**
+//     * 更新预警未读数
+//     *
+//     * @param id
+//     * @param number
+//     */
+//    void updateWarningUnread(@Param("id") Long id, @Param("number") Integer number);
 }

+ 22 - 0
themis-business/src/main/java/com/qmth/themis/business/entity/TOeExamRecord.java

@@ -287,6 +287,28 @@ public class TOeExamRecord implements Serializable {
     @ApiModelProperty(value = "视频删除状态,false:未删除,true:已删除")
     private Boolean videoStatus;
 
+    @ApiModelProperty(value = "陌生人脸预警总数")
+    private Integer warningMultipleFaceCount;
+
+    @ApiModelProperty(value = "异常数据总数")
+    private Integer exceptionCount;
+
+    public Integer getWarningMultipleFaceCount() {
+        return warningMultipleFaceCount;
+    }
+
+    public void setWarningMultipleFaceCount(Integer warningMultipleFaceCount) {
+        this.warningMultipleFaceCount = warningMultipleFaceCount;
+    }
+
+    public Integer getExceptionCount() {
+        return exceptionCount;
+    }
+
+    public void setExceptionCount(Integer exceptionCount) {
+        this.exceptionCount = exceptionCount;
+    }
+
     public Integer getWarningUnread() {
         return warningUnread;
     }

+ 4 - 0
themis-business/src/main/java/com/qmth/themis/business/enums/ExamRecordFieldEnum.java

@@ -137,6 +137,10 @@ public enum ExamRecordFieldEnum {
 
 //    tencent_video_url("tencentVideoUrl"),
 
+    warning_multiple_face_count("warningMultipleFaceCount"),
+
+    exception_count("exceptionCount"),
+
     update_time("updateTime");
 
     private String code;

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

@@ -6,6 +6,7 @@ import com.qmth.themis.business.bean.admin.*;
 import com.qmth.themis.business.cache.bean.ExamRecordDetailBean;
 import com.qmth.themis.business.cache.bean.ExamRecordPaperViewBean;
 import com.qmth.themis.business.dto.response.MarkResultDto;
+import com.qmth.themis.business.entity.TIeInvigilateWarnInfo;
 import com.qmth.themis.business.entity.TOeExamRecord;
 import com.qmth.themis.business.enums.*;
 
@@ -628,33 +629,48 @@ public interface TOeExamRecordService extends IService<TOeExamRecord> {
      */
     TOeExamRecord getExamRecordForDb(Long examId, Long activityId, Long examStudentId, ExamRecordStatusEnum examRecordStatusEnum);
 
+//    /**
+//     * 根据id更新预警数量
+//     *
+//     * @param id
+//     */
+//    void updateWarningCount(Long id);
+//
+//    /**
+//     * 根据id更新预警未读数量
+//     *
+//     * @param id
+//     * @param number
+//     */
+//    void updateWarningUnread(Long id, Integer number);
+
     /**
-     * 根据id更新预警数量
+     * 更新预警
      *
      * @param id
+     * @param tIeInvigilateWarnInfo
      */
-    void updateWarningCount(Long id);
+    void updateWarningCountCache(Long id, TIeInvigilateWarnInfo tIeInvigilateWarnInfo);
 
     /**
-     * 根据id更新预警未读数量
+     * 更新预警未读数
      *
      * @param id
      * @param number
      */
-    void updateWarningUnread(Long id, Integer number);
+    void updateWarningUnreadCache(Long id, Integer number);
 
     /**
-     * 更新预警总数
+     * 更新陌生人脸预警总数
      *
      * @param id
      */
-    void updateWarningCountCache(Long id);
+    void updateWarningMultipleFaceCountCache(Long id);
 
     /**
-     * 更新预警未读
+     * 更新异常
      *
      * @param id
-     * @param number
      */
-    void updateWarningUnreadCache(Long id, Integer number);
+    void updateExceptionCountCache(Long id);
 }

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

@@ -195,7 +195,7 @@ public class TEExamActivityServiceImpl extends ServiceImpl<TEExamActivityMapper,
                 inProcessLivenessFixedRange.add(integer);
             }
             if (Objects.equals(inProcessLivenessFixedRange.toString().trim().replaceAll(" ", ""), "")) {
-                teExamActivityDto.setInProcessLivenessFixedRange(null);
+                teExivityDto.setInProcessLivenessFixedRange(null);
             } else {
                 teExamActivityDto.setInProcessLivenessFixedRange(inProcessLivenessFixedRange);
             }
@@ -204,7 +204,7 @@ public class TEExamActivityServiceImpl extends ServiceImpl<TEExamActivityMapper,
         ExamCourseCacheBean examCourseCacheBean = teExamCourseService
                 .getExamCourseCacheBean(teExamActivityDto.getExamId(), courseCode);
         if (Objects.nonNull(examCourseCacheBean) && Objects.nonNull(examCourseCacheBean.getMobilePhotoUpload())) {
-            teExamActivityDto.setMobilePhotoUpload(examCourseCacheBean.getMobilePhotoUpload());
+            teExamActiviamActtyDto.setMobilePhotoUpload(examCourseCacheBean.getMobilePhotoUpload());
         }
         if (Objects.nonNull(teExamActivityDto.getMonitorVideoSourceStr()) && !Objects
                 .equals(teExamActivityDto.getMonitorVideoSourceStr().toString().trim().replaceAll(" ", ""), "")) {

+ 116 - 59
themis-business/src/main/java/com/qmth/themis/business/service/impl/TOeExamRecordServiceImpl.java

@@ -18,6 +18,7 @@ import com.qmth.themis.business.dao.TOeExamRecordMapper;
 import com.qmth.themis.business.dto.MqDto;
 import com.qmth.themis.business.dto.response.MarkResultDto;
 import com.qmth.themis.business.dto.response.TEStudentMonitorRecordDto;
+import com.qmth.themis.business.entity.TIeInvigilateWarnInfo;
 import com.qmth.themis.business.entity.TOeExamAnswer;
 import com.qmth.themis.business.entity.TOeExamRecord;
 import com.qmth.themis.business.entity.TSyncExamStudentScore;
@@ -124,7 +125,7 @@ public class TOeExamRecordServiceImpl extends ServiceImpl<TOeExamRecordMapper, T
         er.setObjectiveScore(0.0);
 //        er.setMonitorKey(String.valueOf(redisUtil.getRedisSequence()));
         er.setMonitorKey(String.valueOf(er.getId()));
-        er.setAlreadyBreakCount(0);
+//        er.setAlreadyBreakCount(0);
         er.setStartTime(ac.getStartTime());
         er.setEndTime(ac.getFinishTime());
         er.setOpeningSeconds(ac.getOpeningSeconds());
@@ -486,6 +487,22 @@ public class TOeExamRecordServiceImpl extends ServiceImpl<TOeExamRecordMapper, T
             if (Objects.nonNull(o) && o instanceof WarningUnreadBean) {
                 record.put(ExamRecordFieldEnum.warning_unread.getCode(), ((WarningUnreadBean) o).getNumber());
             }
+            o = redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), ExamRecordFieldEnum.warning_multiple_face_count.getCode());
+            if (Objects.nonNull(o) && o instanceof WarningMultipleFaceCountBean) {
+                record.put(ExamRecordFieldEnum.warning_multiple_face_count.getCode(), ((WarningMultipleFaceCountBean) o).getNumber());
+            }
+            o = redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), ExamRecordFieldEnum.exception_count.getCode());
+            if (Objects.nonNull(o) && o instanceof ExceptionCountBean) {
+                record.put(ExamRecordFieldEnum.exception_count.getCode(), ((ExceptionCountBean) o).getNumber());
+            }
+            o = redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), ExamRecordFieldEnum.already_break_count.getCode());
+            if (Objects.nonNull(o) && o instanceof AlreadyBreakCountBean) {
+                record.put(ExamRecordFieldEnum.already_break_count.getCode(), ((AlreadyBreakCountBean) o).getNumber());
+            }
+            o = redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), ExamRecordFieldEnum.in_process_liveness_verify_count.getCode());
+            if (Objects.nonNull(o) && o instanceof InProcessLivenessVerifyCountBean) {
+                record.put(ExamRecordFieldEnum.in_process_liveness_verify_count.getCode(), ((InProcessLivenessVerifyCountBean) o).getNumber());
+            }
             er = GsonUtil.fromJson(GsonUtil.toJson(record), TOeExamRecord.class);
         }
         return er;
@@ -510,70 +527,117 @@ public class TOeExamRecordServiceImpl extends ServiceImpl<TOeExamRecordMapper, T
         return this.getOne(tOeExamRecordQueryWrapper);
     }
 
+//    /**
+//     * 根据id更新预警数量
+//     *
+//     * @param id
+//     */
+//    @Override
+//    public void updateWarningCount(Long id) {
+//        this.baseMapper.updateWarningCount(id);
+//    }
+//
+//    /**
+//     * 根据id更新预警未读数量
+//     *
+//     * @param id
+//     * @param number
+//     */
+//    @Override
+//    public void updateWarningUnread(Long id, Integer number) {
+//        this.baseMapper.updateWarningUnread(id, number);
+//    }
+
     /**
-     * 根据id更新预警数量
+     * 更新预警
      *
      * @param id
+     * @param tIeInvigilateWarnInfo
      */
     @Override
-    public void updateWarningCount(Long id) {
-        this.baseMapper.updateWarningCount(id);
+    public void updateWarningCountCache(Long id, TIeInvigilateWarnInfo tIeInvigilateWarnInfo) {
+        Integer warningCount = ExamRecordCacheUtil.getWarningCount(id);
+        ExamRecordStatusEnum status = ExamRecordCacheUtil.getStatus(id);
+        if (Objects.nonNull(status) && status != ExamRecordStatusEnum.PERSISTED) {
+            long timestamp = System.currentTimeMillis();
+            if (Objects.nonNull(warningCount)) {
+                ExamRecordCacheUtil.setWarningCount(id, warningCount + 1, timestamp);
+            } else {
+                ExamRecordCacheUtil.setWarningCount(id, 1, timestamp);
+            }
+            Integer warningUnread = ExamRecordCacheUtil.getWarningUnread(id);
+            if (Objects.nonNull(warningUnread)) {
+                ExamRecordCacheUtil.setWarningUnread(id, warningUnread + 1, timestamp);
+            } else {
+                ExamRecordCacheUtil.setWarningUnread(id, 1, timestamp);
+            }
+            if (Objects.nonNull(tIeInvigilateWarnInfo) && tIeInvigilateWarnInfo.getType() == VerifyExceptionEnum.FACE_COUNT_ERROR
+                    && Objects.equals(tIeInvigilateWarnInfo.getLevel(), "D8")) {
+                this.updateWarningMultipleFaceCountCache(id);
+            }
+            this.sendExamRecordDataSaveMq(id, timestamp);
+        }
     }
 
     /**
-     * 根据id更新预警未读数量
+     * 更新预警未读数
      *
      * @param id
      * @param number
      */
     @Override
-    public void updateWarningUnread(Long id, Integer number) {
-        this.baseMapper.updateWarningUnread(id, number);
+    public void updateWarningUnreadCache(Long id, Integer number) {
+        Integer warningUnread = ExamRecordCacheUtil.getWarningUnread(id);
+        ExamRecordStatusEnum status = ExamRecordCacheUtil.getStatus(id);
+        if (Objects.nonNull(status) && status != ExamRecordStatusEnum.PERSISTED) {
+            long timestamp = System.currentTimeMillis();
+            if (Objects.nonNull(warningUnread) && number.intValue() == 0) {
+                ExamRecordCacheUtil.setWarningUnread(id, number, timestamp);
+            } else if (Objects.nonNull(warningUnread) && number.intValue() > 0) {
+                ExamRecordCacheUtil.setWarningUnread(id, warningUnread - number, timestamp);
+            } else {
+                ExamRecordCacheUtil.setWarningUnread(id, 0, timestamp);
+            }
+            this.sendExamRecordDataSaveMq(id, timestamp);
+        }
     }
 
     /**
-     * 更新预警总数
+     * 更新陌生人脸预警总数
      *
      * @param id
      */
     @Override
-    public void updateWarningCountCache(Long id) {
-        Integer warningCount = ExamRecordCacheUtil.getWarningCount(id);
-        long timestamp = System.currentTimeMillis();
-        if (Objects.nonNull(warningCount)) {
-            ExamRecordCacheUtil.setWarningCount(id, warningCount + 1, timestamp);
-        } else {
-            ExamRecordCacheUtil.setWarningCount(id, 1, timestamp);
-        }
-        Integer warningUnread = ExamRecordCacheUtil.getWarningUnread(id);
-        if (Objects.nonNull(warningUnread)) {
-            ExamRecordCacheUtil.setWarningUnread(id, warningUnread + 1, timestamp);
-        } else {
-            ExamRecordCacheUtil.setWarningUnread(id, 1, timestamp);
+    public void updateWarningMultipleFaceCountCache(Long id) {
+        Integer warningMultipleFaceCount = ExamRecordCacheUtil.getWarningMultipleFaceCount(id);
+        ExamRecordStatusEnum status = ExamRecordCacheUtil.getStatus(id);
+        if (Objects.nonNull(status) && status != ExamRecordStatusEnum.PERSISTED) {
+            long timestamp = System.currentTimeMillis();
+            if (Objects.nonNull(warningMultipleFaceCount)) {
+                ExamRecordCacheUtil.setWarningMultipleFaceCount(id, warningMultipleFaceCount + 1, timestamp);
+            } else {
+                ExamRecordCacheUtil.setWarningMultipleFaceCount(id, 1, timestamp);
+            }
         }
-//        this.sendExamRecordDataUpdateWarningCountMq(id, timestamp);
-        this.sendExamRecordDataSaveMq(id, timestamp);
     }
 
     /**
-     * 更新预警未读
+     * 更新异常
      *
      * @param id
-     * @param number
      */
     @Override
-    public void updateWarningUnreadCache(Long id, Integer number) {
-        long timestamp = System.currentTimeMillis();
-        Integer warningUnread = ExamRecordCacheUtil.getWarningUnread(id);
-        if (Objects.nonNull(warningUnread) && number.intValue() == 0) {
-            ExamRecordCacheUtil.setWarningUnread(id, number, timestamp);
-        } else if (Objects.nonNull(warningUnread) && number.intValue() > 0) {
-            ExamRecordCacheUtil.setWarningUnread(id, warningUnread - number, timestamp);
-        } else {
-            ExamRecordCacheUtil.setWarningUnread(id, 0, timestamp);
+    public void updateExceptionCountCache(Long id) {
+        Integer exceptionCount = ExamRecordCacheUtil.getExceptionCount(id);
+        ExamRecordStatusEnum status = ExamRecordCacheUtil.getStatus(id);
+        if (Objects.nonNull(status) && status != ExamRecordStatusEnum.PERSISTED) {
+            long timestamp = System.currentTimeMillis();
+            if (Objects.nonNull(exceptionCount)) {
+                ExamRecordCacheUtil.setExceptionCount(id, exceptionCount + 1, timestamp);
+            } else {
+                ExamRecordCacheUtil.setExceptionCount(id, 1, timestamp);
+            }
         }
-        this.sendExamRecordDataSaveMq(id, timestamp);
-//        this.sendExamRecordDataUpdateWarningUnreadMq(id, timestamp, number);
     }
 
     @Override
@@ -593,8 +657,8 @@ public class TOeExamRecordServiceImpl extends ServiceImpl<TOeExamRecordMapper, T
             ExamRecordCacheUtil.setEntryAuthenticationId(recordId, entryAuthenticationId);
             ExamRecordCacheUtil.setEntryAuthenticationResult(recordId, entryAuthenticationResult);
         } else if (LivenessTypeEnum.IN_PROCESS.equals(type)) {
-            Integer count = ExamRecordCacheUtil.getInProcessLivenessVerifyCount(recordId);
-            ExamRecordCacheUtil.setInProcessLivenessVerifyCount(recordId, (count == null ? 0 : count + 1));
+            Integer count = Objects.isNull(ExamRecordCacheUtil.getInProcessLivenessVerifyCount(recordId)) ? 0 : ExamRecordCacheUtil.getInProcessLivenessVerifyCount(recordId);
+            ExamRecordCacheUtil.setInProcessLivenessVerifyCount(recordId, count + 1, System.currentTimeMillis());
         }
         this.sendExamRecordDataSaveMq(recordId, System.currentTimeMillis());
     }
@@ -1197,6 +1261,12 @@ public class TOeExamRecordServiceImpl extends ServiceImpl<TOeExamRecordMapper, T
         return tOeExamRecord;
     }
 
+    public static void main(String[] args) {
+        Integer i = 0;
+//        System.out.println(i++);
+        System.out.println(i + 1);
+    }
+
     /**
      * 设置断点信息
      *
@@ -1211,17 +1281,13 @@ public class TOeExamRecordServiceImpl extends ServiceImpl<TOeExamRecordMapper, T
                     SystemConstant.REDIS_LOCK_EXAM_STATUS_TIME_OUT);
             if (lock) {
                 try {
-                    Integer alreadyBreakCount = Objects.isNull(ExamRecordCacheUtil.getAlreadyBreakCount(recordId)) ?
-                            0 :
-                            ExamRecordCacheUtil.getAlreadyBreakCount(recordId);
-                    alreadyBreakCount++;
-//                    Long examActivityId = ExamRecordCacheUtil.getExamActivityId(recordId);
+                    Integer alreadyBreakCount = Objects.isNull(ExamRecordCacheUtil.getAlreadyBreakCount(recordId)) ? 0 : ExamRecordCacheUtil.getAlreadyBreakCount(recordId);
                     Long breakId = uidUtil.getId();
                     Long lastBreakTimeNow = System.currentTimeMillis();
                     ExamRecordCacheUtil.setLastBreakId(recordId, breakId);
                     ExamRecordCacheUtil.setStatus(recordId, ExamRecordStatusEnum.BREAK_OFF, lastBreakTimeNow);
                     ExamRecordCacheUtil.setLastBreakTime(recordId, lastBreakTimeNow);
-                    ExamRecordCacheUtil.setAlreadyBreakCount(recordId, alreadyBreakCount);
+                    ExamRecordCacheUtil.setAlreadyBreakCount(recordId, alreadyBreakCount + 1, lastBreakTimeNow);
 
                     Long examStudentId = ExamRecordCacheUtil.getExamStudentId(recordId);
                     Long examId = ExamRecordCacheUtil.getExamId(recordId);
@@ -1249,7 +1315,6 @@ public class TOeExamRecordServiceImpl extends ServiceImpl<TOeExamRecordMapper, T
                                 ec.getBreakExpireSeconds();
                         sendExamBreakMqDelayMsg(breakExpireSeconds, recordId);
                         //更新场次-考试记录缓存
-//                        ExamActivityRecordCacheUtil.setExamRecordStatus(examActivityId, recordId);
                     } else {
                         throw new BusinessException(ExceptionResultEnum.EXAM_STATUS_ALREADY_UPDATE);
                     }
@@ -1304,26 +1369,18 @@ public class TOeExamRecordServiceImpl extends ServiceImpl<TOeExamRecordMapper, T
             ExamStudentCacheBean examStudentCacheBean = teExamStudentService.getExamStudentCacheBean(examStudentId);
             ExamCacheBean ec = examService.getExamCacheBean(examId);//考试缓存
             Long lastBreakTime = ExamRecordCacheUtil.getLastBreakTime(recordId);
-            Integer breakExpireSeconds = Objects.isNull(ec.getBreakExpireSeconds()) ?
-                    0 :
-                    ec.getBreakExpireSeconds();
-            Integer durationSeconds = Objects.isNull(ExamRecordCacheUtil.getDurationSeconds(recordId)) ?
-                    0 :
-                    ExamRecordCacheUtil.getDurationSeconds(recordId);
-            Integer alreadyBreakCount = Objects.isNull(ExamRecordCacheUtil.getAlreadyBreakCount(recordId)) ?
-                    0 :
-                    ExamRecordCacheUtil.getAlreadyBreakCount(recordId);
+            Integer breakExpireSeconds = Objects.isNull(ec.getBreakExpireSeconds()) ? 0 : ec.getBreakExpireSeconds();
+            Integer durationSeconds = Objects.isNull(ExamRecordCacheUtil.getDurationSeconds(recordId)) ? 0 : ExamRecordCacheUtil.getDurationSeconds(recordId);
+            Integer alreadyBreakCount = Objects.isNull(ExamRecordCacheUtil.getAlreadyBreakCount(recordId)) ? 0 : ExamRecordCacheUtil.getAlreadyBreakCount(recordId);
             Integer leftBreakResumeCount = ec.getBreakResumeCount() - alreadyBreakCount;
             if (Objects.nonNull(lastBreakTime)
                     && (System.currentTimeMillis() - lastBreakTime) / 1000 >= breakExpireSeconds) {
                 finished = true;
-                examService.finish(examStudentCacheBean.getStudentId(), recordId, FinishTypeEnum.AUTO.name(),
-                        durationSeconds);
+                examService.finish(examStudentCacheBean.getStudentId(), recordId, FinishTypeEnum.AUTO.name(), durationSeconds);
             } else {
-                if (leftBreakResumeCount < 0) {
+                if (leftBreakResumeCount <= 0) {
                     finished = true;
-                    examService.finish(examStudentCacheBean.getStudentId(), recordId, FinishTypeEnum.AUTO.name(),
-                            durationSeconds);
+                    examService.finish(examStudentCacheBean.getStudentId(), recordId, FinishTypeEnum.AUTO.name(), durationSeconds);
                 }
             }
         } catch (Exception e) {

+ 9 - 8
themis-business/src/main/java/com/qmth/themis/business/service/impl/WarningServiceImpl.java

@@ -86,7 +86,7 @@ public class WarningServiceImpl implements WarningService {
                 if (count > teConfig.getMultipleFaceCountError()) {
                     TIeInvigilateWarnInfo tIeInvigilateWarnInfo = new TIeInvigilateWarnInfo(examId, examActivityId, recordId, examStudentId, warningEnum.getLevel().get(1), WarningLevelEnum.valueOf(warningEnum.getLevel().get(1)).getTitle(), warningEnum, photoUrl, Objects.nonNull(ExamRecordCacheUtil.getBreachStatus(recordId)) ? ExamRecordCacheUtil.getBreachStatus(recordId) : 1);
                     tIeInvigilateWarnInfoService.saveOrUpdate(tIeInvigilateWarnInfo);
-                    this.setWarningCount(recordId);
+                    this.setWarningCount(recordId, tIeInvigilateWarnInfo);
                     this.setPhotoUrls(map, tIeInvigilateWarnInfo, examStudentCacheBean, recordId, teConfig.getMultipleFaceCountError(), warningDto);
                 }
             }
@@ -98,7 +98,7 @@ public class WarningServiceImpl implements WarningService {
                 if (count > teConfig.getNoFaceCountError()) {
                     TIeInvigilateWarnInfo tIeInvigilateWarnInfo = new TIeInvigilateWarnInfo(examId, examActivityId, recordId, examStudentId, warningEnum.getLevel().get(0), WarningLevelEnum.valueOf(warningEnum.getLevel().get(0)).getTitle(), warningEnum, photoUrl, Objects.nonNull(ExamRecordCacheUtil.getBreachStatus(recordId)) ? ExamRecordCacheUtil.getBreachStatus(recordId) : 1);
                     tIeInvigilateWarnInfoService.saveOrUpdate(tIeInvigilateWarnInfo);
-                    this.setWarningCount(recordId);
+                    this.setWarningCount(recordId, tIeInvigilateWarnInfo);
                     this.setPhotoUrls(map, tIeInvigilateWarnInfo, examStudentCacheBean, recordId, teConfig.getNoFaceCountError(), warningDto);
                 }
             }
@@ -134,7 +134,7 @@ public class WarningServiceImpl implements WarningService {
             if (count > teConfig.getTotalFaceCompareErrorCount()) {
                 TIeInvigilateWarnInfo tIeInvigilateWarnInfo = new TIeInvigilateWarnInfo(examId, examActivityId, recordId, examStudentId, warningEnum.getLevel().get(0), WarningLevelEnum.valueOf(warningEnum.getLevel().get(0)).getTitle(), warningEnum, photoUrl, Objects.nonNull(ExamRecordCacheUtil.getBreachStatus(recordId)) ? ExamRecordCacheUtil.getBreachStatus(recordId) : 1);
                 tIeInvigilateWarnInfoService.saveOrUpdate(tIeInvigilateWarnInfo);
-                this.setWarningCount(recordId);
+                this.setWarningCount(recordId, tIeInvigilateWarnInfo);
                 this.setPhotoUrls(map, tIeInvigilateWarnInfo, examStudentCacheBean, recordId, teConfig.getTotalFaceCompareErrorCount(), warningDto);
             }
         }
@@ -169,7 +169,7 @@ public class WarningServiceImpl implements WarningService {
             if (count > teConfig.getTotalEyeCloseErrorCount()) {
                 TIeInvigilateWarnInfo tIeInvigilateWarnInfo = new TIeInvigilateWarnInfo(examId, examActivityId, recordId, examStudentId, warningEnum.getLevel().get(0), WarningLevelEnum.valueOf(warningEnum.getLevel().get(0)).getTitle(), warningEnum, photoUrl, Objects.nonNull(ExamRecordCacheUtil.getBreachStatus(recordId)) ? ExamRecordCacheUtil.getBreachStatus(recordId) : 1);
                 tIeInvigilateWarnInfoService.saveOrUpdate(tIeInvigilateWarnInfo);
-                this.setWarningCount(recordId);
+                this.setWarningCount(recordId, tIeInvigilateWarnInfo);
                 this.setPhotoUrls(map, tIeInvigilateWarnInfo, examStudentCacheBean, recordId, teConfig.getTotalEyeCloseErrorCount(), warningDto);
             }
         }
@@ -204,7 +204,7 @@ public class WarningServiceImpl implements WarningService {
             if (count > teConfig.getRealnessCount()) {
                 TIeInvigilateWarnInfo tIeInvigilateWarnInfo = new TIeInvigilateWarnInfo(examId, examActivityId, recordId, examStudentId, WarningLevelEnum.D15.name(), WarningLevelEnum.D15.getTitle(), warningEnum, photoUrl, Objects.nonNull(ExamRecordCacheUtil.getBreachStatus(recordId)) ? ExamRecordCacheUtil.getBreachStatus(recordId) : 1);
                 tIeInvigilateWarnInfoService.saveOrUpdate(tIeInvigilateWarnInfo);
-                this.setWarningCount(recordId);
+                this.setWarningCount(recordId, tIeInvigilateWarnInfo);
                 this.setPhotoUrls(map, tIeInvigilateWarnInfo, examStudentCacheBean, recordId, teConfig.getRealnessCount(), warningDto);
             }
         }
@@ -234,7 +234,7 @@ public class WarningServiceImpl implements WarningService {
         if (Objects.nonNull(map) && map.size() > 0) {
             TIeInvigilateWarnInfo tIeInvigilateWarnInfo = new TIeInvigilateWarnInfo(examId, examActivityId, recordId, examStudentId, VerifyExceptionEnum.LIVENESS_ACTION_ERROR.getLevel().get(0), VerifyExceptionEnum.LIVENESS_ACTION_ERROR.getTitle(), VerifyExceptionEnum.LIVENESS_ACTION_ERROR, photoUrl, Objects.nonNull(ExamRecordCacheUtil.getBreachStatus(recordId)) ? ExamRecordCacheUtil.getBreachStatus(recordId) : 1);
             tIeInvigilateWarnInfoService.saveOrUpdate(tIeInvigilateWarnInfo);
-            this.setWarningCount(recordId);
+            this.setWarningCount(recordId, tIeInvigilateWarnInfo);
             this.setPhotoUrls(map, tIeInvigilateWarnInfo, examStudentCacheBean, recordId, 0, warningDto);
         }
     }
@@ -243,9 +243,10 @@ public class WarningServiceImpl implements WarningService {
      * 设置预警数
      *
      * @param recordId
+     * @param tIeInvigilateWarnInfo
      */
-    public void setWarningCount(Long recordId) {
-        tOeExamRecordService.updateWarningCountCache(recordId);
+    public void setWarningCount(Long recordId, TIeInvigilateWarnInfo tIeInvigilateWarnInfo) {
+        tOeExamRecordService.updateWarningCountCache(recordId, tIeInvigilateWarnInfo);
     }
 
     /**

+ 2 - 0
themis-business/src/main/resources/db/log/1.2.8.log

@@ -32,6 +32,8 @@ ALTER TABLE t_ie_exam_invigilate_call_log ADD receive_user_id BIGINT NULL COMMEN
 ALTER TABLE t_ie_exam_invigilate_call_log ADD start_time BIGINT NULL COMMENT '开始通话时间';
 ALTER TABLE t_ie_exam_invigilate_call_log ADD end_time BIGINT NULL COMMENT '结束通话时间';
 ALTER TABLE t_oe_exam_record ADD warning_unread INTEGER NULL COMMENT '预警记录未读数';
+ALTER TABLE t_oe_exam_record ADD warning_multiple_face_count INTEGER NULL COMMENT '陌生人脸预警总数';
+ALTER TABLE t_oe_exam_record ADD exception_count INTEGER NULL COMMENT '异常数据总数';
 
 ALTER TABLE t_ie_exam_invigilate_call ADD call_time BIGINT NULL COMMENT '接通时间';
 ALTER TABLE t_ie_exam_invigilate_call CHANGE call_time call_time BIGINT NULL COMMENT '接通时间' AFTER start_time;

+ 27 - 65
themis-business/src/main/resources/mapper/TOeExamRecordMapper.xml

@@ -62,12 +62,8 @@
         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_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.approve_status = 0) as warningNew
+        toer.finish_type as finishType,
+        IFNULL(toer.warning_count,0) as warningNew
         from
         t_e_exam_student s
         left join t_e_exam tee on tee.id = s.exam_id
@@ -153,12 +149,7 @@
     <select id="invigilatePageListVideoRandom" resultType="com.qmth.themis.business.bean.admin.InvigilateListVideoBean">
         <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
-        tiiwi.approve_status = 0) as warningNew
+        ,IFNULL(t.warning_count,0) as warningNew
         <include refid="invigilatePageMiddle"/>
         <where>1 = 1
             <if test="examId != null and examId != ''">
@@ -198,19 +189,9 @@
         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
+        toer.finish_type as finishType,
+        IFNULL(toer.exception_count,0) as exceptionCount,
+        IFNULL(toer.warning_multiple_face_count,0) as multipleFaceCount
         from
         t_e_exam_student s
         left join t_e_exam tee on tee.id = s.exam_id
@@ -310,18 +291,9 @@
         IFNULL(toer.warning_count,0) as warningCount,
         IFNULL(toer.breach_status,1) as breachStatus,
         toer.client_last_sync_time as updateTime,
-        tiiwi.approve_status as approveStatus
-        ,(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
-        ,(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
+        tiiwi.approve_status as approveStatus,
+        IFNULL(toer.exception_count,0) as exceptionCount,
+        IFNULL(toer.warning_multiple_face_count,0) as multipleFaceCount
         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
@@ -680,19 +652,9 @@
         toer.monitor_video_source as monitorVideoSource,
         toer.monitor_record as monitorRecord,
         toer.finish_type as finishType,
-        s.class_no as classNo
-        ,(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
-        ,(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
+        s.class_no as classNo,
+        IFNULL(toer.exception_count,0) as exceptionCount,
+        IFNULL(toer.warning_multiple_face_count,0) as multipleFaceCount
         from
         t_e_exam_student s
         left join t_e_exam tee on
@@ -1767,20 +1729,20 @@
             tir.province
     </select>
 
-    <update id="updateWarningCount">
-        update t_oe_exam_record set warning_count = warning_count + 1, warning_unread = warning_unread + 1 where id = #{id}
-    </update>
+<!--    <update id="updateWarningCount">-->
+<!--        update t_oe_exam_record set warning_count = warning_count + 1, warning_unread = warning_unread + 1 where id = #{id}-->
+<!--    </update>-->
 
-    <update id="updateWarningUnread">
-        update t_oe_exam_record set
-        <choose>
-            <when test="number != null and number != '' or number == 0">
-                warning_unread = #{number}
-            </when>
-            <otherwise>
-                warning_unread = warning_unread - #{number}
-            </otherwise>
-        </choose>
-            where id = #{id}
-    </update>
+<!--    <update id="updateWarningUnread">-->
+<!--        update t_oe_exam_record set-->
+<!--        <choose>-->
+<!--            <when test="number != null and number != '' or number == 0">-->
+<!--                warning_unread = #{number}-->
+<!--            </when>-->
+<!--            <otherwise>-->
+<!--                warning_unread = warning_unread - #{number}-->
+<!--            </otherwise>-->
+<!--        </choose>-->
+<!--            where id = #{id}-->
+<!--    </update>-->
 </mapper>

+ 3 - 0
themis-mq/src/main/java/com/qmth/themis/mq/service/impl/MqLogicServiceImpl.java

@@ -936,6 +936,9 @@ public class MqLogicServiceImpl implements MqLogicService {
         //        }
         tIeInvigilateExceptionInfoService.saveOrUpdate(tIeInvigilateExceptionInfo);
 
+        //增加考试记录异常数
+        examRecordService.updateExceptionCountCache(recordId);
+
         String ip = ExamRecordCacheUtil.getClientCurrentIp(recordId), country = null, region = null, province = null, city = null, isp = null;
         String[] strs = SystemConstant.getIpInfo(ip);
         if (Objects.nonNull(strs) && strs.length > 0) {