Merge branch 'master' of https://git.iwulin.tech/quyixiao/eb-service-api
This commit is contained in:
commit
f6e76fe0ac
@ -15,17 +15,17 @@ public class BMultipleInvoiceRequest extends BaiduOfdRequest {
|
||||
/**
|
||||
* 是否开启验真,默认为 false,即不开启,当为 true 时,返回匹配发票验真接口所需的6要素信息,具体返回信息详见末尾说明
|
||||
*/
|
||||
private String verifyParameter = "false";
|
||||
private String verifyParameter = "true";
|
||||
|
||||
/**
|
||||
* 是否返回字段置信度,默认为 false ,即不返回
|
||||
*/
|
||||
private String probability = "false";
|
||||
private String probability = "true";
|
||||
|
||||
/**
|
||||
* 是否返回字段位置坐标,默认为 false,即不返回
|
||||
*/
|
||||
private String location = "false";
|
||||
private String location = "true";
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -5,6 +5,7 @@ import com.aliyun.ocr20191230.models.RecognizeTaxiInvoiceResponse;
|
||||
import com.aliyun.ocr20191230.models.RecognizeTaxiInvoiceResponseBody;
|
||||
import com.heyu.api.alibaba.handle.common.text.ARecognizeTaxiInvoiceHandle;
|
||||
import com.heyu.api.alibaba.request.common.text.ARecognizeTaxiInvoiceRequest;
|
||||
import com.heyu.api.baidu.handle.financial.BTaxiReceiptHandle;
|
||||
import com.heyu.api.controller.BaseController;
|
||||
import com.heyu.api.data.annotation.NotIntercept;
|
||||
import com.heyu.api.data.utils.ApiR;
|
||||
@ -21,6 +22,9 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
*出租车发票识别能力可以准确识别出全国各大城市出租车发票在图像中的位置,支持出租车发票结构化识别,输出发票号码、代码、车号、日期、时间、金额,共 6 个关键字段信息。
|
||||
*
|
||||
*
|
||||
*
|
||||
* https://console.bce.baidu.com/support/?_=1740575657628×tamp=1740577722254#/api?product=AI&project=%E6%96%87%E5%AD%97%E8%AF%86%E5%88%AB&parent=%E8%B4%A2%E5%8A%A1%E7%A5%A8%E6%8D%AEOCR&api=rest%2F2.0%2Focr%2Fv1%2Ftaxi_receipt&method=post
|
||||
*
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@ -32,6 +36,9 @@ public class RecognizeTaxiInvoiceController extends BaseController {
|
||||
@Autowired
|
||||
private ARecognizeTaxiInvoiceHandle arRecognizeTaxiInvoiceHandle;
|
||||
|
||||
@Autowired
|
||||
private BTaxiReceiptHandle bTaxiReceiptHandle;
|
||||
|
||||
|
||||
@RequestMapping("/recognize")
|
||||
public R recognize(ARecognizeTaxiInvoiceRequest request) {
|
||||
|
||||
@ -0,0 +1,73 @@
|
||||
package com.heyu.api.controller.financial;
|
||||
|
||||
|
||||
import com.heyu.api.baidu.handle.financial.BBankReceiptNewHandle;
|
||||
import com.heyu.api.baidu.request.financial.BBankReceiptNewRequest;
|
||||
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.financial.BankReceiptNewResp;
|
||||
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/?_=1740575657628×tamp=1742739144533#/api?product=AI&project=%E6%96%87%E5%AD%97%E8%AF%86%E5%88%AB&parent=%E8%B4%A2%E5%8A%A1%E7%A5%A8%E6%8D%AEOCR&api=rest%2F2.0%2Focr%2Fv1%2Fbank_receipt_new&method=post
|
||||
*
|
||||
*银行回单识别
|
||||
*
|
||||
*接口描述
|
||||
* 支持对不同版式银行回单进行结构化识别,包括标题、付款人户名、付款人开户银行、付款人账号、收款人户名、收款人开户银行、收款人账号、大写金额、小写金额、流水号、回单编号、交易日期、摘要、用途 14个关键字段。
|
||||
*
|
||||
*
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/bankReceipt")
|
||||
@NotIntercept
|
||||
public class BankReceiptNewController extends BaseController {
|
||||
|
||||
|
||||
@Autowired
|
||||
private BBankReceiptNewHandle bankReceiptNewHandle;
|
||||
|
||||
|
||||
@RequestMapping("/recognize")
|
||||
@CacheResult
|
||||
public R recognize(BBankReceiptNewRequest req) {
|
||||
ApiR<Map> bR = bankReceiptNewHandle.handle(req);
|
||||
if (bR.isSuccess()) {
|
||||
Map<String, Object> data = bR.getData();
|
||||
BankReceiptNewResp resp = new BankReceiptNewResp();
|
||||
|
||||
resp.setTitle(MapUtils.getByExpr(data, "words_result.标题.[0].word"));// 标题
|
||||
resp.setPayPersonName(MapUtils.getByExpr(data, "words_result.付款人户名.[0].word")); // 付款人户名
|
||||
resp.setPayBankName(MapUtils.getByExpr(data, "words_result.付款人开户银行.[0].word")); //付款人开户银行
|
||||
resp.setPayAcount(MapUtils.getByExpr(data, "words_result.付款人账号.[0].word"));//付款人账号
|
||||
resp.setPayeeAcount(MapUtils.getByExpr(data, "words_result.收款人户名.[0].word")); //付款人账号
|
||||
resp.setPayeeName(MapUtils.getByExpr(data, "words_result.付款人户名.[0].word")); //收款人户名
|
||||
resp.setPayeeBankName(MapUtils.getByExpr(data, "words_result.收款人开户银行.[0].word"));//收款人开户银行
|
||||
resp.setPayeeBankAccount(MapUtils.getByExpr(data, "words_result.收款人账号.[0].word")); // 收款人账号
|
||||
resp.setCapsAmount(MapUtils.getByExpr(data, "words_result.大写金额.[0].word")); // 大写金额
|
||||
resp.setLowerCaseAmount(MapUtils.getByExpr(data, "words_result.小写金额.[0].word")); // 小写金额
|
||||
resp.setSerialNumber(MapUtils.getByExpr(data, "words_result.流水号.[0].word")); // 流水号
|
||||
resp.setReplyNumber(MapUtils.getByExpr(data, "words_result.回单编号.[0].word"));// 回单编号;
|
||||
resp.setTradeDate(MapUtils.getByExpr(data, "words_result.交易日期.[0].word")); // 交易日期
|
||||
resp.setSummary(MapUtils.getByExpr(data, "words_result.摘要.[0].word"));// 摘要
|
||||
resp.setUse(MapUtils.getByExpr(data, "words_result.用途.[0].word"));//用途
|
||||
|
||||
return R.ok().setData(resp);
|
||||
}
|
||||
|
||||
return R.error();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,81 @@
|
||||
package com.heyu.api.controller.financial;
|
||||
|
||||
|
||||
import com.heyu.api.baidu.handle.financial.BBusTicketHandle;
|
||||
import com.heyu.api.baidu.request.financial.BBusTicketRequest;
|
||||
import com.heyu.api.baidu.response.financial.BBusTicketResp;
|
||||
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.financial.BusTicketResp;
|
||||
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/?_=1740575657628×tamp=1740578576329#/api?product=AI&project=%E6%96%87%E5%AD%97%E8%AF%86%E5%88%AB&parent=%E8%B4%A2%E5%8A%A1%E7%A5%A8%E6%8D%AEOCR&api=rest%2F2.0%2Focr%2Fv1%2Fbus_ticket&method=post
|
||||
* 汽车票识别
|
||||
*
|
||||
*
|
||||
* 接口描述
|
||||
* 支持对全国范围不同版式汽车票的发票代码、发票号码、到达站、出发站、日期、时间、金额、身份证号、姓名、开票日期10个字段进行结构化识别。
|
||||
*
|
||||
*/
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/bus/ticket")
|
||||
@NotIntercept
|
||||
public class BusTicketController extends BaseController {
|
||||
|
||||
|
||||
@Autowired
|
||||
private BBusTicketHandle bBusTicketHandle;
|
||||
|
||||
|
||||
@RequestMapping("/recognize")
|
||||
@CacheResult
|
||||
public R recognize(BBusTicketRequest req) {
|
||||
|
||||
BusTicketResp resp = new BusTicketResp();
|
||||
ApiR<BBusTicketResp> bR = bBusTicketHandle.handle(req);
|
||||
|
||||
if (bR.isSuccess()) {
|
||||
BBusTicketResp bBusTicketResp = bR.getData();
|
||||
BBusTicketResp.WordsResultDTO wordsResultDTO = bBusTicketResp.getWordsResult();
|
||||
|
||||
resp.setDestinationStation(wordsResultDTO.getDestinationStation()); // 到达站
|
||||
resp.setIdNum(wordsResultDTO.getIdNum());// 身份证号
|
||||
resp.setTime(wordsResultDTO.getTime()); //时间
|
||||
resp.setInvoiceCode(wordsResultDTO.getInvoiceCode()); //发票代码
|
||||
resp.setInvoiceNum(wordsResultDTO.getInvoiceNum()); // 发票号码
|
||||
resp.setStartingStation(wordsResultDTO.getStartingStation()); //出发站
|
||||
resp.setDate(wordsResultDTO.getDate()); //日期
|
||||
resp.setName(wordsResultDTO.getName()); //姓名
|
||||
resp.setFare(wordsResultDTO.getFare()); //金额
|
||||
|
||||
return R.ok().setData(resp);
|
||||
}
|
||||
return R.error();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,67 @@
|
||||
package com.heyu.api.controller.financial;
|
||||
|
||||
|
||||
import com.heyu.api.baidu.handle.financial.BFerryTicketHandle;
|
||||
import com.heyu.api.baidu.request.financial.BFerryTicketRequest;
|
||||
import com.heyu.api.baidu.response.financial.BFerryTicketResp;
|
||||
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.financial.FerryTicketResp;
|
||||
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/?_=1740575657628×tamp=1740579219270#/api?product=AI&project=%E6%96%87%E5%AD%97%E8%AF%86%E5%88%AB&parent=%E8%B4%A2%E5%8A%A1%E7%A5%A8%E6%8D%AEOCR&api=rest%2F2.0%2Focr%2Fv1%2Fferry_ticket&method=post
|
||||
* <p>
|
||||
* <p>
|
||||
* 船票识别
|
||||
*
|
||||
* 接口描述
|
||||
* 对全国范围内不同版式的客运船票、货运船票进行结构化识别,包括发票代码、发票号码、发票日期、发票类型、总金额、出发地点、到达地点等7个字段。
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/ferry/ticket")
|
||||
@NotIntercept
|
||||
public class FerryTicketController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private BFerryTicketHandle bFerryTicketHandle;
|
||||
|
||||
@RequestMapping("/recognize")
|
||||
@CacheResult
|
||||
public R recognize(BFerryTicketRequest req) {
|
||||
|
||||
FerryTicketResp resp = new FerryTicketResp();
|
||||
|
||||
|
||||
ApiR<BFerryTicketResp> bR = bFerryTicketHandle.handle(req);
|
||||
if (bR.isSuccess()) {
|
||||
BFerryTicketResp bFerryTicketResp = bR.getData();
|
||||
|
||||
|
||||
BFerryTicketResp.WordsResultDTO wordsResultDTO = bFerryTicketResp.getWordsResult();
|
||||
|
||||
resp.setInvoiceType(wordsResultDTO.getInvoiceType()); //发票类型
|
||||
resp.setInvoiceCode(wordsResultDTO.getInvoiceCode()); // 发票代码
|
||||
resp.setInvoiceNum(wordsResultDTO.getInvoiceNum()); //发票号码
|
||||
resp.setStartingStation(wordsResultDTO.getStartingStation()); // 出发地点
|
||||
resp.setDestinationStation(wordsResultDTO.getDestinationStation()); //到达地点
|
||||
resp.setInvoiceDate(wordsResultDTO.getInvoiceDate()); // 开票日期
|
||||
resp.setFare(wordsResultDTO.getFare()); // 总金额
|
||||
|
||||
|
||||
return R.ok().setData(resp);
|
||||
}
|
||||
|
||||
|
||||
return R.error();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,106 @@
|
||||
package com.heyu.api.controller.financial;
|
||||
|
||||
|
||||
import com.heyu.api.baidu.handle.financial.BInvoiceHandle;
|
||||
import com.heyu.api.baidu.request.financial.BInvoiceRequest;
|
||||
import com.heyu.api.baidu.response.financial.BInvoiceResp;
|
||||
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.financial.InvoiceResp;
|
||||
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.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/***
|
||||
* https://console.bce.baidu.com/support/?_=1740575657628×tamp=1742742293465#/api?product=AI&project=%E6%96%87%E5%AD%97%E8%AF%86%E5%88%AB&parent=%E8%B4%A2%E5%8A%A1%E7%A5%A8%E6%8D%AEOCR&api=rest%2F2.0%2Focr%2Fv1%2Finvoice&method=post
|
||||
*
|
||||
* 通用机打发票识别
|
||||
*
|
||||
*
|
||||
*
|
||||
* 接口描述
|
||||
* 支持对国家/地方税务局发行的横/竖版通用机打发票的23个关键字段进行结构化识别,包括发票类型、发票号码、发票代码、开票日期、合计金额大写、合计金额小写、商品名称、商品单位、商品单价、商品数量、商品金额、机打代码、
|
||||
* 机打号码、校验码、销售方名称、销售方纳税人识别号、购买方名称、购买方纳税人识别号、合计税额等。
|
||||
*
|
||||
*
|
||||
* 在线调试
|
||||
* 您可以在 示例代码中心 中调试该接口,可进行签名验证、查看在线调用的请求内容和返回结果、示例代码的自动生成。
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/invoice")
|
||||
@NotIntercept
|
||||
public class InvoiceController {
|
||||
|
||||
|
||||
@Autowired
|
||||
private BInvoiceHandle bInvoiceHandle;
|
||||
|
||||
|
||||
@RequestMapping("/recognize")
|
||||
@CacheResult
|
||||
public R recognize(BInvoiceRequest req) {
|
||||
|
||||
InvoiceResp resp = new InvoiceResp();
|
||||
|
||||
|
||||
ApiR<BInvoiceResp> bR = bInvoiceHandle.handle(req);
|
||||
if (bR.isSuccess()) {
|
||||
BInvoiceResp bInvoiceResp = bR.getData();
|
||||
BInvoiceResp.WordsResultDTO wordsResultDTO = bInvoiceResp.getWordsResult();
|
||||
|
||||
resp.setCity(wordsResultDTO.getCity()); //市
|
||||
resp.setInvoiceNum(wordsResultDTO.getInvoiceNum()); // 发票号码
|
||||
resp.setSellerName(wordsResultDTO.getSellerName()); // 销售方名称
|
||||
resp.setIndustrySort(wordsResultDTO.getIndustrySort()); // 行业分类
|
||||
resp.setProvince(wordsResultDTO.getProvince()); // 省
|
||||
|
||||
List<InvoiceResp.CommodityDTO> commodityAmountList = new ArrayList<>();
|
||||
|
||||
for (BInvoiceResp.WordsResultDTO.CommodityAmountDTO commodityAmountDTO : wordsResultDTO.getCommodityAmount()) {
|
||||
InvoiceResp.CommodityDTO commodityDTO = new InvoiceResp.CommodityDTO();
|
||||
commodityDTO.setWord(commodityAmountDTO.getWord());
|
||||
commodityDTO.setRow(commodityAmountDTO.getRow());
|
||||
commodityAmountList.add(commodityDTO);
|
||||
}
|
||||
|
||||
resp.setCommodityAmount(commodityAmountList); // 商品金额
|
||||
|
||||
resp.setInvoiceDate(wordsResultDTO.getInvoiceDate()); //开票日期
|
||||
resp.setPurchaserName(wordsResultDTO.getPurchaserName()); //购买方名称
|
||||
resp.setCommodityNum(wordsResultDTO.getCommodityNum()); //商品数量
|
||||
resp.setInvoiceCode(wordsResultDTO.getCheckCode()); // 发票代码
|
||||
resp.setCommodityUnit(wordsResultDTO.getCommodityUnit()); //商品单位
|
||||
resp.setSheetNum(wordsResultDTO.getSheetNum()); //联次
|
||||
resp.setPurchaserRegisterNum(wordsResultDTO.getPurchaserRegisterNum()); //购买方纳税人识别号
|
||||
resp.setTime(wordsResultDTO.getTime()); //时间
|
||||
resp.setCommodityPrice(wordsResultDTO.getCommodityPrice()); // 商品单价
|
||||
resp.setAmountInFiguers(wordsResultDTO.getAmountInFiguers()); //合计金额小写
|
||||
resp.setAmountInWords(wordsResultDTO.getAmountInWords()); //合计金额大写
|
||||
resp.setCheckCode(wordsResultDTO.getCheckCode()); //校验码
|
||||
resp.setTotalTax(wordsResultDTO.getTotalTax()); //合计税额
|
||||
resp.setInvoiceType(wordsResultDTO.getInvoiceType()); // 发票类型
|
||||
resp.setSellerRegisterNum(wordsResultDTO.getSellerRegisterNum()); // 销售方纳税人识别号
|
||||
|
||||
List<InvoiceResp.CommodityDTO> commodityNameDTOS = new ArrayList<>();
|
||||
for (BInvoiceResp.WordsResultDTO.CommodityNameDTO commodityNameDTO : wordsResultDTO.getCommodityName()) {
|
||||
InvoiceResp.CommodityDTO commodityDTO = new InvoiceResp.CommodityDTO();
|
||||
|
||||
commodityDTO.setRow(commodityNameDTO.getRow());
|
||||
commodityDTO.setWord(commodityNameDTO.getWord());
|
||||
|
||||
commodityNameDTOS.add(commodityDTO);
|
||||
}
|
||||
|
||||
resp.setCommodityName(commodityNameDTOS); // 商品名称
|
||||
}
|
||||
|
||||
return R.error();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,68 @@
|
||||
package com.heyu.api.controller.financial;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.heyu.api.baidu.handle.financial.BMultipleInvoiceHandle;
|
||||
import com.heyu.api.baidu.request.financial.BMultipleInvoiceRequest;
|
||||
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.financial.MultipleInvoiceResp;
|
||||
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/?_=1740494347073×tamp=1742743299843#/api?product=AI&project=%E6%96%87%E5%AD%97%E8%AF%86%E5%88%AB&parent=%E8%B4%A2%E5%8A%A1%E7%A5%A8%E6%8D%AEOCR&api=rest%2F2.0%2Focr%2Fv1%2Fmultiple_invoice&method=post
|
||||
*
|
||||
*智能财务票据识别
|
||||
*
|
||||
*
|
||||
*
|
||||
接口描述
|
||||
支持财务场景中13种常见票据的分类及结构化识别,包括增值税发票、卷票、机打发票、定额发票、火车票、出租车票、网约车行程单、飞机行程单、汽车票、过路过桥费、船票、
|
||||
机动车/二手车销售发票。支持多张不同种类票据在同一张图片上的混贴场景,可返回每张票据的位置、种类及票面信息的结构化识别结果。
|
||||
|
||||
视频教程请参见 智能财务票据识别+增值税发票验真使用教程
|
||||
*
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/multiple/invoice")
|
||||
@NotIntercept
|
||||
public class MultipleInvoiceController extends BaseController {
|
||||
|
||||
|
||||
@Autowired
|
||||
private BMultipleInvoiceHandle bMultipleInvoiceHandle;
|
||||
|
||||
|
||||
@RequestMapping("/recognize")
|
||||
@CacheResult
|
||||
public R recognize(BMultipleInvoiceRequest req) {
|
||||
MultipleInvoiceResp resp = new MultipleInvoiceResp();
|
||||
|
||||
ApiR<Map> bR = bMultipleInvoiceHandle.handle(req);
|
||||
if (bR.isSuccess()) {
|
||||
Map<String, Object> data = bR.getData();
|
||||
resp.setProbability(MapUtils.getByExpr(data, "words_result.probability"));
|
||||
resp.setType(MapUtils.getByExpr(data, "words_result.type"));
|
||||
String result = MapUtils.getByExpr(data, "words_result.result");
|
||||
Map map = JSONObject.parseObject(result, Map.class);
|
||||
// 后期这个map 可以写成不同的对象,这里需要找到17种发票之后再来写
|
||||
resp.setResult(map);
|
||||
return R.ok().setData(resp);
|
||||
}
|
||||
|
||||
return R.error();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,91 @@
|
||||
package com.heyu.api.controller.financial;
|
||||
|
||||
|
||||
import com.heyu.api.baidu.handle.financial.BOnlineTaxiItineraryHandle;
|
||||
import com.heyu.api.baidu.request.financial.BOnlineTaxiItineraryRequest;
|
||||
import com.heyu.api.baidu.response.financial.BOnlineTaxiItineraryResp;
|
||||
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.financial.OnlineTaxiItineraryResp;
|
||||
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.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* https://console.bce.baidu.com/support/?_=1740575657628×tamp=1740579436479#/api?product=AI&project=%E6%96%87%E5%AD%97%E8%AF%86%E5%88%AB&parent=%E8%B4%A2%E5%8A%A1%E7%A5%A8%E6%8D%AEOCR&api=rest%2F2.0%2Focr%2Fv1%2Fonline_taxi_itinerary&method=post
|
||||
* 网约车行程单识别
|
||||
*
|
||||
* 接口描述
|
||||
* 对各大主要服务商的网约车行程单进行结构化识别,包括滴滴打车、花小猪打车、高德地图、曹操出行、阳光出行,支持识别服务商、行程开始时间、
|
||||
* 行程结束时间、车型、总金额等16 个关键字段。
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/online/taxi/itinerary")
|
||||
@NotIntercept
|
||||
public class OnlineTaxiItineraryController extends BaseController {
|
||||
|
||||
|
||||
@Autowired
|
||||
private BOnlineTaxiItineraryHandle bOnlineTaxiItineraryHandle;
|
||||
|
||||
|
||||
@RequestMapping("/recognize")
|
||||
@CacheResult
|
||||
public R recognize(BOnlineTaxiItineraryRequest req) {
|
||||
|
||||
OnlineTaxiItineraryResp resp = new OnlineTaxiItineraryResp();
|
||||
|
||||
ApiR<BOnlineTaxiItineraryResp> bR = bOnlineTaxiItineraryHandle.handle(req);
|
||||
if (bR.isSuccess()) {
|
||||
BOnlineTaxiItineraryResp bOnlineTaxiItineraryResp = bR.getData();
|
||||
|
||||
BOnlineTaxiItineraryResp.WordsResultDTO wordsResultDTO = bOnlineTaxiItineraryResp.getWordsResult();
|
||||
resp.setTotalFare(wordsResultDTO.getTotalFare());
|
||||
resp.setEndTime(wordsResultDTO.getEndTime());
|
||||
resp.setPhone(wordsResultDTO.getPhone());
|
||||
resp.setServiceProvider(wordsResultDTO.getServiceProvider());
|
||||
resp.setStartTime(wordsResultDTO.getStartTime());
|
||||
resp.setApplicationDate(wordsResultDTO.getApplicationDate());
|
||||
resp.setItemId(wordsResultDTO.getItemId());
|
||||
|
||||
List<OnlineTaxiItineraryResp.ItemsDTO> items = new ArrayList<>();
|
||||
|
||||
|
||||
for (BOnlineTaxiItineraryResp.WordsResultDTO.ItemsDTO item : wordsResultDTO.getItems()) {
|
||||
|
||||
OnlineTaxiItineraryResp.ItemsDTO itemsDTO = new OnlineTaxiItineraryResp.ItemsDTO();
|
||||
itemsDTO.setItemId(item.getItemId());
|
||||
itemsDTO.setStartPlace(item.getStartPlace());
|
||||
item.setPickupTime(item.getPickupTime());
|
||||
item.setCarType(item.getCarType());
|
||||
item.setCity(item.getCity());
|
||||
item.setDistance(item.getDistance());
|
||||
item.setPickupDate(item.getPickupDate());
|
||||
item.setDestinationPlace(item.getDestinationPlace());
|
||||
item.setFare(item.getFare());
|
||||
items.add(itemsDTO);
|
||||
}
|
||||
|
||||
resp.setItems(items);
|
||||
return R.ok().setData(resp);
|
||||
}
|
||||
|
||||
return R.error(bR.getErrorMsg());
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,70 @@
|
||||
package com.heyu.api.controller.financial;
|
||||
|
||||
|
||||
import com.heyu.api.baidu.handle.financial.BQuotaInvoiceHandle;
|
||||
import com.heyu.api.baidu.request.financial.BQuotaInvoiceRequest;
|
||||
import com.heyu.api.baidu.response.financial.BQuotaInvoiceResp;
|
||||
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.financial.QuotaInvoiceResp;
|
||||
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/?_=1740575657628×tamp=1740576567910#/api?product=AI&project=%E6%96%87%E5%AD%97%E8%AF%86%E5%88%AB&parent=%E8%B4%A2%E5%8A%A1%E7%A5%A8%E6%8D%AEOCR&api=rest%2F2.0%2Focr%2Fv1%2Fquota_invoice&method=post
|
||||
*
|
||||
*
|
||||
* 定额发票识别
|
||||
*
|
||||
*
|
||||
* 接口描述
|
||||
* 支持对各类定额发票的发票代码、发票号码、金额、发票所在地、发票金额小写、省、市7个关键字段进行结构化识别。
|
||||
*
|
||||
*/
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/quota/invoice")
|
||||
@NotIntercept
|
||||
public class QuotaInvoiceController extends BaseController {
|
||||
|
||||
|
||||
@Autowired
|
||||
private BQuotaInvoiceHandle bQuotaInvoiceHandle;
|
||||
|
||||
@RequestMapping("/recognize")
|
||||
@CacheResult
|
||||
public R recognize(BQuotaInvoiceRequest req) {
|
||||
|
||||
QuotaInvoiceResp resp = new QuotaInvoiceResp();
|
||||
|
||||
|
||||
ApiR<BQuotaInvoiceResp> bR = bQuotaInvoiceHandle.handle(req);
|
||||
if (bR.isSuccess()) {
|
||||
BQuotaInvoiceResp bQuotaInvoiceResp = bR.getData();
|
||||
|
||||
BQuotaInvoiceResp.WordsResultDTO wordsResultDTO = bQuotaInvoiceResp.getWordsResult();
|
||||
|
||||
|
||||
resp.setInvoiceCode(wordsResultDTO.getInvoiceCode());
|
||||
resp.setInvoiceNumber(wordsResultDTO.getInvoiceNumber());
|
||||
resp.setInvoiceRate(wordsResultDTO.getInvoiceRate());
|
||||
resp.setInvoiceRateLowercase(wordsResultDTO.getInvoiceRateLowercase());
|
||||
resp.setProvince(wordsResultDTO.getProvince());
|
||||
|
||||
|
||||
return R.ok().setData(resp);
|
||||
|
||||
|
||||
}
|
||||
return R.error();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,210 @@
|
||||
package com.heyu.api.controller.financial;
|
||||
|
||||
|
||||
import com.heyu.api.baidu.handle.financial.BShoppingReceiptHandle;
|
||||
import com.heyu.api.baidu.request.financial.BShoppingReceiptRequest;
|
||||
import com.heyu.api.baidu.response.financial.BShoppingReceiptResp;
|
||||
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.financial.ShoppingReceiptResp;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/***
|
||||
* https://console.bce.baidu.com/support/?_=1740575657628×tamp=1740579777572#/api?product=AI&project=%E6%96%87%E5%AD%97%E8%AF%86%E5%88%AB&parent=%E8%B4%A2%E5%8A%A1%E7%A5%A8%E6%8D%AEOCR&api=rest%2F2.0%2Focr%2Fv1%2Fshopping_receipt&method=post
|
||||
*购物小票识别
|
||||
*
|
||||
*
|
||||
*接口描述
|
||||
* 支持识别各类商场、超市及药店的购物小票,包括店名、小票号码、机器编号、工号、消费日期、消费时间、总金额、找零、币种、实收金额、优惠金额、打印日期、打印时间、明细商品名称、单价、数量、小计金额等信息。
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/shipping/invoice")
|
||||
@NotIntercept
|
||||
public class ShoppingReceiptController extends BaseController {
|
||||
|
||||
|
||||
@Autowired
|
||||
private BShoppingReceiptHandle bShoppingReceiptHandle;
|
||||
|
||||
|
||||
@RequestMapping("/recognize")
|
||||
@CacheResult
|
||||
public R recognize(BShoppingReceiptRequest req) {
|
||||
ShoppingReceiptResp resp = new ShoppingReceiptResp();
|
||||
|
||||
ApiR<BShoppingReceiptResp> bR = bShoppingReceiptHandle.handle(req);
|
||||
if (bR.isSuccess()) {
|
||||
BShoppingReceiptResp bShoppingReceiptResp = bR.getData();
|
||||
List<BShoppingReceiptResp.WordsResultDTO> wordsResultDTO = bShoppingReceiptResp.getWordsResult();
|
||||
|
||||
if (CollectionUtils.isNotEmpty(wordsResultDTO)) {
|
||||
for (BShoppingReceiptResp.WordsResultDTO resultDTO : wordsResultDTO) {
|
||||
List<String> totalAmount = new ArrayList<>(); // 总金额
|
||||
|
||||
if (CollectionUtils.isNotEmpty(resultDTO.getTotalAmount())) {
|
||||
for (BShoppingReceiptResp.WordsResultDTO.TotalAmountDTO totalAmountDTO : resultDTO.getTotalAmount()) {
|
||||
totalAmount.add(totalAmountDTO.getWord());
|
||||
}
|
||||
}
|
||||
resp.setTotalAmount(totalAmount);
|
||||
|
||||
|
||||
List<String> discount = new ArrayList<>(); //优惠/折扣
|
||||
if (CollectionUtils.isNotEmpty(resultDTO.getDiscount())) {
|
||||
for (BShoppingReceiptResp.WordsResultDTO.DiscountDTO discountDTO : resultDTO.getDiscount()) {
|
||||
discount.add(discountDTO.getWord());
|
||||
}
|
||||
}
|
||||
resp.setDiscount(discount);
|
||||
|
||||
|
||||
List<String> currency = new ArrayList<>(); // 币种
|
||||
if (CollectionUtils.isNotEmpty(resultDTO.getCurrency())) {
|
||||
for (BShoppingReceiptResp.WordsResultDTO.CurrencyDTO currencyDTO : resultDTO.getCurrency()) {
|
||||
currency.add(currencyDTO.getWord());
|
||||
}
|
||||
}
|
||||
resp.setCurrency(currency);
|
||||
|
||||
|
||||
List<String> receiptNum = new ArrayList<>(); //小票号码
|
||||
if (CollectionUtils.isNotEmpty(resultDTO.getReceiptNum())) {
|
||||
for (BShoppingReceiptResp.WordsResultDTO.ReceiptNumDTO receiptNumDTO : resultDTO.getReceiptNum()) {
|
||||
receiptNum.add(receiptNumDTO.getWord());
|
||||
}
|
||||
}
|
||||
resp.setReceiptNum(receiptNum);
|
||||
|
||||
|
||||
List<String> shopName = new ArrayList<>(); // 店名/超市名字
|
||||
if (CollectionUtils.isNotEmpty(resultDTO.getShopName())) {
|
||||
for (BShoppingReceiptResp.WordsResultDTO.ShopNameDTO shopNameDTO : resultDTO.getShopName()) {
|
||||
shopName.add(shopNameDTO.getWord());
|
||||
|
||||
}
|
||||
}
|
||||
resp.setShopName(shopName);
|
||||
|
||||
|
||||
List<String> consumptionTime = new ArrayList<>(); //消费时间
|
||||
if (CollectionUtils.isNotEmpty(resultDTO.getConsumptionTime())) {
|
||||
for (BShoppingReceiptResp.WordsResultDTO.ConsumptionTimeDTO consumptionTimeDTO : resultDTO.getConsumptionTime()) {
|
||||
consumptionTime.add(consumptionTimeDTO.getWord());
|
||||
}
|
||||
}
|
||||
resp.setConsumptionTime(consumptionTime);
|
||||
|
||||
List<String> consumptionDate = new ArrayList<>(); //消费日期
|
||||
if (CollectionUtils.isNotEmpty(resultDTO.getConsumptionDate())) {
|
||||
for (BShoppingReceiptResp.WordsResultDTO.ConsumptionDateDTO consumptionDateDTO : resultDTO.getConsumptionDate()) {
|
||||
consumptionDate.add(consumptionDateDTO.getWord());
|
||||
|
||||
}
|
||||
}
|
||||
resp.setConsumptionDate(consumptionDate);
|
||||
|
||||
|
||||
Integer tableRowNum = resultDTO.getTableRowNum(); //商品明细行数,表示Table中的object个数
|
||||
resp.setTableRowNum(tableRowNum);
|
||||
|
||||
List<ShoppingReceiptResp.TableDTO> tableList = new ArrayList<>();
|
||||
if (CollectionUtils.isNotEmpty(resultDTO.getTable())) {
|
||||
for (BShoppingReceiptResp.WordsResultDTO.TableDTO tableDTO : resultDTO.getTable()) {
|
||||
|
||||
ShoppingReceiptResp.TableDTO tab = new ShoppingReceiptResp.TableDTO();
|
||||
tab.setProduct(tableDTO.getProduct().getWord());
|
||||
tab.setQuantity(tableDTO.getQuantity().getWord());
|
||||
tab.setSubtotalAmount(tableDTO.getSubtotalAmount().getWord());
|
||||
tab.setUnitPrice(tableDTO.getUnitPrice().getWord());
|
||||
tableList.add(tab);
|
||||
|
||||
}
|
||||
}
|
||||
resp.setTable(tableList);
|
||||
|
||||
|
||||
List<String> paidAmount = new ArrayList<>(); //实收金额
|
||||
if (CollectionUtils.isNotEmpty(resultDTO.getPaidAmount())) {
|
||||
for (BShoppingReceiptResp.WordsResultDTO.PaidAmountDTO paidAmountDTO : resultDTO.getPaidAmount()) {
|
||||
|
||||
paidAmount.add(paidAmountDTO.getWord());
|
||||
}
|
||||
}
|
||||
resp.setPaidAmount(paidAmount);
|
||||
|
||||
|
||||
List<String> printDate = new ArrayList<>(); //打印日期
|
||||
if (CollectionUtils.isNotEmpty(resultDTO.getPrintDate())) {
|
||||
for (BShoppingReceiptResp.WordsResultDTO.PrintDateDTO printDateDTO : resultDTO.getPrintDate()) {
|
||||
|
||||
printDate.add(printDateDTO.getWord());
|
||||
}
|
||||
|
||||
}
|
||||
resp.setPrintDate(printDate);
|
||||
|
||||
List<String> machineNum = new ArrayList<>(); //机器编号
|
||||
if (CollectionUtils.isNotEmpty(resultDTO.getMachineNum())) {
|
||||
for (BShoppingReceiptResp.WordsResultDTO.MachineNumDTO machineNumDTO : resultDTO.getMachineNum()) {
|
||||
machineNum.add(machineNumDTO.getWord());
|
||||
|
||||
}
|
||||
}
|
||||
resp.setMachineNum(machineNum);
|
||||
|
||||
List<String> change = new ArrayList<>(); //找零
|
||||
if (CollectionUtils.isNotEmpty(resultDTO.getChange())) {
|
||||
for (BShoppingReceiptResp.WordsResultDTO.ChangeDTO changeDTO : resultDTO.getChange()) {
|
||||
change.add(changeDTO.getWord());
|
||||
|
||||
}
|
||||
}
|
||||
resp.setChange(change);
|
||||
|
||||
List<String> employeeNum = new ArrayList<>(); //工号
|
||||
if (CollectionUtils.isNotEmpty(resultDTO.getEmployeeNum())) {
|
||||
for (BShoppingReceiptResp.WordsResultDTO.EmployeeNumDTO employeeNumDTO : resultDTO.getEmployeeNum()) {
|
||||
|
||||
|
||||
employeeNum.add(employeeNumDTO.getWord());
|
||||
}
|
||||
}
|
||||
resp.setEmployeeNum(employeeNum);
|
||||
|
||||
List<String> printTime = new ArrayList<>(); // 打印时间
|
||||
|
||||
if (CollectionUtils.isNotEmpty(resultDTO.getPrintTime())) {
|
||||
for (BShoppingReceiptResp.WordsResultDTO.PrintTimeDTO printTimeDTO : resultDTO.getPrintTime()) {
|
||||
printTime.add(printTimeDTO.getWord());
|
||||
|
||||
}
|
||||
}
|
||||
resp.setPrintTime(printTime);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
return R.error();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,77 @@
|
||||
package com.heyu.api.controller.financial;
|
||||
|
||||
import com.heyu.api.baidu.handle.financial.BTaxiReceiptHandle;
|
||||
import com.heyu.api.baidu.request.financial.BTaxiReceiptRequest;
|
||||
import com.heyu.api.baidu.response.financial.BTaxiReceiptResp;
|
||||
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.financial.TaxiReceiptResp;
|
||||
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;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* <p>
|
||||
* https://console.bce.baidu.com/support/?_=1740575657628×tamp=1740577722254#/api?product=AI&project=%E6%96%87%E5%AD%97%E8%AF%86%E5%88%AB&parent=%E8%B4%A2%E5%8A%A1%E7%A5%A8%E6%8D%AEOCR&api=rest%2F2.0%2Focr%2Fv1%2Ftaxi_receipt&method=post
|
||||
* <p>
|
||||
* <p>
|
||||
* 出租车票识别
|
||||
*
|
||||
*
|
||||
* 接口描述
|
||||
* 支持识别全国各大城市出租车票的 16 个关键字段,包括发票号码、代码、车号、日期、总金额、燃油附加费、叫车服务费、省、市、单价、里程、上车时间、下车时间等。
|
||||
*/
|
||||
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/taxi/receipt")
|
||||
@NotIntercept
|
||||
public class TaxiReceiptController {
|
||||
|
||||
|
||||
@Autowired
|
||||
private BTaxiReceiptHandle bTaxiReceiptHandle;
|
||||
|
||||
@RequestMapping("/recognize")
|
||||
@CacheResult
|
||||
public R recognize(BTaxiReceiptRequest req) {
|
||||
|
||||
TaxiReceiptResp resp = new TaxiReceiptResp();
|
||||
|
||||
|
||||
ApiR<BTaxiReceiptResp> bR = bTaxiReceiptHandle.handle(req);
|
||||
if (bR.isSuccess()) {
|
||||
|
||||
BTaxiReceiptResp bTaxiReceiptResp = bR.getData();
|
||||
BTaxiReceiptResp.WordsResultDTO wordsResultDTO = bTaxiReceiptResp.getWordsResult();
|
||||
|
||||
|
||||
resp.setDate(wordsResultDTO.getDate()); // 日期
|
||||
resp.setFare(wordsResultDTO.getFare()); // 金额
|
||||
resp.setLocation(wordsResultDTO.getLocation()); //开票城市
|
||||
resp.setInvoiceCode(wordsResultDTO.getInvoiceCode()); // 发票代码
|
||||
resp.setInvoiceNum(wordsResultDTO.getInvoiceNum()); //发票号码
|
||||
resp.setTaxiNum(wordsResultDTO.getTaxiNum()); // 车牌号
|
||||
resp.setTime(wordsResultDTO.getTime()); //上下车时间
|
||||
resp.setPickupTime(wordsResultDTO.getPickupTime()); // 上车时间
|
||||
resp.setDropoffTime(wordsResultDTO.getDropoffTime()); //下车时间
|
||||
resp.setFuelOilSurcharge(wordsResultDTO.getFuelOilSurcharge()); //燃油附加费
|
||||
resp.setCallServiceSurcharge(wordsResultDTO.getCallServiceSurcharge()); //叫车服务费
|
||||
resp.setTotalFare(wordsResultDTO.getTotalFare()); //总金额
|
||||
resp.setProvince(wordsResultDTO.getProvince()); // 省
|
||||
resp.setCity(wordsResultDTO.getCity()); // 市
|
||||
resp.setPricePerkm(wordsResultDTO.getPricePerkm()); // 单价
|
||||
resp.setDistance(wordsResultDTO.getDistance()); //里程
|
||||
return R.ok().setData(resp);
|
||||
}
|
||||
|
||||
return R.error(bR.getErrorMsg());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,65 @@
|
||||
package com.heyu.api.controller.financial;
|
||||
|
||||
import com.heyu.api.baidu.handle.financial.BTollInvoiceHandle;
|
||||
import com.heyu.api.baidu.request.financial.BTollInvoiceRequest;
|
||||
import com.heyu.api.baidu.response.financial.BTollInvoiceResp;
|
||||
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.financial.TollInvoiceResp;
|
||||
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/?_=1740575657628×tamp=1740578911257#/api?product=AI&project=%E6%96%87%E5%AD%97%E8%AF%86%E5%88%AB&parent=%E8%B4%A2%E5%8A%A1%E7%A5%A8%E6%8D%AEOCR&api=rest%2F2.0%2Focr%2Fv1%2Ftoll_invoice&method=post
|
||||
* <p>
|
||||
* 过路过桥费发票识别
|
||||
*
|
||||
* 接口描述
|
||||
* 支持对全国范围不同版式过路、过桥费发票的发票代码、发票号码、入口、出口、日期、时间、金额、省、市9个字段进行结构化识别。
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/toll/invoice")
|
||||
@NotIntercept
|
||||
public class TollInvoiceController extends BaseController {
|
||||
|
||||
|
||||
@Autowired
|
||||
private BTollInvoiceHandle bTollInvoiceHandle;
|
||||
|
||||
|
||||
@RequestMapping("/recognize")
|
||||
@CacheResult
|
||||
public R recognize(BTollInvoiceRequest req) {
|
||||
TollInvoiceResp resp = new TollInvoiceResp();
|
||||
|
||||
ApiR<BTollInvoiceResp> bR = bTollInvoiceHandle.handle(req);
|
||||
if (bR.isSuccess()) {
|
||||
BTollInvoiceResp bTollInvoiceResp = bR.getData();
|
||||
|
||||
BTollInvoiceResp.WordsResultDTO wordsResultDTO = bTollInvoiceResp.getWordsResult();
|
||||
resp.setEntrance(wordsResultDTO.getEntrance()); // 入口
|
||||
resp.setTime(wordsResultDTO.getTime()); //时间
|
||||
resp.setInvoiceCode(wordsResultDTO.getInvoiceCode()); //发票代码
|
||||
resp.setDate(wordsResultDTO.getDate()); //日期
|
||||
resp.setExit(wordsResultDTO.getExit()); // 出口
|
||||
resp.setFare(wordsResultDTO.getFare()); //金额
|
||||
resp.setInvoiceNum(wordsResultDTO.getInvoiceNum()); //发票号码
|
||||
resp.setCity(wordsResultDTO.getCity()); // 市
|
||||
resp.setProvince(wordsResultDTO.getProvince()); //省
|
||||
return R.ok().setData(resp);
|
||||
}
|
||||
return R.error();
|
||||
}
|
||||
|
||||
}
|
||||
@ -64,6 +64,9 @@ public class RecognizeQuotaInvoiceController extends BaseController {
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
@ -5,12 +5,13 @@ import com.aliyun.ocr20191230.models.RecognizeVATInvoiceResponse;
|
||||
import com.aliyun.ocr20191230.models.RecognizeVATInvoiceResponseBody;
|
||||
import com.heyu.api.alibaba.handle.common.text.ARecognizeVATInvoiceHandle;
|
||||
import com.heyu.api.alibaba.request.common.text.ARecognizeVATInvoiceRequest;
|
||||
import com.heyu.api.baidu.handle.financial.BVatInvoiceHandle;
|
||||
import com.heyu.api.controller.BaseController;
|
||||
import com.heyu.api.resp.tax.RecognizeVATInvoiceResp;
|
||||
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.tax.RecognizeVATInvoiceResp;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
@ -27,6 +28,15 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
* 增值税发票识别能力可以识别增值税发票(电子发票和纸质发票)关键字段内容,包括:校验码、复核人、开票人、发票代码、收款人等。
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* https://console.bce.baidu.com/support/?_=1740494347073×tamp=1740497736043#/api?product=AI&project=%E6%96%87%E5%AD%97%E8%AF%86%E5%88%AB&parent=%E8%B4%A2%E5%8A%A1%E7%A5%A8%E6%8D%AEOCR&api=rest%2F2.0%2Focr%2Fv1%2Fvat_invoice&method=post
|
||||
* <p>
|
||||
* 增值税发票识别
|
||||
*
|
||||
*
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@ -39,6 +49,9 @@ public class RecognizeVATInvoiceController extends BaseController {
|
||||
private ARecognizeVATInvoiceHandle arRecognizeVATInvoiceHandle;
|
||||
|
||||
|
||||
@Autowired
|
||||
private BVatInvoiceHandle bVatInvoiceHandle;
|
||||
|
||||
@RequestMapping("/recognize")
|
||||
@CacheResult
|
||||
public R recognize(ARecognizeVATInvoiceRequest request) {
|
||||
|
||||
@ -0,0 +1,26 @@
|
||||
package com.heyu.api.resp.financial;
|
||||
|
||||
import com.heyu.api.data.dto.BaseResp;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class BankReceiptNewResp extends BaseResp {
|
||||
|
||||
|
||||
private String title ; // 标题
|
||||
private String payPersonName; // 付款人户名
|
||||
private String payBankName; //付款人开户银行
|
||||
private String payAcount;//付款人账号
|
||||
private String payeeAcount; //付款人账号
|
||||
private String payeeName; //收款人户名
|
||||
private String payeeBankName;//收款人开户银行
|
||||
private String payeeBankAccount; // 收款人账号
|
||||
private String capsAmount; // 大写金额
|
||||
private String lowerCaseAmount; // 小写金额
|
||||
private String serialNumber ; // 流水号
|
||||
private String replyNumber ;// 回单编号;
|
||||
private String tradeDate; // 交易日期
|
||||
private String summary;// 摘要
|
||||
private String use;//用途
|
||||
|
||||
}
|
||||
@ -0,0 +1,21 @@
|
||||
package com.heyu.api.resp.financial;
|
||||
|
||||
import com.heyu.api.data.dto.BaseResp;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
@Data
|
||||
public class BusTicketResp extends BaseResp {
|
||||
|
||||
|
||||
|
||||
private String destinationStation; // 到达站
|
||||
private String idNum;// 身份证号
|
||||
private String time; //时间
|
||||
private String invoiceCode; //发票代码
|
||||
private String invoiceNum; // 发票号码
|
||||
private String startingStation; //出发站
|
||||
private String date; //日期
|
||||
private String name; //姓名
|
||||
private String fare; //金额
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
package com.heyu.api.resp.financial;
|
||||
|
||||
|
||||
import com.heyu.api.data.dto.BaseResp;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class FerryTicketResp extends BaseResp {
|
||||
|
||||
|
||||
private String invoiceType; //发票类型
|
||||
private String invoiceCode; // 发票代码
|
||||
private String invoiceNum; //发票号码
|
||||
private String startingStation; // 出发地点
|
||||
private String destinationStation; //到达地点
|
||||
private String invoiceDate; // 开票日期
|
||||
private String fare; // 总金额
|
||||
|
||||
}
|
||||
@ -0,0 +1,42 @@
|
||||
package com.heyu.api.resp.financial;
|
||||
|
||||
import com.heyu.api.data.dto.BaseResp;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class InvoiceResp extends BaseResp {
|
||||
|
||||
|
||||
private String city; //市
|
||||
private String invoiceNum; // 发票号码
|
||||
private String sellerName; // 销售方名称
|
||||
private String industrySort; // 行业分类
|
||||
private String province; // 省
|
||||
private List<CommodityDTO> commodityAmount; // 商品金额
|
||||
private String invoiceDate; //开票日期
|
||||
private String purchaserName; //购买方名称
|
||||
private List<?> commodityNum; //商品数量
|
||||
private String invoiceCode; // 发票代码
|
||||
private List<?> commodityUnit; //商品单位
|
||||
private String sheetNum; //联次
|
||||
private String purchaserRegisterNum; //购买方纳税人识别号
|
||||
private String time; //时间
|
||||
private List<?> commodityPrice; // 商品单价
|
||||
private String amountInFiguers; //合计金额小写
|
||||
private String amountInWords; //合计金额大写
|
||||
private String checkCode; //校验码
|
||||
private String totalTax; //合计税额
|
||||
private String invoiceType; // 发票类型
|
||||
private String sellerRegisterNum; // 销售方纳税人识别号
|
||||
private List<CommodityDTO> commodityName; // 商品名称
|
||||
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
public static class CommodityDTO {
|
||||
private String word; //内容
|
||||
private String row; //行号
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,27 @@
|
||||
package com.heyu.api.resp.financial;
|
||||
|
||||
|
||||
import com.heyu.api.data.dto.BaseResp;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Data
|
||||
public class MultipleInvoiceResp extends BaseResp {
|
||||
|
||||
/**
|
||||
* 表示单张票据分类的置信度
|
||||
*/
|
||||
private String probability;
|
||||
/**
|
||||
* 每一张票据的种类
|
||||
*/
|
||||
private String type;
|
||||
|
||||
|
||||
/***
|
||||
* 单张票据的识别结果
|
||||
*/
|
||||
private Map<String, Object> result;
|
||||
|
||||
}
|
||||
@ -0,0 +1,34 @@
|
||||
package com.heyu.api.resp.financial;
|
||||
|
||||
import com.heyu.api.data.dto.BaseResp;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class OnlineTaxiItineraryResp extends BaseResp {
|
||||
|
||||
private String totalFare; //总金额
|
||||
private String endTime; //行程结束时间
|
||||
private String phone; //行程人手机号
|
||||
private String serviceProvider; // 服务商
|
||||
private String startTime; // 行程开始时间
|
||||
private String applicationDate; //申请日期
|
||||
private String itemId; //行程信息的对应序号
|
||||
private List<ItemsDTO> items;
|
||||
|
||||
|
||||
@Data
|
||||
public static class ItemsDTO {
|
||||
private String itemId; //行程信息的对应序号
|
||||
private String startPlace; //起点
|
||||
private String pickupTime; //上车时间
|
||||
private String carType; //车型
|
||||
private String city; //城市
|
||||
private String distance; // 里程
|
||||
private String pickupDate; //上车日期
|
||||
private String destinationPlace; //终点
|
||||
private String fare; //
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
package com.heyu.api.resp.financial;
|
||||
|
||||
import com.heyu.api.data.dto.BaseResp;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class QuotaInvoiceResp extends BaseResp {
|
||||
|
||||
|
||||
private String invoiceCode; // 发票代码
|
||||
private String invoiceNumber; //发票号码
|
||||
private String invoiceRate; // 金额
|
||||
private String invoiceRateLowercase; // 发票金额小写
|
||||
private String province; //省
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,38 @@
|
||||
package com.heyu.api.resp.financial;
|
||||
|
||||
|
||||
import com.heyu.api.data.dto.BaseResp;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class ShoppingReceiptResp extends BaseResp {
|
||||
|
||||
|
||||
private List<String> totalAmount; // 总金额
|
||||
private List<String> discount; //优惠/折扣
|
||||
private List<String> currency; // 币种
|
||||
private List<String> receiptNum; //小票号码
|
||||
private List<String> shopName; // 店名/超市名字
|
||||
private List<String> consumptionTime; //消费时间
|
||||
private List<String> consumptionDate; //消费日期
|
||||
private Integer tableRowNum; //商品明细行数,表示Table中的object个数
|
||||
private List<TableDTO> table;
|
||||
private List<String> paidAmount; //实收金额
|
||||
private List<String> printDate; //打印日期
|
||||
private List<String> machineNum; //机器编号
|
||||
private List<String> change; //找零
|
||||
private List<String> employeeNum; //工号
|
||||
private List<String> printTime; // 打印时间
|
||||
|
||||
|
||||
@Data
|
||||
public static class TableDTO {
|
||||
private String product; //商品条码/名称
|
||||
private String quantity; // 数量
|
||||
private String unitPrice; //单价
|
||||
private String subtotalAmount; // 小计金额
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,26 @@
|
||||
package com.heyu.api.resp.financial;
|
||||
|
||||
import com.heyu.api.data.dto.BaseResp;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class TaxiReceiptResp extends BaseResp {
|
||||
|
||||
|
||||
private String date; // 日期
|
||||
private String fare; // 金额
|
||||
private String location; //开票城市
|
||||
private String invoiceCode; // 发票代码
|
||||
private String invoiceNum; //发票号码
|
||||
private String taxiNum; // 车牌号
|
||||
private String time; //上下车时间
|
||||
private String pickupTime; // 上车时间
|
||||
private String dropoffTime; //下车时间
|
||||
private String fuelOilSurcharge; //燃油附加费
|
||||
private String callServiceSurcharge; //叫车服务费
|
||||
private String totalFare; //总金额
|
||||
private String province; // 省
|
||||
private String city; // 市
|
||||
private String pricePerkm; // 单价
|
||||
private String distance; //里程
|
||||
}
|
||||
@ -0,0 +1,23 @@
|
||||
package com.heyu.api.resp.financial;
|
||||
|
||||
import com.heyu.api.data.dto.BaseResp;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class TollInvoiceResp extends BaseResp {
|
||||
|
||||
|
||||
private String entrance; // 入口
|
||||
private String time; //时间
|
||||
private String invoiceCode; //发票代码
|
||||
private String date; //日期
|
||||
private String exit; // 出口
|
||||
private String fare; //金额
|
||||
private String invoiceNum; //发票号码
|
||||
private String city; // 市
|
||||
private String province; //省
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user