|
|
|
@ -128,7 +128,7 @@ public class AliRealNameAuthenticationController { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "统一社会信用代码认证", response = CreditCodeResp.class) |
|
|
|
|
@ApiOperation(value = "统一社会信用代码认证(更改审核状态未提交为待审核)", response = CreditCodeResp.class) |
|
|
|
|
@PostMapping("/creditCodeAuthentication") |
|
|
|
|
public R creditCodeAuthentication(@RequestBody EnterpriseCertification enterpriseCertification, HttpServletRequest request) throws IOException { |
|
|
|
|
|
|
|
|
@ -171,5 +171,49 @@ public class AliRealNameAuthenticationController { |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "统一社会信用代码认证(auditStatus给1,新增认证状态为待审核,用于个人认证幼儿园或供应商情况下)", response = CreditCodeResp.class) |
|
|
|
|
@PostMapping("/organizationCertification") |
|
|
|
|
public R organizationCertification(@RequestBody EnterpriseCertification enterpriseCertification, HttpServletRequest request) throws IOException { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String accountId = TokenUtils.getIdByJwtToken(request); |
|
|
|
|
enterpriseCertification.setAccountId(Integer.valueOf(accountId)); |
|
|
|
|
enterpriseCertification.setSubmitTime(new Date()); |
|
|
|
|
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", enterpriseCertification.getCompanyName()); |
|
|
|
|
querys.put("CreditCode", enterpriseCertification.getCreditCode()); |
|
|
|
|
querys.put("LegalPersonName", enterpriseCertification.getLegalPerson()); |
|
|
|
|
|
|
|
|
|
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()))) { |
|
|
|
|
errorMsg = "企业名称已存在"; |
|
|
|
|
throw new RuntimeException(errorMsg); |
|
|
|
|
} |
|
|
|
|
enterpriseCertificationService.save(enterpriseCertification); |
|
|
|
|
return R.ok("提交成功,请等待审核!"); |
|
|
|
|
} else { |
|
|
|
|
errorMsg = info.getReason(); |
|
|
|
|
return R.ok().put("message", info.getReason()); |
|
|
|
|
} |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
e.printStackTrace(); |
|
|
|
|
throw new RuntimeException(errorMsg); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |