|
|
@@ -363,7 +363,7 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
|
|
|
parsedInvoiceDataList.add(parsedData);
|
|
|
|
|
|
// ========== 校验1:抬头校验 ==========
|
|
|
- if (StringUtils.isNotBlank(buyerName)) {
|
|
|
+ if (!isTitleValidationExempt(invoice.getString("name")) && StringUtils.isNotBlank(buyerName)) {
|
|
|
CompanyTitle existingTitle = companyTitleMapper.selectByTaxId(buyerName);
|
|
|
if (existingTitle == null) {
|
|
|
String errorInfo = String.format("发票: %s, 购买方名称: %s, 税号: %s",
|
|
|
@@ -371,7 +371,7 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
|
|
|
invalidBuyerTaxIds.add(errorInfo);
|
|
|
log.warn("抬头校验失败: 税号={} 不存在于抬头库, 文件名={}", buyerTaxId, fileName);
|
|
|
}
|
|
|
- } else {
|
|
|
+ } else if (!isTitleValidationExempt(invoice.getString("name"))) {
|
|
|
String errorInfo = String.format("发票: %s, 购买方税号为空", fileName);
|
|
|
invalidBuyerTaxIds.add(errorInfo);
|
|
|
log.warn("抬头校验失败: 购买方税号为空, 文件名={}", fileName);
|
|
|
@@ -456,7 +456,7 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
|
|
|
parsedInvoiceDataList.add(parsedData);
|
|
|
|
|
|
// 抬头校验
|
|
|
- if (StringUtils.isNotBlank(buyerName)) {
|
|
|
+ if (!isTitleValidationExempt(invoice.getString("name")) && StringUtils.isNotBlank(buyerName)) {
|
|
|
CompanyTitle existingTitle = companyTitleMapper.selectByTaxId(buyerName);
|
|
|
if (existingTitle == null) {
|
|
|
String errorInfo = String.format("发票: %s, 购买方名称: %s, 税号: %s",
|
|
|
@@ -464,7 +464,7 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
|
|
|
invalidBuyerTaxIds.add(errorInfo);
|
|
|
log.warn("抬头校验失败: 税号={} 不存在于抬头库, 文件名={}", buyerTaxId, fileName);
|
|
|
}
|
|
|
- } else {
|
|
|
+ } else if (!isTitleValidationExempt(invoice.getString("name"))) {
|
|
|
String errorInfo = String.format("发票: %s, 购买方税号为空", fileName);
|
|
|
invalidBuyerTaxIds.add(errorInfo);
|
|
|
log.warn("抬头校验失败: 购买方税号为空, 文件名={}", fileName);
|
|
|
@@ -1348,7 +1348,7 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
|
|
|
parsedInvoiceDataList.add(parsedData);
|
|
|
|
|
|
// ========== 校验1:抬头校验 ==========
|
|
|
- if (StringUtils.isNotBlank(buyerName)) {
|
|
|
+ if (!isTitleValidationExempt(invoice.getString("name")) && StringUtils.isNotBlank(buyerName)) {
|
|
|
CompanyTitle existingTitle = companyTitleMapper.selectByTaxId(buyerName);
|
|
|
if (existingTitle == null) {
|
|
|
String errorInfo = String.format("发票: %s, 购买方名称: %s, 税号: %s",
|
|
|
@@ -1356,7 +1356,7 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
|
|
|
invalidBuyerTaxIds.add(errorInfo);
|
|
|
log.warn("抬头校验失败: 税号={} 不存在于抬头库, 文件名={}", buyerTaxId, fileName);
|
|
|
}
|
|
|
- } else {
|
|
|
+ } else if (!isTitleValidationExempt(invoice.getString("name"))) {
|
|
|
String errorInfo = String.format("发票: %s, 购买方税号为空", fileName);
|
|
|
invalidBuyerTaxIds.add(errorInfo);
|
|
|
log.warn("抬头校验失败: 购买方税号为空, 文件名={}", fileName);
|
|
|
@@ -1441,7 +1441,7 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
|
|
|
parsedInvoiceDataList.add(parsedData);
|
|
|
|
|
|
// 抬头校验
|
|
|
- if (StringUtils.isNotBlank(buyerName)) {
|
|
|
+ if (!isTitleValidationExempt(invoice.getString("name")) && StringUtils.isNotBlank(buyerName)) {
|
|
|
CompanyTitle existingTitle = companyTitleMapper.selectByTaxId(buyerName);
|
|
|
if (existingTitle == null) {
|
|
|
String errorInfo = String.format("发票: %s, 购买方名称: %s, 税号: %s",
|
|
|
@@ -1449,7 +1449,7 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
|
|
|
invalidBuyerTaxIds.add(errorInfo);
|
|
|
log.warn("抬头校验失败: 税号={} 不存在于抬头库, 文件名={}", buyerTaxId, fileName);
|
|
|
}
|
|
|
- } else {
|
|
|
+ } else if (!isTitleValidationExempt(invoice.getString("name"))) {
|
|
|
String errorInfo = String.format("发票: %s, 购买方税号为空", fileName);
|
|
|
invalidBuyerTaxIds.add(errorInfo);
|
|
|
log.warn("抬头校验失败: 购买方税号为空, 文件名={}", fileName);
|
|
|
@@ -1976,7 +1976,7 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
|
|
|
parsedInvoiceDataList.add(parsedData);
|
|
|
|
|
|
// ========== 校验1:抬头校验 ==========
|
|
|
- if (StringUtils.isNotBlank(buyerName)) {
|
|
|
+ if (!isTitleValidationExempt(invoice.getString("name")) && StringUtils.isNotBlank(buyerName)) {
|
|
|
CompanyTitle existingTitle = companyTitleMapper.selectByTaxId(buyerName);
|
|
|
if (existingTitle == null) {
|
|
|
String errorInfo = String.format("发票: %s, 购买方名称: %s, 税号: %s",
|
|
|
@@ -1984,7 +1984,7 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
|
|
|
invalidBuyerTaxIds.add(errorInfo);
|
|
|
log.warn("抬头校验失败: 税号={} 不存在于抬头库, 文件名={}", buyerTaxId, fileName);
|
|
|
}
|
|
|
- } else {
|
|
|
+ } else if (!isTitleValidationExempt(invoice.getString("name"))) {
|
|
|
String errorInfo = String.format("发票: %s, 购买方税号为空", fileName);
|
|
|
invalidBuyerTaxIds.add(errorInfo);
|
|
|
log.warn("抬头校验失败: 购买方税号为空, 文件名={}", fileName);
|
|
|
@@ -2069,7 +2069,7 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
|
|
|
parsedInvoiceDataList.add(parsedData);
|
|
|
|
|
|
// 抬头校验
|
|
|
- if (StringUtils.isNotBlank(buyerName)) {
|
|
|
+ if (!isTitleValidationExempt(invoice.getString("name")) && StringUtils.isNotBlank(buyerName)) {
|
|
|
CompanyTitle existingTitle = companyTitleMapper.selectByTaxId(buyerName);
|
|
|
if (existingTitle == null) {
|
|
|
String errorInfo = String.format("发票: %s, 购买方名称: %s, 税号: %s",
|
|
|
@@ -2077,7 +2077,7 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
|
|
|
invalidBuyerTaxIds.add(errorInfo);
|
|
|
log.warn("抬头校验失败: 税号={} 不存在于抬头库, 文件名={}", buyerTaxId, fileName);
|
|
|
}
|
|
|
- } else {
|
|
|
+ } else if (!isTitleValidationExempt(invoice.getString("name"))) {
|
|
|
String errorInfo = String.format("发票: %s, 购买方税号为空", fileName);
|
|
|
invalidBuyerTaxIds.add(errorInfo);
|
|
|
log.warn("抬头校验失败: 购买方税号为空, 文件名={}", fileName);
|
|
|
@@ -2604,7 +2604,7 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
|
|
|
parsedInvoiceDataList.add(parsedData);
|
|
|
|
|
|
// ========== 校验1:抬头校验 ==========
|
|
|
- if (StringUtils.isNotBlank(buyerName)) {
|
|
|
+ if (!isTitleValidationExempt(invoice.getString("name")) && StringUtils.isNotBlank(buyerName)) {
|
|
|
CompanyTitle existingTitle = companyTitleMapper.selectByTaxId(buyerName);
|
|
|
if (existingTitle == null) {
|
|
|
String errorInfo = String.format("发票: %s, 购买方名称: %s, 税号: %s",
|
|
|
@@ -2612,7 +2612,7 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
|
|
|
invalidBuyerTaxIds.add(errorInfo);
|
|
|
log.warn("抬头校验失败: 税号={} 不存在于抬头库, 文件名={}", buyerTaxId, fileName);
|
|
|
}
|
|
|
- } else {
|
|
|
+ } else if (!isTitleValidationExempt(invoice.getString("name"))) {
|
|
|
String errorInfo = String.format("发票: %s, 购买方税号为空", fileName);
|
|
|
invalidBuyerTaxIds.add(errorInfo);
|
|
|
log.warn("抬头校验失败: 购买方税号为空, 文件名={}", fileName);
|
|
|
@@ -2697,7 +2697,7 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
|
|
|
parsedInvoiceDataList.add(parsedData);
|
|
|
|
|
|
// 抬头校验
|
|
|
- if (StringUtils.isNotBlank(buyerName)) {
|
|
|
+ if (!isTitleValidationExempt(invoice.getString("name")) && StringUtils.isNotBlank(buyerName)) {
|
|
|
CompanyTitle existingTitle = companyTitleMapper.selectByTaxId(buyerName);
|
|
|
if (existingTitle == null) {
|
|
|
String errorInfo = String.format("发票: %s, 购买方名称: %s, 税号: %s",
|
|
|
@@ -2705,7 +2705,7 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
|
|
|
invalidBuyerTaxIds.add(errorInfo);
|
|
|
log.warn("抬头校验失败: 税号={} 不存在于抬头库, 文件名={}", buyerTaxId, fileName);
|
|
|
}
|
|
|
- } else {
|
|
|
+ } else if (!isTitleValidationExempt(invoice.getString("name"))) {
|
|
|
String errorInfo = String.format("发票: %s, 购买方税号为空", fileName);
|
|
|
invalidBuyerTaxIds.add(errorInfo);
|
|
|
log.warn("抬头校验失败: 购买方税号为空, 文件名={}", fileName);
|
|
|
@@ -3233,7 +3233,7 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
|
|
|
parsedInvoiceDataList.add(parsedData);
|
|
|
|
|
|
// ========== 校验1:抬头校验 ==========
|
|
|
- if (StringUtils.isNotBlank(buyerName)) {
|
|
|
+ if (!isTitleValidationExempt(invoice.getString("name")) && StringUtils.isNotBlank(buyerName)) {
|
|
|
CompanyTitle existingTitle = companyTitleMapper.selectByTaxId(buyerName);
|
|
|
if (existingTitle == null) {
|
|
|
String errorInfo = String.format("发票: %s, 购买方名称: %s, 税号: %s",
|
|
|
@@ -3241,7 +3241,7 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
|
|
|
invalidBuyerTaxIds.add(errorInfo);
|
|
|
log.warn("抬头校验失败: 税号={} 不存在于抬头库, 文件名={}", buyerTaxId, fileName);
|
|
|
}
|
|
|
- } else {
|
|
|
+ } else if (!isTitleValidationExempt(invoice.getString("name"))) {
|
|
|
String errorInfo = String.format("发票: %s, 购买方税号为空", fileName);
|
|
|
invalidBuyerTaxIds.add(errorInfo);
|
|
|
log.warn("抬头校验失败: 购买方税号为空, 文件名={}", fileName);
|
|
|
@@ -3326,7 +3326,7 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
|
|
|
parsedInvoiceDataList.add(parsedData);
|
|
|
|
|
|
// 抬头校验
|
|
|
- if (StringUtils.isNotBlank(buyerName)) {
|
|
|
+ if (!isTitleValidationExempt(invoice.getString("name")) && StringUtils.isNotBlank(buyerName)) {
|
|
|
CompanyTitle existingTitle = companyTitleMapper.selectByTaxId(buyerName);
|
|
|
if (existingTitle == null) {
|
|
|
String errorInfo = String.format("发票: %s, 购买方名称: %s, 税号: %s",
|
|
|
@@ -3334,7 +3334,7 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
|
|
|
invalidBuyerTaxIds.add(errorInfo);
|
|
|
log.warn("抬头校验失败: 税号={} 不存在于抬头库, 文件名={}", buyerTaxId, fileName);
|
|
|
}
|
|
|
- } else {
|
|
|
+ } else if (!isTitleValidationExempt(invoice.getString("name"))) {
|
|
|
String errorInfo = String.format("发票: %s, 购买方税号为空", fileName);
|
|
|
invalidBuyerTaxIds.add(errorInfo);
|
|
|
log.warn("抬头校验失败: 购买方税号为空, 文件名={}", fileName);
|
|
|
@@ -4200,6 +4200,10 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ if (isTitleValidationExempt(invoiceName)) {
|
|
|
+ kind = "普通发票";
|
|
|
+ }
|
|
|
+
|
|
|
McInvoiceDto invoiceDto = McInvoiceDto.builder()
|
|
|
.name(UtilMap.getString(item, "SubTypeDescription"))
|
|
|
.kindName(kind)
|
|
|
@@ -4251,6 +4255,19 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
|
|
|
return McR.success(McInvoiceDto.formatResponse(result));
|
|
|
}
|
|
|
|
|
|
+ private boolean isTitleValidationExempt(String invoiceName) {
|
|
|
+ return Arrays.asList(
|
|
|
+ "出租车发票",
|
|
|
+ "汽车票",
|
|
|
+ "通用机打发票",
|
|
|
+ "定额发票",
|
|
|
+ "轮船票",
|
|
|
+ "医疗门诊收费票据(电子)",
|
|
|
+ "医疗住院收费票据(电子)",
|
|
|
+ "过路过桥费发票"
|
|
|
+ ).contains(invoiceName);
|
|
|
+ }
|
|
|
+
|
|
|
private static String guyuanNameRepalce(String name) {
|
|
|
name = name.replaceAll(" ", "");
|
|
|
if (name.contains("谷元")) {
|