wangliang 4 rokov pred
rodič
commit
aa60a25db2

+ 11 - 0
themis-business/src/main/java/com/qmth/themis/business/dao/TOeFaceVerifyHistoryMapper.java

@@ -51,4 +51,15 @@ public interface TOeFaceVerifyHistoryMapper extends BaseMapper<TOeFaceVerifyHist
      * @return
      */
     public Map<String, Object> eyeCloseError(@Param("recordId") Long recordId, @Param("exception") String exception, @Param("type") String type, @Param("batchNo") String batchNo);
+
+    /**
+     * 真实性检测异常
+     *
+     * @param recordId
+     * @param exception
+     * @param type
+     * @param batchNo
+     * @return
+     */
+    public Map<String, Object> realnessError(@Param("recordId") Long recordId, @Param("exception") String exception, @Param("type") String type, @Param("batchNo") String batchNo);
 }

+ 1 - 1
themis-business/src/main/java/com/qmth/themis/business/enums/WarningLevelEnum.java

@@ -15,7 +15,7 @@ public enum WarningLevelEnum {
 
     D6("一个考试场次中检测到人脸与底照不符次数超过3次(持续30秒连续帧画面90%比对底照不符记为次数1次)", "【疑似替考】系统多次检测到当前考生身份不符", "违纪预警"),
 
-    D14("一个考试场次内人脸抓拍检测(D13)失败累计次数超过6次", "疑似采用照片】系统检测到考生疑似在镜头前采用照片", "违纪预警"),
+    D14("一个考试场次内人脸抓拍检测(D13)失败累计次数超过6次", "疑似采用照片】系统检测到考生疑似在镜头前采用照片", "违纪预警"),
 
     D15("真实性检测失败1次以上", "【疑似采用照片或虚拟摄像头】系统随机真实性检测失败", "违纪预警"),
 

+ 11 - 0
themis-business/src/main/java/com/qmth/themis/business/service/TOeFaceVerifyHistoryService.java

@@ -55,4 +55,15 @@ public interface TOeFaceVerifyHistoryService extends IService<TOeFaceVerifyHisto
      * @return
      */
     public Map<String, Object> eyeCloseError(Long recordId, String exception, String type, String batchNo);
+
+    /**
+     * 真实性检测异常
+     *
+     * @param recordId
+     * @param exception
+     * @param type
+     * @param batchNo
+     * @return
+     */
+    public Map<String, Object> realnessError(Long recordId, String exception, String type, String batchNo);
 }

+ 15 - 1
themis-business/src/main/java/com/qmth/themis/business/service/impl/TOeFaceVerifyHistoryServiceImpl.java

@@ -121,6 +121,20 @@ public class TOeFaceVerifyHistoryServiceImpl extends ServiceImpl<TOeFaceVerifyHi
      */
     @Override
     public Map<String, Object> eyeCloseError(Long recordId, String exception, String type, String batchNo) {
-        return tOeFaceVerifyHistoryMapper.faceCompareError(recordId, exception, type, batchNo);
+        return tOeFaceVerifyHistoryMapper.eyeCloseError(recordId, exception, type, batchNo);
+    }
+
+    /**
+     * 真实性检测异常
+     *
+     * @param recordId
+     * @param exception
+     * @param type
+     * @param batchNo
+     * @return
+     */
+    @Override
+    public Map<String, Object> realnessError(Long recordId, String exception, String type, String batchNo) {
+        return tOeFaceVerifyHistoryMapper.realnessError(recordId, exception, type, batchNo);
     }
 }

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

