|
@@ -656,24 +656,11 @@ public class AppUserService extends ServiceImpl<AppUserMapper, AppUser> implemen
|
|
|
}
|
|
|
img = ImageUtils.compressPic(img);
|
|
|
if (type == 2) {
|
|
|
- List<String> faceId = faceFactory.handler().faceSearch(img);
|
|
|
- if (faceId.isEmpty()) {
|
|
|
- throw new AjaxError("人脸不匹配");
|
|
|
- }
|
|
|
- boolean result=false;
|
|
|
- for (String id : faceId) {
|
|
|
- AppUser checkUser = findByFaceId(id);
|
|
|
- if (checkUser != null) {
|
|
|
- if (Objects.equals(checkUser.getId(), loginId)) {
|
|
|
- result=true;
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ AppUser db = getById(loginId);
|
|
|
+ boolean result = faceFactory.handler().verify(db.getFaceId(), img);
|
|
|
if (!result) {
|
|
|
- throw new AjaxError("人员信息未找到");
|
|
|
+ throw new AjaxError("人脸不匹配");
|
|
|
}
|
|
|
-
|
|
|
return;
|
|
|
}
|
|
|
String faceId = RandomUtil.randomString(32);
|
|
@@ -686,22 +673,10 @@ public class AppUserService extends ServiceImpl<AppUserMapper, AppUser> implemen
|
|
|
|
|
|
public void authFace(Long loginId, String img, Integer type) {
|
|
|
if (type == 2) {
|
|
|
- List<String> faceId = faceFactory.handler().faceSearch(img);
|
|
|
- if (faceId.isEmpty()) {
|
|
|
- throw new AjaxError("人脸不匹配");
|
|
|
- }
|
|
|
- boolean result=false;
|
|
|
- for (String id : faceId) {
|
|
|
- AppUser checkUser = findByFaceId(id);
|
|
|
- if (checkUser != null) {
|
|
|
- if (Objects.equals(checkUser.getId(), loginId)) {
|
|
|
- result=true;
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ AppUser db = getById(loginId);
|
|
|
+ boolean result = faceFactory.handler().verify(db.getFaceId(), img);
|
|
|
if (!result) {
|
|
|
- throw new AjaxError("人员信息未找到");
|
|
|
+ throw new AjaxError("人脸不匹配");
|
|
|
}
|
|
|
return;
|
|
|
}
|