|
@@ -153,6 +153,9 @@ public class AppUserService extends ServiceImpl<AppUserMapper, AppUser> implemen
|
|
|
* @return
|
|
|
*/
|
|
|
AppUserVo getSelfInfo() {
|
|
|
+ if (StpAPPUserUtil.getAPPLoginInfo().getFk() == null) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
//查询当前人
|
|
|
AppUser appUser = appUserMapper.selectById(StpAPPUserUtil.getAPPLoginInfo().getLoginId());
|
|
|
if (appUser == null) throw new ServiceException("当前用户信息异常!");
|
|
@@ -675,11 +678,23 @@ public class AppUserService extends ServiceImpl<AppUserMapper, AppUser> implemen
|
|
|
faceFactory.handler().createPersonByBase(faceId, appUser.getName(), img);
|
|
|
}
|
|
|
|
|
|
- public void authFace(Long loginId, String img) {
|
|
|
- boolean isLive = faceFactory.handler().checkIsLive(img);
|
|
|
- if (!isLive) {
|
|
|
- log.error("人脸注册为非活体人脸:{}", loginId);
|
|
|
- // throw new AjaxError("非活体人脸");
|
|
|
+ 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("人脸不匹配");
|
|
|
+ }
|
|
|
+ AppUser appUser = null;
|
|
|
+ for (String id : faceId) {
|
|
|
+ AppUser checkUser = findByFaceId(id);
|
|
|
+ if (checkUser != null) {
|
|
|
+ appUser = checkUser;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (appUser == null) {
|
|
|
+ throw new AjaxError("人员信息未找到");
|
|
|
+ }
|
|
|
+ return;
|
|
|
}
|
|
|
String faceId = RandomUtil.randomString(32);
|
|
|
AppUser appUser = this.getById(loginId);
|
|
@@ -693,10 +708,7 @@ public class AppUserService extends ServiceImpl<AppUserMapper, AppUser> implemen
|
|
|
String img;
|
|
|
try (InputStream is = file.getInputStream()) {
|
|
|
img = Base64.encode(is);
|
|
|
- boolean isLive = faceFactory.handler().checkIsLive(img);
|
|
|
- if (!isLive) {
|
|
|
- // throw new AjaxError("非活体人脸");
|
|
|
- }
|
|
|
+
|
|
|
} catch (IOException e) {
|
|
|
throw new AjaxError("识别失败");
|
|
|
}
|