|
@@ -23,6 +23,7 @@ import com.zhongzheng.modules.user.domain.UserOcr;
|
|
|
import com.zhongzheng.modules.user.mapper.UserMapper;
|
|
import com.zhongzheng.modules.user.mapper.UserMapper;
|
|
|
import com.zhongzheng.modules.user.service.IUserOcrService;
|
|
import com.zhongzheng.modules.user.service.IUserOcrService;
|
|
|
import com.zhongzheng.modules.user.service.IUserService;
|
|
import com.zhongzheng.modules.user.service.IUserService;
|
|
|
|
|
+import io.swagger.models.auth.In;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
@@ -155,6 +156,8 @@ public class FaceServiceImpl implements IFaceService {
|
|
|
UserOcr ocr = iUserOcrService.queryByUserId(userId);
|
|
UserOcr ocr = iUserOcrService.queryByUserId(userId);
|
|
|
String bestFile = ocr.getBestFrame();
|
|
String bestFile = ocr.getBestFrame();
|
|
|
String base64 = ImageUtils.encodeImgageToBase64("https://file-dev.xyyxt.net/"+bestFile);
|
|
String base64 = ImageUtils.encodeImgageToBase64("https://file-dev.xyyxt.net/"+bestFile);
|
|
|
|
|
+ /* String params = "{\"RuleId\":\""+RuleId+"\",\"IdCard\":\""+IdCard+"\",\"Name\":\""+Name+"\"" +
|
|
|
|
|
+ ",\"ImageBase64\":\""+base64+"\"}";*/
|
|
|
String params = "{\"RuleId\":\""+RuleId+"\",\"IdCard\":\""+IdCard+"\",\"Name\":\""+Name+"\"" +
|
|
String params = "{\"RuleId\":\""+RuleId+"\",\"IdCard\":\""+IdCard+"\",\"Name\":\""+Name+"\"" +
|
|
|
",\"ImageBase64\":\""+base64+"\"}";
|
|
",\"ImageBase64\":\""+base64+"\"}";
|
|
|
DetectAuthRequest req = DetectAuthRequest.fromJsonString(params, DetectAuthRequest.class);
|
|
DetectAuthRequest req = DetectAuthRequest.fromJsonString(params, DetectAuthRequest.class);
|
|
@@ -170,20 +173,35 @@ public class FaceServiceImpl implements IFaceService {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
- public void getPicDetectInfo(String bizToken, Long userId) {
|
|
|
|
|
|
|
+ public Integer getPicDetectInfo(String bizToken, Long userId) {
|
|
|
try{
|
|
try{
|
|
|
Credential cred = new Credential(SecretId, SecretKey);
|
|
Credential cred = new Credential(SecretId, SecretKey);
|
|
|
|
|
+
|
|
|
HttpProfile httpProfile = new HttpProfile();
|
|
HttpProfile httpProfile = new HttpProfile();
|
|
|
httpProfile.setEndpoint("faceid.tencentcloudapi.com");
|
|
httpProfile.setEndpoint("faceid.tencentcloudapi.com");
|
|
|
|
|
+
|
|
|
ClientProfile clientProfile = new ClientProfile();
|
|
ClientProfile clientProfile = new ClientProfile();
|
|
|
clientProfile.setHttpProfile(httpProfile);
|
|
clientProfile.setHttpProfile(httpProfile);
|
|
|
|
|
+
|
|
|
FaceidClient client = new FaceidClient(cred, "", clientProfile);
|
|
FaceidClient client = new FaceidClient(cred, "", clientProfile);
|
|
|
- ImageRecognitionRequest req = new ImageRecognitionRequest();
|
|
|
|
|
- ImageRecognitionResponse resp = client.ImageRecognition(req);
|
|
|
|
|
- System.out.println(ImageRecognitionResponse.toJsonString(resp));
|
|
|
|
|
|
|
+
|
|
|
|
|
+ GetDetectInfoRequest req = new GetDetectInfoRequest();
|
|
|
|
|
+ req.setBizToken(bizToken);
|
|
|
|
|
+ req.setRuleId("1");
|
|
|
|
|
+ GetDetectInfoResponse resp = client.GetDetectInfo(req);
|
|
|
|
|
+ System.out.println(resp.getDetectInfo());
|
|
|
|
|
+ JSONObject resultObject = JSONObject.parseObject(resp.getDetectInfo());
|
|
|
|
|
+ Map entry = (Map)resultObject.get("Text");
|
|
|
|
|
+ UserOcrAddBo bo = new UserOcrAddBo();
|
|
|
|
|
+ bo.setUserId(userId);
|
|
|
|
|
+ bo.setOcrInfo(JSONObject.toJSONString(entry));
|
|
|
|
|
+ bo.setStatus(1);
|
|
|
|
|
+ iUserOcrService.insertByAddBo(bo);
|
|
|
|
|
+ int ErrCode = ((Integer)entry.get("ErrCode"));
|
|
|
|
|
+ return ErrCode;
|
|
|
} catch (TencentCloudSDKException e) {
|
|
} catch (TencentCloudSDKException e) {
|
|
|
- System.out.println(e.toString());
|
|
|
|
|
}
|
|
}
|
|
|
|
|
+ return -1;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|