main
rong.liu 11 months ago
parent c5cd561a66
commit 6f16b75d70
  1. 37
      users/src/main/java/com/huoran/users/controller/AliRealNameAuthenticationController.java

@ -264,7 +264,7 @@ public class AliRealNameAuthenticationController {
return R.ok("提交成功,请等待审核!"); return R.ok("提交成功,请等待审核!");
} else { } else {
errorMsg = info.getReason(); errorMsg = info.getReason();
return R.ok().put("message", info.getReason()); return R.error().put("message", info.getReason());
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); 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);
}
}
} }
Loading…
Cancel
Save