This commit is contained in:
quyixiao 2025-03-25 20:26:49 +08:00
parent f6e76fe0ac
commit 5a3744ad92
17 changed files with 1055 additions and 1 deletions

View File

@ -0,0 +1,16 @@
package com.heyu.api.baidu.response.financial;
import lombok.Data;
/**
* https://console.bce.baidu.com/support/?_=1740494347073&timestamp=1740500368284#/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_verification&method=post
* <p>
* 增值税发票验真
*/
@Data
public class BAirTransportVatInvoiceVerificationResp extends BVatInvoiceVerificationResp {
}

View File

@ -0,0 +1,253 @@
package com.heyu.api.baidu.response.financial;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
/**
* https://console.bce.baidu.com/support/?_=1740494347073&timestamp=1740500368284#/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_verification&method=post
* <p>
* 增值税发票验真
*/
@NoArgsConstructor
@Data
public class BCommonVatInvoiceVerificationResp extends BVatInvoiceVerificationResp {
@JsonProperty("words_result")
private WordsResultDTO wordsResult;
@NoArgsConstructor
@Data
public static class WordsResultDTO {
@JsonProperty("log_id")
private Long logId;
@JsonProperty("words_result_num")
private Integer wordsResultNum;
@JsonProperty("VerifyFrequency")
private String verifyFrequency;
@JsonProperty("VerifyMessage")
private String verifyMessage;
@JsonProperty("InvalidSign")
private String invalidSign;
@JsonProperty("InvoiceType")
private String invoiceType;
@JsonProperty("MachineCode")
private String machineCode;
@JsonProperty("CheckCode")
private String checkCode;
@JsonProperty("InvoiceCode")
private String invoiceCode;
@JsonProperty("InvoiceDate")
private String invoiceDate;
@JsonProperty("VerifyResult")
private String verifyResult;
@JsonProperty("InvoiceNum")
private String invoiceNum;
@JsonProperty("TaxControlNum")
private String taxControlNum;
@JsonProperty("CommodityEndDate")
private List<CommodityEndDateDTO> commodityEndDate;
@JsonProperty("VehicleTonnage")
private String vehicleTonnage;
@JsonProperty("CommodityVehicleType")
private List<CommodityVehicleTypeDTO> commodityVehicleType;
@JsonProperty("CommodityStartDate")
private List<CommodityStartDateDTO> commodityStartDate;
@JsonProperty("SellerAddress")
private String sellerAddress;
@JsonProperty("CommodityPrice")
private List<CommodityPriceDTO> commodityPrice;
@JsonProperty("TransportCargoInformation")
private String transportCargoInformation;
@JsonProperty("NoteDrawer")
private String noteDrawer;
@JsonProperty("CommodityNum")
private List<CommodityNumDTO> commodityNum;
@JsonProperty("SellerRegisterNum")
private String sellerRegisterNum;
@JsonProperty("SellerBank")
private String sellerBank;
@JsonProperty("Remarks")
private String remarks;
@JsonProperty("TotalTax")
private String totalTax;
@JsonProperty("CommodityTaxRate")
private List<CommodityTaxRateDTO> commodityTaxRate;
@JsonProperty("CommodityExpenseItem")
private List<CommodityExpenseItemDTO> commodityExpenseItem;
@JsonProperty("ZeroTaxRateIndicator")
private String zeroTaxRateIndicator;
@JsonProperty("Carrier")
private String carrier;
@JsonProperty("SenderCode")
private String senderCode;
@JsonProperty("PurchaserRegisterNum")
private String purchaserRegisterNum;
@JsonProperty("ReceiverCode")
private String receiverCode;
@JsonProperty("AmountInFiguers")
private String amountInFiguers;
@JsonProperty("PurchaserBank")
private String purchaserBank;
@JsonProperty("Checker")
private String checker;
@JsonProperty("TollSign")
private String tollSign;
@JsonProperty("VehicleTypeNum")
private String vehicleTypeNum;
@JsonProperty("DepartureViaArrival")
private String departureViaArrival;
@JsonProperty("Receiver")
private String receiver;
@JsonProperty("Recipient")
private String recipient;
@JsonProperty("TotalAmount")
private String totalAmount;
@JsonProperty("CommodityAmount")
private List<CommodityAmountDTO> commodityAmount;
@JsonProperty("PurchaserName")
private String purchaserName;
@JsonProperty("CommodityType")
private List<CommodityTypeDTO> commodityType;
@JsonProperty("Sender")
private String sender;
@JsonProperty("PurchaserAddress")
private String purchaserAddress;
@JsonProperty("CommodityTax")
private List<CommodityTaxDTO> commodityTax;
@JsonProperty("CarrierCode")
private String carrierCode;
@JsonProperty("CommodityPlateNum")
private List<CommodityPlateNumDTO> commodityPlateNum;
@JsonProperty("CommodityUnit")
private List<CommodityUnitDTO> commodityUnit;
@JsonProperty("Payee")
private String payee;
@JsonProperty("RecipientCode")
private String recipientCode;
@JsonProperty("CommodityName")
private List<CommodityNameDTO> commodityName;
@JsonProperty("SellerName")
private String sellerName;
@NoArgsConstructor
@Data
public static class CommodityEndDateDTO {
@JsonProperty("row")
private String row;
@JsonProperty("word")
private String word;
}
@NoArgsConstructor
@Data
public static class CommodityVehicleTypeDTO {
@JsonProperty("row")
private String row;
}
@NoArgsConstructor
@Data
public static class CommodityStartDateDTO {
@JsonProperty("row")
private String row;
@JsonProperty("word")
private String word;
}
@NoArgsConstructor
@Data
public static class CommodityPriceDTO {
@JsonProperty("row")
private String row;
@JsonProperty("word")
private String word;
}
@NoArgsConstructor
@Data
public static class CommodityNumDTO {
@JsonProperty("row")
private String row;
@JsonProperty("word")
private String word;
}
@NoArgsConstructor
@Data
public static class CommodityTaxRateDTO {
@JsonProperty("row")
private String row;
@JsonProperty("word")
private String word;
}
@NoArgsConstructor
@Data
public static class CommodityExpenseItemDTO {
@JsonProperty("row")
private String row;
@JsonProperty("word")
private String word;
}
@NoArgsConstructor
@Data
public static class CommodityAmountDTO {
@JsonProperty("row")
private String row;
@JsonProperty("word")
private String word;
}
@NoArgsConstructor
@Data
public static class CommodityTypeDTO {
@JsonProperty("row")
private String row;
@JsonProperty("word")
private String word;
}
@NoArgsConstructor
@Data
public static class CommodityTaxDTO {
@JsonProperty("row")
private String row;
@JsonProperty("word")
private String word;
}
@NoArgsConstructor
@Data
public static class CommodityPlateNumDTO {
@JsonProperty("row")
private String row;
@JsonProperty("word")
private String word;
}
@NoArgsConstructor
@Data
public static class CommodityUnitDTO {
@JsonProperty("row")
private String row;
@JsonProperty("word")
private String word;
}
@NoArgsConstructor
@Data
public static class CommodityNameDTO {
@JsonProperty("row")
private String row;
@JsonProperty("word")
private String word;
}
}
}

View File

@ -0,0 +1,15 @@
package com.heyu.api.baidu.response.financial;
import lombok.Data;
/**
* https://console.bce.baidu.com/support/?_=1740494347073&timestamp=1740500368284#/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_verification&method=post
* <p>
* 增值税发票验真
*/
@Data
public class BTrainVatInvoiceVerificationResp extends BVatInvoiceVerificationResp {
}

View File

@ -0,0 +1,16 @@
package com.heyu.api.baidu.response.financial;
import lombok.Data;
/**
* https://console.bce.baidu.com/support/?_=1740494347073&timestamp=1740500368284#/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_verification&method=post
* <p>
* 增值税发票验真
*/
@Data
public class BUsedCarVatInvoiceVerificationResp extends BVatInvoiceVerificationResp {
}

View File

@ -1,6 +1,7 @@
package com.heyu.api.baidu.response.financial;
import com.heyu.api.data.dto.BaseResp;
import lombok.Data;
/**
@ -11,5 +12,5 @@ import lombok.Data;
*
*/
@Data
public class BVatInvoiceVerificationResp {
public class BVatInvoiceVerificationResp extends BaseResp {
}

View File

@ -0,0 +1,15 @@
package com.heyu.api.baidu.response.financial;
import lombok.Data;
/**
* https://console.bce.baidu.com/support/?_=1740494347073&timestamp=1740500368284#/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_verification&method=post
* <p>
* 增值税发票验真
*/
@Data
public class BVehicleVatInvoiceVerificationResp extends BVatInvoiceVerificationResp {
}

View File

@ -0,0 +1,284 @@
package com.heyu.api.controller.financial;
import com.heyu.api.baidu.handle.financial.BVatInvoiceVerificationHandle;
import com.heyu.api.baidu.request.financial.BVatInvoiceVerificationRequest;
import com.heyu.api.baidu.response.financial.BCommonVatInvoiceVerificationResp;
import com.heyu.api.baidu.response.financial.BVatInvoiceVerificationResp;
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.request.financial.CommonVatInvoiceVerificationRequest;
import com.heyu.api.resp.financial.CommonVatInvoiceVerificationResp;
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/?_=1740494347073&timestamp=1740500368284#/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_verification&method=post
*
*
* 增值税发票验真
*
*
*
* 支持 14 种增值税发票的信息核验包括增值税专票电子专票普票电子普票卷票区块链发票深圳地区全电发票新版全国统一电子发票专票/普票通行费增值税电子普通发票货物运输业增值税专用发票
* 机动车销售发票二手车销售发票航空运输电子客票行程单电子发票铁路电子客票电子发票支持返回票面的全部信息同时可直接与同平台的发票识别能力对接完成发票识别的同时进行自动化验真
*
*
* 视频教程请参见 智能财务票据识别+增值税发票验真使用教程
*
*
*/
@Slf4j
@RestController
@RequestMapping("/common/vat/Invoice")
@NotIntercept
public class CommonVatInvoiceVerificationController extends BaseController {
@Autowired
private BVatInvoiceVerificationHandle bVatInvoiceVerificationHandle;
@RequestMapping("/verification")
@CacheResult
public R verification(CommonVatInvoiceVerificationRequest req) {
BVatInvoiceVerificationRequest bVatInvoiceVerificationRequest = new BVatInvoiceVerificationRequest();
bVatInvoiceVerificationRequest.setInvoiceCode(req.getInvoiceCode());
bVatInvoiceVerificationRequest.setInvoiceNum(req.getInvoiceNum());
bVatInvoiceVerificationRequest.setInvoiceDate(req.getInvoiceDate());
bVatInvoiceVerificationRequest.setInvoiceType(req.getInvoiceType());
bVatInvoiceVerificationRequest.setCheckCode(req.getCheckCode());
bVatInvoiceVerificationRequest.setTotalAmount(req.getTotalAmount());
CommonVatInvoiceVerificationResp resp = new CommonVatInvoiceVerificationResp();
ApiR<BVatInvoiceVerificationResp> bR = bVatInvoiceVerificationHandle.handle(bVatInvoiceVerificationRequest, BCommonVatInvoiceVerificationResp.class);
if (bR.isSuccess()) {
BCommonVatInvoiceVerificationResp bCommonVatInvoiceVerificationResp = (BCommonVatInvoiceVerificationResp) bR.getData();
BCommonVatInvoiceVerificationResp.WordsResultDTO wordsResultDTO = bCommonVatInvoiceVerificationResp.getWordsResult();
String verifyFrequency = wordsResultDTO.getVerifyFrequency(); // 查验次数为历史查验次数
String verifyMessage = wordsResultDTO.getVerifyMessage(); //查验结果信息查验成功且发票为真返回查验成功发票一致查验失败返回对应错误原因详见末尾表格
String invalidSign= wordsResultDTO.getInvalidSign(); // 是否作废冲红Y已作废H已冲红N未作废
String invoiceType = wordsResultDTO.getInvoiceType(); //发票种类即增值税专用发票增值税电子专用发票增值税普通发票增值税普通发票电子增值税普通发票卷式通行费增值税电子普通发票区块链电子发票全电发票专用发票全电发票普通发票机动车销售发票二手车销售发票货物运输业增值税专用发票航空运输电子客票行程单电子发票铁路电子客票电子发票
String machineCode = wordsResultDTO.getMachineCode(); //机器编号
String checkCode = wordsResultDTO.getCheckCode(); //校验码
String invoiceCode = wordsResultDTO.getInvoiceCode(); //发票代码
String invoiceDate = wordsResultDTO.getInvoiceDate(); // 开票日期
String verifyResult = wordsResultDTO.getVerifyResult(); //查验结果查验成功返回0001查验失败返回对应查验结果错误码详见末尾表格
String invoiceNum = wordsResultDTO.getInvoiceNum(); //发票号码
String taxControlNum = wordsResultDTO.getTaxControlNum(); //税控盘号货运专票返回信息其他类型发票可忽略
resp.setVerifyFrequency(verifyFrequency);
resp.setVerifyMessage(verifyMessage);
resp.setInvalidSign(invalidSign);
resp.setInvoiceType(invoiceType);
resp.setMachineCode(machineCode);
resp.setCheckCode(checkCode);
resp.setInvoiceCode(invoiceCode);
resp.setInvoiceDate(invoiceDate);
resp.setVerifyResult(verifyResult);
resp.setInvoiceNum(invoiceNum);
resp.setTaxControlNum(taxControlNum);
List<CommonVatInvoiceVerificationResp.CommodityDTO> commodityEndDate = new ArrayList<>(); // 通行日期止通行费增值税电子普通发票返回信息其他类型发票可忽略wordsResultDTO
if(CollectionUtils.isNotEmpty(wordsResultDTO.getCommodityEndDate())){
for (BCommonVatInvoiceVerificationResp.WordsResultDTO.CommodityEndDateDTO commodityEndDateDTO : wordsResultDTO.getCommodityEndDate()) {
CommonVatInvoiceVerificationResp.CommodityDTO commodityDTO = new CommonVatInvoiceVerificationResp.CommodityDTO();
commodityDTO.setRow(commodityEndDateDTO.getRow());
commodityDTO.setWord(commodityEndDateDTO.getWord());
commodityEndDate.add(commodityDTO);
}
}
resp.setCommodityEndDate(commodityEndDate);
resp.setVehicleTonnage(wordsResultDTO.getVehicleTonnage()); //车船吨位货运专票返回信息其他类型发票可忽略
List<CommonVatInvoiceVerificationResp.CommodityDTO> commodityVehicleType = new ArrayList<>(); //类型通行费增值税电子普通发票返回信息其他类型发票可忽略
if(CollectionUtils.isNotEmpty(wordsResultDTO.getCommodityVehicleType())){
for (BCommonVatInvoiceVerificationResp.WordsResultDTO.CommodityVehicleTypeDTO commodityVehicleTypeDTO : wordsResultDTO.getCommodityVehicleType()) {
CommonVatInvoiceVerificationResp.CommodityDTO commodityDTO = new CommonVatInvoiceVerificationResp.CommodityDTO();
commodityDTO.setRow(commodityVehicleTypeDTO.getRow());
commodityVehicleType.add(commodityDTO);
}
}
resp.setCommodityVehicleType(commodityVehicleType);
List<CommonVatInvoiceVerificationResp.CommodityDTO> commodityStartDate = new ArrayList<>(); //通行日期起通行费增值税电子普通发票返回信息其他类型发票可忽略
if(CollectionUtils.isNotEmpty(wordsResultDTO.getCommodityStartDate())){
for (BCommonVatInvoiceVerificationResp.WordsResultDTO.CommodityStartDateDTO commodityStartDateDTO : wordsResultDTO.getCommodityStartDate()) {
CommonVatInvoiceVerificationResp.CommodityDTO commodityDTO = new CommonVatInvoiceVerificationResp.CommodityDTO();
commodityDTO.setRow(commodityStartDateDTO.getRow());
commodityDTO.setWord(commodityStartDateDTO.getWord());
commodityStartDate.add(commodityDTO);
commodityStartDate.add(commodityDTO);
}
}
resp.setCommodityStartDate(commodityStartDate);
resp.setSellerAddress(wordsResultDTO.getSellerAddress()); // 销售方地址及电话
List<CommonVatInvoiceVerificationResp.CommodityDTO> commodityPrice = new ArrayList<>(); //单价
if(CollectionUtils.isNotEmpty(wordsResultDTO.getCommodityPrice())){
for (BCommonVatInvoiceVerificationResp.WordsResultDTO.CommodityPriceDTO commodityPriceDTO : wordsResultDTO.getCommodityPrice()) {
CommonVatInvoiceVerificationResp.CommodityDTO commodityDTO = new CommonVatInvoiceVerificationResp.CommodityDTO();
commodityDTO.setRow(commodityPriceDTO.getRow());
commodityDTO.setWord(commodityPriceDTO.getWord());
commodityPrice.add(commodityDTO);
commodityPrice.add(commodityDTO);
}
}
resp.setCommodityPrice(commodityPrice);
resp.setTransportCargoInformation(wordsResultDTO.getTransportCargoInformation()); //运输货物信息货运专票返回信息其他类型发票可忽略
resp.setNoteDrawer(wordsResultDTO.getNoteDrawer()); //开票人因税局不返回此字段故字段为空暂做保留使用
resp.setSellerRegisterNum(wordsResultDTO.getSellerRegisterNum()); //销售方纳税人识别号
resp.setSellerBank(wordsResultDTO.getSellerBank()); //销售方开户行及账号
resp.setRemarks(wordsResultDTO.getRemarks()); // 备注
resp.setTotalTax(wordsResultDTO.getTotalTax()); //合计税额
resp.setZeroTaxRateIndicator(wordsResultDTO.getZeroTaxRateIndicator()); //零税率标识非零税率,1税率栏位显示免税2税率栏位显示不征税3零税率通行费增值税电子普通发票返回信息其他类型发票可忽略
resp.setCarrier(wordsResultDTO.getCarrier()); //承运人名称货运专票返回信息其他类型发票可忽略
resp.setSenderCode(wordsResultDTO.getSenderCode()); // 发货人识别号货运专票返回信息其他类型发票可忽略
resp.setPurchaserRegisterNum(wordsResultDTO.getPurchaserRegisterNum()); // 购方纳税人识别号
resp.setReceiverCode(wordsResultDTO.getReceiverCode()); //收货人识别号货运专票返回信息其他类型发票可忽略
resp.setAmountInFiguers(wordsResultDTO.getAmountInFiguers()); //价税合计小写
resp.setPurchaserBank(wordsResultDTO.getPurchaserBank()); // 购方开户行及账号
resp.setChecker(wordsResultDTO.getChecker()); //复核因税局不返回此字段故字段为空暂做保留使用
resp.setTollSign(wordsResultDTO.getTollSign()); //通行费标志Y-可抵扣通行费N-不可抵扣通行费通行费增值税电子普通发票返回信息其他类型发票可忽略
resp.setVehicleTypeNum(wordsResultDTO.getVehicleTypeNum());
resp.setDepartureViaArrival(wordsResultDTO.getDepartureViaArrival()); // 起运地经由到达地货运专票返回信息其他类型发票可忽略
resp.setReceiver(wordsResultDTO.getReceiver()); // 收货人名称货运专票返回信息其他类型发票可忽略
resp.setRecipient(wordsResultDTO.getRecipient()); // 受票方名称货运专票返回信息其他类型发票可忽略
resp.setTotalAmount(wordsResultDTO.getTotalAmount()); // 合计金额
resp.setPurchaserName(wordsResultDTO.getPurchaserName()); //购方名称
resp.setSender(wordsResultDTO.getSender()); // 发货人名称货运专票返回信息其他类型发票可忽略
resp.setPurchaserAddress(wordsResultDTO.getPurchaserAddress()); // 买方单位/个人住址
resp.setCarrierCode(wordsResultDTO.getCarrierCode()); //承运人识别号货运专票返回信息其他类型发票可忽略
resp.setPayee(wordsResultDTO.getPayee()); //收款人因税局不返回此字段故字段为空暂做保留使用
resp.setRecipientCode(wordsResultDTO.getRecipientCode()); //受票方识别号货运专票返回信息其他类型发票可忽略
resp.setSellerName(wordsResultDTO.getSellerName()); //销售方名称
List<CommonVatInvoiceVerificationResp.CommodityDTO> commodityTaxRate = new ArrayList<>(); //税率
if(CollectionUtils.isNotEmpty(wordsResultDTO.getCommodityTaxRate())){
for (BCommonVatInvoiceVerificationResp.WordsResultDTO.CommodityTaxRateDTO commodityTaxRateDTO : wordsResultDTO.getCommodityTaxRate()) {
CommonVatInvoiceVerificationResp.CommodityDTO commodityDTO = new CommonVatInvoiceVerificationResp.CommodityDTO();
commodityDTO.setRow(commodityTaxRateDTO.getRow());
commodityDTO.setWord(commodityTaxRateDTO.getWord());
commodityTaxRate.add(commodityDTO);
}
}
resp.setCommodityTaxRate(commodityTaxRate);
List<CommonVatInvoiceVerificationResp.CommodityDTO> commodityExpenseItem = new ArrayList<>(); //费用项目货运专票返回信息其他类型发票可忽略
if(CollectionUtils.isNotEmpty(wordsResultDTO.getCommodityExpenseItem())){
for (BCommonVatInvoiceVerificationResp.WordsResultDTO.CommodityExpenseItemDTO commodityExpenseItemDTO : wordsResultDTO.getCommodityExpenseItem()) {
CommonVatInvoiceVerificationResp.CommodityDTO commodityDTO = new CommonVatInvoiceVerificationResp.CommodityDTO();
commodityDTO.setRow(commodityExpenseItemDTO.getRow());
commodityDTO.setWord(commodityExpenseItemDTO.getWord());
commodityExpenseItem.add(commodityDTO);
}
}
resp.setCommodityExpenseItem(commodityExpenseItem);
List<CommonVatInvoiceVerificationResp.CommodityDTO> commodityNum = new ArrayList<>(); //数量
if(CollectionUtils.isNotEmpty(wordsResultDTO.getCommodityNum())){
for (BCommonVatInvoiceVerificationResp.WordsResultDTO.CommodityNumDTO commodityNumDTO : wordsResultDTO.getCommodityNum()) {
CommonVatInvoiceVerificationResp.CommodityDTO commodityDTO = new CommonVatInvoiceVerificationResp.CommodityDTO();
commodityDTO.setRow(commodityNumDTO.getRow());
commodityDTO.setWord(commodityNumDTO.getWord());
commodityNum.add(commodityDTO);
}
}
resp.setCommodityNum(commodityNum);
List<CommonVatInvoiceVerificationResp.CommodityDTO> commodityAmount= new ArrayList<>(); //金额
if(CollectionUtils.isNotEmpty(wordsResultDTO.getCommodityAmount())){
for (BCommonVatInvoiceVerificationResp.WordsResultDTO.CommodityAmountDTO commodityAmountDTO : wordsResultDTO.getCommodityAmount()) {
CommonVatInvoiceVerificationResp.CommodityDTO commodityDTO = new CommonVatInvoiceVerificationResp.CommodityDTO();
commodityDTO.setRow(commodityAmountDTO.getRow());
commodityDTO.setWord(commodityAmountDTO.getWord());
commodityAmount.add(commodityDTO);
}
}
resp.setCommodityAmount(commodityAmount);
List<CommonVatInvoiceVerificationResp.CommodityDTO> commodityType = new ArrayList<>(); //规格型号
if(CollectionUtils.isNotEmpty(wordsResultDTO.getCommodityType())){
for (BCommonVatInvoiceVerificationResp.WordsResultDTO.CommodityTypeDTO commodityTypeDTO : wordsResultDTO.getCommodityType()) {
CommonVatInvoiceVerificationResp.CommodityDTO commodityDTO = new CommonVatInvoiceVerificationResp.CommodityDTO();
commodityDTO.setRow(commodityTypeDTO.getRow());
commodityDTO.setWord(commodityTypeDTO.getWord());
commodityType.add(commodityDTO);
}
}
resp.setCommodityType(commodityType);
List<CommonVatInvoiceVerificationResp.CommodityDTO> commodityTax = new ArrayList<>(); //税额
if(CollectionUtils.isNotEmpty(wordsResultDTO.getCommodityTax())){
for (BCommonVatInvoiceVerificationResp.WordsResultDTO.CommodityTaxDTO tax : wordsResultDTO.getCommodityTax()) {
CommonVatInvoiceVerificationResp.CommodityDTO commodityDTO = new CommonVatInvoiceVerificationResp.CommodityDTO();
commodityDTO.setRow(tax.getRow());
commodityDTO.setWord(tax.getWord());
commodityTax.add(commodityDTO);
}
}
resp.setCommodityTax(commodityTax);
List<CommonVatInvoiceVerificationResp.CommodityDTO> commodityPlateNum= new ArrayList<>(); //车牌号通行费增值税电子普通发票返回信息其他类型发票可忽略
if(CollectionUtils.isNotEmpty(wordsResultDTO.getCommodityPlateNum())){
for (BCommonVatInvoiceVerificationResp.WordsResultDTO.CommodityPlateNumDTO commodityPlateNumDTO : wordsResultDTO.getCommodityPlateNum()) {
CommonVatInvoiceVerificationResp.CommodityDTO commodityDTO = new CommonVatInvoiceVerificationResp.CommodityDTO();
commodityDTO.setRow(commodityPlateNumDTO.getRow());
commodityDTO.setWord(commodityPlateNumDTO.getWord());
commodityPlateNum.add(commodityDTO);
}
}
resp.setCommodityPlateNum(commodityPlateNum);
List<CommonVatInvoiceVerificationResp.CommodityDTO> commodityUnit = new ArrayList<>(); // 单位
if(CollectionUtils.isNotEmpty(wordsResultDTO.getCommodityUnit())){
for (BCommonVatInvoiceVerificationResp.WordsResultDTO.CommodityUnitDTO commodityUnitDTO : wordsResultDTO.getCommodityUnit()) {
CommonVatInvoiceVerificationResp.CommodityDTO commodityDTO = new CommonVatInvoiceVerificationResp.CommodityDTO();
commodityDTO.setRow(commodityUnitDTO.getRow());
commodityDTO.setWord(commodityUnitDTO.getWord());
commodityUnit.add(commodityDTO);
}
}
resp.setCommodityUnit(commodityUnit);
List<CommonVatInvoiceVerificationResp.CommodityDTO> commodityName = new ArrayList<>(); // 货物名称/项目名称
if(CollectionUtils.isNotEmpty(wordsResultDTO.getCommodityName())){
for (BCommonVatInvoiceVerificationResp.WordsResultDTO.CommodityNameDTO commodityNameDTO : wordsResultDTO.getCommodityName()) {
CommonVatInvoiceVerificationResp.CommodityDTO commodityDTO = new CommonVatInvoiceVerificationResp.CommodityDTO();
commodityDTO.setRow(commodityNameDTO.getRow());
commodityDTO.setWord(commodityNameDTO.getWord());
commodityName.add(commodityDTO);
}
}
resp.setCommodityName(commodityName);
}
return R.ok();
}
}

View File

@ -0,0 +1,59 @@
package com.heyu.api.request.financial;
import com.heyu.api.baidu.request.BBaseRequest;
import lombok.Data;
/**
* https://console.bce.baidu.com/support/?_=1740494347073&timestamp=1740500368284#/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_verification&method=post
* <p>
* 增值税发票验真
*/
@Data
public class AirTransportVatInvoiceVerificationRequest extends BBaseRequest {
/**
* 发票代码
* 全电发票专用发票全电发票普通发票此参数可为空其他类型发票均不可为空
*/
private String invoiceCode;
/**
* 发票号码
*/
private String invoiceNum;
/**
* 开票日期格式YYYYMMDD20210101
*/
private String invoiceDate;
/**
* 航空运输电子客票行程单电子发票elec_flight_itinerary_invoice
* 发票种类
*
*
*
*
*/
private String invoiceType;
/**
* 校验码填写发票校验码后6位
* 增值税电子专票普票电子普票卷票区块链电子发票通行费增值税电子普通发票此参数必填
* 其他类型发票此参数可为空
*/
private String checkCode;
/**
* 发票金额
* 增值税专票电子专票区块链电子发票机动车销售发票货运专票填写不含税金额
* 二手车销售发票填写车价合计
* 全电发票专用发票全电发票普通发票填写价税合计金额其他类型发票可为空
*/
private String totalAmount;
}

View File

@ -0,0 +1,67 @@
package com.heyu.api.request.financial;
import com.heyu.api.baidu.request.BBaseRequest;
import lombok.Data;
/**
* https://console.bce.baidu.com/support/?_=1740494347073&timestamp=1740500368284#/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_verification&method=post
* <p>
* 增值税发票验真
*/
@Data
public class CommonVatInvoiceVerificationRequest extends BBaseRequest {
/**
* 发票代码
* 全电发票专用发票全电发票普通发票此参数可为空其他类型发票均不可为空
*/
private String invoiceCode;
/**
* 发票号码
*/
private String invoiceNum;
/**
* 开票日期格式YYYYMMDD20210101
*/
private String invoiceDate;
/**
* 增值税专用发票special_vat_invoice
* 增值税电子专用发票elec_special_vat_invoice
* 增值税普通发票normal_invoice
* 增值税普通发票电子elec_normal_invoice
* 增值税普通发票卷式roll_normal_invoice
* 通行费增值税电子普通发票toll_elec_normal_invoice
* 区块链电子发票目前仅支持深圳地区blockchain_invoice
* 全电发票专用发票elec_invoice_special
* 全电发票普通发票elec_invoice_normal
* 货运运输业增值税专用发票special_freight_transport_invoice
* 发票种类
*
*
*
* 增值税专票电子专票普票电子普通发票卷票通行费增值税电子普通发票货物运输业增值税专用发票返回信息
*/
private String invoiceType;
/**
* 校验码填写发票校验码后6位
* 增值税电子专票普票电子普票卷票区块链电子发票通行费增值税电子普通发票此参数必填
* 其他类型发票此参数可为空
*/
private String checkCode;
/**
* 发票金额
* 增值税专票电子专票区块链电子发票机动车销售发票货运专票填写不含税金额
* 二手车销售发票填写车价合计
* 全电发票专用发票全电发票普通发票填写价税合计金额其他类型发票可为空
*/
private String totalAmount;
}

View File

@ -0,0 +1,55 @@
package com.heyu.api.request.financial;
import com.heyu.api.baidu.request.BBaseRequest;
import lombok.Data;
/**
* https://console.bce.baidu.com/support/?_=1740494347073&timestamp=1740500368284#/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_verification&method=post
* <p>
* 增值税发票验真
*/
@Data
public class TrainVatInvoiceVerificationRequest extends BBaseRequest {
/**
* 发票代码
* 全电发票专用发票全电发票普通发票此参数可为空其他类型发票均不可为空
*/
private String invoiceCode;
/**
* 发票号码
*/
private String invoiceNum;
/**
* 开票日期格式YYYYMMDD20210101
*/
private String invoiceDate;
/**
铁路电子客票电子发票 elec_train_ticket_invoice
*
* 增值税专票电子专票普票电子普通发票卷票通行费增值税电子普通发票货物运输业增值税专用发票返回信息
*/
private String invoiceType;
/**
* 校验码填写发票校验码后6位
* 增值税电子专票普票电子普票卷票区块链电子发票通行费增值税电子普通发票此参数必填
* 其他类型发票此参数可为空
*/
private String checkCode;
/**
* 发票金额
* 增值税专票电子专票区块链电子发票机动车销售发票货运专票填写不含税金额
* 二手车销售发票填写车价合计
* 全电发票专用发票全电发票普通发票填写价税合计金额其他类型发票可为空
*/
private String totalAmount;
}

View File

@ -0,0 +1,54 @@
package com.heyu.api.request.financial;
import com.heyu.api.baidu.request.BBaseRequest;
import lombok.Data;
/**
* https://console.bce.baidu.com/support/?_=1740494347073&timestamp=1740500368284#/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_verification&method=post
* <p>
* 增值税发票验真
*/
@Data
public class UsedCarVatInvoiceVerificationRequest extends BBaseRequest {
/**
* 发票代码
* 全电发票专用发票全电发票普通发票此参数可为空其他类型发票均不可为空
*/
private String invoiceCode;
/**
* 发票号码
*/
private String invoiceNum;
/**
* 开票日期格式YYYYMMDD20210101
*/
private String invoiceDate;
/**
* 二手车销售发票used_vehicle_invoice
*/
private String invoiceType;
/**
* 校验码填写发票校验码后6位
* 增值税电子专票普票电子普票卷票区块链电子发票通行费增值税电子普通发票此参数必填
* 其他类型发票此参数可为空
*/
private String checkCode;
/**
* 发票金额
* 增值税专票电子专票区块链电子发票机动车销售发票货运专票填写不含税金额
* 二手车销售发票填写车价合计
* 全电发票专用发票全电发票普通发票填写价税合计金额其他类型发票可为空
*/
private String totalAmount;
}

View File

@ -0,0 +1,53 @@
package com.heyu.api.request.financial;
import com.heyu.api.baidu.request.BBaseRequest;
import lombok.Data;
/**
* https://console.bce.baidu.com/support/?_=1740494347073&timestamp=1740500368284#/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_verification&method=post
* <p>
* 增值税发票验真
*/
@Data
public class VehicleVatInvoiceVerificationRequest extends BBaseRequest {
/**
* 发票代码
* 全电发票专用发票全电发票普通发票此参数可为空其他类型发票均不可为空
*/
private String invoiceCode;
/**
* 发票号码
*/
private String invoiceNum;
/**
* 开票日期格式YYYYMMDD20210101
*/
private String invoiceDate;
/**
* 二手车销售发票used_vehicle_invoice
*/
private String invoiceType;
/**
* 校验码填写发票校验码后6位
* 增值税电子专票普票电子普票卷票区块链电子发票通行费增值税电子普通发票此参数必填
* 其他类型发票此参数可为空
*/
private String checkCode;
/**
* 发票金额
* 增值税专票电子专票区块链电子发票机动车销售发票货运专票填写不含税金额
* 二手车销售发票填写车价合计
* 全电发票专用发票全电发票普通发票填写价税合计金额其他类型发票可为空
*/
private String totalAmount;
}

View File

@ -0,0 +1,17 @@
package com.heyu.api.resp.financial;
import com.heyu.api.data.dto.BaseResp;
import lombok.Data;
/**
* https://console.bce.baidu.com/support/?_=1740494347073&timestamp=1740500368284#/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_verification&method=post
* <p>
* 增值税发票验真
*/
@Data
public class AirTransportVatInvoiceVerificationResp extends BaseResp {
}

View File

@ -0,0 +1,99 @@
package com.heyu.api.resp.financial;
import com.heyu.api.data.dto.BaseResp;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
/**
* https://console.bce.baidu.com/support/?_=1740494347073&timestamp=1740500368284#/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_verification&method=post
* <p>
* 增值税发票验真
*/
@Data
public class CommonVatInvoiceVerificationResp extends BaseResp {
private String verifyFrequency; // 查验次数为历史查验次数
private String verifyMessage; //查验结果信息查验成功且发票为真返回查验成功发票一致查验失败返回对应错误原因详见末尾表格
private String invalidSign; // 是否作废冲红Y已作废H已冲红N未作废
private String invoiceType; //发票种类即增值税专用发票增值税电子专用发票增值税普通发票增值税普通发票电子增值税普通发票卷式通行费增值税电子普通发票区块链电子发票全电发票专用发票全电发票普通发票机动车销售发票二手车销售发票货物运输业增值税专用发票航空运输电子客票行程单电子发票铁路电子客票电子发票
private String machineCode; //机器编号
private String checkCode; //校验码
private String invoiceCode; //发票代码
private String invoiceDate; // 开票日期
/***
* 9999 查验失败 查验失败业务出现异常请提交工单咨询
* 0002 超过该张票当天查验次数 此发票今日查询次数已达上限5次请次日查询
* 0005 请求不合法 发票信息有误请核对后再查询
* 0006 发票信息不一致 发票信息有误请核对后再查询
* 0009 发票不存在 所查发票不存在
* 1004 已超过最大查验量 已超过最大查验量请提交工单咨询
* 1005 查询发票不规范 信息有误请核对后再查询
* 1006 查验异常 发票信息有误请核对后再查询
* 1008 字段不能为空 发票请求参数不能为空
* 1009 参数长度不正确 参数长度不符合规范确认参数再次查验
* 1014 日期当天的不能查验 日期当天的不能查验请隔天再查
* 1015 超过5年的不能查验 超过5年的不能查验
* 1020 没有查验权限 没有查验权限请提交工单咨询
* 1021 网络超时 税局维护升级暂时无法查验请提交工单咨询
*/
private String verifyResult; //查验结果查验成功返回0001查验失败返回对应查验结果错误码详见末尾表格
private String invoiceNum; //发票号码
private String taxControlNum; //税控盘号货运专票返回信息其他类型发票可忽略
private List<CommodityDTO> commodityEndDate; // 通行日期止通行费增值税电子普通发票返回信息其他类型发票可忽略
private String vehicleTonnage; //车船吨位货运专票返回信息其他类型发票可忽略
private List<CommodityDTO> commodityVehicleType; //类型通行费增值税电子普通发票返回信息其他类型发票可忽略
private List<CommodityDTO> commodityStartDate; //通行日期起通行费增值税电子普通发票返回信息其他类型发票可忽略
private String sellerAddress; // 销售方地址及电话
private List<CommodityDTO> commodityPrice; //单价
private String transportCargoInformation; //运输货物信息货运专票返回信息其他类型发票可忽略
private String noteDrawer; //开票人因税局不返回此字段故字段为空暂做保留使用
private List<CommodityDTO> commodityNum; //数量
private String sellerRegisterNum; //销售方纳税人识别号
private String sellerBank; //销售方开户行及账号
private String remarks; // 备注
private String totalTax; //合计税额
private List<CommodityDTO> commodityTaxRate; //税率
private List<CommodityDTO> commodityExpenseItem; //费用项目货运专票返回信息其他类型发票可忽略
private String zeroTaxRateIndicator; //零税率标识非零税率,1税率栏位显示免税2税率栏位显示不征税3零税率通行费增值税电子普通发票返回信息其他类型发票可忽略
private String carrier; //承运人名称货运专票返回信息其他类型发票可忽略
private String senderCode; // 发货人识别号货运专票返回信息其他类型发票可忽略
private String purchaserRegisterNum; // 购方纳税人识别号
private String receiverCode; //收货人识别号货运专票返回信息其他类型发票可忽略
private String amountInFiguers; //价税合计小写
private String purchaserBank; // 购方开户行及账号
private String checker; //复核因税局不返回此字段故字段为空暂做保留使用
private String tollSign; //通行费标志Y-可抵扣通行费N-不可抵扣通行费通行费增值税电子普通发票返回信息其他类型发票可忽略
private String vehicleTypeNum;
private String departureViaArrival; // 起运地经由到达地货运专票返回信息其他类型发票可忽略
private String receiver; // 收货人名称货运专票返回信息其他类型发票可忽略
private String recipient; // 受票方名称货运专票返回信息其他类型发票可忽略
private String totalAmount; // 合计金额
private List<CommodityDTO> commodityAmount; //金额
private String purchaserName; //购方名称
private List<CommodityDTO> commodityType; //规格型号
private String sender; // 发货人名称货运专票返回信息其他类型发票可忽略
private String purchaserAddress; // 买方单位/个人住址
private List<CommodityDTO> commodityTax; //税额
private String carrierCode; //承运人识别号货运专票返回信息其他类型发票可忽略
private List<CommodityDTO> commodityPlateNum; //车牌号通行费增值税电子普通发票返回信息其他类型发票可忽略
private List<CommodityDTO> commodityUnit; // 单位
private String payee; //收款人因税局不返回此字段故字段为空暂做保留使用
private String recipientCode; //受票方识别号货运专票返回信息其他类型发票可忽略
private List<CommodityDTO> commodityName; // 货物名称/项目名称
private String sellerName; //销售方名称
@NoArgsConstructor
@Data
public static class CommodityDTO {
private String row; //行号
private String word; // 内容
}
}

View File

@ -0,0 +1,17 @@
package com.heyu.api.resp.financial;
import com.heyu.api.data.dto.BaseResp;
import lombok.Data;
/**
* https://console.bce.baidu.com/support/?_=1740494347073&timestamp=1740500368284#/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_verification&method=post
* <p>
* 增值税发票验真
*/
@Data
public class TrainVatInvoiceVerificationResp extends BaseResp {
}

View File

@ -0,0 +1,17 @@
package com.heyu.api.resp.financial;
import com.heyu.api.data.dto.BaseResp;
import lombok.Data;
/**
* https://console.bce.baidu.com/support/?_=1740494347073&timestamp=1740500368284#/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_verification&method=post
* <p>
* 增值税发票验真
*/
@Data
public class UsedCarVatInvoiceVerificationResp extends BaseResp {
}

View File

@ -0,0 +1,16 @@
package com.heyu.api.resp.financial;
import com.heyu.api.data.dto.BaseResp;
import lombok.Data;
/**
* https://console.bce.baidu.com/support/?_=1740494347073&timestamp=1740500368284#/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_verification&method=post
* <p>
* 增值税发票验真
*/
@Data
public class VehicleVatInvoiceVerificationResp extends BaseResp {
}