提交修改
This commit is contained in:
parent
39511bc7eb
commit
dad7a1be30
@ -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) {
|
||||
|
||||
@ -1,13 +1,16 @@
|
||||
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;
|
||||
@ -23,9 +26,6 @@ import java.util.Map;
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
接口描述
|
||||
支持财务场景中13种常见票据的分类及结构化识别,包括增值税发票、卷票、机打发票、定额发票、火车票、出租车票、网约车行程单、飞机行程单、汽车票、过路过桥费、船票、
|
||||
机动车/二手车销售发票。支持多张不同种类票据在同一张图片上的混贴场景,可返回每张票据的位置、种类及票面信息的结构化识别结果。
|
||||
@ -47,13 +47,18 @@ public class MultipleInvoiceController extends BaseController {
|
||||
@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,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