|
|
|
@ -1,12 +1,16 @@ |
|
|
|
|
package com.dxhy.core.service.openservice.impl; |
|
|
|
|
|
|
|
|
|
import java.util.Date; |
|
|
|
|
import java.util.List; |
|
|
|
|
import java.util.Optional; |
|
|
|
|
import java.util.UUID; |
|
|
|
|
import java.io.*; |
|
|
|
|
import java.util.*; |
|
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
|
|
|
|
|
|
|
import cn.hutool.core.codec.Base64Decoder; |
|
|
|
|
import com.dxhy.common.util.FileUtil; |
|
|
|
|
import com.dxhy.core.service.openservice.model.ocr.*; |
|
|
|
|
import com.google.common.collect.Lists; |
|
|
|
|
import com.google.common.collect.Maps; |
|
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
|
import org.springframework.beans.factory.annotation.Value; |
|
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
@ -57,6 +61,8 @@ public class OpenServicePlatformServiceImpl implements IOpenServicePlatformServi |
|
|
|
|
private String ocrTaxno; |
|
|
|
|
@Value("${openService.ocrUrl:}") |
|
|
|
|
private String ocrUrl; |
|
|
|
|
@Value("${sn.ocrUrl:}") |
|
|
|
|
private String snOcrUrl; |
|
|
|
|
@Resource |
|
|
|
|
private MakeAppSecService makeAppSecService; |
|
|
|
|
|
|
|
|
@ -154,38 +160,276 @@ public class OpenServicePlatformServiceImpl implements IOpenServicePlatformServi |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public List<OpenServiceOcr> ocrInvoice(String picture, String userName, String password, String taxno) { |
|
|
|
|
return OcrToSn(picture); |
|
|
|
|
// String sendDate = DateUtil.format(new Date(), DatePattern.PURE_DATETIME_PATTERN);
|
|
|
|
|
// String signStr = "username=%s&sendDate=%s&version=%s";
|
|
|
|
|
// String version = "1.0";
|
|
|
|
|
// if (StringUtils.isBlank(userName) || StringUtils.isBlank(password) || StringUtils.isBlank(taxno)) {
|
|
|
|
|
// userName = ocrUserName;
|
|
|
|
|
// password = ocrPassword;
|
|
|
|
|
// taxno = ocrTaxno;
|
|
|
|
|
// }
|
|
|
|
|
// signStr = String.format(signStr, userName, sendDate, version);
|
|
|
|
|
// JSONObject dataJson = new JSONObject();
|
|
|
|
|
// dataJson.put("taxno", taxno);
|
|
|
|
|
// dataJson.put("picture", picture);
|
|
|
|
|
// JSONObject json = new JSONObject();
|
|
|
|
|
// json.put("username", userName);
|
|
|
|
|
// json.put("password", password);
|
|
|
|
|
// json.put("sendDate", sendDate);
|
|
|
|
|
// json.put("signature", makeAppSecService.getSign(signStr, password));
|
|
|
|
|
// json.put("version", version);
|
|
|
|
|
// log.info("请求报文,去除picture:{} , picture是否有值:{}", json.toJSONString(), StringUtils.isNotBlank(picture));
|
|
|
|
|
// json.put("data", Base64.encode(dataJson.toString()));
|
|
|
|
|
//
|
|
|
|
|
// String post = HttpUtil.post(ocrUrl, json.toString(), 60000);
|
|
|
|
|
// log.info("ocr识别结果:{}", post);
|
|
|
|
|
// JSONObject jsonObject = JSONObject.parseObject(post, JSONObject.class);
|
|
|
|
|
// String returnCode = jsonObject.getString("returnCode");
|
|
|
|
|
//
|
|
|
|
|
// if (!"0000".equals(returnCode)) {
|
|
|
|
|
// return null;
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// String decodeStr = Base64.decodeStr(jsonObject.getString("data"));
|
|
|
|
|
// return JSONObject.parseArray(decodeStr, OpenServiceOcr.class);
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
String sendDate = DateUtil.format(new Date(), DatePattern.PURE_DATETIME_PATTERN); |
|
|
|
|
String signStr = "username=%s&sendDate=%s&version=%s"; |
|
|
|
|
String version = "1.0"; |
|
|
|
|
if (StringUtils.isBlank(userName) || StringUtils.isBlank(password) || StringUtils.isBlank(taxno)) { |
|
|
|
|
userName = ocrUserName; |
|
|
|
|
password = ocrPassword; |
|
|
|
|
taxno = ocrTaxno; |
|
|
|
|
} |
|
|
|
|
signStr = String.format(signStr, userName, sendDate, version); |
|
|
|
|
JSONObject dataJson = new JSONObject(); |
|
|
|
|
dataJson.put("taxno", taxno); |
|
|
|
|
dataJson.put("picture", picture); |
|
|
|
|
JSONObject json = new JSONObject(); |
|
|
|
|
json.put("username", userName); |
|
|
|
|
json.put("password", password); |
|
|
|
|
json.put("sendDate", sendDate); |
|
|
|
|
json.put("signature", makeAppSecService.getSign(signStr, password)); |
|
|
|
|
json.put("version", version); |
|
|
|
|
log.info("请求报文,去除picture:{} , picture是否有值:{}", json.toJSONString(), StringUtils.isNotBlank(picture)); |
|
|
|
|
json.put("data", Base64.encode(dataJson.toString())); |
|
|
|
|
|
|
|
|
|
String post = HttpUtil.post(ocrUrl, json.toString(), 60000); |
|
|
|
|
log.info("ocr识别结果:{}", post); |
|
|
|
|
JSONObject jsonObject = JSONObject.parseObject(post, JSONObject.class); |
|
|
|
|
String returnCode = jsonObject.getString("returnCode"); |
|
|
|
|
|
|
|
|
|
if (!"0000".equals(returnCode)) { |
|
|
|
|
return null; |
|
|
|
|
/** |
|
|
|
|
* Ocr识别使用山能 |
|
|
|
|
* @param picture 文件流 |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
public List<OpenServiceOcr> OcrToSn(String picture){ |
|
|
|
|
//判断是否为图片流文件, 兼容公司平台进行base64解密
|
|
|
|
|
String str = Base64Decoder.decodeStr(picture); |
|
|
|
|
String requestUrl = snOcrUrl; |
|
|
|
|
String result = FileUtil.uploadFile(requestUrl, str); |
|
|
|
|
if(StringUtils.isBlank(result)){ |
|
|
|
|
log.info("调用山能ocr识别失败"); |
|
|
|
|
}else { |
|
|
|
|
OcrResponseVo ocrResponseVo = JSONObject.parseObject(result, OcrResponseVo.class); |
|
|
|
|
if(ocrResponseVo != null && ocrResponseVo.getCode() == 200){ |
|
|
|
|
List<OcrDataListEntity> ocrDataListEntities = ocrResponseVo.getResult().getObjectList(); |
|
|
|
|
return dxOcrConvertSnOcr(ocrDataListEntities); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//实现实体类转换
|
|
|
|
|
public List<OpenServiceOcr> dxOcrConvertSnOcr(List<OcrDataListEntity> ocrDataListEntities){ |
|
|
|
|
List<OpenServiceOcr> openServices = Lists.newArrayList(); |
|
|
|
|
for (OcrDataListEntity ocrDataListEntity : ocrDataListEntities) { |
|
|
|
|
OpenServiceOcr serviceOcr = new OpenServiceOcr(); |
|
|
|
|
List<List<OcrProductListEntity>> productList = ocrDataListEntity.getProductList(); |
|
|
|
|
|
|
|
|
|
List<OcrItemListEntity> itemList = ocrDataListEntity.getItemList(); |
|
|
|
|
|
|
|
|
|
Map<String, String> itemData = itemList.stream().collect(Collectors.toMap(OcrItemListEntity::getKey, OcrItemListEntity::getValue)); |
|
|
|
|
OpenServiceOcr openServiceOcr = new OpenServiceOcr(); |
|
|
|
|
|
|
|
|
|
String type = ocrDataListEntity.getType(); |
|
|
|
|
//type 为 vat_special_invoice(增值税专用发票)、vat_electronic_invoice(增
|
|
|
|
|
//值税电子普通发票)、vat_common_invoice(增值税普通发票)、
|
|
|
|
|
//vat_electronic_toll_invoice(增值税电子普通发票(通行费))
|
|
|
|
|
//type 为 motor_vehicle_sale_invoice(机动车销售统一发票)
|
|
|
|
|
//type 为 used_car_purchase_invoice(二手车销售统一发票)
|
|
|
|
|
//type 为 vat_roll_invoice(增值税普通发票(卷票))
|
|
|
|
|
//type 为 vehicle_toll(过路过桥费发票、汽车通行费)
|
|
|
|
|
//type 为 quota_invoice(通用定额发票)
|
|
|
|
|
//type 为 taxi_ticket(出租车发票)
|
|
|
|
|
//type 为 air_transport(行程单)
|
|
|
|
|
//type 为 train_ticket(火车票)
|
|
|
|
|
//type 为 general_machine_invoice(通用机打发票)、 highway_passenger_invoice(公路客运发票)、shipping_invoice(船运客票)、passenger_transport_invoice(旅客运输普票)
|
|
|
|
|
//type 为 parking_invoice(停车费发票)
|
|
|
|
|
|
|
|
|
|
openServiceOcr.setFPLXDM(itemData.get(OcrDataTypeEnum.VAT_INVOICE_TYPE.getKey())); |
|
|
|
|
// openServiceOcr.setXZJD(itemData.get(OcrDataTypeEnum.VAT_INVOICE_TYPE.getKey()));
|
|
|
|
|
|
|
|
|
|
OpenServiceOcr.InvoiceOcrData invoiceOcrData = new OpenServiceOcr.InvoiceOcrData(); |
|
|
|
|
invoiceOcrData.setSFCY("0"); //是否查验
|
|
|
|
|
//判断发票类型
|
|
|
|
|
if("vat_special_invoice".equals(type) || "vat_electronic_invoice".equals(type) || "vat_common_invoice".equals(type) || "vat_electronic_toll_invoice".equals(type)){ |
|
|
|
|
invoiceOcrData.setJYM(itemData.get(OcrDataTypeEnum.VAT_INVOICE_CORRECT_CODE.getKey())); |
|
|
|
|
invoiceOcrData.setFPDM(itemData.get(OcrDataTypeEnum.VAT_INVOICE_DAIMA.getKey())); |
|
|
|
|
invoiceOcrData.setFPHM(itemData.get(OcrDataTypeEnum.VAT_INVOICE_HAOMA.getKey())); |
|
|
|
|
|
|
|
|
|
invoiceOcrData.setKPRQ(itemData.get(OcrDataTypeEnum.VAT_INVOICE_ISSUE_DATE.getKey())); |
|
|
|
|
invoiceOcrData.setGMFSBH(itemData.get(OcrDataTypeEnum.VAT_INVOICE_RATE_PAYER_ID.getKey())); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String decodeStr = Base64.decodeStr(jsonObject.getString("data")); |
|
|
|
|
return JSONObject.parseArray(decodeStr, OpenServiceOcr.class); |
|
|
|
|
invoiceOcrData.setJDHM(itemData.get(OcrDataTypeEnum.VAT_INVOICE_JIDA_HAOMA.getKey())); |
|
|
|
|
invoiceOcrData.setXHFMC(itemData.get(OcrDataTypeEnum.VAT_INVOICE_SELLER_NAME.getKey())); |
|
|
|
|
invoiceOcrData.setXHFSBH(itemData.get(OcrDataTypeEnum.VAT_INVOICE_SELLER_ID.getKey())); |
|
|
|
|
invoiceOcrData.setXHFDZDH(itemData.get(OcrDataTypeEnum.VAT_INVOICE_SELLER_ADDR_TELL.getKey())); |
|
|
|
|
invoiceOcrData.setXHFYHZH(itemData.get(OcrDataTypeEnum.VAT_INVOICE_SELLER_BANK_ACCOUNT.getKey())); |
|
|
|
|
invoiceOcrData.setGMFMC(itemData.get(OcrDataTypeEnum.VAT_INVOICE_PAYER_NAME.getKey())); |
|
|
|
|
invoiceOcrData.setGMFDZDH(itemData.get(OcrDataTypeEnum.VAT_INVOICE_PAYER_ADDR_TELL.getKey())); |
|
|
|
|
invoiceOcrData.setGMFYHZH(itemData.get(OcrDataTypeEnum.VAT_INVOICE_PAYER_BANK_ACCOUNT.getKey())); |
|
|
|
|
|
|
|
|
|
invoiceOcrData.setHJJE(itemData.get(OcrDataTypeEnum.VAT_INVOICE_PRICE_LIST.getKey())); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//是否代开 vat_invoice_zhuan_yong_flag TODO
|
|
|
|
|
invoiceOcrData.setSFDK(itemData.get(OcrDataTypeEnum.VAT_INVOICE_DAI_KAI_FLAG.getKey())); |
|
|
|
|
invoiceOcrData.setHJSE(itemData.get(OcrDataTypeEnum.VAT_INVOICE_TAX_TOTAL.getKey())); |
|
|
|
|
|
|
|
|
|
invoiceOcrData.setJSHJ(itemData.get(OcrDataTypeEnum.VAT_INVOICE_TOTAL_COVER_TAX_DIGITS.getKey())); |
|
|
|
|
invoiceOcrData.setFPLC(itemData.get(OcrDataTypeEnum.VAT_INVOICE_PAGE_NUMBER.getKey())); |
|
|
|
|
openServiceOcr.setFPLXDM(itemData.get(OcrDataTypeEnum.VAT_INVOICE_TYPE.getKey())); |
|
|
|
|
invoiceOcrData.setBZ(itemData.get(OcrDataTypeEnum.VAT_INVOICE_TOTAL_NOTE.getKey())); |
|
|
|
|
invoiceOcrData.setFWM(itemData.get(OcrDataTypeEnum.VAT_INVOICE_CIPHER_FIELD.getKey())); |
|
|
|
|
invoiceOcrData.setSKR(itemData.get(OcrDataTypeEnum.VAT_INVOICE_PAYEE.getKey())); |
|
|
|
|
invoiceOcrData.setFHR(itemData.get(OcrDataTypeEnum.VAT_INVOICE_REVIEW.getKey())); |
|
|
|
|
invoiceOcrData.setKPR(itemData.get(OcrDataTypeEnum.VAT_INVOICE_DRAWER.getKey())); |
|
|
|
|
invoiceOcrData.setSFYGSYZ("False".equals(itemData.get(OcrDataTypeEnum.EXIST_STAMPLE.getKey()))?"0":"1"); |
|
|
|
|
|
|
|
|
|
List<OpenServiceOcr.InvoiceOcrDetail> invoiceOcrDetailList = Lists.newArrayList(); |
|
|
|
|
for (List<OcrProductListEntity> productListEntities : productList) { |
|
|
|
|
OpenServiceOcr.InvoiceOcrDetail invoiceOcrDetail = new OpenServiceOcr.InvoiceOcrDetail(); |
|
|
|
|
// invoiceOcrDetail.setMXXH(itemData.get(OcrDataTypeEnum.VAT_INVOICE_TYPE.getKey()));
|
|
|
|
|
invoiceOcrDetail.setHWMC(itemData.get(OcrDataTypeEnum.VAT_INVOICE_GOODS.getKey())); |
|
|
|
|
invoiceOcrDetail.setGGXH(itemData.get(OcrDataTypeEnum.VAT_INVOICE_PLATE_SPECIFIC.getKey())); |
|
|
|
|
invoiceOcrDetail.setDW(itemData.get(OcrDataTypeEnum.VAT_INVOICE_ELECTRANS_UNIT.getKey())); |
|
|
|
|
invoiceOcrDetail.setSPSL(itemData.get(OcrDataTypeEnum.VAT_INVOICE_ELECTRANS_QUANTITY.getKey())); |
|
|
|
|
invoiceOcrDetail.setDJ(itemData.get(OcrDataTypeEnum.VAT_INVOICE_ELECTRANS_UNIT_PRICE.getKey())); |
|
|
|
|
invoiceOcrDetail.setJE(itemData.get(OcrDataTypeEnum.VAT_INVOICE_PRICE.getKey())); |
|
|
|
|
invoiceOcrDetail.setSL(itemData.get(OcrDataTypeEnum.VAT_INVOICE_TAX_RATE.getKey())); |
|
|
|
|
invoiceOcrDetail.setSE(itemData.get(OcrDataTypeEnum.VAT_INVOICE_TAX.getKey())); |
|
|
|
|
invoiceOcrDetailList.add(invoiceOcrDetail); |
|
|
|
|
invoiceOcrData.setFPMX(invoiceOcrDetailList); |
|
|
|
|
} |
|
|
|
|
} else if ("vat_roll_invoice".equals(type)) { |
|
|
|
|
invoiceOcrData.setKPRQ(itemData.get(OcrDataTypeEnum.DATE_OF_INVOICE.getKey())); |
|
|
|
|
invoiceOcrData.setFPBT(itemData.get(OcrDataTypeEnum.INVOICE_HEAD.getKey())); |
|
|
|
|
invoiceOcrData.setJYM(itemData.get(OcrDataTypeEnum.CHECK_NUMBER.getKey())); |
|
|
|
|
invoiceOcrData.setFPDM(itemData.get(OcrDataTypeEnum.INVOICE_NUMBER.getKey())); |
|
|
|
|
invoiceOcrData.setFPHM(itemData.get(OcrDataTypeEnum.INVOICE_NUMBER.getKey())); |
|
|
|
|
invoiceOcrData.setJQBM(itemData.get(OcrDataTypeEnum.MACHINE_CODE.getKey())); |
|
|
|
|
invoiceOcrData.setGMFSBH(itemData.get(OcrDataTypeEnum.BUY_TAX_NUMBER.getKey())); |
|
|
|
|
invoiceOcrData.setJSHJ(itemData.get(OcrDataTypeEnum.TOTAL_MONEY.getKey())); |
|
|
|
|
invoiceOcrData.setXHFMC(itemData.get(OcrDataTypeEnum.SOLD_NAME.getKey())); |
|
|
|
|
invoiceOcrData.setXHFSBH(itemData.get(OcrDataTypeEnum.SOLD_TAX_NUMBER.getKey())); |
|
|
|
|
invoiceOcrData.setGMFMC(itemData.get(OcrDataTypeEnum.BUY_NAME.getKey())); |
|
|
|
|
invoiceOcrData.setSKR(itemData.get(OcrDataTypeEnum.CASHIER_NAME.getKey())); |
|
|
|
|
//是否代开 vat_invoice_zhuan_yong_flag TODO
|
|
|
|
|
invoiceOcrData.setSFYGSYZ("False".equals(itemData.get(OcrDataTypeEnum.EXIST_STAMPLE.getKey()))?"0":"1"); |
|
|
|
|
|
|
|
|
|
List<OpenServiceOcr.InvoiceOcrDetail> invoiceOcrDetailList = Lists.newArrayList(); |
|
|
|
|
for (List<OcrProductListEntity> productListEntities : productList) { |
|
|
|
|
OpenServiceOcr.InvoiceOcrDetail invoiceOcrDetail = new OpenServiceOcr.InvoiceOcrDetail(); |
|
|
|
|
// invoiceOcrDetail.setMXXH(itemData.get(OcrDataTypeEnum.VAT_INVOICE_TYPE.getKey()));
|
|
|
|
|
invoiceOcrDetail.setHWMC(itemData.get(OcrDataTypeEnum.VAT_INVOICE_GOODS.getKey())); |
|
|
|
|
invoiceOcrDetail.setGGXH(itemData.get(OcrDataTypeEnum.VAT_INVOICE_PLATE_SPECIFIC.getKey())); |
|
|
|
|
invoiceOcrDetail.setDW(itemData.get(OcrDataTypeEnum.VAT_INVOICE_ELECTRANS_UNIT.getKey())); |
|
|
|
|
invoiceOcrDetail.setSPSL(itemData.get(OcrDataTypeEnum.VAT_INVOICE_ELECTRANS_QUANTITY.getKey())); |
|
|
|
|
invoiceOcrDetail.setDJ(itemData.get(OcrDataTypeEnum.VAT_INVOICE_ELECTRANS_UNIT_PRICE.getKey())); |
|
|
|
|
invoiceOcrDetail.setJE(itemData.get(OcrDataTypeEnum.VAT_INVOICE_PRICE.getKey())); |
|
|
|
|
invoiceOcrDetail.setSL(itemData.get(OcrDataTypeEnum.VAT_INVOICE_TAX_RATE.getKey())); |
|
|
|
|
invoiceOcrDetail.setSE(itemData.get(OcrDataTypeEnum.VAT_INVOICE_TAX.getKey())); |
|
|
|
|
invoiceOcrDetailList.add(invoiceOcrDetail); |
|
|
|
|
invoiceOcrData.setFPMX(invoiceOcrDetailList); |
|
|
|
|
} |
|
|
|
|
} else if ("motor_vehicle_sale_invoice".equals(type)) { |
|
|
|
|
// -------------机动车销售统一发票特殊字段--------------
|
|
|
|
|
invoiceOcrData.setGMFMC(itemData.get(OcrDataTypeEnum.VEHICLE_INVOICE_BUYER.getKey())); |
|
|
|
|
invoiceOcrData.setGMFSBH(itemData.get(OcrDataTypeEnum.VEHICLE_INVOICE_BUYER_ID.getKey())); |
|
|
|
|
invoiceOcrData.setCPXH(itemData.get(OcrDataTypeEnum.VEHICLE_INVOICE_CAR_MODEL.getKey())); |
|
|
|
|
invoiceOcrData.setHGZH(itemData.get(OcrDataTypeEnum.VEHICLE_INVOICE_CERT_ID.getKey())); |
|
|
|
|
invoiceOcrData.setFDJHM(itemData.get(OcrDataTypeEnum.VEHICLE_INVOICE_ENGINE_ID.getKey())); |
|
|
|
|
invoiceOcrData.setCLSBH(itemData.get(OcrDataTypeEnum.VEHICLE_INVOICE_CAR_VIN.getKey())); |
|
|
|
|
invoiceOcrData.setHJJE(itemData.get(OcrDataTypeEnum.VEHICLE_INVOICE_PRICE_WITHOUT_TAX.getKey())); |
|
|
|
|
invoiceOcrData.setZGSWJG(itemData.get(OcrDataTypeEnum.VEHICLE_INVOICE_TAX_AUTHORITH.getKey())); |
|
|
|
|
invoiceOcrData.setZGSWJGDM(itemData.get(OcrDataTypeEnum.VEHICLE_INVOICE_TAX_AUTHORITH_ID.getKey())); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
invoiceOcrData.setJSHJ(itemData.get(OcrDataTypeEnum.VEHICLE_INVOICE_TOTAL_PRICE_DIGITS.getKey())); |
|
|
|
|
invoiceOcrData.setKPRQ(itemData.get(OcrDataTypeEnum.VEHICLE_INVOICE_ISSUE_DATE.getKey())); |
|
|
|
|
invoiceOcrData.setFPDM(itemData.get(OcrDataTypeEnum.VEHICLE_INVOICE_DAIMA.getKey())); |
|
|
|
|
invoiceOcrData.setFPHM(itemData.get(OcrDataTypeEnum.VEHICLE_INVOICE_HAOMA.getKey())); |
|
|
|
|
} else if ("used_car_purchase_invoice".equals(type)) { |
|
|
|
|
// -------------二手车销售统一发票特殊字段--------------
|
|
|
|
|
invoiceOcrData.setGMFMC(itemData.get(OcrDataTypeEnum.VEHICLE_INVOICE_BUYER.getKey())); |
|
|
|
|
invoiceOcrData.setGMFSBH(itemData.get(OcrDataTypeEnum.VEHICLE_INVOICE_BUYER_ID.getKey())); |
|
|
|
|
invoiceOcrData.setXHFMC(itemData.get(OcrDataTypeEnum.VEHICLE_INVOICE_SELLER.getKey())); |
|
|
|
|
invoiceOcrData.setXHFSBH(itemData.get(OcrDataTypeEnum.VEHICLE_INVOICE_SELLER_ID.getKey())); |
|
|
|
|
invoiceOcrData.setESCSC(itemData.get(OcrDataTypeEnum.VEHICLE_INVOICE_MARKET.getKey())); |
|
|
|
|
invoiceOcrData.setCPZH(itemData.get(OcrDataTypeEnum.VEHICLE_INVOICE_PLATE_NUM.getKey())); |
|
|
|
|
invoiceOcrData.setDJZH(itemData.get(OcrDataTypeEnum.VEHICLE_INVOICE_CAR_MODEL.getKey())); |
|
|
|
|
invoiceOcrData.setCLSBH(itemData.get(OcrDataTypeEnum.VEHICLE_INVOICE_VIN.getKey())); |
|
|
|
|
invoiceOcrData.setCPXH(itemData.get(OcrDataTypeEnum.VEHICLE_INVOICE_CAR_MODEL.getKey())); |
|
|
|
|
invoiceOcrData.setESCNSRSBH(itemData.get(OcrDataTypeEnum.VEHICLE_INVOICE_MARKET_TAX_ID.getKey())); |
|
|
|
|
invoiceOcrData.setESCNSRSBH(itemData.get(OcrDataTypeEnum.VEHICLE_INVOICE_MARKET_TAX_ID.getKey())); |
|
|
|
|
invoiceOcrData.setJSHJ(itemData.get(OcrDataTypeEnum.VEHICLE_INVOICE_TOTAL_PRICE_DIGITS.getKey())); |
|
|
|
|
invoiceOcrData.setKPRQ(itemData.get(OcrDataTypeEnum.VEHICLE_INVOICE_ISSUE_DATE.getKey())); |
|
|
|
|
invoiceOcrData.setFPDM(itemData.get(OcrDataTypeEnum.VEHICLE_INVOICE_DAIMA.getKey())); |
|
|
|
|
invoiceOcrData.setFPHM(itemData.get(OcrDataTypeEnum.VEHICLE_INVOICE_HAOMA.getKey())); |
|
|
|
|
} else if("vehicle_toll".equals(type)){ |
|
|
|
|
// -------------过路费特殊字段--------------
|
|
|
|
|
invoiceOcrData.setJSHJ(itemData.get(OcrDataTypeEnum.MONEY.getKey())); |
|
|
|
|
invoiceOcrData.setKPRQ(itemData.get(OcrDataTypeEnum.DATE.getKey())); |
|
|
|
|
invoiceOcrData.setSJ(itemData.get(OcrDataTypeEnum.TIME.getKey())); |
|
|
|
|
invoiceOcrData.setFPDM(itemData.get(OcrDataTypeEnum.TOLL_CODE.getKey())); |
|
|
|
|
invoiceOcrData.setFPHM(itemData.get(OcrDataTypeEnum.TOLL_NUMBER.getKey())); |
|
|
|
|
|
|
|
|
|
}else if ("quota_invoice".equals(type)) { |
|
|
|
|
invoiceOcrData.setJSHJ(itemData.get(OcrDataTypeEnum.MONEY_SMALL.getKey())); |
|
|
|
|
invoiceOcrData.setFPDM(itemData.get(OcrDataTypeEnum.QUOTA_INVOICE_CODE.getKey())); |
|
|
|
|
invoiceOcrData.setFPHM(itemData.get(OcrDataTypeEnum.QUOTA_INVOICE_NUMBER.getKey())); |
|
|
|
|
|
|
|
|
|
} else if ("taxi_ticket".equals(type)) { |
|
|
|
|
// -------------出租车发票特殊字段--------------
|
|
|
|
|
invoiceOcrData.setJSHJ(itemData.get(OcrDataTypeEnum.SUM.getKey())); |
|
|
|
|
invoiceOcrData.setFPDM(itemData.get(OcrDataTypeEnum.INVOICE_CODE.getKey())); |
|
|
|
|
invoiceOcrData.setFPHM(itemData.get(OcrDataTypeEnum.INVOICE_NO.getKey())); |
|
|
|
|
invoiceOcrData.setKPRQ(itemData.get(OcrDataTypeEnum.DATE.getKey())); |
|
|
|
|
invoiceOcrData.setSCSJ(itemData.get(OcrDataTypeEnum.BOARDING_TIME.getKey())); |
|
|
|
|
invoiceOcrData.setXCSJ(itemData.get(OcrDataTypeEnum.LANDING_TIME.getKey())); |
|
|
|
|
invoiceOcrData.setLC(itemData.get(OcrDataTypeEnum.MILEAGE.getKey())); |
|
|
|
|
invoiceOcrData.setSZD(itemData.get(OcrDataTypeEnum.LOCATION.getKey())); |
|
|
|
|
invoiceOcrData.setCPZH(itemData.get(OcrDataTypeEnum.TAXI_NO.getKey())); |
|
|
|
|
} else if("air_transport".equals(type)){ |
|
|
|
|
invoiceOcrData.setXM(itemData.get(OcrDataTypeEnum.PASSENGER_NAME.getKey())); |
|
|
|
|
invoiceOcrData.setSFZH(itemData.get(OcrDataTypeEnum.ID_NO.getKey())); |
|
|
|
|
invoiceOcrData.setPZHM(itemData.get(OcrDataTypeEnum.E_TICKET_NO.getKey())); |
|
|
|
|
invoiceOcrData.setTKRQ(itemData.get(OcrDataTypeEnum.ISSUED_DATE.getKey())); |
|
|
|
|
invoiceOcrData.setTKDW(itemData.get(OcrDataTypeEnum.ISSUED_BY.getKey())); |
|
|
|
|
invoiceOcrData.setPJ(itemData.get(OcrDataTypeEnum.FARE.getKey())); |
|
|
|
|
invoiceOcrData.setMHFZJJ(itemData.get(OcrDataTypeEnum.CIVIL_AVIATION_FUND.getKey())); |
|
|
|
|
invoiceOcrData.setRYFJF(itemData.get(OcrDataTypeEnum.FUEL_SURCHARGE.getKey())); |
|
|
|
|
invoiceOcrData.setQTSF(itemData.get(OcrDataTypeEnum.OTHER_TAXES.getKey())); |
|
|
|
|
invoiceOcrData.setZE(itemData.get(OcrDataTypeEnum.TOTAL.getKey())); |
|
|
|
|
invoiceOcrData.setBXF(itemData.get(OcrDataTypeEnum.INSURANCE.getKey())); |
|
|
|
|
} else if("train_ticket".equals(type)){ |
|
|
|
|
// -------------火车票特殊字段--------------
|
|
|
|
|
// invoiceOcrData.setPZHM(itemData.get(OcrDataTypeEnum.VAT_INVOICE_TYPE.getKey()));
|
|
|
|
|
invoiceOcrData.setKPRQ(itemData.get(OcrDataTypeEnum.DEPARTURE_DATE.getKey())); |
|
|
|
|
invoiceOcrData.setSJ(itemData.get(OcrDataTypeEnum.DEPARTURE_DATE.getKey())); |
|
|
|
|
// invoiceOcrData.setXM(itemData.get(OcrDataTypeEnum.VAT_INVOICE_TYPE.getKey()));
|
|
|
|
|
invoiceOcrData.setCFZD(itemData.get(OcrDataTypeEnum.DEPARTURE_STATION.getKey())); |
|
|
|
|
invoiceOcrData.setDDZD(itemData.get(OcrDataTypeEnum.ARRIVAL_STATION.getKey())); |
|
|
|
|
invoiceOcrData.setCC(itemData.get(OcrDataTypeEnum.TRAIN_NUMBER.getKey())); |
|
|
|
|
invoiceOcrData.setZWDJ(itemData.get(OcrDataTypeEnum.CLASS.getKey())); |
|
|
|
|
invoiceOcrData.setXLH(itemData.get(OcrDataTypeEnum.SEAT_NUMBER.getKey())); |
|
|
|
|
invoiceOcrData.setSFZH(itemData.get(OcrDataTypeEnum.PASSENGER_ID.getKey())); |
|
|
|
|
} else if ("general_machine_invoice".equals(type) || "highway_passenger_invoice".equals(type) || "shipping_invoice".equals(type) || "passenger_transport_invoice".equals(type)) { |
|
|
|
|
//为 general_machine_invoice(通用机打发票)、 highway_passenger_invoice(公路客运发票)、shipping_invoice(船运客票)、passenger_transport_invoice(旅客运输普票)
|
|
|
|
|
|
|
|
|
|
// -------------航空运输电子客票行程单特殊字段--------------
|
|
|
|
|
invoiceOcrData.setJSHJ(itemData.get(OcrDataTypeEnum.MONEY.getKey())); |
|
|
|
|
invoiceOcrData.setFPDM(itemData.get(OcrDataTypeEnum.INVOICE_CODE.getKey())); |
|
|
|
|
invoiceOcrData.setFPHM(itemData.get(OcrDataTypeEnum.INVOICE_NUMBER.getKey())); |
|
|
|
|
invoiceOcrData.setKPRQ(itemData.get(OcrDataTypeEnum.DATE.getKey())); |
|
|
|
|
invoiceOcrData.setSJ(itemData.get(OcrDataTypeEnum.TIME.getKey())); |
|
|
|
|
} else if ("parking_invoice".equals(type)) { |
|
|
|
|
invoiceOcrData.setJSHJ(itemData.get(OcrDataTypeEnum.MONEY.getKey())); |
|
|
|
|
invoiceOcrData.setFPHM(itemData.get(OcrDataTypeEnum.INVOICE_NUMBER.getKey())); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
openServiceOcr.setRegion(ocrDataListEntity.getPosition()); |
|
|
|
|
openServices.add(openServiceOcr); |
|
|
|
|
} |
|
|
|
|
return openServices; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|