Browse Source

Merge remote-tracking branch 'origin/dev' into dev

wangliang 4 years ago
parent
commit
6c9a12621e
15 changed files with 112 additions and 52 deletions
  1. 4 3
      themis-business/src/main/java/com/qmth/themis/business/cache/ExamBreakCacheUtil.java
  2. 8 2
      themis-business/src/main/java/com/qmth/themis/business/cache/ExamRecordCacheUtil.java
  3. 4 4
      themis-business/src/main/java/com/qmth/themis/business/cache/bean/FaceVerifyCacheBean.java
  4. 11 9
      themis-business/src/main/java/com/qmth/themis/business/cache/bean/LivenessVerifyCacheBean.java
  5. 4 4
      themis-business/src/main/java/com/qmth/themis/business/entity/TOeFaceVerifyHistory.java
  6. 12 10
      themis-business/src/main/java/com/qmth/themis/business/entity/TOeLivenessVerifyHistory.java
  7. 5 4
      themis-business/src/main/java/com/qmth/themis/business/enums/VerifyExceptionEnum.java
  8. 8 0
      themis-business/src/main/java/com/qmth/themis/business/service/TOeExamBreakHistoryService.java
  9. 2 2
      themis-business/src/main/java/com/qmth/themis/business/service/TOeLivenessVerifyHistoryService.java
  10. 24 2
      themis-business/src/main/java/com/qmth/themis/business/service/impl/TOeExamBreakHistoryServiceImpl.java
  11. 10 3
      themis-business/src/main/java/com/qmth/themis/business/service/impl/TOeFaceVerifyHistoryServiceImpl.java
  12. 14 3
      themis-business/src/main/java/com/qmth/themis/business/service/impl/TOeLivenessVerifyHistoryServiceImpl.java
  13. 1 1
      themis-business/src/main/resources/db/init.sql
  14. 3 3
      themis-exam/src/main/java/com/qmth/themis/exam/api/TELivenessController.java
  15. 2 2
      themis-mq/src/main/java/com/qmth/themis/mq/service/impl/MqLogicServiceImpl.java

+ 4 - 3
themis-business/src/main/java/com/qmth/themis/business/cache/ExamBreakCacheUtil.java

@@ -4,6 +4,7 @@ import java.util.Date;
 
 
 import com.qmth.themis.business.constant.SpringContextHolder;
 import com.qmth.themis.business.constant.SpringContextHolder;
 import com.qmth.themis.business.enums.BreakReasonEnum;
 import com.qmth.themis.business.enums.BreakReasonEnum;
+import com.qmth.themis.business.enums.VerifyExceptionEnum;
 import com.qmth.themis.business.util.RedisUtil;
 import com.qmth.themis.business.util.RedisUtil;
 
 
 /**
 /**
@@ -67,12 +68,12 @@ public class ExamBreakCacheUtil {
 		return (Date) redisUtil.get(RedisKeyHelper.examBreakCacheKey(examBreakId), "startTime");
 		return (Date) redisUtil.get(RedisKeyHelper.examBreakCacheKey(examBreakId), "startTime");
 	}
 	}
 	
 	
-	public static void setEntryAuthenticationResult(Long examBreakId,Boolean entryAuthenticationResult) {
+	public static void setEntryAuthenticationResult(Long examBreakId,VerifyExceptionEnum entryAuthenticationResult) {
 		redisUtil.set(RedisKeyHelper.examBreakCacheKey(examBreakId), "entryAuthenticationResult", entryAuthenticationResult);
 		redisUtil.set(RedisKeyHelper.examBreakCacheKey(examBreakId), "entryAuthenticationResult", entryAuthenticationResult);
 	}
 	}
 	
 	
-	public static Boolean getEntryAuthenticationResult(Long examBreakId) {
-		return (Boolean) redisUtil.get(RedisKeyHelper.examBreakCacheKey(examBreakId), "entryAuthenticationResult");
+	public static VerifyExceptionEnum getEntryAuthenticationResult(Long examBreakId) {
+		return (VerifyExceptionEnum) redisUtil.get(RedisKeyHelper.examBreakCacheKey(examBreakId), "entryAuthenticationResult");
 	}
 	}
 	
 	
 	public static void setEntryAuthenticationId(Long examBreakId,Long entryAuthenticationId) {
 	public static void setEntryAuthenticationId(Long examBreakId,Long entryAuthenticationId) {

+ 8 - 2
themis-business/src/main/java/com/qmth/themis/business/cache/ExamRecordCacheUtil.java

@@ -68,7 +68,7 @@ public class ExamRecordCacheUtil {
 	public static void setFinishType(Long recordId, FinishTypeEnum finishType) {
 	public static void setFinishType(Long recordId, FinishTypeEnum finishType) {
 		redisUtil.set(RedisKeyHelper.examRecordCacheKey(recordId), "finishType", finishType);
 		redisUtil.set(RedisKeyHelper.examRecordCacheKey(recordId), "finishType", finishType);
 	}
 	}
-	
+
 	public static FinishTypeEnum getFinishType(Long recordId) {
 	public static FinishTypeEnum getFinishType(Long recordId) {
 		return (FinishTypeEnum) redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "finishType");
 		return (FinishTypeEnum) redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "finishType");
 	}
 	}
@@ -76,11 +76,17 @@ public class ExamRecordCacheUtil {
 	public static Date getClientLastSyncTime(Long recordId) {
 	public static Date getClientLastSyncTime(Long recordId) {
 		return (Date) redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "clientLastSyncTime");
 		return (Date) redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "clientLastSyncTime");
 	}
 	}
+
 	public static Integer getLeftBreakResumeCount(Long recordId) {
 	public static Integer getLeftBreakResumeCount(Long recordId) {
 		return (Integer) redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "leftBreakResumeCount");
 		return (Integer) redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "leftBreakResumeCount");
 	}
 	}
-	
+
 	public static ExamRecordStatusEnum getStatus(Long recordId) {
 	public static ExamRecordStatusEnum getStatus(Long recordId) {
 		return (ExamRecordStatusEnum) redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "status");
 		return (ExamRecordStatusEnum) redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "status");
 	}
 	}
+
+	public static Long getLastBreakId(Long recordId) {
+		return (Long) redisUtil.get(RedisKeyHelper.examRecordCacheKey(recordId), "lastBreakId");
+	}
+
 }
 }

+ 4 - 4
themis-business/src/main/java/com/qmth/themis/business/cache/bean/FaceVerifyCacheBean.java

@@ -4,7 +4,7 @@ import java.io.Serializable;
 import java.util.Date;
 import java.util.Date;
 
 
 import com.qmth.themis.business.enums.ExamTypeEnum;
 import com.qmth.themis.business.enums.ExamTypeEnum;
-import com.qmth.themis.business.enums.FaceVerifyExceptionEnum;
+import com.qmth.themis.business.enums.VerifyExceptionEnum;
 
 
 /**人脸验证记录
 /**人脸验证记录
  * @Description: 
  * @Description: 
@@ -46,7 +46,7 @@ public class FaceVerifyCacheBean implements Serializable {
     private Integer faceCount;
     private Integer faceCount;
 
 
     //异常类型
     //异常类型
-    private FaceVerifyExceptionEnum exception;
+    private VerifyExceptionEnum exception;
     
     
     //验证时间戳
     //验证时间戳
     private Long time;
     private Long time;
@@ -123,11 +123,11 @@ public class FaceVerifyCacheBean implements Serializable {
 		this.faceCount = faceCount;
 		this.faceCount = faceCount;
 	}
 	}
 
 
-	public FaceVerifyExceptionEnum getException() {
+	public VerifyExceptionEnum getException() {
 		return exception;
 		return exception;
 	}
 	}
 
 
-	public void setException(FaceVerifyExceptionEnum exception) {
+	public void setException(VerifyExceptionEnum exception) {
 		this.exception = exception;
 		this.exception = exception;
 	}
 	}
 
 

+ 11 - 9
themis-business/src/main/java/com/qmth/themis/business/cache/bean/LivenessVerifyCacheBean.java

@@ -4,6 +4,7 @@ import java.io.Serializable;
 import java.util.Date;
 import java.util.Date;
 
 
 import com.qmth.themis.business.enums.LivenessTypeEnum;
 import com.qmth.themis.business.enums.LivenessTypeEnum;
+import com.qmth.themis.business.enums.VerifyExceptionEnum;
 
 
 /**活体验证记录
 /**活体验证记录
  * @Description: 
  * @Description: 
@@ -31,8 +32,8 @@ public class LivenessVerifyCacheBean implements Serializable {
     //重试次数
     //重试次数
     private Integer retry;
     private Integer retry;
 
 
-    //本地验证是否通过,0:不通过,1:通过
-    private Integer pass;
+    //验证异常
+    private VerifyExceptionEnum exception;
 
 
     //开始时间
     //开始时间
     private Date startTime;
     private Date startTime;
@@ -84,15 +85,16 @@ public class LivenessVerifyCacheBean implements Serializable {
         this.retry = retry;
         this.retry = retry;
     }
     }
 
 
-    public Integer getPass() {
-        return pass;
-    }
 
 
-    public void setPass(Integer pass) {
-        this.pass = pass;
-    }
+    public VerifyExceptionEnum getException() {
+		return exception;
+	}
+
+	public void setException(VerifyExceptionEnum exception) {
+		this.exception = exception;
+	}
 
 
-    public Date getStartTime() {
+	public Date getStartTime() {
         return startTime;
         return startTime;
     }
     }
 
 

+ 4 - 4
themis-business/src/main/java/com/qmth/themis/business/entity/TOeFaceVerifyHistory.java

@@ -7,7 +7,7 @@ import com.baomidou.mybatisplus.annotation.FieldFill;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.qmth.themis.business.enums.ExamTypeEnum;
 import com.qmth.themis.business.enums.ExamTypeEnum;
-import com.qmth.themis.business.enums.FaceVerifyExceptionEnum;
+import com.qmth.themis.business.enums.VerifyExceptionEnum;
 
 
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import io.swagger.annotations.ApiModelProperty;
@@ -61,7 +61,7 @@ public class TOeFaceVerifyHistory implements Serializable {
     
     
     @ApiModelProperty(value = "异常类型")
     @ApiModelProperty(value = "异常类型")
     @TableField(value = "exception")
     @TableField(value = "exception")
-    private FaceVerifyExceptionEnum exception;
+    private VerifyExceptionEnum exception;
 
 
     @ApiModelProperty(value = "图片保存路径")
     @ApiModelProperty(value = "图片保存路径")
     @TableField(value = "photo_url")
     @TableField(value = "photo_url")
@@ -135,11 +135,11 @@ public class TOeFaceVerifyHistory implements Serializable {
 		this.type = type;
 		this.type = type;
 	}
 	}
 
 
-	public FaceVerifyExceptionEnum getException() {
+	public VerifyExceptionEnum getException() {
 		return exception;
 		return exception;
 	}
 	}
 
 
-	public void setException(FaceVerifyExceptionEnum exception) {
+	public void setException(VerifyExceptionEnum exception) {
 		this.exception = exception;
 		this.exception = exception;
 	}
 	}
 
 

+ 12 - 10
themis-business/src/main/java/com/qmth/themis/business/entity/TOeLivenessVerifyHistory.java

@@ -6,6 +6,7 @@ import java.util.Date;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.qmth.themis.business.enums.LivenessTypeEnum;
 import com.qmth.themis.business.enums.LivenessTypeEnum;
+import com.qmth.themis.business.enums.VerifyExceptionEnum;
 
 
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import io.swagger.annotations.ApiModelProperty;
@@ -41,9 +42,9 @@ public class TOeLivenessVerifyHistory implements Serializable {
     @TableField(value = "retry")
     @TableField(value = "retry")
     private Integer retry;
     private Integer retry;
 
 
-    @ApiModelProperty(value = "本地验证是否通过,0:不通过,1:通过")
-    @TableField(value = "pass")
-    private Integer pass;
+    @ApiModelProperty(value = "异常类型")
+    @TableField(value = "exception")
+    private VerifyExceptionEnum exception;
 
 
     @ApiModelProperty(value = "开始时间")
     @ApiModelProperty(value = "开始时间")
     @TableField(value = "start_time")
     @TableField(value = "start_time")
@@ -97,15 +98,16 @@ public class TOeLivenessVerifyHistory implements Serializable {
         this.retry = retry;
         this.retry = retry;
     }
     }
 
 
-    public Integer getPass() {
-        return pass;
-    }
 
 
-    public void setPass(Integer pass) {
-        this.pass = pass;
-    }
+    public VerifyExceptionEnum getException() {
+		return exception;
+	}
+
+	public void setException(VerifyExceptionEnum exception) {
+		this.exception = exception;
+	}
 
 
-    public Date getStartTime() {
+	public Date getStartTime() {
         return startTime;
         return startTime;
     }
     }
 
 

+ 5 - 4
themis-business/src/main/java/com/qmth/themis/business/enums/FaceVerifyExceptionEnum.java → themis-business/src/main/java/com/qmth/themis/business/enums/VerifyExceptionEnum.java

@@ -1,21 +1,22 @@
 package com.qmth.themis.business.enums;
 package com.qmth.themis.business.enums;
 
 
 /**
 /**
- * 人脸验证异常
+ * 人脸、活检验证异常
  * 
  * 
  * @Description:
  * @Description:
  * @Author: xiatian
  * @Author: xiatian
  * @Date: 2020-07-31
  * @Date: 2020-07-31
  */
  */
