Commit 3f21f623 authored by Ken you's avatar Ken you

fix validIRExcelCell bug --Ken

parent bd8472ac
...@@ -1565,6 +1565,7 @@ public class DataImportService extends BaseService { ...@@ -1565,6 +1565,7 @@ public class DataImportService extends BaseService {
private List<InvoiceRecord> generalIRs(Sheet sheet) { private List<InvoiceRecord> generalIRs(Sheet sheet) {
List<InvoiceRecord> irs = Lists.newArrayList(); List<InvoiceRecord> irs = Lists.newArrayList();
Set<String> orgsNot=new HashSet<>();
for (int j = 1; j <= sheet.getLastRowNum(); j++) { for (int j = 1; j <= sheet.getLastRowNum(); j++) {
InvoiceRecord ir = new InvoiceRecord(); InvoiceRecord ir = new InvoiceRecord();
Long irId = idService.nextId(); Long irId = idService.nextId();
...@@ -1574,6 +1575,14 @@ public class DataImportService extends BaseService { ...@@ -1574,6 +1575,14 @@ public class DataImportService extends BaseService {
} }
ir.setId(irId); ir.setId(irId);
ir.setSeqNo(getCellIntegerValue(row.getCell(0))); ir.setSeqNo(getCellIntegerValue(row.getCell(0)));
//所属机构
if(StringUtils.isBlank(getCellStringValue(row.getCell(1)))){
continue;
}
//如果存在有错误的机构也跳过
if(validIRExcelCell(row,orgsNot).contains(getCellStringValue(row.getCell(1)))){
continue;
}
ir.setBillingBody(getCellStringValue(row.getCell(1))); ir.setBillingBody(getCellStringValue(row.getCell(1)));
ir.setCustomerCompanyName(getCellStringValue(row.getCell(2))); ir.setCustomerCompanyName(getCellStringValue(row.getCell(2)));
ir.setInvoiceType(getCellStringValue(row.getCell(3))); ir.setInvoiceType(getCellStringValue(row.getCell(3)));
...@@ -1603,6 +1612,38 @@ public class DataImportService extends BaseService { ...@@ -1603,6 +1612,38 @@ public class DataImportService extends BaseService {
return irs; return irs;
} }
/**
* 导入分发-已开增值税发票记录,校验1-发票类型、开票内容、所属机构、税率、税额、开票金额任意不为空;
* 且校验2-校验发票类型的值只能包含“增值税专用发票”、“增值税普通发票”、“增值税电子发票”和“机动车发票”,
* 存在校验1或校验2不通过的机构不进行导入
* @param row
* @return
*/
private Set<String> validIRExcelCell(Row row,Set<String> orgsNot ){
List<String> invoiceTypes=Arrays.asList(new String[]{"增值税专用发票","增值税普通发票","增值税电子发票","机动车发票"});
String orgName=getCellStringValue(row.getCell(1));
//发票类型
if(StringUtils.isBlank(getCellStringValue(row.getCell(3)))){
orgsNot.add(orgName);
}
else if(!invoiceTypes.contains(getCellStringValue(row.getCell(3)))){
orgsNot.add(orgName);
}
//开票内容
if(StringUtils.isBlank(getCellStringValue(row.getCell(4)))){
orgsNot.add(orgName);
}
//开票金额
if(StringUtils.isBlank(getCellStringValue(row.getCell(5)))){
orgsNot.add(orgName);
}
//税额
if(StringUtils.isBlank(getCellStringValue(row.getCell(20)))){
orgsNot.add(orgName);
}
return orgsNot;
}
private List<AdjustmentTable> generalATs(Sheet sheet) { private List<AdjustmentTable> generalATs(Sheet sheet) {
List<AdjustmentTable> ats = Lists.newArrayList(); List<AdjustmentTable> ats = Lists.newArrayList();
for (int j = 1; j <= sheet.getLastRowNum(); j++) { for (int j = 1; j <= sheet.getLastRowNum(); j++) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment