提交修改
This commit is contained in:
parent
3ddc2ca740
commit
079ed9c187
@ -0,0 +1,56 @@
|
||||
package com.heyu.api.controller.certificate.card;
|
||||
|
||||
|
||||
import com.aliyun.ocr20191230.models.RecognizeBusinessLicenseResponse;
|
||||
import com.aliyun.ocr20191230.models.RecognizeBusinessLicenseResponseBody;
|
||||
import com.heyu.api.alibaba.handle.common.text.ARecognizeBusinessLicenseHandle;
|
||||
import com.heyu.api.alibaba.request.common.text.ARecognizeBusinessLicenseRequest;
|
||||
import com.heyu.api.controller.BaseController;
|
||||
import com.heyu.api.controller.request.card.BusinessLicenseRecognizeRequest;
|
||||
import com.heyu.api.controller.resp.card.BusinessLicenseRecognizeResp;
|
||||
import com.heyu.api.data.annotation.CacheResult;
|
||||
import com.heyu.api.data.annotation.NotIntercept;
|
||||
import com.heyu.api.data.utils.ApiR;
|
||||
import com.heyu.api.data.utils.R;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/business/license")
|
||||
@NotIntercept
|
||||
public class BusinessLicenseRecognizeController extends BaseController {
|
||||
|
||||
|
||||
@Autowired
|
||||
private ARecognizeBusinessLicenseHandle arRecognizeBusinessLicenseHandle;
|
||||
|
||||
@RequestMapping("/recognize")
|
||||
@CacheResult
|
||||
public R recognize(BusinessLicenseRecognizeRequest request) {
|
||||
ARecognizeBusinessLicenseRequest arRecognizeBusinessLicenseRequest = new ARecognizeBusinessLicenseRequest();
|
||||
arRecognizeBusinessLicenseRequest.setImageBase64(request.getImageBase64());
|
||||
arRecognizeBusinessLicenseRequest.setImageUrl(request.getImageUrl());
|
||||
BusinessLicenseRecognizeResp resp = new BusinessLicenseRecognizeResp();
|
||||
ApiR<RecognizeBusinessLicenseResponse> aR = arRecognizeBusinessLicenseHandle.handle(arRecognizeBusinessLicenseRequest);
|
||||
if (aR.isSuccess()) {
|
||||
RecognizeBusinessLicenseResponse response = aR.getData();
|
||||
if (isSuccessStatusCode(response.getStatusCode())) {
|
||||
RecognizeBusinessLicenseResponseBody responseBody = response.getBody();
|
||||
RecognizeBusinessLicenseResponseBody.RecognizeBusinessLicenseResponseBodyData responseBodyData = responseBody.getData();
|
||||
resp.setCompanyType(responseBodyData.getType());
|
||||
resp.setRegisterDate(responseBodyData.getEstablishDate());
|
||||
resp.setValidDate(responseBodyData.getValidPeriod());
|
||||
resp.setBusiness(responseBodyData.getBusiness());
|
||||
resp.setRegisterNumber(responseBodyData.getRegisterNumber());
|
||||
resp.setCompanyAddress(responseBodyData.getAddress());
|
||||
resp.setRegisterCapital(responseBodyData.getCapital());
|
||||
resp.setCompanyName(responseBodyData.getName());
|
||||
resp.setCompanyLegalPerson(responseBodyData.getLegalPerson());
|
||||
}
|
||||
}
|
||||
return R.ok().setData(resp);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,25 @@
|
||||
package com.heyu.api.controller.request.card;
|
||||
|
||||
|
||||
import com.heyu.api.data.dto.BaseRequest;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class BusinessLicenseRecognizeRequest extends BaseRequest {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 营业执照图片的url
|
||||
*/
|
||||
private String imageUrl;
|
||||
|
||||
/**
|
||||
* 营业执照base 64 编码
|
||||
*/
|
||||
private String imageBase64;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,98 @@
|
||||
package com.heyu.api.controller.resp.card;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/***
|
||||
* 营业执照识别
|
||||
*
|
||||
* RecognizeBusinessLicense
|
||||
*
|
||||
*
|
||||
* https://next.api.aliyun.com/api/ocr/2019-12-30/RecognizeBusinessLicense?tab=DOC&lang=JAVA
|
||||
*/
|
||||
@Data
|
||||
public class BusinessLicenseRecognizeResp {
|
||||
|
||||
/***
|
||||
* 公司类型。识别失败时返回FailInRecognition。
|
||||
*
|
||||
* 示例值:
|
||||
* 有限责任公司
|
||||
*/
|
||||
private String companyType;
|
||||
|
||||
|
||||
/***
|
||||
* 公司注册日期。例如证件上为“2014 年 04 月 16 日”,则接口返回“20140416”。
|
||||
*
|
||||
* 示例值:
|
||||
* 20150504
|
||||
*/
|
||||
private String registerDate;
|
||||
|
||||
|
||||
/**
|
||||
* 公司营业期限终止日期。例如证件上为“2014 年 04 月 16 日至 2034 年 04 月 15 日”,则接口返回“20340415”。
|
||||
*
|
||||
* 说明 当前算法将日期格式统一输出为“年月日”(例如“20391130”),并用“29991231”表示“长期”。
|
||||
* 示例值:
|
||||
* 29991231
|
||||
*/
|
||||
private String validDate;
|
||||
|
||||
|
||||
/***
|
||||
* 经营范围。识别失败时返回FailInRecognition。
|
||||
*
|
||||
* 示例值:
|
||||
* 网络技术服务;网站建设;销售:I类医疗器械、保健用品(不含保健食品)等
|
||||
*/
|
||||
private String business;
|
||||
|
||||
|
||||
/***
|
||||
* 统一社会信用代码。识别失败时返回FailInRecognition。
|
||||
*
|
||||
* 示例值:
|
||||
* 91500108320423****
|
||||
*/
|
||||
private String registerNumber;
|
||||
|
||||
/***
|
||||
* 公司地址。识别失败时返回FailInRecognition。
|
||||
*
|
||||
* 示例值:
|
||||
* 浙江省杭州市西湖区转塘科技经济区块888号888幢
|
||||
*/
|
||||
private String companyAddress;
|
||||
|
||||
|
||||
/***
|
||||
*注册资本。识别失败时返回FailInRecognition。
|
||||
*
|
||||
* 示例值:
|
||||
* 壹百万元整
|
||||
*/
|
||||
private String registerCapital;
|
||||
|
||||
|
||||
/***
|
||||
* 公司名称。识别失败时返回FailInRecognition。
|
||||
*
|
||||
* 示例值:
|
||||
* 某某电子商务有限公司
|
||||
*/
|
||||
private String companyName;
|
||||
|
||||
|
||||
/***
|
||||
*公司法人。识别失败时返回FailInRecognition。
|
||||
*
|
||||
* 示例值:
|
||||
* 李四
|
||||
*/
|
||||
private String companyLegalPerson;
|
||||
|
||||
|
||||
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user