main
rong.liu 11 months ago
parent 2571853dd6
commit 928c61ce9c
  1. 46
      users/src/main/java/com/huoran/users/controller/AliRealNameAuthenticationController.java
  2. 2
      users/src/main/java/com/huoran/users/service/impl/EnterpriseCertificationServiceImpl.java

@ -128,7 +128,7 @@ public class AliRealNameAuthenticationController {
} }
@ApiOperation(value = "统一社会信用代码认证", response = CreditCodeResp.class) @ApiOperation(value = "统一社会信用代码认证(更改审核状态未提交为待审核)", response = CreditCodeResp.class)
@PostMapping("/creditCodeAuthentication") @PostMapping("/creditCodeAuthentication")
public R creditCodeAuthentication(@RequestBody EnterpriseCertification enterpriseCertification, HttpServletRequest request) throws IOException { 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);
}
}
} }

@ -26,6 +26,8 @@ public class EnterpriseCertificationServiceImpl extends ServiceImpl<EnterpriseCe
public EnterpriseCertification checkWhetherItExists(String company_name) { public EnterpriseCertification checkWhetherItExists(String company_name) {
QueryWrapper<EnterpriseCertification> wrapper = new QueryWrapper<>(); QueryWrapper<EnterpriseCertification> wrapper = new QueryWrapper<>();
wrapper.eq("company_name", company_name); wrapper.eq("company_name", company_name);
//校验已经通过的企业名称是否重复
wrapper.eq("audit_status", 2);
return getOne(wrapper); return getOne(wrapper);
} }

Loading…
Cancel
Save