Browse Source

活体检测预警BUG修改

wangliang 2 years ago
parent
commit
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")
     @SuppressWarnings("MybatisXMapperMethodInspection")
     public Map<String, Object> realnessError(@Param("recordId") Long recordId, @Param("exception") String exception, @Param("type") String type, @Param("batchNo") String batchNo);
     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.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.qmth.themis.business.entity.TOeLivenessVerifyHistory;
 import com.qmth.themis.business.entity.TOeLivenessVerifyHistory;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.Map;
 
 
 /**
 /**
  * @Description: 活体验证记录 Mapper 接口
  * @Description: 活体验证记录 Mapper 接口
@@ -14,4 +17,6 @@ import org.apache.ibatis.annotations.Mapper;
 @Mapper
 @Mapper
 public interface TOeLivenessVerifyHistoryMapper extends BaseMapper<TOeLivenessVerifyHistory> {
 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
      * @return
      */
      */
     public Map<String, Object> realnessError(Long recordId, String exception, String type, String batchNo);
     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.bean.exam.LivenessVerifyBean;
 import com.qmth.themis.business.entity.TOeLivenessVerifyHistory;
 import com.qmth.themis.business.entity.TOeLivenessVerifyHistory;
 
 
+import java.util.Map;
+
 /**
 /**
  * @Description: 活体验证记录 服务类
  * @Description: 活体验证记录 服务类
  * @Param:
  * @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,
     void save(Long id, Long recordId, String type, String actions, Integer retry, Long startTime, Long finishTime,
               String exception, String batchNo);
               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) {
     public Map<String, Object> realnessError(Long recordId, String exception, String type, String batchNo) {
         return tOeFaceVerifyHistoryMapper.realnessError(recordId, exception, type, 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 org.springframework.transaction.annotation.Transactional;
 
 
 import javax.annotation.Resource;
 import javax.annotation.Resource;
+import java.util.Map;
 
 
 /**
 /**
  * @Description: 活体验证记录 服务实现类
  * @Description: 活体验证记录 服务实现类
@@ -38,6 +39,9 @@ public class TOeLivenessVerifyHistoryServiceImpl
     @Resource
     @Resource
     UidUtil uidUtil;
     UidUtil uidUtil;
 
 
+    @Resource
+    TOeLivenessVerifyHistoryMapper tOeLivenessVerifyHistoryMapper;
+
     @Override
     @Override
     public LivenessVerifyBean verify(Long recordId, String type, String actions, Integer retry, Long startTime,
     public LivenessVerifyBean verify(Long recordId, String type, String actions, Integer retry, Long startTime,
             Long finishTime, String exception) {
             Long finishTime, String exception) {
@@ -78,4 +82,17 @@ public class TOeLivenessVerifyHistoryServiceImpl
         entity.setBatchNo(batchNo);
         entity.setBatchNo(batchNo);
         saveOrUpdate(entity);
         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
     @Resource
     TOeExamRecordService tOeExamRecordService;
     TOeExamRecordService tOeExamRecordService;
 
 
+    @Resource
+    TOeLivenessVerifyHistoryService tOeLivenessVerifyHistoryService;
+
     /**
     /**
      * 人脸数量异常
      * 人脸数量异常
      *
      *
@@ -228,9 +231,9 @@ public class WarningServiceImpl implements WarningService {
             examActivityId = tOeExamRecord.getExamActivityId();
             examActivityId = tOeExamRecord.getExamActivityId();
         }
         }
         ExamStudentCacheBean examStudentCacheBean = teExamStudentService.getExamStudentCacheBean(examStudentId);
         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) {
         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);
             tIeInvigilateWarnInfoService.saveOrUpdate(tIeInvigilateWarnInfo);
             this.setWarningCount(recordId);
             this.setWarningCount(recordId);
             this.setPhotoUrls(map, tIeInvigilateWarnInfo, examStudentCacheBean, recordId, 0);
             this.setPhotoUrls(map, tIeInvigilateWarnInfo, examStudentCacheBean, recordId, 0);

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

@@ -41,7 +41,7 @@
         union all
         union all
             select
             select
                 count(1) as tmpCount,
                 count(1) as tmpCount,
-                group_concat(t.photoUrl),
+                group_concat(t.photoUrl) as photoUrls,
                 min(t.create_time) as createTime
                 min(t.create_time) as createTime
             from
             from
                 (
                 (
@@ -118,7 +118,7 @@
         union all
         union all
                 select
                 select
                 count(1) as tmpCount,
                 count(1) as tmpCount,
-                group_concat(t.photoUrl),
+                group_concat(t.photoUrl) as photoUrls,
                 min(t.create_time) as createTime
                 min(t.create_time) as createTime
                 from
                 from
                 (
                 (
@@ -135,7 +135,6 @@
                 tolvh.create_time
                 tolvh.create_time
                 from
                 from
                 t_oe_liveness_verify_history tolvh
                 t_oe_liveness_verify_history tolvh
-
                 <where>
                 <where>
                     <if test="recordId != null and recordId != ''">
                     <if test="recordId != null and recordId != ''">
                         and tolvh.exam_record_id = #{recordId}
                         and tolvh.exam_record_id = #{recordId}
@@ -214,31 +213,4 @@
         </where>
         </where>
         group by tofvh.`exception`) t
         group by tofvh.`exception`) t
     </select>
     </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>
 </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">
 <!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">
 <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>
 </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 startTime = (Long) param.get("startTime");
         Long finishTime = (Long) param.get("finishTime");
         Long finishTime = (Long) param.get("finishTime");
         String exception = (String) param.get("exception");
         String exception = (String) param.get("exception");
-//        TEConfig teConfig = teConfigService.getGlobalConfig();
         Long examStudentId = ExamRecordCacheUtil.getExamStudentId(recordId);
         Long examStudentId = ExamRecordCacheUtil.getExamStudentId(recordId);
         if (Objects.isNull(examStudentId)) {
         if (Objects.isNull(examStudentId)) {
             TOeExamRecord tOeExamRecord = SystemConstant.getExamRecord(recordId);
             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)) {//人脸数量异常
                     if (Objects.equals(VerifyExceptionEnum.FACE_COMPARE_ERROR, warningEnum) || Objects.equals(VerifyExceptionEnum.FACE_COUNT_ERROR, warningEnum)) {//人脸数量异常
                         Integer faceCount = Integer.parseInt(String.valueOf(jsonObject.get("faceCount")));
                         Integer faceCount = Integer.parseInt(String.valueOf(jsonObject.get("faceCount")));
                         WarningDto warningDto = new WarningDto(warningEnum, faceCount, null, recordId, String.valueOf(jsonObject.get("photoUrl")));
                         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);
                         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);
                         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)) {//活检动作错误
                     } 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")));
                         WarningDto warningDto = new WarningDto(warningEnum, null, null, recordId, String.valueOf(jsonObject.get("photoUrl")));
                         livenessVerifyHistoryService.save(id, recordId, type, actions, retry, startTime, finishTime, exception, null);
                         livenessVerifyHistoryService.save(id, recordId, type, actions, retry, startTime, finishTime, exception, null);