Selaa lähdekoodia

照片对比优化

tongfeng 2 vuotta sitten
vanhempi
commit
3af99da1ec

+ 0 - 5
eladmin-system/src/main/java/me/zhengjie/base/face/FaceCompareUtil.java

@@ -53,11 +53,6 @@ public class FaceCompareUtil {
     @Value("${hongruan.libpath}")
     private String libpath;
 
-/*    //以下为本地测试
-    private static final String appid = "H6Er8ksqAcKc7Dk4Yum9Rkz4g9Gm77ZXAEMgvenjkTQQ";
-    private static final String sdkkey = "Abd9D8xZQUqG8vDtU2a1tEkdfThkK1tZppjXzydGwEd6";
-    private static final String libpath = "D:\\arcsoft_lib";*/
-
     @PostConstruct
     private void init(){
         //从官网获取

+ 18 - 11
eladmin-system/src/main/java/me/zhengjie/domain/notary/impl/NotaryDomainImpl.java

@@ -20,8 +20,6 @@ import org.springframework.util.ObjectUtils;
 
 import java.io.*;
 
-import static com.arcsoft.face.toolkit.ImageFactory.getRGBData;
-
 @Component
 @RequiredArgsConstructor
 @Slf4j
@@ -119,9 +117,6 @@ public class NotaryDomainImpl implements NotaryDomain {
         FileInfoEntity fileInfo = faceCompareUtil.uploadFaceFile(base64);
         boolean redisFlag = (count != null && count >= 2);
         if (ObjectUtils.isEmpty(id) || redisFlag) {
-            if (! faceCompareUtil.imageCenter(base)){
-                return ResultCode.IMAGE_NOT_STANDARD;
-            }
             //要做人脸核身
             thirdPartyInterfaceEntity = JuheServiceUtil.URLPost(idCard, nickName, base64,thirdPartyInterfaceEntity);
             thirdPartyInterfaceEntity.setFileId(fileInfo.getId() + "");
@@ -140,8 +135,14 @@ public class NotaryDomainImpl implements NotaryDomain {
                 contractOrderMapper.updateById(orderEntity);
                 log.info("当事人人脸核身通过");
                 redis.del(redisCount);
+                if (ObjectUtil.isNotEmpty(base)){
+                    base.delete();
+                }
                 return ResultCode.SUCCESS;
             }
+            if (ObjectUtil.isNotEmpty(base)){
+                base.delete();
+            }
             return ResultCode.LIVE_VIDEO_INVALID;
         }
         //要做照片比对
@@ -156,9 +157,6 @@ public class NotaryDomainImpl implements NotaryDomain {
                 redis.del(redisCount);
             }
         }
-        if (ObjectUtil.isNotEmpty(base)){
-            base.delete();
-        }
         return resultCode;
 
     }
@@ -272,10 +270,16 @@ public class NotaryDomainImpl implements NotaryDomain {
                     log.info("银行客户经理人脸核身通过");
                     redis.del(redisCount);
                     thirdPartyInterfaceRepository.insert(faceCompareEntity);
+                    if (ObjectUtil.isNotEmpty(base)){
+                        base.delete();
+                    }
                     return ResultCode.SUCCESS;
                 }
                 log.info("客户经理人脸核身失败");
                 thirdPartyInterfaceRepository.insert(faceCompareEntity);
+                if (ObjectUtil.isNotEmpty(base)){
+                    base.delete();
+                }
                 return ResultCode.LIVE_VIDEO_INVALID;
             }
         } else if (ObjectUtils.isEmpty(compareImageId) || redisFlag) {
@@ -299,9 +303,15 @@ public class NotaryDomainImpl implements NotaryDomain {
                 redis.del(redisCount);
                 contractOrderMapper.updateById(orderEntity);
                 log.info("当事人人脸核身通过");
+                if (ObjectUtil.isNotEmpty(base)){
+                    base.delete();
+                }
                 return ResultCode.SUCCESS;
             }
             log.info("当事人人脸核身失败");
+            if (ObjectUtil.isNotEmpty(base)){
+                base.delete();
+            }
             return ResultCode.LIVE_VIDEO_INVALID;
         }
         //如果不用做人脸核身 那么就去做照片比对
@@ -325,9 +335,6 @@ public class NotaryDomainImpl implements NotaryDomain {
                 redis.del(redisCount);
             }
         }
-        if (ObjectUtil.isNotEmpty(base)){
-            base.delete();
-        }
         return resultCode;
     }