Commit 9826759a authored by hanfeng's avatar hanfeng

修改实名认证

parent 218e3849
......@@ -27,16 +27,15 @@ import java.util.Map;
@Slf4j
public class XCFQPictureParsingImpl implements UserPictureParsing {
private String appcode = "acea1c8811f748b3a65815f11db357c4";
// private String appcode = "acea1c8811f748b3a65815f11db357c4";
private String appcode2 = "ee7710ce92054cae9f6c040f6864e6a7";
/**
* 认证相关的数据
*/
private String host = "https://ocridcard.market.alicloudapi.com";
private String path = "/idcard";
private String host = "https://ocridcards.market.alicloudapi.com";
private String path = "/idimages";
private String methd = "POST";
......@@ -81,7 +80,7 @@ public class XCFQPictureParsingImpl implements UserPictureParsing {
}
private Map<String,String> judgeAccordingToAnalyticalData(String imageUrl, String type) {
String json = imageParse(imageUrl, type);
String json = imageParse(imageUrl);
log.info("json:" + json);
if (StringUtils.isBlank(json)) {
return null;
......@@ -103,14 +102,12 @@ public class XCFQPictureParsingImpl implements UserPictureParsing {
//身份证照片解析
private String imageParse(String imageUrl, String type) {
private String imageParse(String imageUrl) {
Map<String, String> headers = new HashMap<String, String>();
headers.put("Authorization", "APPCODE " + appcode2);
Map<String, String> querys = new HashMap<String, String>();
Map<String, String> bodys = new HashMap<String, String>();
bodys.put("image", imageUrl);
//默认正面front,背面请传back
bodys.put("idCardSide", type);
try {
return callExternalRequest(headers,querys,bodys,1);
} catch (Exception e) {
......@@ -140,13 +137,7 @@ public class XCFQPictureParsingImpl implements UserPictureParsing {
}
if (403==statusCode){
if (type==2){
log.error("验证次数已用完");
return null;
}
Map<String, String> headers2 = new HashMap<String, String>();
headers.put("Authorization", "APPCODE " + appcode);
return callExternalRequest(headers2,querys,bodys,2);
}
return null;
......
......@@ -28,9 +28,8 @@ import java.util.Map;
@Primary
public class XCFQAuthentication implements UserAuthentication {
private String appcode="acea1c8811f748b3a65815f11db357c4";
private String appcode2="ee7710ce92054cae9f6c040f6864e6a7";
// private String appcode="acea1c8811f748b3a65815f11db357c4";
private String appcode2 = "ee7710ce92054cae9f6c040f6864e6a7";
/**
* 认证相关的数据
......@@ -59,7 +58,7 @@ public class XCFQAuthentication implements UserAuthentication {
Map<String, String> headers = new HashMap<String, String>();
headers.put("Authorization", "APPCODE " + appcode2);
try {
callExternalRequest(message,headers,1);
callExternalRequest(message, headers, 1);
} catch (Exception e) {
e.printStackTrace();
}
......@@ -67,7 +66,7 @@ public class XCFQAuthentication implements UserAuthentication {
}
private boolean callExternalRequest(UserMessage message, Map<String, String> headers,int type) throws Exception {
private boolean callExternalRequest(UserMessage message, Map<String, String> headers, int type) throws Exception {
//map携带身份证和姓名进行认证
Map<String, String> querys = new HashMap<>();
querys.put(idCardName, message.getIdNumber());
......@@ -79,7 +78,7 @@ public class XCFQAuthentication implements UserAuthentication {
/**
* 状态码: 200 正常;400 URL无效;401 appCode错误; 403 次数用完; 500 API网管错误
*/
log.info("外部接口响应状态码:"+statusCode);
log.info("外部接口响应状态码:" + statusCode);
//获取response的body
if (statusCode == 200) {
......@@ -95,14 +94,8 @@ public class XCFQAuthentication implements UserAuthentication {
}
}
if (403==statusCode){
if (type==2){
if (403 == statusCode) {
log.error("验证次数已用完");
return false;
}
Map<String, String> headers2 = new HashMap<String, String>();
headers.put("Authorization", "APPCODE " + appcode);
return callExternalRequest(message,headers2,2);
}
return false;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment