|
|
|
@ -1,16 +1,12 @@ |
|
|
|
|
package com.huoran.users.controller; |
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
|
import com.fasterxml.jackson.core.type.TypeReference; |
|
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper; |
|
|
|
|
import com.google.gson.Gson; |
|
|
|
|
import com.huoran.common.response.R; |
|
|
|
|
import com.huoran.common.utils.TokenUtils; |
|
|
|
|
import com.huoran.users.config.AliRealNameAuthenticationConfig; |
|
|
|
|
import com.huoran.users.entity.EnterpriseCertification; |
|
|
|
|
import com.huoran.users.entity.UserAuthenticationInformation; |
|
|
|
|
import com.huoran.users.entity.req.EnterpriseCertificationReq; |
|
|
|
|
import com.huoran.users.entity.res.BusinessLicenseOCRResp; |
|
|
|
|
import com.huoran.users.entity.res.CreditCodeResp; |
|
|
|
|
import com.huoran.users.entity.res.IdCardOCRResp; |
|
|
|
@ -48,29 +44,6 @@ public class AliRealNameAuthenticationController { |
|
|
|
|
@Autowired |
|
|
|
|
public EnterpriseCertificationService enterpriseCertificationService; |
|
|
|
|
|
|
|
|
|
/* @ApiOperation(value = "身份证图片验证(对象)") |
|
|
|
|
@PostMapping("/faceAuthenticationByObject") |
|
|
|
|
public R faceAuthenticationByObject(HttpServletRequest request, @RequestBody IdCardOCRReq req) throws IOException { |
|
|
|
|
//正面身份证信息返回
|
|
|
|
|
String positiveIDReturnsInformation = FaceRecognitionAidUtil.IdCardOCRRecognition(req.getTheFrontOfIDCard(),"face"); |
|
|
|
|
|
|
|
|
|
//反面身份证信息返回
|
|
|
|
|
String reverseIDInformationReturned = FaceRecognitionAidUtil.IdCardOCRRecognition(req.getReverseOfIDCard(),"back"); |
|
|
|
|
|
|
|
|
|
*//*if (ObjectUtils.isEmpty(positiveIDReturnsInformation)&&ObjectUtils.isEmpty(reverseIDInformationReturned)){
|
|
|
|
|
throw new RuntimeException("身份证图片验证失败,请重新再试!"); |
|
|
|
|
}*//*
|
|
|
|
|
Optional.ofNullable(positiveIDReturnsInformation) |
|
|
|
|
.orElseThrow(() -> new RuntimeException("身份证图片验证失败,请重新再试!")); |
|
|
|
|
Optional.ofNullable(reverseIDInformationReturned) |
|
|
|
|
.orElseThrow(() -> new RuntimeException("身份证图片验证失败,请重新再试!")); |
|
|
|
|
|
|
|
|
|
IdCardOCRResp front = new Gson().fromJson(positiveIDReturnsInformation, IdCardOCRResp.class); |
|
|
|
|
|
|
|
|
|
IdCardOCRResp reverseSide = new Gson().fromJson(reverseIDInformationReturned, IdCardOCRResp.class); |
|
|
|
|
|
|
|
|
|
return R.ok().put("front", front).put("reverseSide", reverseSide); |
|
|
|
|
}*/ |
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "身份证图片验证") |
|
|
|
|
@PostMapping("/faceAuthentication") |
|
|
|
@ -115,7 +88,7 @@ public class AliRealNameAuthenticationController { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@PostMapping("/authenticationOrNot") |
|
|
|
|
@ApiOperation(value = "是否认证", response = UserAuthenticationInformation.class) |
|
|
|
|
@ApiOperation(value = "个人是否认证", response = UserAuthenticationInformation.class) |
|
|
|
|
public R authenticationOrNot(HttpServletRequest request) { |
|
|
|
|
|
|
|
|
|
String accountId = TokenUtils.getIdByJwtToken(request); |
|
|
|
@ -127,19 +100,6 @@ public class AliRealNameAuthenticationController { |
|
|
|
|
} |
|
|
|
|
return R.ok().put("data", true).put("authenticationInformation", userAuthenticationInformation); |
|
|
|
|
} |
|
|
|
|
/*@ApiOperation(value = "输入身份证号码、姓名进行实名认证") |
|
|
|
|
@PostMapping("/realNameAuthentication") |
|
|
|
|
public R realNameAuthentication(@RequestParam(name = "idCardNo", required = true) @ApiParam(value = "身份证号码") String idCardNo, @RequestParam(name = "userName", required = true) @ApiParam(value = "用户姓名") String userName, HttpServletRequest request) throws IOException { |
|
|
|
|
String accountId = TokenUtils.getIdByJwtToken(request); |
|
|
|
|
String json = FaceRecognitionAidUtil.postData(AliRealNameAuthenticationConfig.ALI_API_APPCODE, AliRealNameAuthenticationConfig.GET_APP_CODE_LINK, userName, idCardNo); |
|
|
|
|
RealNameAuthenticationResp info = new Gson().fromJson(json, RealNameAuthenticationResp.class); |
|
|
|
|
|
|
|
|
|
if (!info.getRespCode().equals("0000")) { |
|
|
|
|
throw new RuntimeException(info.getRespMessage()); |
|
|
|
|
} |
|
|
|
|
return R.ok().put("data", info); |
|
|
|
|
|
|
|
|
|
}*/ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "营业执照图片验证") |
|
|
|
@ -197,7 +157,7 @@ public class AliRealNameAuthenticationController { |
|
|
|
|
errorMsg = "企业名称已存在"; |
|
|
|
|
throw new RuntimeException(errorMsg); |
|
|
|
|
} |
|
|
|
|
enterpriseCertificationService.save(enterpriseCertification); |
|
|
|
|
enterpriseCertificationService.updateById(enterpriseCertification); |
|
|
|
|
return R.ok("提交成功,请等待审核!"); |
|
|
|
|
} else { |
|
|
|
|
errorMsg = info.getReason(); |
|
|
|
@ -212,6 +172,4 @@ public class AliRealNameAuthenticationController { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |