Преглед изворни кода

update getFaceVerifyDisciplineDetail

deason пре 3 година
родитељ
комит
f512d5ab25

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

@@ -5,7 +5,11 @@ import org.springframework.data.jpa.repository.JpaRepository;
 import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
 import org.springframework.stereotype.Repository;
 
+import java.util.List;
+
 @Repository
 public interface ExamFaceLiveVerifyRepo extends JpaRepository<ExamFaceLiveVerifyEntity, Long>, JpaSpecificationExecutor<ExamFaceLiveVerifyEntity> {
 
+    List<ExamFaceLiveVerifyEntity> findByExamRecordDataId(Long examRecordDataId);
+
 }

+ 25 - 7
examcloud-core-oe-admin-service/src/main/java/cn/com/qmth/examcloud/core/oe/admin/service/impl/ExamAuditServiceImpl.java

@@ -39,6 +39,7 @@ import org.springframework.data.domain.Pageable;
 import org.springframework.data.jpa.domain.Specification;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.CollectionUtils;
 
 import javax.persistence.EntityManager;
 import javax.persistence.Query;
@@ -98,6 +99,9 @@ public class ExamAuditServiceImpl implements ExamAuditService {
     @Autowired
     private FaceBiopsyItemRepo faceBiopsyItemRepo;
 
+    @Autowired
+    private ExamFaceLiveVerifyRepo examFaceLiveVerifyRepo;
+
     @Autowired
     private ExamStudentFinalScoreService examStudentFinalScoreService;
 
@@ -522,13 +526,28 @@ public class ExamAuditServiceImpl implements ExamAuditService {
     //获取活检违纪详情
     private String getFaceVerifyDisciplineDetail(Long examRecordDataId, Long rootOrgId) {
         FaceBiopsyScheme faceBiopsyScheme = FaceBiopsyHelper.getFaceBiopsyScheme(rootOrgId);
+        if (FaceBiopsyScheme.FACE_CLIENT == faceBiopsyScheme) {
+            // C端活体检测方案
+            List<ExamFaceLiveVerifyEntity> entities = examFaceLiveVerifyRepo.findByExamRecordDataId(examRecordDataId);
+            if (CollectionUtils.isEmpty(entities)) {
+                return "未进行人脸活体检测";
+            }
 
-        //新活体检测方案从新表中取相关数据
-        if (faceBiopsyScheme == FaceBiopsyScheme.FACE_MOTION) {
+            StringBuilder result = new StringBuilder();
+            for (ExamFaceLiveVerifyEntity entity : entities) {
+                result.append(CommonUtil.getDateStrWithSecond(entity.getCreationTime()))
+                        .append(":")
+                        .append(entity.getStatus().getDescription())
+                        .append("&&");
+            }
+
+            return result.toString();
+        } else if (faceBiopsyScheme == FaceBiopsyScheme.FACE_MOTION) {
+            // Electron Client 自研活体检测方案
             List<FaceBiopsyItemEntity> faceBiopsyItems = faceBiopsyItemRepo.findByExamRecordDataIdOrderByIdAsc(examRecordDataId);
+
             //从未调过人脸检测接口,或者只调过接口但是未保存过结果(即未完成活检),则提示未进行人脸活体检测
-            if (faceBiopsyItems == null ||
-                    (faceBiopsyItems.size() == 1 && !faceBiopsyItems.get(0).getCompleted())) {
+            if (faceBiopsyItems == null || (faceBiopsyItems.size() == 1 && !faceBiopsyItems.get(0).getCompleted())) {
                 return "未进行人脸活体检测";
             }
 
@@ -549,9 +568,8 @@ public class ExamAuditServiceImpl implements ExamAuditService {
                 sbBuffer.append("&&");
             }
             return sbBuffer.toString();
-        }
-        //旧活体检测方案从旧表中取相关数据
-        else {
+        } else {
+            // FaceID活体检测方案
             List<ExamFaceLivenessVerifyEntity> faceVerifies =
                     examFaceLivenessVerifyRepo.findByExamRecordDataIdOrderById(examRecordDataId);
             if (faceVerifies == null || faceVerifies.size() == 0) {