-public enum FaceVerifyExceptionEnum {
+public enum VerifyExceptionEnum {
 
 
 	NONE("无异常"),
 	NONE("无异常"),
 
 
-	FACE_COUNT_ERROR("人脸数量异常"), FACE_COMPARE_ERROR("人脸比对异常"), EYE_CLOSE_ERROR("闭眼检测异常"), ACE_COUNT_ERROR("恢复开考");
+	FACE_COUNT_ERROR("人脸数量异常"), FACE_COMPARE_ERROR("人脸比对异常"), EYE_CLOSE_ERROR("闭眼检测异常"),
+	LIVENESS_ACTION_ERROR("活检动作错误");
 
 
 	private String title;
 	private String title;
 
 
-	private FaceVerifyExceptionEnum(String title) {
+	private VerifyExceptionEnum(String title) {
 		this.title = title;
 		this.title = title;
 	}
 	}
 
 

+ 8 - 0
themis-business/src/main/java/com/qmth/themis/business/service/TOeExamBreakHistoryService.java

@@ -2,6 +2,7 @@ package com.qmth.themis.business.service;
 
 
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.qmth.themis.business.entity.TOeExamBreakHistory;
 import com.qmth.themis.business.entity.TOeExamBreakHistory;
+import com.qmth.themis.business.enums.VerifyExceptionEnum;
 
 
 /**
 /**
  * @Description: 考试断点记录 服务类
  * @Description: 考试断点记录 服务类
@@ -12,4 +13,11 @@ import com.qmth.themis.business.entity.TOeExamBreakHistory;
  */
  */
 public interface TOeExamBreakHistoryService extends IService<TOeExamBreakHistory> {
 public interface TOeExamBreakHistoryService extends IService<TOeExamBreakHistory> {
 
 
+	/**保存验证信息
+	 * @param recordId
+	 * @param entryAuthenticationId
+	 * @param entryAuthenticationResult
+	 */
+	void saveAuthenticationResult(Long recordId, Long entryAuthenticationId, VerifyExceptionEnum entryAuthenticationResult);
+
 }
 }

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

@@ -14,10 +14,10 @@ import com.qmth.themis.business.entity.TOeLivenessVerifyHistory;
 public interface TOeLivenessVerifyHistoryService extends IService<TOeLivenessVerifyHistory> {
 public interface TOeLivenessVerifyHistoryService extends IService<TOeLivenessVerifyHistory> {
 
 
 	LivenessVerifyBean verify(Long recordId, String type, String actions, Integer retry, Long startTime,
 	LivenessVerifyBean verify(Long recordId, String type, String actions, Integer retry, Long startTime,
-			Long finishTime, Boolean pass);
+			Long finishTime, String exception);
 
 
 
 
 	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,
-			Boolean pass);
+			String exception);
 
 
 }
 }

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

@@ -1,10 +1,15 @@
 package com.qmth.themis.business.service.impl;
 package com.qmth.themis.business.service.impl;
 
 
+import org.springframework.stereotype.Service;
+
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.qmth.themis.business.cache.ExamBreakCacheUtil;
+import com.qmth.themis.business.cache.ExamRecordCacheUtil;
 import com.qmth.themis.business.dao.TOeExamBreakHistoryMapper;
 import com.qmth.themis.business.dao.TOeExamBreakHistoryMapper;
 import com.qmth.themis.business.entity.TOeExamBreakHistory;
 import com.qmth.themis.business.entity.TOeExamBreakHistory;
+import com.qmth.themis.business.enums.VerifyExceptionEnum;
 import com.qmth.themis.business.service.TOeExamBreakHistoryService;
 import com.qmth.themis.business.service.TOeExamBreakHistoryService;
-import org.springframework.stereotype.Service;
+import com.qmth.themis.common.exception.BusinessException;
 
 
 /**
 /**
  * @Description: 考试断点记录 服务实现类
  * @Description: 考试断点记录 服务实现类
@@ -15,5 +20,22 @@ import org.springframework.stereotype.Service;
  */
  */
 @Service
 @Service
 public class TOeExamBreakHistoryServiceImpl extends ServiceImpl<TOeExamBreakHistoryMapper, TOeExamBreakHistory> implements TOeExamBreakHistoryService {
 public class TOeExamBreakHistoryServiceImpl extends ServiceImpl<TOeExamBreakHistoryMapper, TOeExamBreakHistory> implements TOeExamBreakHistoryService {
-
+	
+	/**保存验证信息
+	 * @param recordId
+	 * @param entryAuthenticationId
+	 * @param entryAuthenticationResult
+	 */
+	@Override
+	public void saveAuthenticationResult(Long recordId,Long entryAuthenticationId,VerifyExceptionEnum entryAuthenticationResult) {
+		Long examBreakId=ExamRecordCacheUtil.getLastBreakId(recordId);
+		if(examBreakId==null) {
+			throw new BusinessException("未找到断点ID");
+		}
+		if(ExamBreakCacheUtil.getExamRecordId(examBreakId)==null) {
+			throw new BusinessException("未找到断点信息");
+		}
+		ExamBreakCacheUtil.setEntryAuthenticationId(examBreakId, entryAuthenticationId); 
+		ExamBreakCacheUtil.setEntryAuthenticationResult(examBreakId, entryAuthenticationResult);
+	}
 }
 }

