Browse Source

update syncExamData rpc api

deason 3 years ago
parent
commit
099c7117ee

+ 28 - 0
examcloud-core-oe-admin-api-provider/src/main/java/cn/com/qmth/examcloud/core/oe/admin/api/provider/SyncExamDataCloudServiceProvider.java

@@ -29,6 +29,7 @@ import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.domain.Example;
 import org.springframework.data.domain.Example;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.CollectionUtils;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -91,6 +92,9 @@ public class SyncExamDataCloudServiceProvider extends ControllerSupport implemen
     @Autowired
     @Autowired
     private FaceBiopsyItemStepRepo faceBiopsyItemStepRepo;
     private FaceBiopsyItemStepRepo faceBiopsyItemStepRepo;
 
 
+    @Autowired
+    private ExamFaceLiveVerifyRepo examFaceLiveVerifyRepo;
+
     @Autowired
     @Autowired
     private ExamAuditService examAuditService;
     private ExamAuditService examAuditService;
 
 
@@ -230,6 +234,9 @@ public class SyncExamDataCloudServiceProvider extends ControllerSupport implemen
             syncFaceBiopsy(req.getFaceBiopsy(), realExamRecordDataId);
             syncFaceBiopsy(req.getFaceBiopsy(), realExamRecordDataId);
         }
         }
 
 
+        //同步C端活体检测记录
+        syncFaceLiveVerifyRecords(req.getFaceLiveVerifyRecords(), realExamRecordDataId);
+
         startTime = this.debugCost("10 同步face id活体检测数据", transitionExamRecordDataId, startTime);
         startTime = this.debugCost("10 同步face id活体检测数据", transitionExamRecordDataId, startTime);
 
 
         //同步考试记录对应的试卷结构
         //同步考试记录对应的试卷结构
@@ -584,6 +591,27 @@ public class SyncExamDataCloudServiceProvider extends ControllerSupport implemen
         }
         }
     }
     }
 
 
+    private void syncFaceLiveVerifyRecords(List<FaceLiveVerifyBean> faceLiveVerifyRecords, Long examRecordDataId) {
+        if (CollectionUtils.isEmpty(faceLiveVerifyRecords)) {
+            return;
+        }
+
+        for (FaceLiveVerifyBean bean : faceLiveVerifyRecords) {
+            ExamFaceLiveVerifyEntity entity = new ExamFaceLiveVerifyEntity();
+
+            entity.setExamRecordDataId(examRecordDataId);
+            entity.setStatus(FaceLiveVerifyStatus.valueOf(bean.getStatus()));
+            entity.setFaceCount(bean.getFaceCount());
+            entity.setSimilarity(bean.getSimilarity());
+            entity.setRealness(bean.getRealness());
+            entity.setErrorMsg(bean.getErrorMsg());
+            entity.setProcessTime(bean.getProcessTime());
+            entity.setActions(bean.getActions());
+
+            examFaceLiveVerifyRepo.save(entity);
+        }
+    }
+
     private FaceBiopsyEntity copyFaceBiopsyFrom(FaceBiopsyBean bean, Long examRecordDataId) {
     private FaceBiopsyEntity copyFaceBiopsyFrom(FaceBiopsyBean bean, Long examRecordDataId) {
         FaceBiopsyEntity entity = new FaceBiopsyEntity();
         FaceBiopsyEntity entity = new FaceBiopsyEntity();
         entity.setRootOrgId(bean.getRootOrgId());
         entity.setRootOrgId(bean.getRootOrgId());

+ 11 - 0
examcloud-core-oe-admin-dao/src/main/java/cn/com/qmth/examcloud/core/oe/admin/dao/ExamFaceLiveVerifyRepo.java

@@ -0,0 +1,11 @@
+package cn.com.qmth.examcloud.core.oe.admin.dao;
+
+import cn.com.qmth.examcloud.core.oe.admin.dao.entity.ExamFaceLiveVerifyEntity;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+import org.springframework.stereotype.Repository;
+
+@Repository
+public interface ExamFaceLiveVerifyRepo extends JpaRepository<ExamFaceLiveVerifyEntity, Long>, JpaSpecificationExecutor<ExamFaceLiveVerifyEntity> {
+
+}

+ 141 - 0
examcloud-core-oe-admin-dao/src/main/java/cn/com/qmth/examcloud/core/oe/admin/dao/entity/ExamFaceLiveVerifyEntity.java

@@ -0,0 +1,141 @@
+package cn.com.qmth.examcloud.core.oe.admin.dao.entity;
+
+import cn.com.qmth.examcloud.core.oe.admin.dao.enums.FaceLiveVerifyStatus;
+import cn.com.qmth.examcloud.web.jpa.JpaEntity;
+
+import javax.persistence.*;
+
+/**
+ * 人脸活体验证结果表(支持C端客户端活检)
+ */
+@Entity
+@Table(name = "ec_oe_exam_face_live_verify", indexes = {
+        @Index(name = "IDX_OE_FLV_01", columnList = "examRecordDataId"),
+        @Index(name = "IDX_OE_FLV_02", columnList = "status")
+})
+public class ExamFaceLiveVerifyEntity extends JpaEntity {
+
+    private static final long serialVersionUID = -3428631813990503829L;
+
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    private Long id;
+
+    /**
+     * 考试记录ID
+     */
+    @Column(nullable = false)
+    private Long examRecordDataId;
+
+    /**
+     * 验证状态
+     */
+    @Enumerated(EnumType.STRING)
+    @Column(length = 50, nullable = false)
+    private FaceLiveVerifyStatus status;
+
+    /**
+     * 动作验证列表,JSON格式
+     */
+    @Column(length = 2000)
+    private String actions;
+
+    /**
+     * 人脸数量
+     */
+    private Integer faceCount;
+
+    /**
+     * 相似度分数
+     */
+    private Double similarity;
+
+    /**
+     * 真实性分数
+     */
+    private Double realness;
+
+    /**
+     * 处理耗时(毫秒)
+     */
+    private Long processTime;
+
+    /**
+     * 错误信息
+     */
+    @Column(length = 500)
+    private String errorMsg;
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public Long getExamRecordDataId() {
+        return examRecordDataId;
+    }
+
+    public void setExamRecordDataId(Long examRecordDataId) {
+        this.examRecordDataId = examRecordDataId;
+    }
+
+    public FaceLiveVerifyStatus getStatus() {
+        return status;
+    }
+
+    public void setStatus(FaceLiveVerifyStatus status) {
+        this.status = status;
+    }
+
+    public String getActions() {
+        return actions;
+    }
+
+    public void setActions(String actions) {
+        this.actions = actions;
+    }
+
+    public Integer getFaceCount() {
+        return faceCount;
+    }
+
+    public void setFaceCount(Integer faceCount) {
+        this.faceCount = faceCount;
+    }
+
+    public Double getSimilarity() {
+        return similarity;
+    }
+
+    public void setSimilarity(Double similarity) {
+        this.similarity = similarity;
+    }
+
+    public Double getRealness() {
+        return realness;
+    }
+
+    public void setRealness(Double realness) {
+        this.realness = realness;
+    }
+
+    public Long getProcessTime() {
+        return processTime;
+    }
+
+    public void setProcessTime(Long processTime) {
+        this.processTime = processTime;
+    }
+
+    public String getErrorMsg() {
+        return errorMsg;
+    }
+
+    public void setErrorMsg(String errorMsg) {
+        this.errorMsg = errorMsg;
+    }
+
+}

+ 28 - 0
examcloud-core-oe-admin-dao/src/main/java/cn/com/qmth/examcloud/core/oe/admin/dao/enums/FaceLiveVerifyStatus.java

@@ -0,0 +1,28 @@
+package cn.com.qmth.examcloud.core.oe.admin.dao.enums;
+
+/**
+ * 人脸活体验证状态
+ */
+public enum FaceLiveVerifyStatus {
+
+    SUCCESS("验证成功"),
+
+    ACTION_FAILED("动作有误,验证失败"),
+
+    NOT_ONESELF("不是本人"),
+
+    TIME_OUT("超时未完成"),
+
+    ERROR("验证异常");
+
+    private String description;
+
+    FaceLiveVerifyStatus(String description) {
+        this.description = description;
+    }
+
+    public String getDescription() {
+        return description;
+    }
+
+}