tongfeng 2 rokov pred
rodič
commit
ffce9b194d

+ 1 - 1
eladmin-system/src/main/java/me/zhengjie/application/admin/service/impl/AdminOrderServiceImpl.java

@@ -407,7 +407,7 @@ public class AdminOrderServiceImpl implements AdminOrderService {
         }
         String format = DateFormatUtils.format(new Date());
         qw.between("create_time",format+" 00:00:00",format+" 23:59:59");
-
+        qw.orderByDesc("create_time");
         List<FaceCompareRsp> faceCompareRspList = thirdPartyInterfaceRepository.page(page,qw);
 
         response.setData(new AppResultData<List<FaceCompareRsp>>(faceCompareRspList,new me.zhengjie.base.Page(req.getIndex(), req.getSize(), (int) page.getTotal())));

+ 40 - 3
eladmin-system/src/main/java/me/zhengjie/domain/notary/impl/NotaryDomainImpl.java

@@ -320,7 +320,7 @@ public class NotaryDomainImpl implements NotaryDomain {
      * @param count      redis当中的次数
      * @return
      */
-    public boolean compareImage(File base, Integer id, String redisCount, Integer count) {
+    public ResultCode compareImage(File base, Integer id, String redisCount, Integer count) {
         //从官网获取
         FaceEngine faceEngine = new FaceEngine(LIBPATH);
         //激活引擎
@@ -378,8 +378,45 @@ public class NotaryDomainImpl implements NotaryDomain {
         if (pitch >= 10 || yaw >= 10) {
             //照片不符合标准
             log.info("图片不符合标准");
+
+            new Thread(new Runnable() {
+                @Override
+                public void run() {
+                    String imgStr = Img2Base64Util.getImgStr(base.getPath());
+                    uploadFile(imgStr);
+                    System.err.println(imgStr);
+                }
+            }).start();
+
+            return ResultCode.IMAGE_NOT_STANDARD;
+        }
+        //活体检测
+        /*List<LivenessInfo> livenessInfoList = new ArrayList<LivenessInfo>();
+        errorCode = faceEngine.getLiveness(livenessInfoList);
+        if (CollectionUtils.isEmpty(livenessInfoList)){
+            log.info("活体验证失败");
             return false;
         }
+        System.out.println("活体:" + livenessInfoList.get(0).getLiveness());
+
+        //IR属性处理
+        ImageInfo imageInfoGray = getGrayData(base);
+        List<FaceInfo> faceInfoListGray = new ArrayList<FaceInfo>();
+        errorCode = faceEngine.detectFaces(imageInfo.getImageData(), imageInfo.getWidth(), imageInfo.getHeight(), imageInfo.getImageFormat(), faceInfoListGray);
+
+        FunctionConfiguration configuration2 = new FunctionConfiguration();
+        configuration2.setSupportIRLiveness(true);
+        errorCode = faceEngine.processIr(imageInfoGray.getImageData(), imageInfoGray.getWidth(), imageInfoGray.getHeight(), imageInfoGray.getImageFormat(), faceInfoListGray, configuration2);
+        //IR活体检测
+        List<IrLivenessInfo> irLivenessInfo = new ArrayList<>();
+        errorCode = faceEngine.getLivenessIr(irLivenessInfo);
+        if (CollectionUtils.isEmpty(irLivenessInfo)){
+            log.info("活体验证失败");
+            return false;
+        }
+        System.out.println("IR活体:" + irLivenessInfo.get(0).getLiveness());*/
+
+
         //特征提取
         FaceFeature faceFeature = new FaceFeature();
         errorCode = faceEngine.extractFaceFeature(imageInfo.getImageData(), imageInfo.getWidth(), imageInfo.getHeight(), imageInfo.getImageFormat(), faceInfoList.get(0), faceFeature);
@@ -413,7 +450,7 @@ public class NotaryDomainImpl implements NotaryDomain {
             log.info("人脸照片比对通过");
             base.delete();
             file.delete();
-            return true;
+            return ResultCode.SUCCESS;
         }
         if (count == null) {
             redis.set(redisCount, 1, 30, TimeUnit.MINUTES);
@@ -423,7 +460,7 @@ public class NotaryDomainImpl implements NotaryDomain {
         log.info("人脸照片比对未通过");
         base.delete();
         file.delete();
-        return false;
+        return ResultCode.LIVE_VIDEO_INVALID;
     }