@@ -175,22 +175,22 @@ public class WarningServiceImpl implements WarningService {
     public void realnessError(WarningDto warningDto) {
         Long recordId = warningDto.getRecordId();
         VerifyExceptionEnum warningEnum = warningDto.getWarningEnum();
+        String photoUrl = warningDto.getPhotoUrl();
         TEConfig teConfig = teConfigService.getGlobalConfig();
         Long examId = ExamRecordCacheUtil.getExamId(recordId);
         Long examStudentId = ExamRecordCacheUtil.getExamStudentId(recordId);
         Long examActivityId = ExamRecordCacheUtil.getExamActivityId(recordId);
-        QueryWrapper<TOeFaceVerifyHistory> tOeFaceVerifyHistoryQueryWrapper = new QueryWrapper<>();
-        tOeFaceVerifyHistoryQueryWrapper.lambda().eq(TOeFaceVerifyHistory::getExamRecordId, recordId)
-                .eq(TOeFaceVerifyHistory::getException, warningEnum.name())
-                .eq(TOeFaceVerifyHistory::getBatchNo, warningDto.getRandom());
         ExamStudentCacheBean examStudentCacheBean = teExamStudentService.getExamStudentCacheBean(examStudentId);
-        int count = faceVerifyHistoryService.count(tOeFaceVerifyHistoryQueryWrapper);
-        if (count > teConfig.getRealnessCount()) {
-            TIeInvigilateWarnInfo tIeInvigilateWarnInfo = new TIeInvigilateWarnInfo(examId, examActivityId, recordId, examStudentId, WarningLevelEnum.D15.name(), WarningLevelEnum.D15.getTitle(), warningEnum, Objects.nonNull(ExamRecordCacheUtil.getBreachStatus(recordId)) ? ExamRecordCacheUtil.getBreachStatus(recordId) : 1);
-            tIeInvigilateWarnInfoService.saveOrUpdate(tIeInvigilateWarnInfo);
-            this.setWarningCount(recordId);
-            TEExamStudentLog teExamStudentLog = new TEExamStudentLog(tIeInvigilateWarnInfo.getType().name(), WarningLevelEnum.valueOf(tIeInvigilateWarnInfo.getLevel()).getTitle(), tIeInvigilateWarnInfo.getType().getCode(), examStudentCacheBean.getStudentId(), examStudentCacheBean.getId(), recordId, WarningLevelEnum.valueOf(tIeInvigilateWarnInfo.getLevel()).getSecondTitle());
-            teExamStudentLogService.saveOrUpdate(teExamStudentLog);
+        Map<String, Object> map = faceVerifyHistoryService.realnessError(recordId, warningDto.getWarningEnum().name(), ExamTypeEnum.IN_PROCESS.name(), warningDto.getRandom());
+        if (Objects.nonNull(map) && map.size() > 0) {
+            Integer count = Integer.parseInt(String.valueOf(map.get("tmpCount")));
+            count = Objects.isNull(count) ? 0 : count;
+            if (count > teConfig.getRealnessCount()) {
+                TIeInvigilateWarnInfo tIeInvigilateWarnInfo = new TIeInvigilateWarnInfo(examId, examActivityId, recordId, examStudentId, WarningLevelEnum.D15.name(), WarningLevelEnum.D15.getTitle(), warningEnum, Objects.nonNull(ExamRecordCacheUtil.getBreachStatus(recordId)) ? ExamRecordCacheUtil.getBreachStatus(recordId) : 1);
+                tIeInvigilateWarnInfoService.saveOrUpdate(tIeInvigilateWarnInfo);
+                this.setWarningCount(recordId);
+                this.setPhotoUrls(map, tIeInvigilateWarnInfo, examStudentCacheBean, recordId, teConfig.getRealnessCount());
+            }
         }
     }
 

+ 30 - 0
themis-business/src/main/resources/mapper/TOeFaceVerifyHistoryMapper.xml

@@ -184,4 +184,34 @@
         </where>
         group by tofvh.`exception`) t
     </select>
+
+    <select id="realnessError" resultType="java.util.Map">
+        select
+        sum(t.tmpCount) as tmpCount,
+        group_concat(t.photoUrl) as photoUrls,
+        min(t.createTime) as createTime
+        from
+        (
+        select
+        count(1) as tmpCount,
+        group_concat(tofvh.photo_url) as photoUrl,
+        min(tofvh.create_time) as createTime
+        from
+        t_oe_face_verify_history tofvh
+        <where>
+            <if test="recordId != null and recordId != ''">
+                and tofvh.exam_record_id = #{recordId}
+            </if>
+            <if test="exception != null and exception != ''">
+                and tofvh.`exception` = #{exception}
+            </if>
+            <if test="type != null and type != ''">
+                and tofvh.`type` = #{type}
+            </if>
+            <if test="batchNo != null and batchNo != ''">
+                and tofvh.batch_no = #{batchNo}
+            </if>
+        </where>
+        group by tofvh.`exception`) t
+    </select>
 </mapper>