|
|
|
@ -79,13 +79,15 @@ public class AliRealNameAuthenticationController { |
|
|
|
|
//身份证信息返回
|
|
|
|
|
String idCardInformationReturn = FaceRecognitionAidUtil.IdCardOCRRecognition(imgFile, side); |
|
|
|
|
if (ObjectUtils.isEmpty(idCardInformationReturn)) { |
|
|
|
|
throw new RuntimeException("身份证图片验证失败,请重新再试!"); |
|
|
|
|
// ("身份证图片验证失败,请重新再试!");
|
|
|
|
|
return R.error("身份证图片验证失败,请重新再试!"); |
|
|
|
|
} |
|
|
|
|
IdCardOCRResp resp = new Gson().fromJson(idCardInformationReturn, IdCardOCRResp.class); |
|
|
|
|
if (resp.getSuccess()) { |
|
|
|
|
return R.ok().put("data", resp); |
|
|
|
|
} else { |
|
|
|
|
throw new RuntimeException("身份证图片验证失败,请重新再试!"); |
|
|
|
|
// ("身份证图片验证失败,请重新再试!");
|
|
|
|
|
return R.error("身份证图片验证失败,请重新再试!"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
@ -101,7 +103,8 @@ public class AliRealNameAuthenticationController { |
|
|
|
|
RealNameAuthenticationResp info = new Gson().fromJson(json, RealNameAuthenticationResp.class); |
|
|
|
|
|
|
|
|
|
if (!info.getRespCode().equals("0000")) { |
|
|
|
|
throw new RuntimeException(info.getRespMessage()); |
|
|
|
|
// ();
|
|
|
|
|
return R.error(info.getRespMessage()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
QueryWrapper<UserAuthenticationInformation> queryWrapper = new QueryWrapper<>(); |
|
|
|
@ -151,7 +154,7 @@ public class AliRealNameAuthenticationController { |
|
|
|
|
queryWrapper.eq("account_id", accountId); |
|
|
|
|
UserAuthenticationInformation userAuthenticationInformation = service.getOne(queryWrapper); |
|
|
|
|
if (ObjectUtils.isEmpty(userAuthenticationInformation)) { |
|
|
|
|
return R.ok().put("data", false); |
|
|
|
|
return R.ok().put("data", false).put("msg", "未认证"); |
|
|
|
|
} |
|
|
|
|
return R.ok().put("data", true).put("authenticationInformation", userAuthenticationInformation); |
|
|
|
|
} |
|
|
|
@ -174,11 +177,13 @@ public class AliRealNameAuthenticationController { |
|
|
|
|
if (info.getSuccess()) { |
|
|
|
|
return R.ok().put("data", info); |
|
|
|
|
} else { |
|
|
|
|
throw new RuntimeException("营业执照图片验证,请重新再试!"); |
|
|
|
|
//("营业执照图片验证失败,请重新再试!");
|
|
|
|
|
return R.error("营业执照图片验证失败,请重新再试!"); |
|
|
|
|
} |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
e.printStackTrace(); |
|
|
|
|
throw new RuntimeException("营业执照图片验证,请重新再试!"); |
|
|
|
|
// ("营业执照图片验证失败,请重新再试!");
|
|
|
|
|
return R.error("营业执照图片验证失败,请重新再试!"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -214,7 +219,9 @@ public class AliRealNameAuthenticationController { |
|
|
|
|
if (info.getStatus()) { |
|
|
|
|
if (!ObjectUtils.isEmpty(enterpriseCertificationService.checkWhetherItExists(enterpriseCertification.getCompanyName(), certification.getId(), enterpriseCertification.getOpenId()))) { |
|
|
|
|
errorMsg = "企业名称已存在"; |
|
|
|
|
throw new RuntimeException(errorMsg); |
|
|
|
|
// (errorMsg);
|
|
|
|
|
|
|
|
|
|
return R.error(errorMsg); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
enterpriseCertificationService.updateById(enterpriseCertification); |
|
|
|
@ -225,7 +232,8 @@ public class AliRealNameAuthenticationController { |
|
|
|
|
} |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
e.printStackTrace(); |
|
|
|
|
throw new RuntimeException(errorMsg); |
|
|
|
|
// (errorMsg);
|
|
|
|
|
return R.error(errorMsg); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -258,21 +266,70 @@ public class AliRealNameAuthenticationController { |
|
|
|
|
if (info.getStatus()) { |
|
|
|
|
if (!ObjectUtils.isEmpty(enterpriseCertificationService.checkWhetherItExists(enterpriseCertification.getCompanyName(), null, enterpriseCertification.getOpenId()))) { |
|
|
|
|
errorMsg = "企业名称已存在"; |
|
|
|
|
throw new RuntimeException(errorMsg); |
|
|
|
|
return R.error(errorMsg); |
|
|
|
|
} |
|
|
|
|
enterpriseCertificationService.save(enterpriseCertification); |
|
|
|
|
return R.ok("提交成功,请等待审核!"); |
|
|
|
|
} else { |
|
|
|
|
errorMsg = info.getReason(); |
|
|
|
|
return R.ok().put("message", info.getReason()); |
|
|
|
|
|
|
|
|
|
//失败后删除本次生成的企业团队信息
|
|
|
|
|
QueryWrapper<HrUserAccount> accountQueryWrapper = new QueryWrapper<>(); |
|
|
|
|
accountQueryWrapper.eq("app_open_id", enterpriseCertification.getOpenId()); |
|
|
|
|
accountQueryWrapper.eq("platform_id", enterpriseCertification.getPlatformSource()); |
|
|
|
|
|
|
|
|
|
HrUserAccount userAccount = userAccountService.getOne(accountQueryWrapper); |
|
|
|
|
|
|
|
|
|
userInfoService.removeById(userAccount.getUserId()); |
|
|
|
|
userAccountService.removeById(userAccount); |
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return R.error().put("message", info.getReason()); |
|
|
|
|
} |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
e.printStackTrace(); |
|
|
|
|
throw new RuntimeException(errorMsg); |
|
|
|
|
return R.error().put("message", errorMsg); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
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 = "企业名称已存在"; |
|
|
|
|
(errorMsg); |
|
|
|
|
} |
|
|
|
|
enterpriseCertificationService.save(enterpriseCertification);*/ |
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
errorMsg = info.getReason(); |
|
|
|
|
|
|
|
|
|
System.err.println("错误信息:" + errorMsg); |
|
|
|
|
} |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
e.printStackTrace(); |
|
|
|
|
errorMsg = "系统错误"; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |