|
|
|
@ -244,7 +244,7 @@ public class AliRealNameAuthenticationController { |
|
|
|
|
String method = "GET"; |
|
|
|
|
Map<String, String> headers = new HashMap<String, String>(); |
|
|
|
|
//最后在header中的格式(中间是英文空格)为Authorization:APPCODE 83359fd73fe94948385f570e3c139105
|
|
|
|
|
headers.put("Authorization", "APPCODE " +AliRealNameAuthenticationConfig.ALI_API_APPCODE); |
|
|
|
|
headers.put("Authorization", "APPCODE " + AliRealNameAuthenticationConfig.ALI_API_APPCODE); |
|
|
|
|
Map<String, String> querys = new HashMap<String, String>(); |
|
|
|
|
querys.put("ComapnyName", enterpriseCertification.getCompanyName()); |
|
|
|
|
querys.put("CreditCode", enterpriseCertification.getCreditCode()); |
|
|
|
@ -264,7 +264,7 @@ public class AliRealNameAuthenticationController { |
|
|
|
|
return R.ok("提交成功,请等待审核!"); |
|
|
|
|
} else { |
|
|
|
|
errorMsg = info.getReason(); |
|
|
|
|
return R.ok().put("message", info.getReason()); |
|
|
|
|
return R.error().put("message", info.getReason()); |
|
|
|
|
} |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
e.printStackTrace(); |
|
|
|
@ -274,5 +274,40 @@ public class AliRealNameAuthenticationController { |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static void main(String[] args) { |
|
|
|
|
String host = "https://sys.81api.com"; |
|
|
|
|
String path = "/verifyCompany/"; |
|
|
|
|
String method = "GET"; |
|
|
|
|
Map<String, String> headers = new HashMap<String, String>(); |
|
|
|
|
//最后在header中的格式(中间是英文空格)为Authorization:APPCODE 83359fd73fe94948385f570e3c139105
|
|
|
|
|
headers.put("Authorization", "APPCODE " + AliRealNameAuthenticationConfig.ALI_API_APPCODE); |
|
|
|
|
Map<String, String> querys = new HashMap<String, String>(); |
|
|
|
|
querys.put("ComapnyName", "荆州国瑞网络科技有限公司"); |
|
|
|
|
querys.put("CreditCode", "91421000MA494BGL8W"); |
|
|
|
|
querys.put("LegalPersonName", "余承文"); |
|
|
|
|
|
|
|
|
|
String errorMsg = ""; |
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
HttpResponse response = HttpUtils.doGet(host, path, method, headers, querys); |
|
|
|
|
CreditCodeResp info = new Gson().fromJson(EntityUtils.toString(response.getEntity()), CreditCodeResp.class); |
|
|
|
|
if (info.getStatus()) { |
|
|
|
|
/*if (!ObjectUtils.isEmpty(enterpriseCertificationService.checkWhetherItExists(enterpriseCertification.getCompanyName(), null, enterpriseCertification.getOpenId()))) { |
|
|
|
|
errorMsg = "企业名称已存在"; |
|
|
|
|
throw new RuntimeException(errorMsg); |
|
|
|
|
} |
|
|
|
|
enterpriseCertificationService.save(enterpriseCertification);*/ |
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
errorMsg = info.getReason(); |
|
|
|
|
|
|
|
|
|
System.err.println("错误信息:"+errorMsg); |
|
|
|
|
} |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
e.printStackTrace(); |
|
|
|
|
throw new RuntimeException(errorMsg); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |