From fbcd56b5a4272e03ebbddb6748134e5edc8e522f Mon Sep 17 00:00:00 2001 From: quyixiao <2621048238@qq.com> Date: Tue, 25 Mar 2025 21:20:51 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BUsedCarVatInvoiceVerificationResp.java | 84 +++++++++++++ .../BVehicleVatInvoiceVerificationResp.java | 83 ++++++++++++ ...sportVatInvoiceVerificationController.java | 72 +++++++++++ ...TrainVatInvoiceVerificationController.java | 76 +++++++++++ ...edCarVatInvoiceVerificationController.java | 118 ++++++++++++++++++ ...hicleVatInvoiceVerificationController.java | 106 ++++++++++++++++ .../UsedCarVatInvoiceVerificationResp.java | 52 +++++++- .../VehicleVatInvoiceVerificationResp.java | 53 ++++++++ 8 files changed, 643 insertions(+), 1 deletion(-) create mode 100644 api-web/api-interface/src/main/java/com/heyu/api/controller/financial/AirTransportVatInvoiceVerificationController.java create mode 100644 api-web/api-interface/src/main/java/com/heyu/api/controller/financial/TrainVatInvoiceVerificationController.java create mode 100644 api-web/api-interface/src/main/java/com/heyu/api/controller/financial/UsedCarVatInvoiceVerificationController.java create mode 100644 api-web/api-interface/src/main/java/com/heyu/api/controller/financial/VehicleVatInvoiceVerificationController.java diff --git a/api-third/src/main/java/com/heyu/api/baidu/response/financial/BUsedCarVatInvoiceVerificationResp.java b/api-third/src/main/java/com/heyu/api/baidu/response/financial/BUsedCarVatInvoiceVerificationResp.java index 68a6f8b..2ca4cf3 100644 --- a/api-third/src/main/java/com/heyu/api/baidu/response/financial/BUsedCarVatInvoiceVerificationResp.java +++ b/api-third/src/main/java/com/heyu/api/baidu/response/financial/BUsedCarVatInvoiceVerificationResp.java @@ -1,7 +1,9 @@ package com.heyu.api.baidu.response.financial; +import com.fasterxml.jackson.annotation.JsonProperty; import lombok.Data; +import lombok.NoArgsConstructor; /** * https://console.bce.baidu.com/support/?_=1740494347073×tamp=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 @@ -9,8 +11,90 @@ import lombok.Data; * 增值税发票验真 */ +@NoArgsConstructor @Data public class BUsedCarVatInvoiceVerificationResp 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("Operator") + private String operator; + @JsonProperty("TransferVehicleManagementOffice") + private String transferVehicleManagementOffice; + @JsonProperty("ManuModel") + private String manuModel; + @JsonProperty("RegistrationCode") + private String registrationCode; + @JsonProperty("OperatorPhone") + private String operatorPhone; + @JsonProperty("PurchaserCode") + private String purchaserCode; + @JsonProperty("Saler") + private String saler; + @JsonProperty("UsedCarMarketCode") + private String usedCarMarketCode; + @JsonProperty("Purchaser") + private String purchaser; + @JsonProperty("OperatorCode") + private String operatorCode; + @JsonProperty("UsedCarMarketBank") + private String usedCarMarketBank; + @JsonProperty("SalerAddress") + private String salerAddress; + @JsonProperty("SalerCode") + private String salerCode; + @JsonProperty("PurchaserPhone") + private String purchaserPhone; + @JsonProperty("LicensePlateNum") + private String licensePlateNum; + @JsonProperty("VehicleType") + private String vehicleType; + @JsonProperty("OperatorBank") + private String operatorBank; + @JsonProperty("OperatorAddress") + private String operatorAddress; + @JsonProperty("VinNum") + private String vinNum; + @JsonProperty("TotalCarPrice") + private String totalCarPrice; + @JsonProperty("SalerPhone") + private String salerPhone; + @JsonProperty("PurchaserAddress") + private String purchaserAddress; + @JsonProperty("UsedCarMarketPhone") + private String usedCarMarketPhone; + @JsonProperty("UsedCarMarketAddress") + private String usedCarMarketAddress; + @JsonProperty("UsedCarMarket") + private String usedCarMarket; + } } diff --git a/api-third/src/main/java/com/heyu/api/baidu/response/financial/BVehicleVatInvoiceVerificationResp.java b/api-third/src/main/java/com/heyu/api/baidu/response/financial/BVehicleVatInvoiceVerificationResp.java index 3c05a05..56a1864 100644 --- a/api-third/src/main/java/com/heyu/api/baidu/response/financial/BVehicleVatInvoiceVerificationResp.java +++ b/api-third/src/main/java/com/heyu/api/baidu/response/financial/BVehicleVatInvoiceVerificationResp.java @@ -1,7 +1,9 @@ package com.heyu.api.baidu.response.financial; +import com.fasterxml.jackson.annotation.JsonProperty; import lombok.Data; +import lombok.NoArgsConstructor; /** * https://console.bce.baidu.com/support/?_=1740494347073×tamp=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 @@ -9,7 +11,88 @@ import lombok.Data; * 增值税发票验真 */ +@NoArgsConstructor @Data public class BVehicleVatInvoiceVerificationResp 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("Origin") + private String origin; + @JsonProperty("ManuModel") + private String manuModel; + @JsonProperty("SalerBank") + private String salerBank; + @JsonProperty("VehicleType") + private String vehicleType; + @JsonProperty("Tax") + private String tax; + @JsonProperty("TaxPaymentVoucherNum") + private String taxPaymentVoucherNum; + @JsonProperty("CommodityInspectionNum") + private String commodityInspectionNum; + @JsonProperty("TaxAuthorCode") + private String taxAuthorCode; + @JsonProperty("VinNum") + private String vinNum; + @JsonProperty("SalerPhone") + private String salerPhone; + @JsonProperty("LimitPassenger") + private String limitPassenger; + @JsonProperty("PurchaserCode") + private String purchaserCode; + @JsonProperty("TaxAuthor") + private String taxAuthor; + @JsonProperty("Tonnage") + private String tonnage; + @JsonProperty("ImportCertificateNum") + private String importCertificateNum; + @JsonProperty("Saler") + private String saler; + @JsonProperty("SalerAccountNum") + private String salerAccountNum; + @JsonProperty("Price") + private String price; + @JsonProperty("CertificateNum") + private String certificateNum; + @JsonProperty("TaxRate") + private String taxRate; + @JsonProperty("Purchaser") + private String purchaser; + @JsonProperty("SalerCode") + private String salerCode; + @JsonProperty("EngineNum") + private String engineNum; + @JsonProperty("PriceTaxLow") + private String priceTaxLow; + } } diff --git a/api-web/api-interface/src/main/java/com/heyu/api/controller/financial/AirTransportVatInvoiceVerificationController.java b/api-web/api-interface/src/main/java/com/heyu/api/controller/financial/AirTransportVatInvoiceVerificationController.java new file mode 100644 index 0000000..e5100af --- /dev/null +++ b/api-web/api-interface/src/main/java/com/heyu/api/controller/financial/AirTransportVatInvoiceVerificationController.java @@ -0,0 +1,72 @@ +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.BAirTransportVatInvoiceVerificationResp; +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.AirTransportVatInvoiceVerificationRequest; +import com.heyu.api.resp.financial.AirTransportVatInvoiceVerificationResp; +import com.heyu.api.resp.financial.CommonVatInvoiceVerificationResp; +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/?_=1740494347073×tamp=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("/air/transport/vat/Invoice") +@NotIntercept +public class AirTransportVatInvoiceVerificationController extends BaseController { + + + @Autowired + private BVatInvoiceVerificationHandle bVatInvoiceVerificationHandle; + + + @RequestMapping("/verification") + @CacheResult + public R verification(AirTransportVatInvoiceVerificationRequest 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 bR = bVatInvoiceVerificationHandle.handle(bVatInvoiceVerificationRequest, AirTransportVatInvoiceVerificationResp.class); + if (bR.isSuccess()) { + BAirTransportVatInvoiceVerificationResp bAirTransportVatInvoiceVerificationResp = (BAirTransportVatInvoiceVerificationResp) bR.getData(); + + } + return R.ok(); + } + + +} diff --git a/api-web/api-interface/src/main/java/com/heyu/api/controller/financial/TrainVatInvoiceVerificationController.java b/api-web/api-interface/src/main/java/com/heyu/api/controller/financial/TrainVatInvoiceVerificationController.java new file mode 100644 index 0000000..83cdb33 --- /dev/null +++ b/api-web/api-interface/src/main/java/com/heyu/api/controller/financial/TrainVatInvoiceVerificationController.java @@ -0,0 +1,76 @@ +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.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/?_=1740494347073×tamp=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("/train/vat/Invoice") +@NotIntercept +public class TrainVatInvoiceVerificationController 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 bR = bVatInvoiceVerificationHandle.handle(bVatInvoiceVerificationRequest, BCommonVatInvoiceVerificationResp.class); + if (bR.isSuccess()) { + + + + } + + + return R.ok(); + } + + +} diff --git a/api-web/api-interface/src/main/java/com/heyu/api/controller/financial/UsedCarVatInvoiceVerificationController.java b/api-web/api-interface/src/main/java/com/heyu/api/controller/financial/UsedCarVatInvoiceVerificationController.java new file mode 100644 index 0000000..79594b0 --- /dev/null +++ b/api-web/api-interface/src/main/java/com/heyu/api/controller/financial/UsedCarVatInvoiceVerificationController.java @@ -0,0 +1,118 @@ +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.BUsedCarVatInvoiceVerificationResp; +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.UsedCarVatInvoiceVerificationResp; +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/?_=1740494347073×tamp=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("/used/car/vat/Invoice") +@NotIntercept +public class UsedCarVatInvoiceVerificationController 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()); + + UsedCarVatInvoiceVerificationResp resp = new UsedCarVatInvoiceVerificationResp(); + + + ApiR bR = bVatInvoiceVerificationHandle.handle(bVatInvoiceVerificationRequest, BUsedCarVatInvoiceVerificationResp.class); + if (bR.isSuccess()) { + + BUsedCarVatInvoiceVerificationResp bUsedCarVatInvoiceVerificationResp =(BUsedCarVatInvoiceVerificationResp) bR.getData(); + BUsedCarVatInvoiceVerificationResp.WordsResultDTO wordsResultDTO = bUsedCarVatInvoiceVerificationResp.getWordsResult(); + + + resp.setVerifyFrequency(wordsResultDTO.getVerifyFrequency()); // 查验次数。为历史查验次数 + resp.setVerifyMessage(wordsResultDTO.getVerifyMessage()); //查验结果信息。查验成功且发票为真返回“查验成功发票一致“,查验失败返回对应错误原因,详见末尾表格 + resp.setInvalidSign(wordsResultDTO.getInvalidSign()); // 是否作废(冲红)。Y:已作废;H:已冲红;N:未作废 + resp.setInvoiceType(wordsResultDTO.getInvoiceType()); //发票种类。即增值税专用发票、增值税电子专用发票、增值税普通发票、增值税普通发票(电子)、增值税普通发票(卷式)、通行费增值税电子普通发票、区块链电子发票、全电发票(专用发票)、全电发票(普通发票)、机动车销售发票、二手车销售发票、货物运输业增值税专用发票、航空运输电子客票行程单(电子发票)、铁路电子客票(电子发票) + resp.setMachineCode(wordsResultDTO.getMachineCode()); //机器编号 + resp.setCheckCode(wordsResultDTO.getCheckCode()); //校验码 + resp.setInvoiceCode(wordsResultDTO.getInvoiceCode()); //发票代码 + resp.setInvoiceDate(wordsResultDTO.getInvoiceDate()); // 开票日期 + resp.setVerifyResult(wordsResultDTO.getPurchaser()); //查验结果。查验成功返回“0001”,查验失败返回对应查验结果错误码,详见末尾表格 + resp.setInvoiceNum(wordsResultDTO.getInvoiceNum()); //发票号码 + resp.setOperator(wordsResultDTO.getOperator()); //经营、拍卖单位 + resp.setTransferVehicleManagementOffice(wordsResultDTO.getTransferVehicleManagementOffice()); // 转入地车辆车管所名称 + resp.setManuModel(wordsResultDTO.getManuModel()); //厂牌型号 + resp.setRegistrationCode(wordsResultDTO.getRegistrationCode()); //登记证号 + resp.setOperatorPhone(wordsResultDTO.getOperatorPhone()); //经营、拍卖单位电话 + resp.setPurchaserCode(wordsResultDTO.getPurchaserCode()); //买方单位代码/身份证号 + resp.setSaler(wordsResultDTO.getSaler()); //卖方单位/个人 + resp.setUsedCarMarketCode(wordsResultDTO.getUsedCarMarketCode()); //二手车市场纳税人识别号 + resp.setPurchaser(wordsResultDTO.getPurchaser()); //买方单位/个人 + resp.setOperatorCode(wordsResultDTO.getOperatorCode()); //经营、拍卖单位纳税人识别号 + resp.setUsedCarMarketBank(wordsResultDTO.getUsedCarMarketBank()); // 二手车市场开户银行及账号 + resp.setSalerAddress(wordsResultDTO.getSalerAddress()); // 卖方单位/个人住址 + resp.setSalerCode(wordsResultDTO.getSalerCode()); //卖方单位代码/身份证号 + resp.setPurchaserPhone(wordsResultDTO.getPurchaserPhone()); //买方电话 + resp.setLicensePlateNum(wordsResultDTO.getLicensePlateNum()); //车牌照号 + resp.setVehicleType(wordsResultDTO.getVehicleType()); //车辆类型 + resp.setOperatorBank(wordsResultDTO.getOperatorBank()); //开户银行及账号 + resp.setOperatorAddress(wordsResultDTO.getOperatorAddress()); //经营、拍卖单位地址 + resp.setVinNum(wordsResultDTO.getVinNum()); //车辆识别代号/车架号码 + resp.setTotalCarPrice(wordsResultDTO.getTotalCarPrice()); //车价合计 + resp.setSalerPhone(wordsResultDTO.getSalerPhone()); //卖方电话 + resp.setPurchaserAddress(wordsResultDTO.getPurchaserAddress()); //买方单位/个人住址 + resp.setUsedCarMarketPhone(wordsResultDTO.getUsedCarMarketPhone()); //二手车市场电话 + resp.setUsedCarMarketAddress(wordsResultDTO.getUsedCarMarketAddress()); //二手车市地址 + resp.setUsedCarMarket(wordsResultDTO.getUsedCarMarket()); // 二手车市场 + + return R.ok().setData(resp); + + + + + } + + + return R.ok(); + } + + +} diff --git a/api-web/api-interface/src/main/java/com/heyu/api/controller/financial/VehicleVatInvoiceVerificationController.java b/api-web/api-interface/src/main/java/com/heyu/api/controller/financial/VehicleVatInvoiceVerificationController.java new file mode 100644 index 0000000..80e65f2 --- /dev/null +++ b/api-web/api-interface/src/main/java/com/heyu/api/controller/financial/VehicleVatInvoiceVerificationController.java @@ -0,0 +1,106 @@ +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.BVatInvoiceVerificationResp; +import com.heyu.api.baidu.response.financial.BVehicleVatInvoiceVerificationResp; +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.VehicleVatInvoiceVerificationRequest; +import com.heyu.api.resp.financial.VehicleVatInvoiceVerificationResp; +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/?_=1740494347073×tamp=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("/vehicle/vat/Invoice") +@NotIntercept +public class VehicleVatInvoiceVerificationController extends BaseController { + + + @Autowired + private BVatInvoiceVerificationHandle bVatInvoiceVerificationHandle; + + + @RequestMapping("/verification") + @CacheResult + public R verification(VehicleVatInvoiceVerificationRequest 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()); + + VehicleVatInvoiceVerificationResp resp= new VehicleVatInvoiceVerificationResp(); + ApiR bR = bVatInvoiceVerificationHandle.handle(bVatInvoiceVerificationRequest, BVehicleVatInvoiceVerificationResp.class); + if (bR.isSuccess()) { + BVehicleVatInvoiceVerificationResp bVehicleVatInvoiceVerificationResp = (BVehicleVatInvoiceVerificationResp)bR.getData(); + BVehicleVatInvoiceVerificationResp.WordsResultDTO wordsResultDTO = bVehicleVatInvoiceVerificationResp.getWordsResult(); + + resp.setVerifyFrequency(wordsResultDTO.getVerifyFrequency()); // 查验次数。为历史查验次数 + resp.setVerifyMessage(wordsResultDTO.getVerifyMessage()); //查验结果信息。查验成功且发票为真返回“查验成功发票一致“,查验失败返回对应错误原因,详见末尾表格 + resp.setInvalidSign(wordsResultDTO.getInvalidSign()); // 是否作废(冲红)。Y:已作废;H:已冲红;N:未作废 + resp.setInvoiceType(wordsResultDTO.getInvoiceType()); //发票种类。即增值税专用发票、增值税电子专用发票、增值税普通发票、增值税普通发票(电子)、增值税普通发票(卷式)、通行费增值税电子普通发票、区块链电子发票、全电发票(专用发票)、全电发票(普通发票)、机动车销售发票、二手车销售发票、货物运输业增值税专用发票、航空运输电子客票行程单(电子发票)、铁路电子客票(电子发票) + resp.setMachineCode(wordsResultDTO.getMachineCode()); //机器编号 + resp.setCheckCode(wordsResultDTO.getCheckCode()); //校验码 + resp.setInvoiceCode(wordsResultDTO.getInvoiceCode()); //发票代码 + resp.setInvoiceDate(wordsResultDTO.getInvoiceDate()); // 开票日期 + resp.setVerifyResult(wordsResultDTO.getVerifyResult()); //查验结果。查验成功返回“0001”,查验失败返回对应查验结果错误码,详见末尾表格 + resp.setInvoiceNum(wordsResultDTO.getInvoiceNum()); //发票号码 + resp.setOrigin(wordsResultDTO.getOrigin()); // 始发地 + resp.setManuModel(wordsResultDTO.getManuModel()); //厂牌型号 + resp.setSalerBank(wordsResultDTO.getSalerBank()); //销货单位开户银行 + resp.setVehicleType(wordsResultDTO.getVehicleType()); + resp.setTax(wordsResultDTO.getTax()); //税额 + resp.setTaxPaymentVoucherNum(wordsResultDTO.getTaxPaymentVoucherNum()); //完税凭证号码 + resp.setCommodityInspectionNum(wordsResultDTO.getCommodityInspectionNum()); //商检单号 + resp.setTaxAuthorCode(wordsResultDTO.getTaxAuthorCode()); // 主管税务机关代码 + resp.setVinNum(wordsResultDTO.getInvoiceNum()); // 车辆识别代号/车架号码 + resp.setSalerPhone(wordsResultDTO.getSalerPhone()); // 卖方电话 + resp.setLimitPassenger(wordsResultDTO.getLimitPassenger()); // 限乘人数 + resp.setPurchaserCode(wordsResultDTO.getPurchaserCode()); //买方单位代码/身份证号 + resp.setTaxAuthor(wordsResultDTO.getTaxAuthor()); //主管税务机关名称 + resp.setTonnage(wordsResultDTO.getTonnage()); //吨位 + resp.setImportCertificateNum(wordsResultDTO.getImportCertificateNum()); //进口证明书号 + resp.setSaler(wordsResultDTO.getSaler()); // 销货单位名称 + resp.setSalerAccountNum(wordsResultDTO.getSalerAccountNum()); //销货单位账号 + resp.setPrice(wordsResultDTO.getPrice()); //不含税价格 + resp.setCertificateNum(wordsResultDTO.getCertificateNum()); //合格证号书 + resp.setTaxRate(wordsResultDTO.getTaxRate()); //税率 + resp.setPurchaser(wordsResultDTO.getPurchaser()); // 买方单位/个人 + resp.setSalerCode(wordsResultDTO.getSalerCode()); //卖方单位代码/身份证号 + resp.setEngineNum(wordsResultDTO.getEngineNum()); // 发动机号码 + resp.setPriceTaxLow(wordsResultDTO.getPriceTaxLow()); //价税合计 + return R.ok().setData(resp); + } + return R.ok(); + } + + +} diff --git a/api-web/api-interface/src/main/java/com/heyu/api/resp/financial/UsedCarVatInvoiceVerificationResp.java b/api-web/api-interface/src/main/java/com/heyu/api/resp/financial/UsedCarVatInvoiceVerificationResp.java index 39a3e58..74f6ab6 100644 --- a/api-web/api-interface/src/main/java/com/heyu/api/resp/financial/UsedCarVatInvoiceVerificationResp.java +++ b/api-web/api-interface/src/main/java/com/heyu/api/resp/financial/UsedCarVatInvoiceVerificationResp.java @@ -13,5 +13,55 @@ import lombok.Data; @Data public class UsedCarVatInvoiceVerificationResp 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 operator; //经营、拍卖单位 + private String transferVehicleManagementOffice; // 转入地车辆车管所名称 + private String manuModel; //厂牌型号 + private String registrationCode; //登记证号 + private String operatorPhone; //经营、拍卖单位电话 + private String purchaserCode; //买方单位代码/身份证号 + private String saler; //卖方单位/个人 + private String usedCarMarketCode; //二手车市场纳税人识别号 + private String purchaser; //买方单位/个人 + private String operatorCode; //经营、拍卖单位纳税人识别号 + private String usedCarMarketBank; // 二手车市场开户银行及账号 + private String salerAddress; // 卖方单位/个人住址 + private String salerCode; //卖方单位代码/身份证号 + private String purchaserPhone; //买方电话 + private String licensePlateNum; //车牌照号 + private String vehicleType; //车辆类型 + private String operatorBank; //开户银行及账号 + private String operatorAddress; //经营、拍卖单位地址 + private String vinNum; //车辆识别代号/车架号码 + private String totalCarPrice; //车价合计 + private String salerPhone; //卖方电话 + private String purchaserAddress; //买方单位/个人住址 + private String usedCarMarketPhone; //二手车市场电话 + private String usedCarMarketAddress; //二手车市地址 + private String usedCarMarket; // 二手车市场 } diff --git a/api-web/api-interface/src/main/java/com/heyu/api/resp/financial/VehicleVatInvoiceVerificationResp.java b/api-web/api-interface/src/main/java/com/heyu/api/resp/financial/VehicleVatInvoiceVerificationResp.java index 0251c3b..76b6718 100644 --- a/api-web/api-interface/src/main/java/com/heyu/api/resp/financial/VehicleVatInvoiceVerificationResp.java +++ b/api-web/api-interface/src/main/java/com/heyu/api/resp/financial/VehicleVatInvoiceVerificationResp.java @@ -13,4 +13,57 @@ import lombok.Data; @Data public class VehicleVatInvoiceVerificationResp 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 origin; // 始发地 + private String manuModel; //厂牌型号 + private String salerBank; //销货单位开户银行 + private String vehicleType; + private String tax; //税额 + private String taxPaymentVoucherNum; //完税凭证号码 + private String commodityInspectionNum; //商检单号 + private String taxAuthorCode; // 主管税务机关代码 + private String vinNum; // 车辆识别代号/车架号码 + private String salerPhone; // 卖方电话 + private String limitPassenger; // 限乘人数 + private String purchaserCode; //买方单位代码/身份证号 + private String taxAuthor; //主管税务机关名称 + private String tonnage; //吨位 + private String importCertificateNum; //进口证明书号 + private String saler; // 销货单位名称 + private String salerAccountNum; //销货单位账号 + private String price; //不含税价格 + private String certificateNum; //合格证号书 + private String taxRate; //税率 + private String purchaser; // 买方单位/个人 + private String salerCode; //卖方单位代码/身份证号 + private String engineNum; // 发动机号码 + private String priceTaxLow; //价税合计 + }