+ 10 - 3
themis-business/src/main/java/com/qmth/themis/business/service/impl/TOeFaceVerifyHistoryServiceImpl.java

@@ -14,7 +14,8 @@ import com.qmth.themis.business.cache.bean.FaceVerifyCacheBean;
 import com.qmth.themis.business.dao.TOeFaceVerifyHistoryMapper;
 import com.qmth.themis.business.dao.TOeFaceVerifyHistoryMapper;
 import com.qmth.themis.business.entity.TOeFaceVerifyHistory;
 import com.qmth.themis.business.entity.TOeFaceVerifyHistory;
 import com.qmth.themis.business.enums.ExamTypeEnum;
 import com.qmth.themis.business.enums.ExamTypeEnum;
-import com.qmth.themis.business.enums.FaceVerifyExceptionEnum;
+import com.qmth.themis.business.enums.VerifyExceptionEnum;
+import com.qmth.themis.business.service.TOeExamBreakHistoryService;
 import com.qmth.themis.business.service.TOeFaceVerifyHistoryService;
 import com.qmth.themis.business.service.TOeFaceVerifyHistoryService;
 import com.qmth.themis.business.util.RedisUtil;
 import com.qmth.themis.business.util.RedisUtil;
 import com.qmth.themis.common.contanst.Constants;
 import com.qmth.themis.common.contanst.Constants;
@@ -33,6 +34,9 @@ public class TOeFaceVerifyHistoryServiceImpl extends ServiceImpl<TOeFaceVerifyHi
 	@Resource
 	@Resource
 	RedisUtil redisUtil;
 	RedisUtil redisUtil;
 	
 	
