Commit e970b108 authored by weizhikai's avatar weizhikai

1、利润表表样;2、已认证发票清单导入加入数据条数验证;3、已开增值税发票记录针对开票日期值得获取优化

parent 46970c1a
......@@ -19,5 +19,6 @@ public class ErrorMessageCN {
public static final String NoCompanyCode = "该机构缺少机构代码字段!";
public static final String ErrorFileFormat="文件样式错误";
public static final String NotOrgException = "表格企业名称为空";
public static final String NotData = "该Sheet无数据";
}
......@@ -52,6 +52,7 @@ import pwc.taxtech.atms.vat.entity.*;
import javax.annotation.Resource;
import java.io.InputStream;
import java.math.BigDecimal;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.*;
......@@ -1310,6 +1311,7 @@ public class DataImportService extends BaseService {
for (int i = 0; i < workbook.getNumberOfSheets(); i++) {
Sheet sheet = workbook.getSheetAt(i);
if (isSheetEmpty(sheet)) continue;
List<CertifiedInvoicesList> cils = Lists.newArrayList();
String tayPayerIdNum = getCellStringValue(sheet.getRow(1).getCell(1));
OrganizationExample example = new OrganizationExample();
......@@ -1360,6 +1362,23 @@ public class DataImportService extends BaseService {
}
String companyName = organizations.get(0).getName();
dataImportLog.setCompanyName(companyName);
//比较变量,其余值和该值进行比较,判断其余变量是否为0
BigDecimal compareVariable = new BigDecimal(0.00);
//验证当前sheet页有无数据
Object value = CitCommonUtil.getValue(sheet.getRow(1).getCell(5));
if("".equals(value)){
dataImportLog.setImportResult(false);
dataImportLog.setErrorMsg(ErrorMessageCN.NotData);
dataImportLogs.add(dataImportLog);
continue;
}else if(new BigDecimal(value.toString()).compareTo(compareVariable)==0){
dataImportLog.setImportResult(false);
dataImportLog.setErrorMsg(ErrorMessageCN.NotData);
dataImportLogs.add(dataImportLog);
continue;
}
// 所选期间与导入文件期间不相等 且非 所选期间12期导入文件为13期
boolean isThirteenPeriod = period % 100 == 13 && tmsPeriod % 100 == 12;
if (!tmsPeriod.equals(period) && !isThirteenPeriod) {
......@@ -1492,6 +1511,7 @@ public class DataImportService extends BaseService {
for (int i = 0; i < workbook.getNumberOfSheets(); i++) {
Sheet sheet = workbook.getSheetAt(i);
if (isSheetEmpty(sheet)) continue;
//获取纳税人识别号
String identifyNumber="";
if(sheet.getLastRowNum()>1){
......@@ -1782,7 +1802,7 @@ public class DataImportService extends BaseService {
return rlits;
}
private DataImportResponseDto<InvoiceRecord> generalIRs(Sheet sheet,FormulaEvaluator evaluator) {
private DataImportResponseDto<InvoiceRecord> generalIRs(Sheet sheet,FormulaEvaluator evaluator) throws ParseException {
List<InvoiceRecord> irs = Lists.newArrayList();
List<DataImportErrorDto> errorDtos = Lists.newArrayList();
Set<String> orgsNot = new HashSet<>();
......@@ -1808,7 +1828,7 @@ public class DataImportService extends BaseService {
errorDtos.add(importErrorDto);
}
}
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
for (int j = 1; j <= sheet.getLastRowNum(); j++) {
InvoiceRecord ir = new InvoiceRecord();
Long irId = idService.nextId();
......@@ -1837,7 +1857,12 @@ public class DataImportService extends BaseService {
ir.setContractAmount(getCellBigDecimalValue(row.getCell(9),evaluator));
ir.setDepartment(getCellStringValue(row.getCell(10)));
ir.setApplicationDate(row.getCell(11).getDateCellValue());
ir.setBillingDate(row.getCell(12).getDateCellValue());
Object cellValue = CitCommonUtil.getValue(row.getCell(12));
if(!"".equals(cellValue)){
ir.setBillingDate(sdf.parse(cellValue.toString()));
}
// ir.setBillingDate(row.getCell(12).getDateCellValue());
ir.setPeriod(DateUtils.dateToPeriod(ir.getBillingDate()));
ir.setBillingMonth(DateUtils.strToDate5(getCellStringValue(row.getCell(13))));
ir.setInvoiceCode(getCellStringValue(row.getCell(14)));
......
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