tongfeng пре 2 година
родитељ
комит
4b855a4d3c

+ 5 - 3
eladmin-common/src/main/java/me/zhengjie/utils/RedisUtils.java

@@ -705,7 +705,9 @@ public class RedisUtils {
         log.debug("缓存删除数量:" + count + "个");
         log.debug("--------------------------------------------");
     }
-//    public void increment() {
-//    	redisTemplate.ops
-//    }
+    public void increment(String key) {
+        ValueOperations<Object, Object> objectObjectValueOperations = redisTemplate.opsForValue();
+        objectObjectValueOperations.increment(key);
+        expire(key,30,TimeUnit.MINUTES);
+    }
 }

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

@@ -370,6 +370,7 @@ public class NotaryDomainImpl implements NotaryDomain {
         List<Face3DAngle> face3DAngleList = new ArrayList<Face3DAngle>();
         errorCode = faceEngine.getFace3DAngle(face3DAngleList);
         if (CollectionUtils.isEmpty(face3DAngleList)){
+            redis.increment(redisCount);
             return ResultCode.IMAGE_NOT_STANDARD;
         }
         //俯仰角
@@ -381,16 +382,7 @@ 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();
-
+            redis.increment(redisCount);
             return ResultCode.IMAGE_NOT_STANDARD;
         }
         //活体检测
@@ -455,11 +447,7 @@ public class NotaryDomainImpl implements NotaryDomain {
             file.delete();
             return ResultCode.SUCCESS;
         }
-        if (count == null) {
-            redis.set(redisCount, 1, 30, TimeUnit.MINUTES);
-        } else {
-            redis.set(redisCount, count + 1, 30, TimeUnit.MINUTES);
-        }
+        redis.increment(redisCount);
         log.info("人脸照片比对未通过");
         base.delete();
         file.delete();