+	@Resource
+	TOeExamBreakHistoryService examBreakHistoryService;
+	
 	@Override
 	@Override
 	public FaceVerifyBean verify(Long recordId, String type, String photoUrl, Integer faceCount, Double similarity,
 	public FaceVerifyBean verify(Long recordId, String type, String photoUrl, Integer faceCount, Double similarity,
 			Double realness, Long time, String exception) {
 			Double realness, Long time, String exception) {
@@ -40,7 +44,7 @@ public class TOeFaceVerifyHistoryServiceImpl extends ServiceImpl<TOeFaceVerifyHi
 		cache.setId(Constants.idGen.next());
 		cache.setId(Constants.idGen.next());
 		cache.setExamRecordId(recordId);
 		cache.setExamRecordId(recordId);
 		cache.setFaceCount(faceCount);
 		cache.setFaceCount(faceCount);
-		cache.setException(FaceVerifyExceptionEnum.valueOf(exception));
+		cache.setException(VerifyExceptionEnum.valueOf(exception));
 		cache.setPhotoUrl(photoUrl);
 		cache.setPhotoUrl(photoUrl);
 		cache.setRealness(realness);
 		cache.setRealness(realness);
 		cache.setSimilarity(similarity);
 		cache.setSimilarity(similarity);
@@ -50,6 +54,9 @@ public class TOeFaceVerifyHistoryServiceImpl extends ServiceImpl<TOeFaceVerifyHi
 		FaceVerifyBean ret=new FaceVerifyBean();
 		FaceVerifyBean ret=new FaceVerifyBean();
 		ret.setId(cache.getId());
 		ret.setId(cache.getId());
 		ret.setUpdateTime(new Date().getTime());
 		ret.setUpdateTime(new Date().getTime());
+		if(ExamTypeEnum.RECOVER.equals(cache.getType())) {
+			examBreakHistoryService.saveAuthenticationResult(recordId, cache.getId(), cache.getException());
+		}
 		return ret;
 		return ret;
 	}
 	}
 
 
@@ -61,7 +68,7 @@ public class TOeFaceVerifyHistoryServiceImpl extends ServiceImpl<TOeFaceVerifyHi
 		entity.setId(id);
 		entity.setId(id);
 		entity.setExamRecordId(recordId);
 		entity.setExamRecordId(recordId);
 		entity.setFaceCount(faceCount);
 		entity.setFaceCount(faceCount);
-		entity.setException(FaceVerifyExceptionEnum.valueOf(exception));
+		entity.setException(VerifyExceptionEnum.valueOf(exception));
 		entity.setPhotoUrl(photoUrl);
 		entity.setPhotoUrl(photoUrl);
 		entity.setRealness(realness);
 		entity.setRealness(realness);
 		entity.setSimilarity(similarity);
 		entity.setSimilarity(similarity);

+ 14 - 3
themis-business/src/main/java/com/qmth/themis/business/service/impl/TOeLivenessVerifyHistoryServiceImpl.java

@@ -14,6 +14,8 @@ import com.qmth.themis.business.cache.bean.LivenessVerifyCacheBean;
 import com.qmth.themis.business.dao.TOeLivenessVerifyHistoryMapper;
 import com.qmth.themis.business.dao.TOeLivenessVerifyHistoryMapper;
 import com.qmth.themis.business.entity.TOeLivenessVerifyHistory;
 import com.qmth.themis.business.entity.TOeLivenessVerifyHistory;
 import com.qmth.themis.business.enums.LivenessTypeEnum;
 import com.qmth.themis.business.enums.LivenessTypeEnum;
+import com.qmth.themis.business.enums.VerifyExceptionEnum;
+import com.qmth.themis.business.service.TOeExamBreakHistoryService;
 import com.qmth.themis.business.service.TOeLivenessVerifyHistoryService;
 import com.qmth.themis.business.service.TOeLivenessVerifyHistoryService;
 import com.qmth.themis.business.util.RedisUtil;
 import com.qmth.themis.business.util.RedisUtil;
 import com.qmth.themis.common.contanst.Constants;
 import com.qmth.themis.common.contanst.Constants;
@@ -31,9 +33,13 @@ public class TOeLivenessVerifyHistoryServiceImpl extends ServiceImpl<TOeLiveness
 	@Resource
 	@Resource
 	RedisUtil redisUtil;
 	RedisUtil redisUtil;
 	
 	
+	@Resource
+	TOeExamBreakHistoryService examBreakHistoryService;
+	
+	
 	@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, Boolean pass) {
+			Long finishTime, String exception) {
 		LivenessVerifyCacheBean cache=new LivenessVerifyCacheBean();
 		LivenessVerifyCacheBean cache=new LivenessVerifyCacheBean();
 		cache.setId(Constants.idGen.next());
 		cache.setId(Constants.idGen.next());
 		cache.setExamRecordId(recordId);
 		cache.setExamRecordId(recordId);
@@ -42,11 +48,14 @@ public class TOeLivenessVerifyHistoryServiceImpl extends ServiceImpl<TOeLiveness
 		cache.setRetry(retry);
 		cache.setRetry(retry);
 		cache.setStartTime(new Date(startTime));
 		cache.setStartTime(new Date(startTime));
 		cache.setFinishTime(new Date(finishTime));
 		cache.setFinishTime(new Date(finishTime));
-		cache.setPass((pass?1:0));
+		cache.setException(VerifyExceptionEnum.valueOf(exception));
 		redisUtil.set(RedisKeyHelper.livenessVerifyCacheKey(cache.getId()), cache);
 		redisUtil.set(RedisKeyHelper.livenessVerifyCacheKey(cache.getId()), cache);
 		LivenessVerifyBean ret=new LivenessVerifyBean();
 		LivenessVerifyBean ret=new LivenessVerifyBean();
 		ret.setId(cache.getId());
 		ret.setId(cache.getId());
 		ret.setUpdateTime(new Date().getTime());
 		ret.setUpdateTime(new Date().getTime());
+		if(LivenessTypeEnum.RESUME_START.equals(cache.getType())) {
+			examBreakHistoryService.saveAuthenticationResult(recordId, cache.getId(), cache.getException());
+		}
 		return ret;
 		return ret;
 	}
 	}
 	
 	
@@ -54,7 +63,7 @@ public class TOeLivenessVerifyHistoryServiceImpl extends ServiceImpl<TOeLiveness
 	@Transactional
 	@Transactional
 	@Override
 	@Override
 	public void save(Long id,Long recordId, String type, String actions, Integer retry, Long startTime,
 	public void save(Long id,Long recordId, String type, String actions, Integer retry, Long startTime,
-			Long finishTime, Boolean pass) {
+			Long finishTime, String exception) {
 		TOeLivenessVerifyHistory entity=new TOeLivenessVerifyHistory();
 		TOeLivenessVerifyHistory entity=new TOeLivenessVerifyHistory();
 		entity.setId(id);
 		entity.setId(id);
 		entity.setExamRecordId(recordId);
 		entity.setExamRecordId(recordId);
@@ -63,7 +72,9 @@ public class TOeLivenessVerifyHistoryServiceImpl extends ServiceImpl<TOeLiveness
 		entity.setRetry(retry);
 		entity.setRetry(retry);
 		entity.setStartTime(new Date(startTime));
 		entity.setStartTime(new Date(startTime));
 		entity.setFinishTime(new Date(finishTime));
 		entity.setFinishTime(new Date(finishTime));
+		entity.setException(VerifyExceptionEnum.valueOf(exception));
 		saveOrUpdate(entity);
 		saveOrUpdate(entity);
 	}
 	}
+	
 
 
 }
 }

+ 1 - 1
themis-business/src/main/resources/db/init.sql

@@ -1318,9 +1318,9 @@ CREATE TABLE `t_oe_liveness_verify_history` (
   `type` varchar(30) NOT NULL COMMENT 'first:初次开考,recover:恢复开考,process:过程中',
   `type` varchar(30) NOT NULL COMMENT 'first:初次开考,recover:恢复开考,process:过程中',
   `actions` varchar(2000) DEFAULT NULL COMMENT '随机动作与结果',
   `actions` varchar(2000) DEFAULT NULL COMMENT '随机动作与结果',
   `retry` int DEFAULT NULL COMMENT '重试次数',
   `retry` int DEFAULT NULL COMMENT '重试次数',
-  `pass` tinyint DEFAULT NULL COMMENT '本地验证是否通过,0:不通过,1:通过',
   `start_time` datetime DEFAULT NULL COMMENT '开始时间',
   `start_time` datetime DEFAULT NULL COMMENT '开始时间',
   `finish_time` datetime DEFAULT NULL COMMENT '完成时间',
   `finish_time` datetime DEFAULT NULL COMMENT '完成时间',
+  `exception` varchar(30) DEFAULT NULL COMMENT '异常类型',
   PRIMARY KEY (`id`)
   PRIMARY KEY (`id`)
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='活体验证记录';
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='活体验证记录';
 
 

+ 3 - 3
themis-exam/src/main/java/com/qmth/themis/exam/api/TELivenessController.java

@@ -55,9 +55,9 @@ public class TELivenessController {
 			@ApiParam(value = "整体第几次重试", required = true) @RequestParam Integer retry,
 			@ApiParam(value = "整体第几次重试", required = true) @RequestParam Integer retry,
 			@ApiParam(value = "验证开始时间", required = true) @RequestParam Long startTime,
 			@ApiParam(value = "验证开始时间", required = true) @RequestParam Long startTime,
 			@ApiParam(value = "验证结束时间", required = true) @RequestParam Long finishTime,
 			@ApiParam(value = "验证结束时间", required = true) @RequestParam Long finishTime,
-			@ApiParam(value = "本地验证是否通过", required = true) @RequestParam Boolean pass) {
+			@ApiParam(value = "验证异常", required = true) @RequestParam String exception) {
 		LivenessVerifyBean ret = livenessVerifyHistoryService.verify(recordId, type, actions, retry, startTime,
 		LivenessVerifyBean ret = livenessVerifyHistoryService.verify(recordId, type, actions, retry, startTime,
-				finishTime, pass);
+				finishTime, exception);
 		Map<String, Object> transMap = new HashMap<String, Object>();
 		Map<String, Object> transMap = new HashMap<String, Object>();
 		transMap.put("id", ret.getId());
 		transMap.put("id", ret.getId());
 		transMap.put("recordId", recordId);
 		transMap.put("recordId", recordId);
@@ -66,7 +66,7 @@ public class TELivenessController {
 		transMap.put("retry", retry);
 		transMap.put("retry", retry);
 		transMap.put("startTime", startTime);
 		transMap.put("startTime", startTime);
 		transMap.put("finishTime", finishTime);
 		transMap.put("finishTime", finishTime);
-		transMap.put("pass", pass);
+		transMap.put("exception", exception);
 		// mq发送消息start
 		// mq发送消息start
 		MqDto mqDto = new MqDto(MqTopicEnum.themisTopic.getCode(), MqTagEnum.livenessVerifySave.name(), transMap,
 		MqDto mqDto = new MqDto(MqTopicEnum.themisTopic.getCode(), MqTagEnum.livenessVerifySave.name(), transMap,
 				MqEnum.EXAM, null, null);
 				MqEnum.EXAM, null, null);

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

@@ -298,8 +298,8 @@ public class MqLogicServiceImpl implements MqLogicService {
         Integer retry = (Integer) param.get("retry");
         Integer retry = (Integer) param.get("retry");
         Long startTime = (Long) param.get("startTime");
         Long startTime = (Long) param.get("startTime");
         Long finishTime = (Long) param.get("finishTime");
         Long finishTime = (Long) param.get("finishTime");
-        Boolean pass = (Boolean) param.get("pass");
-        livenessVerifyHistoryService.save(id, recordId, type, actions, retry, startTime, finishTime, pass);
+        String exception = (String) param.get("exception");
+        livenessVerifyHistoryService.save(id, recordId, type, actions, retry, startTime, finishTime, exception);
         mqDto.setAck(SystemConstant.STANDARD_ACK_TYPE);
         mqDto.setAck(SystemConstant.STANDARD_ACK_TYPE);
         TMRocketMessage tmRocketMessage = gson.fromJson(gson.toJson(mqDto), TMRocketMessage.class);
         TMRocketMessage tmRocketMessage = gson.fromJson(gson.toJson(mqDto), TMRocketMessage.class);
         tmRocketMessage.setBody(JacksonUtil.parseJson(tmRocketMessage.getBody()));
         tmRocketMessage.setBody(JacksonUtil.parseJson(tmRocketMessage.getBody()));