提交修改

This commit is contained in:
quyixiao 2025-03-22 11:57:47 +08:00
parent d815cfad4d
commit 0e7a37906e
10 changed files with 440 additions and 3 deletions

View File

@ -1,13 +1,14 @@
package com.heyu.api.baidu.handle.certificate;
import com.heyu.api.data.annotation.CustomPath;
import com.heyu.api.baidu.BaiduBaseHandle;
import com.heyu.api.baidu.request.certificate.BFoodProductLicenseRequest;
import com.heyu.api.data.annotation.CustomPath;
import lombok.extern.slf4j.Slf4j;
import org.json.JSONObject;
import org.springframework.stereotype.Component;
import java.util.Map;
/**
* https://console.bce.baidu.com/support/?_=1740219852952&timestamp=1740323565114#/api?product=AI&project=%E6%96%87%E5%AD%97%E8%AF%86%E5%88%AB&parent=%E5%8D%A1%E8%AF%81OCR&api=rest%2F2.0%2Focr%2Fv1%2Ffood_product_license&method=post
* <p>
@ -17,7 +18,7 @@ import org.springframework.stereotype.Component;
@Component
@Slf4j
@CustomPath("foodProductLicense")
public class BFoodProductLicenseHandle extends BaiduBaseHandle<BFoodProductLicenseRequest, JSONObject> {
public class BFoodProductLicenseHandle extends BaiduBaseHandle<BFoodProductLicenseRequest, Map> {
@Override
public String getUri() {
return "/rest/2.0/ocr/v1/food_product_license";

View File

@ -37,5 +37,7 @@ public class BFourFactorsVerificationResp extends BBaseResp {
private String companymatch;
@JsonProperty("regnummatch")
private String regnummatch;
@JsonProperty("idnummatch")
private String idnummatch;
}
}

View File

@ -0,0 +1,64 @@
package com.heyu.api.controller.certificate;
import com.heyu.api.baidu.handle.certificate.BTwoFactorsVerificationHandle;
import com.heyu.api.baidu.request.certificate.BTwoFactorsVerificationRequest;
import com.heyu.api.baidu.response.certificate.BTwoFactorsVerificationResp;
import com.heyu.api.controller.BaseController;
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 com.heyu.api.resp.certificate.Factors2VerificationResp;
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;
/***
* https://console.bce.baidu.com/support/?_=1740219852952&timestamp=1742615731509#/api?product=AI&project=%E6%96%87%E5%AD%97%E8%AF%86%E5%88%AB&parent=%E5%8D%A1%E8%AF%81OCR&api=rest%2F2.0%2Focr%2Fv1%2Ftwo_factors_verification&method=post
*
* 企业二要素核验
*
*接口描述
* 通过核验企业名称统一社会信用代码一致性快速核验企业资质
*
* 目前支持工商注册的企业认证事业单位律师事务所等信息暂不支持验证发生工商变更或刚注册的企业信息预计在企业公示的核准日期T+3个工作日后可进行验证
*
*
*
*/
@Slf4j
@RestController
@RequestMapping("/factors2")
@NotIntercept
public class Factors2VerificationController extends BaseController {
@Autowired
private BTwoFactorsVerificationHandle bTwoFactorsVerificationHandle;
@RequestMapping("/recognize")
@CacheResult
public R recognize(BTwoFactorsVerificationRequest request) {
Factors2VerificationResp resp = new Factors2VerificationResp();
ApiR<BTwoFactorsVerificationResp> bR = bTwoFactorsVerificationHandle.handle(request);
if (bR.isSuccess()) {
BTwoFactorsVerificationResp bFourFactorsVerificationResp = bR.getData();
BTwoFactorsVerificationResp.WordsResultDTO wordsResultDTO = bFourFactorsVerificationResp.getWordsResult();
resp.setVerifyresult(wordsResultDTO.getVerifyresult());
resp.setCompanymatch(wordsResultDTO.getCompanymatch());
resp.setRegnummatch(wordsResultDTO.getRegnummatch());
return R.ok().setData(resp);
}
return R.error(bR.getErrorMsg());
}
}

View File

@ -0,0 +1,62 @@
package com.heyu.api.controller.certificate;
import com.heyu.api.baidu.handle.certificate.BThreeFactorsVerificationHandle;
import com.heyu.api.baidu.request.certificate.BFourFactorsVerificationRequest;
import com.heyu.api.baidu.response.certificate.BThreeFactorsVerificationResp;
import com.heyu.api.controller.BaseController;
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 com.heyu.api.resp.certificate.Factors4VerificationResp;
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;
/***
* https://console.bce.baidu.com/support/?_=1740219852952&timestamp=1742615758969#/api?product=AI&project=%E6%96%87%E5%AD%97%E8%AF%86%E5%88%AB&parent=%E5%8D%A1%E8%AF%81OCR&api=rest%2F2.0%2Focr%2Fv1%2Fthree_factors_verification&method=post
*
* 企业三要素核验
*
*
* 接口描述
* 通过核验企业名称统一社会信用代码法人姓名一致性快速核验企业资质
*
* 目前支持工商注册的企业认证事业单位律师事务所等信息暂不支持验证发生工商变更或刚注册的企业信息预计在企业公示的核准日期T+3个工作日后可进行验证
*
*/
@Slf4j
@RestController
@RequestMapping("/factors3")
@NotIntercept
public class Factors3VerificationController extends BaseController {
@Autowired
private BThreeFactorsVerificationHandle bFourFactorsVerificationHandle;
@RequestMapping("/recognize")
@CacheResult
public R recognize(BFourFactorsVerificationRequest request) {
Factors4VerificationResp resp = new Factors4VerificationResp();
ApiR<BThreeFactorsVerificationResp> bR = bFourFactorsVerificationHandle.handle(request);
if (bR.isSuccess()) {
BThreeFactorsVerificationResp bFourFactorsVerificationResp = bR.getData();
BThreeFactorsVerificationResp.WordsResultDTO wordsResultDTO = bFourFactorsVerificationResp.getWordsResult();
resp.setVerifyresult(wordsResultDTO.getVerifyresult());
resp.setNamematch(wordsResultDTO.getNamematch());
resp.setCompanymatch(wordsResultDTO.getCompanymatch());
resp.setRegnummatch(wordsResultDTO.getRegnummatch());
return R.ok().setData(resp);
}
return R.error(bR.getErrorMsg());
}
}

View File

@ -0,0 +1,66 @@
package com.heyu.api.controller.certificate;
import com.heyu.api.baidu.handle.certificate.BFourFactorsVerificationHandle;
import com.heyu.api.baidu.request.certificate.BFourFactorsVerificationRequest;
import com.heyu.api.baidu.response.certificate.BFourFactorsVerificationResp;
import com.heyu.api.controller.BaseController;
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 com.heyu.api.resp.certificate.Factors4VerificationResp;
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;
/***
* https://console.bce.baidu.com/support/?_=1740219852952&timestamp=1742614719901#/api?product=AI&project=%E6%96%87%E5%AD%97%E8%AF%86%E5%88%AB&parent=%E5%8D%A1%E8%AF%81OCR&api=rest%2F2.0%2Focr%2Fv1%2Ffour_factors_verification&method=post
*
* 企业四要素核验
*
*
* 接口描述
* 比对校验企业名称统一社会信用代码法人姓名注册证件号的一致性验证企业工商信息
*
* 目前支持工商注册的企业认证事业单位律师事务所等信息暂不支持验证发生工商变更或刚注册的企业信息预计在企业公示的核准日期T+15个工作日后可进行验证
*
*
*
*/
@Slf4j
@RestController
@RequestMapping("/factors4")
@NotIntercept
public class Factors4VerificationController extends BaseController {
@Autowired
private BFourFactorsVerificationHandle bFourFactorsVerificationHandle;
@RequestMapping("/recognize")
@CacheResult
public R recognize(BFourFactorsVerificationRequest request) {
Factors4VerificationResp resp = new Factors4VerificationResp();
ApiR<BFourFactorsVerificationResp> bR = bFourFactorsVerificationHandle.handle(request);
if (bR.isSuccess()) {
BFourFactorsVerificationResp bFourFactorsVerificationResp = bR.getData();
BFourFactorsVerificationResp.WordsResultDTO wordsResultDTO = bFourFactorsVerificationResp.getWordsResult();
resp.setVerifyresult(wordsResultDTO.getVerifyresult());
resp.setNamematch(wordsResultDTO.getNamematch());
resp.setCompanymatch(wordsResultDTO.getCompanymatch());
resp.setRegnummatc(wordsResultDTO.getRegnummatch());
resp.setIdnummatch(wordsResultDTO.getIdnummatch());
return R.ok().setData(resp);
}
return R.error(bR.getErrorMsg());
}
}

View File

@ -0,0 +1,62 @@
package com.heyu.api.controller.certificate;
import com.heyu.api.baidu.handle.certificate.BFoodProductLicenseHandle;
import com.heyu.api.baidu.request.certificate.BFoodProductLicenseRequest;
import com.heyu.api.controller.BaseController;
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.MapUtils;
import com.heyu.api.data.utils.R;
import com.heyu.api.resp.certificate.FoodProductLicenseResp;
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;
import java.util.Map;
@Slf4j
@RestController
@RequestMapping("/foodProductLicense")
@NotIntercept
public class FoodProductLicenseController extends BaseController {
@Autowired
private BFoodProductLicenseHandle bFoodProductLicenseHandle;
@RequestMapping("/recognize")
@CacheResult
public R recognize(BFoodProductLicenseRequest request) {
FoodProductLicenseResp resp = new FoodProductLicenseResp();
ApiR<Map> bR = bFoodProductLicenseHandle.handle(request);
if (bR.isSuccess()) {
Map<String, Object> data = bR.getData();
resp.setDaySupervisionUnit(MapUtils.getByExpr(data, "words_result.日常监督管理机构"));
resp.setDaySupervisionPerson(MapUtils.getByExpr(data, "words_result.日常监督管理人员"));
resp.setIssuanceDate(MapUtils.getByExpr(data, "words_result.签发日期"));
resp.setReportingPhoneNumber(MapUtils.getByExpr(data, "words_result.投诉举报电话等信息"));
resp.setValidDateEnd(MapUtils.getByExpr(data, "words_result.有效期至"));
resp.setLicenseNumber(MapUtils.getByExpr(data, "words_result.许可证编号"));
resp.setLegalPerson(MapUtils.getByExpr(data, "words_result.法定代表人"));
resp.setProductAddress(MapUtils.getByExpr(data, "words_result.社会信用代码"));
resp.setAddress(MapUtils.getByExpr(data, "words_result.住所"));
resp.setFoodType(MapUtils.getByExpr(data, "words_result.食品类别"));
resp.setIssuingAuthority(MapUtils.getByExpr(data, "words_result.发证机关"));
resp.setIssuingPerson(MapUtils.getByExpr(data, "words_result.签发人"));
resp.setProductName(MapUtils.getByExpr(data, "words_result.生产者名称"));
return R.ok().setData(resp);
}
return R.error();
}
}

View File

@ -0,0 +1,28 @@
package com.heyu.api.resp.certificate;
import com.heyu.api.data.dto.BaseResp;
import lombok.Data;
@Data
public class Factors2VerificationResp extends BaseResp {
/**
* 返回值为:
* -1四要素完全匹配
* -0四要素不完全匹配
*/
private String verifyresult;
/***
* 企业名称 1匹配 0不匹配 2无法验证
*/
private String companymatch;
/***
* 统一社会信用代码 1匹配 0不匹配 2无法验证
*/
private String regnummatch;
}

View File

@ -0,0 +1,35 @@
package com.heyu.api.resp.certificate;
import com.heyu.api.data.dto.BaseResp;
import lombok.Data;
@Data
public class Factors3VerificationResp extends BaseResp {
/**
* 返回值为:
* -1四要素完全匹配
* -0四要素不完全匹配
*/
private String verifyresult;
/***
* 注册证件号 1匹配 0不匹配 2无法验证
*/
private String idnummatch;
/***
* 法人姓名 1匹配 0不匹配 2无法验证
*/
private String namematch;
/***
* 企业名称 1匹配 0不匹配 2无法验证
*/
private String companymatch;
/***
* 统一社会信用代码 1匹配 0不匹配 2无法验证
*/
private String regnummatc;
}

View File

@ -0,0 +1,32 @@
package com.heyu.api.resp.certificate;
import com.heyu.api.data.dto.BaseResp;
import lombok.Data;
@Data
public class Factors4VerificationResp extends BaseResp {
/**
* 返回值为:
* -1四要素完全匹配
* -0四要素不完全匹配
*/
private String verifyresult;
/***
* 法人姓名 1匹配 0不匹配 2无法验证
*/
private String namematch;
/***
* 企业名称 1匹配 0不匹配 2无法验证
*/
private String companymatch;
/***
* 统一社会信用代码 1匹配 0不匹配 2无法验证
*/
private String regnummatch;
}

View File

@ -0,0 +1,85 @@
package com.heyu.api.resp.certificate;
import com.heyu.api.data.dto.BaseResp;
import lombok.Data;
@Data
public class FoodProductLicenseResp extends BaseResp {
/***
* 日常监督管理机构
*/
private String daySupervisionUnit;
/***
* 日常监督管理人员
*/
private String daySupervisionPerson;
/***
* 签发日期
*/
private String issuanceDate;
/***
* 投诉举报电话等信息
*/
private String reportingPhoneNumber;
/***
* 有效期至
*/
private String validDateEnd;
/***
* 许可证编号
*/
private String licenseNumber;
/***
* 法定代表人
*/
private String legalPerson;
/***
* 生产地址
*/
private String productAddress;
/***
* 住所
*/
private String address;
/**
* 食品类别
*/
private String foodType;
/***
* 发证机关
*/
private String issuingAuthority;
/**
* 签发人
*/
private String issuingPerson;
/***
* 生产者名称
*/
private String productName;
}