|
@@ -1,11 +1,18 @@
|
|
|
package com.pj.project.app_user;
|
|
|
|
|
|
+import cn.hutool.core.thread.ThreadUtil;
|
|
|
+import cn.hutool.core.util.RandomUtil;
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
|
+import cn.hutool.log.StaticLog;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.pj.api.consts.FeignFactory;
|
|
|
import com.pj.api.dto.AppUserCreateDTO;
|
|
|
import com.pj.api.dto.AppUserDto;
|
|
|
import com.pj.api.dto.PeopleDto;
|
|
|
import com.pj.api.dto.UpdateAccountDTO;
|
|
|
import com.pj.current.satoken.StpAPPUserUtil;
|
|
|
+import com.pj.face.factory.FaceFactory;
|
|
|
import com.pj.project.app_user.dto.ForgetPasswordDto;
|
|
|
import com.pj.project.app_user.dto.LoginDto;
|
|
|
import com.pj.project.app_user.dto.RegisterDto;
|
|
@@ -13,6 +20,14 @@ import com.pj.project.app_user.vo.AppUserVo;
|
|
|
import com.pj.project4sp.utils.ImageUtils;
|
|
|
import com.pj.utils.sg.AjaxJson;
|
|
|
import com.pj.utils.so.SoMap;
|
|
|
+import com.tencentcloudapi.common.Credential;
|
|
|
+import com.tencentcloudapi.common.exception.TencentCloudSDKException;
|
|
|
+import com.tencentcloudapi.common.profile.ClientProfile;
|
|
|
+import com.tencentcloudapi.common.profile.HttpProfile;
|
|
|
+import com.tencentcloudapi.iai.v20200303.IaiClient;
|
|
|
+import com.tencentcloudapi.iai.v20200303.models.VerifyPersonRequest;
|
|
|
+import com.tencentcloudapi.iai.v20200303.models.VerifyPersonResponse;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
@@ -20,6 +35,7 @@ import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
import java.util.Date;
|
|
|
import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
@@ -30,8 +46,10 @@ import java.util.Map;
|
|
|
*/
|
|
|
@RestController
|
|
|
@RequestMapping("/app/AppUser/")
|
|
|
+@Slf4j
|
|
|
public class AppUserApiController {
|
|
|
-
|
|
|
+ @Autowired
|
|
|
+ private FaceFactory faceFactory;
|
|
|
/**
|
|
|
* 底层 Service 对象
|
|
|
*/
|
|
@@ -185,5 +203,45 @@ public class AppUserApiController {
|
|
|
return appUserService.getByPhoneAndUserType(phone, userType);
|
|
|
}
|
|
|
|
|
|
+ @RequestMapping("find")
|
|
|
+ public AjaxJson find(@RequestBody String img) {
|
|
|
+ img=ImageUtils.compressPic(img);
|
|
|
+// LambdaQueryWrapper<AppUser>ew=new LambdaQueryWrapper<>();
|
|
|
+// ew.isNotNull(AppUser::getFaceId);
|
|
|
+// List<AppUser> appUserList = appUserService.list(ew);
|
|
|
+// appUserList.stream().filter(appUser -> StrUtil.isNotEmpty(appUser.getFaceId()))
|
|
|
+// .forEach(appUser -> {
|
|
|
+// String faceId = appUser.getFaceId();
|
|
|
+// Credential cred = new Credential("AKIDtmacfdOH97likhhaL971xywwhRH7saCt", "1DOSWWYcl2FWhw7BLOII6zz65ylOzTpS");
|
|
|
+// // 实例化一个http选项,可选的,没有特殊需求可以跳过
|
|
|
+// HttpProfile httpProfile = new HttpProfile();
|
|
|
+// httpProfile.setEndpoint("iai.tencentcloudapi.com");
|
|
|
+// // 实例化一个client选项,可选的,没有特殊需求可以跳过
|
|
|
+// ClientProfile clientProfile = new ClientProfile();
|
|
|
+// clientProfile.setHttpProfile(httpProfile);
|
|
|
+// // 实例化要请求产品的client对象,clientProfile是可选的
|
|
|
+// IaiClient client = new IaiClient(cred, "ap-chongqing", clientProfile);
|
|
|
+// VerifyPersonRequest req = new VerifyPersonRequest();
|
|
|
+// req.setImage(img);
|
|
|
+// req.setPersonId(faceId);
|
|
|
+// // 返回的resp是一个VerifyPersonResponse的实例,与请求对象对应
|
|
|
+// VerifyPersonResponse resp=null;
|
|
|
+// try {
|
|
|
+// resp = client.VerifyPerson(req);
|
|
|
+// } catch (TencentCloudSDKException e) {
|
|
|
+// if (e.getMessage().contains("人员ID不存在")){
|
|
|
+// appUser.setFaceId("1111");
|
|
|
+// appUserService.updateById(appUser);
|
|
|
+// }
|
|
|
+// log.error("VerifyPerson:{},{},{},{}",faceId,appUser.getName(),appUser.getId(),e.getMessage());
|
|
|
+// }
|
|
|
+// if (resp!= null) {
|
|
|
+// log.info("VerifyPerson:{},{},{},{},{}",faceId,appUser.getName(),appUser.getId(),resp.getIsMatch(),resp.getScore());
|
|
|
+// }
|
|
|
+// ThreadUtil.sleep(RandomUtil.randomLong(1000,2000));
|
|
|
+// });
|
|
|
+ return AjaxJson.getSuccess();
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
}
|