Kaynağa Gözat

人脸识别接口更新v1

qzy 11 ay önce
ebeveyn
işleme
321225cda6

+ 13 - 6
sp-service/sp-admin/src/main/java/com/pj/project/app_user/AppUserService.java

@@ -658,16 +658,20 @@ public class AppUserService extends ServiceImpl<AppUserMapper, AppUser> implemen
             if (faceId.isEmpty()) {
                 throw new AjaxError("人脸不匹配");
             }
-            AppUser appUser = null;
+            boolean result=false;
             for (String id : faceId) {
                 AppUser checkUser = findByFaceId(id);
                 if (checkUser != null) {
-                    appUser = checkUser;
+                    if (Objects.equals(checkUser.getId(), loginId)) {
+                        result=true;
+                        break;
+                    }
                 }
             }
-            if (appUser == null) {
+            if (!result) {
                 throw new AjaxError("人员信息未找到");
             }
+
             return;
         }
         String faceId = RandomUtil.randomString(32);
@@ -684,14 +688,17 @@ public class AppUserService extends ServiceImpl<AppUserMapper, AppUser> implemen
             if (faceId.isEmpty()) {
                 throw new AjaxError("人脸不匹配");
             }
-            AppUser appUser = null;
+            boolean result=false;
             for (String id : faceId) {
                 AppUser checkUser = findByFaceId(id);
                 if (checkUser != null) {
-                    appUser = checkUser;
+                    if (Objects.equals(checkUser.getId(), loginId)) {
+                        result=true;
+                        break;
+                    }
                 }
             }
-            if (appUser == null) {
+            if (!result) {
                 throw new AjaxError("人员信息未找到");
             }
             return;