|
@@ -636,18 +636,25 @@ public class AppUserService extends ServiceImpl<AppUserMapper, AppUser> implemen
|
|
|
}
|
|
|
|
|
|
|
|
|
- public void authFace(Long loginId, MultipartFile file) {
|
|
|
+ public void authFace(Long loginId, MultipartFile file,Integer type) {
|
|
|
String img;
|
|
|
try (InputStream is = file.getInputStream()) {
|
|
|
img = Base64.encode(is);
|
|
|
- boolean isLive = faceFactory.handler().checkIsLive(img);
|
|
|
- if (!isLive) {
|
|
|
- log.error("人脸注册为非活体人脸:{}", loginId);
|
|
|
- // throw new AjaxError("非活体人脸");
|
|
|
- }
|
|
|
+
|
|
|
} catch (IOException e) {
|
|
|
throw new AjaxError("识别失败");
|
|
|
}
|
|
|
+ if (type==2){
|
|
|
+ String faceId = faceFactory.handler().faceSearch(img);
|
|
|
+ if (StrUtil.isEmpty(faceId)) {
|
|
|
+ throw new AjaxError("人脸不匹配");
|
|
|
+ }
|
|
|
+ AppUser appUser = findByFaceId(faceId);
|
|
|
+ if (appUser == null) {
|
|
|
+ throw new AjaxError("人员信息未找到");
|
|
|
+ }
|
|
|
+ return;
|
|
|
+ }
|
|
|
String faceId = RandomUtil.randomString(32);
|
|
|
AppUser appUser = this.getById(loginId);
|
|
|
appUser.setFace(1);
|
|
@@ -676,7 +683,7 @@ public class AppUserService extends ServiceImpl<AppUserMapper, AppUser> implemen
|
|
|
img = Base64.encode(is);
|
|
|
boolean isLive = faceFactory.handler().checkIsLive(img);
|
|
|
if (!isLive) {
|
|
|
- throw new AjaxError("非活体人脸");
|
|
|
+ // throw new AjaxError("非活体人脸");
|
|
|
}
|
|
|
} catch (IOException e) {
|
|
|
throw new AjaxError("识别失败");
|