提交修改
This commit is contained in:
parent
fc135c0f8b
commit
41fb0960fc
@ -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.BDivorceCertificateRequest;
|
||||
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×tamp=1740323750254#/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%2Fdivorce_certificate&method=post
|
||||
* <p>
|
||||
@ -17,7 +18,7 @@ import org.springframework.stereotype.Component;
|
||||
@Component
|
||||
@Slf4j
|
||||
@CustomPath("divorceCertificate")
|
||||
public class BDivorceCertificateHandle extends BaiduBaseHandle<BDivorceCertificateRequest, JSONObject> {
|
||||
public class BDivorceCertificateHandle extends BaiduBaseHandle<BDivorceCertificateRequest, Map> {
|
||||
|
||||
@Override
|
||||
public String getUri() {
|
||||
|
||||
@ -0,0 +1,102 @@
|
||||
package com.heyu.api.controller.certificate;
|
||||
|
||||
|
||||
import com.heyu.api.baidu.handle.certificate.BDivorceCertificateHandle;
|
||||
import com.heyu.api.baidu.request.certificate.BDivorceCertificateRequest;
|
||||
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.DivorceCertificateResp;
|
||||
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;
|
||||
|
||||
/***
|
||||
*
|
||||
* https://console.bce.baidu.com/support/?_=1740219852952×tamp=1742570382939#/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%2Fdivorce_certificate&method=post
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* 接口描述
|
||||
* 支持对离婚证进行结构化识别,包括姓名_男、身份证件号_男、出生日期_男、国籍_男、性别_男、姓名_女、身份证件号_女、出生日期_女、国籍_女、性别_女、离婚证字号、持证人、备注、登记日期,全部 14 个字段。
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/divorceCertificate")
|
||||
@NotIntercept
|
||||
public class DivorceCertificateController extends BaseController {
|
||||
|
||||
|
||||
@Autowired
|
||||
private BDivorceCertificateHandle bDivorceCertificateHandle;
|
||||
|
||||
|
||||
@RequestMapping("/recognize")
|
||||
@CacheResult
|
||||
public R recognize(BDivorceCertificateRequest request) {
|
||||
DivorceCertificateResp resp = new DivorceCertificateResp();
|
||||
|
||||
ApiR<Map> bR = bDivorceCertificateHandle.handle(request);
|
||||
if (bR.isSuccess()) {
|
||||
Map<String, Object> data = bR.getData();
|
||||
resp.setManRealName(MapUtils.getByExpr(data, "words_result.姓名_男.word"));
|
||||
resp.setManRealNameConfidence(MapUtils.getByExpr(data, "words_result.姓名_男.probability"));
|
||||
|
||||
resp.setManIdCard(MapUtils.getByExpr(data, "words_result.身份证件号_男.word"));
|
||||
resp.setManIdCardConfidence(MapUtils.getByExpr(data, "words_result.身份证件号_男.probability"));
|
||||
|
||||
resp.setManBirthday(MapUtils.getByExpr(data, "words_result.出生日期_男.word"));
|
||||
resp.setManBirthdayConfidence(MapUtils.getByExpr(data, "words_result.出生日期_男.probability"));
|
||||
|
||||
resp.setManNationality(MapUtils.getByExpr(data, "words_result.国籍_男.word"));
|
||||
resp.setManNationalityConfidence(MapUtils.getByExpr(data, "words_result.国籍_男.probability"));
|
||||
|
||||
resp.setManGender(MapUtils.getByExpr(data, "words_result.性别_男.word"));
|
||||
resp.setManGenderConfidence(MapUtils.getByExpr(data, "words_result.性别_男.probability"));
|
||||
|
||||
resp.setWomanRealName(MapUtils.getByExpr(data, "words_result.姓名_女.word"));
|
||||
resp.setWomanRealNameConfidence(MapUtils.getByExpr(data, "words_result.姓名_女.probability"));
|
||||
|
||||
resp.setWomanIdCard(MapUtils.getByExpr(data, "words_result.身份证件号_女.word"));
|
||||
resp.setWomanIdCardConfidence(MapUtils.getByExpr(data, "words_result.身份证件号_女.probability"));
|
||||
|
||||
resp.setWomanBirthday(MapUtils.getByExpr(data, "words_result.出生日期_女.word"));
|
||||
resp.setWomanBirthdayConfidence(MapUtils.getByExpr(data, "words_result.出生日期_女.probability"));
|
||||
|
||||
resp.setWomanNationality(MapUtils.getByExpr(data, "words_result.国籍_女.word"));
|
||||
resp.setWomanNationalityConfidence(MapUtils.getByExpr(data, "words_result.国籍_女.probability"));
|
||||
|
||||
resp.setWomanGender(MapUtils.getByExpr(data, "words_result.性别_女.word"));
|
||||
resp.setWomanGenderConfidence(MapUtils.getByExpr(data, "words_result.性别_女.probability"));
|
||||
|
||||
resp.setRegisterDate(MapUtils.getByExpr(data, "words_result.登记日期.word"));
|
||||
resp.setRegisterDateConfidence(MapUtils.getByExpr(data, "words_result.登记日期.probability"));
|
||||
|
||||
resp.setDivorceNumber(MapUtils.getByExpr(data, "words_result.离婚证字号.word"));
|
||||
resp.setDivorceNumberConfidence(MapUtils.getByExpr(data, "words_result.离婚证字号.probability"));
|
||||
|
||||
resp.setHolderCertified(MapUtils.getByExpr(data, "words_result.持证人.word"));
|
||||
resp.setHolderCertifiedConfidence(MapUtils.getByExpr(data, "words_result.持证人.probability"));
|
||||
|
||||
resp.setRemark(MapUtils.getByExpr(data, "words_result.备注.word"));
|
||||
resp.setRemarkConfidence(MapUtils.getByExpr(data, "words_result.备注.probability"));
|
||||
|
||||
return R.ok().setData(resp);
|
||||
}
|
||||
|
||||
return R.error(bR.getErrorMsg());
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
package com.heyu.api.request.certificate;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
@Data
|
||||
public class DivorceCertificateReq {
|
||||
}
|
||||
@ -0,0 +1,160 @@
|
||||
package com.heyu.api.resp.certificate;
|
||||
|
||||
import com.heyu.api.data.dto.BaseResp;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
@Data
|
||||
public class DivorceCertificateResp extends BaseResp {
|
||||
|
||||
|
||||
/***
|
||||
* 姓名_男
|
||||
*/
|
||||
private String manRealName;
|
||||
|
||||
/***
|
||||
* 姓名_男 置信度
|
||||
*/
|
||||
private String manRealNameConfidence;
|
||||
/***
|
||||
* 身份证件号_男
|
||||
*/
|
||||
private String manIdCard;
|
||||
|
||||
/***
|
||||
* 身份证件号_男 置信度
|
||||
*/
|
||||
private String manIdCardConfidence;
|
||||
|
||||
/**
|
||||
* 出生日期_男
|
||||
*/
|
||||
private String manBirthday;
|
||||
/**
|
||||
* 出生日期_男 置信度
|
||||
*/
|
||||
private String manBirthdayConfidence;
|
||||
|
||||
|
||||
/**
|
||||
* 国籍_男
|
||||
*
|
||||
*/
|
||||
private String manNationality;
|
||||
|
||||
/***
|
||||
* 国籍_男 置信度
|
||||
*/
|
||||
private String manNationalityConfidence;
|
||||
|
||||
|
||||
/***
|
||||
* 性别_男
|
||||
*/
|
||||
private String manGender;
|
||||
|
||||
/***
|
||||
* 性别_男 置信度
|
||||
*/
|
||||
private String manGenderConfidence;
|
||||
|
||||
/***
|
||||
* 姓名_女
|
||||
*/
|
||||
private String womanRealName;
|
||||
|
||||
/***
|
||||
* 姓名_女 置信度
|
||||
*/
|
||||
private String womanRealNameConfidence;
|
||||
|
||||
/***
|
||||
* 身份证件号_女
|
||||
*/
|
||||
private String womanIdCard;
|
||||
|
||||
/***
|
||||
* 身份证件号_女 置信度
|
||||
*/
|
||||
private String womanIdCardConfidence;
|
||||
|
||||
|
||||
/***
|
||||
* 出生日期_女
|
||||
*/
|
||||
private String womanBirthday;
|
||||
/***
|
||||
* 出生日期_女 置信度
|
||||
*/
|
||||
private String womanBirthdayConfidence;
|
||||
|
||||
/***
|
||||
* 国籍_女
|
||||
*/
|
||||
private String womanNationality;
|
||||
|
||||
/***
|
||||
* 出生日期_女 置信度
|
||||
*/
|
||||
private String womanNationalityConfidence;
|
||||
|
||||
/***
|
||||
* 性别_女
|
||||
*/
|
||||
private String womanGender;
|
||||
|
||||
/***
|
||||
* 性别_女 置信度
|
||||
*/
|
||||
private String womanGenderConfidence;
|
||||
|
||||
|
||||
/***
|
||||
* 登记日期
|
||||
*
|
||||
*/
|
||||
private String registerDate ;
|
||||
|
||||
/***
|
||||
* 登记日期 置信度
|
||||
*
|
||||
*/
|
||||
private String registerDateConfidence;
|
||||
|
||||
|
||||
/***
|
||||
* 离婚证字号
|
||||
*/
|
||||
private String divorceNumber;
|
||||
|
||||
|
||||
/***
|
||||
* 离婚证字号 置信度
|
||||
*/
|
||||
private String divorceNumberConfidence;
|
||||
|
||||
|
||||
/***
|
||||
* 持证人
|
||||
*/
|
||||
private String holderCertified;
|
||||
|
||||
/***
|
||||
* 持证人 置信度
|
||||
*/
|
||||
private String holderCertifiedConfidence;
|
||||
|
||||
/***
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/***
|
||||
* 备注 置信度
|
||||
*/
|
||||
private String remarkConfidence;
|
||||
|
||||
|
||||
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user