فهرست منبع

活体检测预警BUG修改

wangliang 2 سال پیش
والد
کامیت
e1f5072615

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

@@ -66,15 +66,4 @@ public interface TOeFaceVerifyHistoryMapper extends BaseMapper<TOeFaceVerifyHist
      */
     @SuppressWarnings("MybatisXMapperMethodInspection")
     public Map<String, Object> realnessError(@Param("recordId") Long recordId, @Param("exception") String exception, @Param("type") String type, @Param("batchNo") String batchNo);
-
-    /**
-     * 活检动作错误异常
-     *
-     * @param recordId
-     * @param exception
-     * @param type
-     * @return
-     */
-    @SuppressWarnings("MybatisXMapperMethodInspection")
-    public Map<String, Object> livenessActionError(@Param("recordId") Long recordId, @Param("exception") String exception, @Param("type") String type);
 }

+ 5 - 0
themis-business/src/main/java/com/qmth/themis/business/dao/TOeLivenessVerifyHistoryMapper.java

@@ -3,6 +3,9 @@ package com.qmth.themis.business.dao;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.qmth.themis.business.entity.TOeLivenessVerifyHistory;
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.Map;
 
 /**
  * @Description: 活体验证记录 Mapper 接口
@@ -14,4 +17,6 @@ import org.apache.ibatis.annotations.Mapper;
 @Mapper
 public interface TOeLivenessVerifyHistoryMapper extends BaseMapper<TOeLivenessVerifyHistory> {
 
+    @SuppressWarnings("MybatisXMapperMethodInspection")
+    public Map<String, Object> livenessActionError(@Param("recordId") Long recordId, @Param("exception") String exception, @Param("type") String type);
 }

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

@@ -66,14 +66,4 @@ public interface TOeFaceVerifyHistoryService extends IService<TOeFaceVerifyHisto
      * @return
      */
     public Map<String, Object> realnessError(Long recordId, String exception, String type, String batchNo);
-
-    /**
-     * 活检动作错误异常
-     *
-     * @param recordId
-     * @param exception
-     * @param type
-     * @return
-     */
-    public Map<String, Object> livenessActionError(Long recordId, String exception, String type);
 }

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

@@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.extension.service.IService;
 import com.qmth.themis.business.bean.exam.LivenessVerifyBean;
 import com.qmth.themis.business.entity.TOeLivenessVerifyHistory;
 
+import java.util.Map;
+
 /**
  * @Description: 活体验证记录 服务类
  * @Param:
@@ -19,4 +21,14 @@ public interface TOeLivenessVerifyHistoryService extends IService<TOeLivenessVer
 
     void save(Long id, Long recordId, String type, String actions, Integer retry, Long startTime, Long finishTime,
               String exception, String batchNo);
+
+    /**
+     * 活检动作错误异常
+     *
+     * @param recordId
+     * @param exception
+     * @param type
+     * @return
+     */
+    public Map<String, Object> livenessActionError(Long recordId, String exception, String type);
 }

+ 0 - 13
themis-business/src/main/java/com/qmth/themis/business/service/impl/TOeFaceVerifyHistoryServiceImpl.java

@@ -142,17 +142,4 @@ public class TOeFaceVerifyHistoryServiceImpl extends ServiceImpl<TOeFaceVerifyHi
     public Map<String, Object> realnessError(Long recordId, String exception, String type, String batchNo) {
         return tOeFaceVerifyHistoryMapper.realnessError(recordId, exception, type, batchNo);
     }
-
-    /**
-     * 活检动作错误异常
-     *
-     * @param recordId
-     * @param exception
-     * @param type
-     * @return
-     */
-    @Override
-    public Map<String, Object> livenessActionError(Long recordId, String exception, String type) {
-        return tOeFaceVerifyHistoryMapper.livenessActionError(recordId, exception, type);
-    }
 }

+ 17 - 0
themis-business/src/main/java/com/qmth/themis/business/service/impl/TOeLivenessVerifyHistoryServiceImpl.java

@@ -16,6 +16,7 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
 import javax.annotation.Resource;
+import java.util.Map;
 
 /**
  * @Description: 活体验证记录 服务实现类
@@ -38,6 +39,9 @@ public class TOeLivenessVerifyHistoryServiceImpl
     @Resource
     UidUtil uidUtil;
 
+    @Resource
+    TOeLivenessVerifyHistoryMapper tOeLivenessVerifyHistoryMapper;
+
     @Override
     public LivenessVerifyBean verify(Long recordId, String type, String actions, Integer retry, Long startTime,
             Long finishTime, String exception) {
@@ -78,4 +82,17 @@ public class TOeLivenessVerifyHistoryServiceImpl
         entity.setBatchNo(batchNo);
         saveOrUpdate(entity);
     }
+
+    /**
+     * 活检动作错误异常
+     *
+     * @param recordId
+     * @param exception
+     * @param type
+     * @return
+     */
+    @Override
+    public Map<String, Object> livenessActionError(Long recordId, String exception, String type) {
+        return tOeLivenessVerifyHistoryMapper.livenessActionError(recordId, exception, type);
+    }
 }

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

@@ -52,6 +52,9 @@ public class WarningServiceImpl implements WarningService {
     @Resource
     TOeExamRecordService tOeExamRecordService;
 
+    @Resource
+    TOeLivenessVerifyHistoryService tOeLivenessVerifyHistoryService;
+
     /**
      * 人脸数量异常
      *
@@ -228,9 +231,9 @@ public class WarningServiceImpl implements WarningService {
             examActivityId = tOeExamRecord.getExamActivityId();
         }
         ExamStudentCacheBean examStudentCacheBean = teExamStudentService.getExamStudentCacheBean(examStudentId);
-        Map<String, Object> map = faceVerifyHistoryService.livenessActionError(recordId, warningDto.getWarningEnum().name(), ExamTypeEnum.IN_PROCESS.name());
+        Map<String, Object> map = tOeLivenessVerifyHistoryService.livenessActionError(recordId, warningDto.getWarningEnum().name(), ExamTypeEnum.IN_PROCESS.name());
         if (Objects.nonNull(map) && map.size() > 0) {
-            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);
+            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.setPhotoUrls(map, tIeInvigilateWarnInfo, examStudentCacheBean, recordId, 0);

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

@@ -41,7 +41,7 @@
         union all
             select
                 count(1) as tmpCount,
-                group_concat(t.photoUrl),
+                group_concat(t.photoUrl) as photoUrls,
                 min(t.create_time) as createTime
             from
                 (
@@ -118,7 +118,7 @@
         union all
                 select
                 count(1) as tmpCount,
-                group_concat(t.photoUrl),
+                group_concat(t.photoUrl) as photoUrls,
                 min(t.create_time) as createTime
                 from
                 (
@@ -135,7 +135,6 @@
                 tolvh.create_time
                 from
                 t_oe_liveness_verify_history tolvh
-
                 <where>
                     <if test="recordId != null and recordId != ''">
                         and tolvh.exam_record_id = #{recordId}
@@ -214,31 +213,4 @@
         </where>
         group by tofvh.`exception`) t
     </select>
-
-    <select id="livenessActionError" 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>
-        </where>
-        group by tofvh.`exception`) t
-    </select>
 </mapper>

+ 35 - 0
themis-business/src/main/resources/mapper/TOeLivenessVerifyHistoryMapper.xml

@@ -2,4 +2,39 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.qmth.themis.business.dao.TOeLivenessVerifyHistoryMapper">
 
+    <select id="livenessActionError" resultType="java.util.Map">
+        select
+        count(1) as tmpCount,
+        group_concat(t.photoUrl) as photoUrls,
+        min(t.create_time) as createTime
+        from
+        (
+        select
+        CONVERT((tolvh.actions->>'$.faceCount')
+        USING utf8) as faceCount, tolvh.`exception`,
+        CONVERT((tolvh.actions->>'$.photoUrl')
+        USING utf8) as photoUrl,tolvh.create_time
+        from
+        (
+        select
+        tolvh.actions->>'$[0]' as actions,
+        tolvh.`exception`,
+        tolvh.create_time
+        from
+        t_oe_liveness_verify_history tolvh
+        <where>
+            <if test="recordId != null and recordId != ''">
+                and tolvh.exam_record_id = #{recordId}
+            </if>
+            <if test="exception != null and exception != ''">
+                and tolvh.`exception` = #{exception}
+            </if>
+            <if test="type != null and type != ''">
+                and tolvh.`type` = #{type}
+            </if>
+        </where>
+        ) tolvh
+        ) t
+        group by t.`exception`
+    </select>
 </mapper>

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

@@ -554,7 +554,6 @@ public class MqLogicServiceImpl implements MqLogicService {
         Long startTime = (Long) param.get("startTime");
         Long finishTime = (Long) param.get("finishTime");
         String exception = (String) param.get("exception");
-//        TEConfig teConfig = teConfigService.getGlobalConfig();
         Long examStudentId = ExamRecordCacheUtil.getExamStudentId(recordId);
         if (Objects.isNull(examStudentId)) {
             TOeExamRecord tOeExamRecord = SystemConstant.getExamRecord(recordId);
@@ -590,53 +589,8 @@ public class MqLogicServiceImpl implements MqLogicService {
                     if (Objects.equals(VerifyExceptionEnum.FACE_COMPARE_ERROR, warningEnum) || Objects.equals(VerifyExceptionEnum.FACE_COUNT_ERROR, warningEnum)) {//人脸数量异常
                         Integer faceCount = Integer.parseInt(String.valueOf(jsonObject.get("faceCount")));
                         WarningDto warningDto = new WarningDto(warningEnum, faceCount, null, recordId, String.valueOf(jsonObject.get("photoUrl")));
-//                        if (faceCount > 1) {//多张人脸
-//                            String multipleFaceRandom = ExamRecordCacheUtil.getMultipleFaceCountErrorRandom(recordId);
-//                            if (Objects.isNull(multipleFaceRandom)) {
-//                                multipleFaceRandom = SystemConstant.getNanoId();
-//                                ExamRecordCacheUtil.setMultipleFaceCountErrorRandom(recordId, multipleFaceRandom);
-//                            }
-//                            ExamRecordCacheUtil.setMultipleFaceCountErrorNum(recordId, new AtomicInteger(ExamRecordCacheUtil.getMultipleFaceCountErrorNum(recordId).incrementAndGet()));
-//                            warningDto.setRandom(multipleFaceRandom);
-//                            livenessVerifyHistoryService.save(id, recordId, type, actions, retry, startTime, finishTime, exception, null);
-//                            Integer count = ExamRecordCacheUtil.getMultipleFaceCountErrorNum(recordId).get();
-//                            if (count > teConfig.getMultipleFaceCountError()) {
-//                                ExamRecordCacheUtil.setMultipleFaceCountErrorRandom(recordId, SystemConstant.getNanoId());
-//                                ExamRecordCacheUtil.setMultipleFaceCountErrorNum(recordId, new AtomicInteger(0));
-//                            warningService.livenessActionError(warningDto);
-//                            }
-//                        } else if (faceCount <= 0) {
-//                            String noFaceRandom = ExamRecordCacheUtil.getNoFaceCountErrorRandom(recordId);
-//                            if (Objects.isNull(noFaceRandom)) {
-//                                noFaceRandom = SystemConstant.getNanoId();
-//                                ExamRecordCacheUtil.setNoFaceCountErrorRandom(recordId, noFaceRandom);
-//                            }
-//                            ExamRecordCacheUtil.setNoFaceCountErrorNum(recordId, new AtomicInteger(ExamRecordCacheUtil.getMultipleFaceCountErrorNum(recordId).incrementAndGet()));
-//                            warningDto.setRandom(noFaceRandom);
                         livenessVerifyHistoryService.save(id, recordId, type, actions, retry, startTime, finishTime, exception, null);
-//                            Integer count = ExamRecordCacheUtil.getNoFaceCountErrorNum(recordId).get();
-//                            if (count > teConfig.getNoFaceCountError()) {
-//                                ExamRecordCacheUtil.setNoFaceCountErrorRandom(recordId, SystemConstant.getNanoId());
-//                                ExamRecordCacheUtil.setNoFaceCountErrorNum(recordId, new AtomicInteger(0));
                         warningService.livenessActionError(warningDto);
-//                            }
-//                        }
-//                    } else if (Objects.equals(VerifyExceptionEnum.FACE_COMPARE_ERROR, warningEnum)) {//人脸比对异常
-//                        WarningDto warningDto = new WarningDto(warningEnum, null, null, recordId, String.valueOf(jsonObject.get("photoUrl")));
-//                        String faceCompareErrorRandom = ExamRecordCacheUtil.getFaceCompareErrorRandom(recordId);
-//                        if (Objects.isNull(faceCompareErrorRandom)) {
-//                            faceCompareErrorRandom = SystemConstant.getNanoId();
-//                            ExamRecordCacheUtil.setFaceCompareErrorRandom(recordId, faceCompareErrorRandom);
-//                        }
-//                        ExamRecordCacheUtil.setFaceCompareErrorNum(recordId, new AtomicInteger(ExamRecordCacheUtil.getFaceCompareErrorNum(recordId).incrementAndGet()));
-//                        warningDto.setRandom(faceCompareErrorRandom);
-//                        livenessVerifyHistoryService.save(id, recordId, type, actions, retry, startTime, finishTime, exception, null);
-//                        Integer count = ExamRecordCacheUtil.getFaceCompareErrorNum(recordId).get();
-//                        if (count > teConfig.getTotalFaceCompareErrorCount()) {
-//                            ExamRecordCacheUtil.setFaceCompareErrorRandom(recordId, SystemConstant.getNanoId());
-//                            ExamRecordCacheUtil.setFaceCompareErrorNum(recordId, new AtomicInteger(0));
-//                        warningService.livenessActionError(warningDto);
-//                        }
                     } else if (Objects.equals(VerifyExceptionEnum.FACE_COMPARE_ERROR, warningEnum) || Objects.equals(VerifyExceptionEnum.LIVENESS_ACTION_ERROR, warningEnum)) {//活检动作错误
                         WarningDto warningDto = new WarningDto(warningEnum, null, null, recordId, String.valueOf(jsonObject.get("photoUrl")));
                         livenessVerifyHistoryService.save(id, recordId, type, actions, retry, startTime, finishTime, exception, null);