|
@@ -176,9 +176,15 @@ public class NhIVController {
|
|
|
image = pdfUrlConvertBase64(image);
|
|
|
}
|
|
|
List<Map> invoices = (List<Map>) txyInvoice.doRecognizeGeneralInvoice(image).get("MixedInvoiceItems");
|
|
|
+ List<String> nos=new ArrayList<>();
|
|
|
List<McInvoiceDto> result = invoices.stream().map(item -> {
|
|
|
Map prop = UtilMap.getMap(UtilMap.getMap(item, "SingleInvoiceInfos"), UtilMap.getString(item, "SubType"));
|
|
|
-
|
|
|
+ // 2025.5.12 去除小计金额,并去除发票编号重复数据
|
|
|
+ String no=UtilMap.getString(prop, "Number");
|
|
|
+ if(nos.contains(no)){
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ nos.add(no);
|
|
|
String kind = UtilMap.getString(item, "TypeDescription");
|
|
|
String invoiceName = UtilMap.getString(item, "SubTypeDescription");
|
|
|
if (kind.equals("全电发票")) {
|
|
@@ -199,9 +205,9 @@ public class NhIVController {
|
|
|
.serial(UtilMap.getString(prop, "Number"))
|
|
|
.date(UtilString.replaceDateZH_cn(UtilMap.getString(prop, "Date")))
|
|
|
.checkCode(UtilMap.getString(prop, "CheckCode"))
|
|
|
- // ppExt: 多明细行时, 优先取值合计 [全电票返回了subTotal字段, 但值为空]
|
|
|
- .amount(UtilNumber.setBigDecimal(UtilMap.getString_first(prop, "Total","SubTotal", "Fare")))
|
|
|
- .tax(UtilNumber.setBigDecimal(UtilMap.getString_first(prop, "SubTax", "Tax")))
|
|
|
+ // ppExt: 多明细行时, 优先取值合计 [全电票返回了subTotal字段, 但值为空] // 2025.5.12 去除小计金额,并去除发票编号重复数据
|
|
|
+ .amount(UtilNumber.setBigDecimal(UtilMap.getString_first(prop, "Total", "Fare"))) // "SubTotal",
|
|
|
+ .tax(UtilNumber.setBigDecimal(UtilMap.getString_first(prop, "Tax"))) // "SubTax",
|
|
|
.excludingTax(UtilNumber.setBigDecimal(UtilMap.getString(prop, "PretaxAmount")))
|
|
|
.buyerName(StringUtils.isBlank(guyuanNameRepalce(UtilMap.getString(prop, "Buyer")))?"上海能辉科技股份有限公司":guyuanNameRepalce(UtilMap.getString(prop, "Buyer")))
|
|
|
// ppExt: 中央非税未返回税号官方说明: 非税发票理论是没有税号的,图片中属于信用代码
|
|
@@ -232,7 +238,7 @@ public class NhIVController {
|
|
|
invoiceDto.setDepartureTime(UtilMap.getString(prop, "TimeGetOn") + " ~ " + UtilMap.getString(prop, "TimeGetOff"));
|
|
|
}
|
|
|
return invoiceDto;
|
|
|
- }).collect(Collectors.toList());
|
|
|
+ }).filter(item -> item!=null).collect(Collectors.toList());
|
|
|
return McR.success(McInvoiceDto.formatResponse(result));
|
|
|
}
|
|
|
|