wangliang 4 år sedan
förälder
incheckning
1e9ee77dea

+ 13 - 0
themis-business/src/main/java/com/qmth/themis/business/entity/TOeLivenessVerifyHistory.java

@@ -3,6 +3,7 @@ package com.qmth.themis.business.entity;
 import java.io.Serializable;
 import java.util.Date;
 
+import com.baomidou.mybatisplus.annotation.FieldFill;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.qmth.themis.business.enums.LivenessTypeEnum;
@@ -54,6 +55,18 @@ public class TOeLivenessVerifyHistory implements Serializable {
     @TableField(value = "finish_time")
     private Date finishTime;
 
+    @ApiModelProperty(value = "创建时间")
+    @TableField(value = "create_time", fill = FieldFill.INSERT)
+    private Date createTime;
+
+    public Date getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+
     public static long getSerialVersionUID() {
         return serialVersionUID;
     }

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

@@ -22,7 +22,7 @@ public enum VerifyExceptionEnum {
 
 	NONE("无异常", Arrays.asList("-1")),
 
-	REALNESS("真实性检测", Arrays.asList("D15"));
+	REALNESS("真实性检测异常", Arrays.asList("D15"));
 
 	private String code;
 

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

@@ -83,7 +83,7 @@ public class WarningServiceImpl implements WarningService {
         } else if (faceCount <= 0) {//未检测到人脸
             Map<String, Object> map = faceVerifyHistoryService.faceCountError(recordId, warningDto.getWarningEnum().name(), faceCount, false);
             if (Objects.nonNull(map) && map.size() > 0) {
-                Integer count = (Integer) map.get("tmpCount");
+                Integer count = Integer.parseInt(String.valueOf(map.get("tmpCount")));
                 count = Objects.isNull(count) ? 0 : count;
                 if (count >= teConfig.getNoFaceCountError()) {
                     TIeInvigilateWarnInfo tIeInvigilateWarnInfo = new TIeInvigilateWarnInfo(examId, examActivityId, recordId, examStudentId, warningEnum.getLevel().get(0), WarningLevelEnum.valueOf(warningEnum.getLevel().get(0)).getDesc(), warningEnum, photoUrl);
@@ -113,7 +113,7 @@ public class WarningServiceImpl implements WarningService {
         ExamStudentCacheBean examStudentCacheBean = teExamStudentService.getExamStudentCacheBean(examStudentId);
         Map<String, Object> map = faceVerifyHistoryService.faceCompareError(recordId, warningDto.getWarningEnum().name());
         if (Objects.nonNull(map) && map.size() > 0) {
-            Integer count = (Integer) map.get("tmpCount");
+            Integer count = Integer.parseInt(String.valueOf(map.get("tmpCount")));
             count = Objects.isNull(count) ? 0 : count;
             if (count >= teConfig.getMatchFaceCompareErrorCount()) {
                 TIeInvigilateWarnInfo tIeInvigilateWarnInfo = new TIeInvigilateWarnInfo(examId, examActivityId, recordId, examStudentId, warningEnum.getLevel().get(0), WarningLevelEnum.valueOf(warningEnum.getLevel().get(0)).getDesc(), warningEnum, photoUrl);
@@ -211,6 +211,7 @@ public class WarningServiceImpl implements WarningService {
         photoUrls.add(photoUrl);
         JSONObject jsonObject = new JSONObject();
         jsonObject.put("PHOTOS", photoUrls);
+        jsonObject.put("MIN_CREATE_TIME", (Date) map.get("createTime"));
         TEExamStudentLog teExamStudentLog = new TEExamStudentLog(tIeInvigilateWarnInfo.getType().name(), tIeInvigilateWarnInfo.getType().getCode(), jsonObject.toJSONString(), examStudentCacheBean.getStudentId(), examStudentCacheBean.getId(), recordId);
         teExamStudentLogService.saveOrUpdate(teExamStudentLog);
     }

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

@@ -5,12 +5,14 @@
     <select id="faceCountError" resultType="java.util.Map">
         select
             sum(t.tmpCount) as tmpCount,
-            group_concat(t.photoUrl) as photoUrls
+            group_concat(t.photoUrl) as photoUrls,
+            min(t.createTime) as createTime
         from
             (
             select
                 count(1) as tmpCount,
-                group_concat(tofvh.photo_url) as photoUrl
+                group_concat(tofvh.photo_url) as photoUrl,
+                min(tofvh.create_time) as createTime
             from
                 t_oe_face_verify_history tofvh
             <where>
@@ -33,14 +35,15 @@
         union all
             select
                 count(1) as tmpCount,
-                group_concat(t.photoUrl)
+                group_concat(t.photoUrl),
+                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
+                        USING utf8) as photoUrl,tolvh.create_time
                 from
                     t_oe_liveness_verify_history tolvh
                 <where>
@@ -67,12 +70,14 @@
     <select id="faceCompareError" resultType="java.util.Map">
         select
             sum(t.tmpCount) as tmpCount,
-            group_concat(t.photoUrl) as photoUrls
+            group_concat(t.photoUrl) as photoUrls,
+            min(t.createTime) as createTime
         from
             (
             select
                 count(1) as tmpCount,
-                group_concat(tofvh.photo_url) as photoUrl
+                group_concat(tofvh.photo_url) as photoUrl,
+                min(tofvh.create_time) as createTime
             from
                 t_oe_face_verify_history tofvh
             <where>
@@ -85,20 +90,27 @@
             </where>
             group by tofvh.`exception`
         union all
-            select
+                select
                 count(1) as tmpCount,
+                group_concat(t.photoUrl),
+                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
-            from
+                USING utf8) as photoUrl,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>
-            </where>
-            group by tolvh.`exception`) t
+                <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>
+                </where> ) t
+            group by t.`exception`) t
     </select>
 </mapper>