提交修改
This commit is contained in:
parent
f23833fa2c
commit
36768f9a5b
@ -1,11 +1,11 @@
|
||||
package com.heyu.api.baidu.handle.financial;
|
||||
|
||||
|
||||
import com.heyu.api.data.annotation.CustomPath;
|
||||
import com.heyu.api.data.utils.StringUtils;
|
||||
import com.heyu.api.baidu.BaiduBaseHandle;
|
||||
import com.heyu.api.baidu.request.financial.BAirTicketRequest;
|
||||
import com.heyu.api.baidu.response.financial.BAirTicketResp;
|
||||
import com.heyu.api.data.annotation.CustomPath;
|
||||
import com.heyu.api.data.utils.StringUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
|
||||
@ -52,7 +52,7 @@ public class BMultiAirTicketResp extends BAirTicketResp {
|
||||
@JsonProperty("issued_date")
|
||||
private List<IssuedDateDTO> issuedDate;
|
||||
@JsonProperty("other_tax")
|
||||
private List<?> otherTax;
|
||||
private List<String> otherTax;
|
||||
@JsonProperty("id_num")
|
||||
private List<IdNumDTO> idNum;
|
||||
@JsonProperty("destination_station")
|
||||
|
||||
@ -0,0 +1,227 @@
|
||||
package com.heyu.api.controller.financial;
|
||||
|
||||
|
||||
import com.heyu.api.baidu.handle.financial.BAirTicketHandle;
|
||||
import com.heyu.api.baidu.request.financial.BAirTicketRequest;
|
||||
import com.heyu.api.baidu.response.financial.BAirTicketResp;
|
||||
import com.heyu.api.baidu.response.financial.BMultiAirTicketResp;
|
||||
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.AirTicketMultiResp;
|
||||
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=1740577959399#/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%2Fair_ticket&method=post
|
||||
* <p>
|
||||
* 飞机行程单识别
|
||||
* <p>
|
||||
* <p>
|
||||
* 接口描述
|
||||
* 支持对飞机行程单的24个字段进行结构化识别,包括电子客票号、印刷序号、姓名、始发站、目的站、航班号、日期、时间、票价、身份证号、承运人、民航发展基金、
|
||||
* 保险费、燃油附加费、其他税费、合计金额、填开日期、订票渠道、客票级别、座位等级、销售单位号、签注、免费行李、验证码。 同时,支持单张行程单上的多航班信
|
||||
* 息识别。
|
||||
*/
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/air/ticket/multi")
|
||||
@NotIntercept
|
||||
public class AirTicketMultiController extends BaseController {
|
||||
|
||||
|
||||
@Autowired
|
||||
private BAirTicketHandle bAirTicketHandle;
|
||||
|
||||
|
||||
@RequestMapping("/recognize")
|
||||
@CacheResult
|
||||
public R recognize(BAirTicketRequest req) {
|
||||
AirTicketMultiResp resp = new AirTicketMultiResp();
|
||||
|
||||
|
||||
req.setMultiDetect("true");
|
||||
|
||||
ApiR<BAirTicketResp> bR = bAirTicketHandle.handle(req, BMultiAirTicketResp.class);
|
||||
|
||||
if (bR.isSuccess()) {
|
||||
BMultiAirTicketResp bAirTicketResp = (BMultiAirTicketResp) bR.getData();
|
||||
BMultiAirTicketResp.WordsResultDTO wordsResultDTO = bAirTicketResp.getWordsResult();
|
||||
|
||||
List<String> insurance = new ArrayList<>();
|
||||
if (CollectionUtils.isNotEmpty(wordsResultDTO.getInsurance())) {
|
||||
for (BMultiAirTicketResp.WordsResultDTO.InsuranceDTO insuranceDTO : wordsResultDTO.getInsurance()) {
|
||||
insurance.add(insuranceDTO.getWord());
|
||||
}
|
||||
}
|
||||
resp.setInsurance(insurance);
|
||||
|
||||
List<String> date = new ArrayList<>();
|
||||
if (CollectionUtils.isNotEmpty(wordsResultDTO.getDate())) {
|
||||
for (BMultiAirTicketResp.WordsResultDTO.DateDTO dateDTO : wordsResultDTO.getDate()) {
|
||||
date.add(dateDTO.getWord());
|
||||
}
|
||||
}
|
||||
|
||||
resp.setDate(date);
|
||||
|
||||
|
||||
List<String> flight = new ArrayList<>();
|
||||
if (CollectionUtils.isNotEmpty(wordsResultDTO.getFlight())) {
|
||||
for (BMultiAirTicketResp.WordsResultDTO.FlightDTO flightDTO : wordsResultDTO.getFlight()) {
|
||||
flight.add(flightDTO.getWord());
|
||||
}
|
||||
}
|
||||
|
||||
resp.setFlight(flight);
|
||||
|
||||
|
||||
List<String> issuedBy = new ArrayList<>();
|
||||
if (CollectionUtils.isNotEmpty(wordsResultDTO.getIssuedBy())) {
|
||||
for (BMultiAirTicketResp.WordsResultDTO.IssuedByDTO issuedByDTO : wordsResultDTO.getIssuedBy()) {
|
||||
issuedBy.add(issuedByDTO.getWord());
|
||||
}
|
||||
}
|
||||
|
||||
resp.setIssuedBy(issuedBy);
|
||||
|
||||
|
||||
List<String> startingStation = new ArrayList<>();
|
||||
|
||||
if (CollectionUtils.isNotEmpty(wordsResultDTO.getStartingStation())) {
|
||||
|
||||
for (BMultiAirTicketResp.WordsResultDTO.StartingStationDTO startingStationDTO : wordsResultDTO.getStartingStation()) {
|
||||
|
||||
startingStation.add(startingStationDTO.getWord());
|
||||
}
|
||||
}
|
||||
|
||||
resp.setStartingStation(startingStation);
|
||||
|
||||
List<String> fare = new ArrayList<>();
|
||||
if (CollectionUtils.isNotEmpty(wordsResultDTO.getFare())) {
|
||||
for (BMultiAirTicketResp.WordsResultDTO.FareDTO fareDTO : wordsResultDTO.getFare()) {
|
||||
fare.add(fareDTO.getWord());
|
||||
}
|
||||
}
|
||||
resp.setFare(fare);
|
||||
|
||||
List<String> ticketRates = new ArrayList<>();
|
||||
if (CollectionUtils.isNotEmpty(wordsResultDTO.getTicketRates())) {
|
||||
for (BMultiAirTicketResp.WordsResultDTO.TicketRatesDTO ticketRate : wordsResultDTO.getTicketRates()) {
|
||||
ticketRates.add(ticketRate.getWord());
|
||||
}
|
||||
}
|
||||
resp.setTicketRates(ticketRates);
|
||||
|
||||
|
||||
List<String> serialNumber = new ArrayList<>();
|
||||
if (CollectionUtils.isNotEmpty(wordsResultDTO.getSerialNumber())) {
|
||||
for (BMultiAirTicketResp.WordsResultDTO.SerialNumberDTO serialNumberDTO : wordsResultDTO.getSerialNumber()) {
|
||||
serialNumber.add(serialNumberDTO.getWord());
|
||||
|
||||
}
|
||||
}
|
||||
resp.setSerialNumber(serialNumber);
|
||||
|
||||
List<String> ticketNumber = new ArrayList<>();
|
||||
if (CollectionUtils.isNotEmpty(wordsResultDTO.getTicketNumber())) {
|
||||
for (BMultiAirTicketResp.WordsResultDTO.TicketNumberDTO ticketNumberDTO : wordsResultDTO.getTicketNumber()) {
|
||||
ticketNumber.add(ticketNumberDTO.getWord());
|
||||
}
|
||||
}
|
||||
resp.setTicketNumber(ticketNumber);
|
||||
|
||||
List<String> fuelSurcharge = new ArrayList<>();
|
||||
if (CollectionUtils.isNotEmpty(wordsResultDTO.getFuelSurcharge())) {
|
||||
for (BMultiAirTicketResp.WordsResultDTO.FuelSurchargeDTO fuelSurchargeDTO : wordsResultDTO.getFuelSurcharge()) {
|
||||
fuelSurcharge.add(fuelSurchargeDTO.getWord());
|
||||
|
||||
}
|
||||
}
|
||||
resp.setFuelSurcharge(fuelSurcharge);
|
||||
|
||||
|
||||
List<String> carrier = new ArrayList<>();
|
||||
if (CollectionUtils.isNotEmpty(wordsResultDTO.getCarrier())) {
|
||||
for (BMultiAirTicketResp.WordsResultDTO.CarrierDTO carrierDTO : wordsResultDTO.getCarrier()) {
|
||||
carrier.add(carrierDTO.getWord());
|
||||
}
|
||||
}
|
||||
resp.setCarrier(carrier);
|
||||
|
||||
|
||||
List<String> issuedDate = new ArrayList<>();
|
||||
if (CollectionUtils.isNotEmpty(wordsResultDTO.getIssuedDate())) {
|
||||
for (BMultiAirTicketResp.WordsResultDTO.IssuedDateDTO issuedDateDTO : wordsResultDTO.getIssuedDate()) {
|
||||
issuedDate.add(issuedDateDTO.getWord());
|
||||
}
|
||||
}
|
||||
resp.setIssuedDate(issuedDate);
|
||||
|
||||
List<String> otherTax = new ArrayList<>();
|
||||
if (CollectionUtils.isNotEmpty(wordsResultDTO.getOtherTax())) {
|
||||
for (String tax : wordsResultDTO.getOtherTax()) {
|
||||
otherTax.add(tax);
|
||||
}
|
||||
}
|
||||
resp.setOtherTax(otherTax);
|
||||
|
||||
List<String> idNum = new ArrayList<>();
|
||||
if (CollectionUtils.isNotEmpty(wordsResultDTO.getIdNum())) {
|
||||
for (BMultiAirTicketResp.WordsResultDTO.IdNumDTO idNumDTO : wordsResultDTO.getIdNum()) {
|
||||
idNum.add(idNumDTO.getWord());
|
||||
|
||||
}
|
||||
}
|
||||
resp.setIdNum(idNum);
|
||||
|
||||
|
||||
List<String> destinationStation = new ArrayList<>();
|
||||
if (CollectionUtils.isNotEmpty(wordsResultDTO.getDestinationStation())) {
|
||||
for (BMultiAirTicketResp.WordsResultDTO.DestinationStationDTO destinationStationDTO : wordsResultDTO.getDestinationStation()) {
|
||||
destinationStation.add(destinationStationDTO.getWord());
|
||||
|
||||
}
|
||||
}
|
||||
resp.setDestinationStation(destinationStation);
|
||||
|
||||
|
||||
List<String> name = new ArrayList<>();
|
||||
if (CollectionUtils.isNotEmpty(wordsResultDTO.getName())) {
|
||||
for (BMultiAirTicketResp.WordsResultDTO.NameDTO nameDTO : wordsResultDTO.getName()) {
|
||||
name.add(nameDTO.getWord());
|
||||
|
||||
}
|
||||
}
|
||||
resp.setName(name);
|
||||
|
||||
List<String> time = new ArrayList<>();
|
||||
|
||||
if (CollectionUtils.isNotEmpty(wordsResultDTO.getTime())) {
|
||||
for (BMultiAirTicketResp.WordsResultDTO.TimeDTO timeDTO : wordsResultDTO.getTime()) {
|
||||
time.add(timeDTO.getWord());
|
||||
|
||||
}
|
||||
}
|
||||
resp.setTime(time);
|
||||
|
||||
|
||||
return R.ok().setData(resp);
|
||||
}
|
||||
|
||||
|
||||
return R.error();
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,87 @@
|
||||
package com.heyu.api.controller.financial;
|
||||
|
||||
|
||||
import com.heyu.api.baidu.handle.financial.BAirTicketHandle;
|
||||
import com.heyu.api.baidu.request.financial.BAirTicketRequest;
|
||||
import com.heyu.api.baidu.response.financial.BAirTicketResp;
|
||||
import com.heyu.api.baidu.response.financial.BSingleAirTicketResp;
|
||||
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.AirTicketSingleResp;
|
||||
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=1740577959399#/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%2Fair_ticket&method=post
|
||||
* <p>
|
||||
* 飞机行程单识别
|
||||
* <p>
|
||||
* <p>
|
||||
* 接口描述
|
||||
* 支持对飞机行程单的24个字段进行结构化识别,包括电子客票号、印刷序号、姓名、始发站、目的站、航班号、日期、时间、票价、身份证号、承运人、民航发展基金、
|
||||
* 保险费、燃油附加费、其他税费、合计金额、填开日期、订票渠道、客票级别、座位等级、销售单位号、签注、免费行李、验证码。 同时,支持单张行程单上的多航班信
|
||||
* 息识别。
|
||||
*/
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/air/ticket/single")
|
||||
@NotIntercept
|
||||
public class AirTicketSingleController extends BaseController {
|
||||
|
||||
|
||||
@Autowired
|
||||
private BAirTicketHandle bAirTicketHandle;
|
||||
|
||||
|
||||
@RequestMapping("/recognize")
|
||||
@CacheResult
|
||||
public R recognize(BAirTicketRequest req) {
|
||||
|
||||
|
||||
AirTicketSingleResp resp = new AirTicketSingleResp();
|
||||
req.setMultiDetect("false");
|
||||
|
||||
ApiR<BAirTicketResp> bR = bAirTicketHandle.handle(req, BSingleAirTicketResp.class);
|
||||
|
||||
if (bR.isSuccess()) {
|
||||
BSingleAirTicketResp bAirTicketResp = (BSingleAirTicketResp) bR.getData();
|
||||
BSingleAirTicketResp.WordsResultDTO wordsResultDTO = bAirTicketResp.getWordsResult();
|
||||
resp.setInsurance(wordsResultDTO.getInsurance()); // 保险费
|
||||
resp.setDate(wordsResultDTO.getDate()); // 日期
|
||||
resp.setAllow(wordsResultDTO.getAllow()); //免费行李
|
||||
resp.setFlight(wordsResultDTO.getFlight()); // 航班号
|
||||
resp.setIssuedBy(wordsResultDTO.getIssuedBy()); //订票渠道
|
||||
resp.setStartingStation(wordsResultDTO.getStartingStation()); // 始发站
|
||||
resp.setFare(wordsResultDTO.getFare()); //票价
|
||||
resp.setEndorsement(wordsResultDTO.getEndorsement()); // 签注
|
||||
resp.setTicketRates(wordsResultDTO.getTicketRates()); // 合计金额
|
||||
resp.setCk(wordsResultDTO.getCk()); //验证码
|
||||
resp.setSerialNumber(wordsResultDTO.getSerialNumber()); // 印刷序号
|
||||
resp.setTicketNumber(wordsResultDTO.getTicketNumber()); // 电子客票号码
|
||||
resp.setFuelSurcharge(wordsResultDTO.getFuelSurcharge()); // 燃油附加费
|
||||
resp.setCarrier(wordsResultDTO.getCarrier()); // 承运人
|
||||
resp.setIssuedDate(wordsResultDTO.getIssuedDate()); //填开日期
|
||||
resp.setOtherTax(wordsResultDTO.getOtherTax()); // 其他税费
|
||||
resp.setFareBasis(wordsResultDTO.getFareBasis()); // 客票级别
|
||||
resp.setIdNum(wordsResultDTO.getIdNum()); // 身份证号
|
||||
resp.setDestinationStation(wordsResultDTO.getDestinationStation()); // 目的站
|
||||
resp.setName(wordsResultDTO.getName()); // 姓名
|
||||
resp.setAgentCode(wordsResultDTO.getAgentCode()); // 销售单位号
|
||||
resp.setTime(wordsResultDTO.getTime()); // 时间
|
||||
resp.setClassX(wordsResultDTO.getClassX()); // 座位等级
|
||||
resp.setDevFund(wordsResultDTO.getDevFund()); // 民航发展基金/基建费
|
||||
return R.ok().setData(resp);
|
||||
}
|
||||
|
||||
|
||||
return R.error();
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,51 @@
|
||||
package com.heyu.api.resp.financial;
|
||||
|
||||
import com.heyu.api.data.dto.BaseResp;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class AirTicketMultiResp extends BaseResp {
|
||||
|
||||
|
||||
|
||||
|
||||
private List<String> insurance;
|
||||
|
||||
private List<String> date;
|
||||
|
||||
private List<String> flight;
|
||||
|
||||
private List<String> issuedBy;
|
||||
|
||||
private List<String> startingStation;
|
||||
|
||||
private List<String > fare;
|
||||
|
||||
private List<String> ticketRates;
|
||||
|
||||
private List<String> serialNumber;
|
||||
|
||||
private List<String> ticketNumber;
|
||||
|
||||
private List<String> fuelSurcharge;
|
||||
|
||||
private List<String> carrier;
|
||||
|
||||
private List<String> issuedDate;
|
||||
|
||||
private List<?> otherTax;
|
||||
|
||||
private List<String> idNum;
|
||||
|
||||
private List<String> destinationStation;
|
||||
|
||||
private List<String> name;
|
||||
|
||||
private List<String> time;
|
||||
|
||||
private List<String> devFund;
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,36 @@
|
||||
package com.heyu.api.resp.financial;
|
||||
|
||||
import com.heyu.api.data.dto.BaseResp;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class AirTicketSingleResp extends BaseResp {
|
||||
|
||||
|
||||
|
||||
|
||||
private String insurance; // 保险费
|
||||
private String date; // 日期
|
||||
private String allow; //免费行李
|
||||
private String flight; // 航班号
|
||||
private String issuedBy; //订票渠道
|
||||
private String startingStation; // 始发站
|
||||
private String fare; //票价
|
||||
private String endorsement; // 签注
|
||||
private String ticketRates; // 合计金额
|
||||
private String ck; //验证码
|
||||
private String serialNumber; // 印刷序号
|
||||
private String ticketNumber; // 电子客票号码
|
||||
private String fuelSurcharge; // 燃油附加费
|
||||
private String carrier; // 承运人
|
||||
private String issuedDate; //填开日期
|
||||
private String otherTax; // 其他税费
|
||||
private String fareBasis; // 客票级别
|
||||
private String idNum; // 身份证号
|
||||
private String destinationStation; // 目的站
|
||||
private String name; // 姓名
|
||||
private String agentCode; // 销售单位号
|
||||
private String time; // 时间
|
||||
private String classX; // 座位等级
|
||||
private String devFund; // 民航发展基金/基建费
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user