Commit b93354c2 authored by zhkwei's avatar zhkwei

Merge remote-tracking branch 'origin/dev_mysql' into dev_mysql

parents 088cd98f 26e11df2
package pwc.taxtech.atms.service.impl; package pwc.taxtech.atms.service.impl;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.github.pagehelper.Page; import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
...@@ -10,6 +9,7 @@ import org.apache.commons.collections.CollectionUtils; ...@@ -10,6 +9,7 @@ import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.usermodel.*; import org.apache.poi.ss.usermodel.*;
import org.nutz.lang.Strings;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -51,7 +51,6 @@ import pwc.taxtech.atms.vat.entity.*; ...@@ -51,7 +51,6 @@ import pwc.taxtech.atms.vat.entity.*;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.io.InputStream; import java.io.InputStream;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
import java.util.concurrent.*; import java.util.concurrent.*;
...@@ -739,6 +738,8 @@ public class DataImportService extends BaseService { ...@@ -739,6 +738,8 @@ public class DataImportService extends BaseService {
try { try {
InputStream inputStream = file.getInputStream(); InputStream inputStream = file.getInputStream();
Workbook workbook = WorkbookFactory.create(inputStream); Workbook workbook = WorkbookFactory.create(inputStream);
FormulaEvaluator evaluator = workbook.getCreationHelper().createFormulaEvaluator();
evaluator.evaluateAll();
if (StringUtils.isBlank(periodDate) || "null".equals(periodDate)) { if (StringUtils.isBlank(periodDate) || "null".equals(periodDate)) {
throw new ServiceException(ErrorMessageCN.DoNotSelectPeriod); throw new ServiceException(ErrorMessageCN.DoNotSelectPeriod);
} }
...@@ -842,34 +843,34 @@ public class DataImportService extends BaseService { ...@@ -842,34 +843,34 @@ public class DataImportService extends BaseService {
iData.setSpecialInvoiceAmount4(getCellLongDecimalValue(cell5)); iData.setSpecialInvoiceAmount4(getCellLongDecimalValue(cell5));
Cell cell6 = sheet.getRow(6).getCell(j); Cell cell6 = sheet.getRow(6).getCell(j);
iData.setSpecialInvoiceSalesAmount1(getCellBigDecimalValue(cell6)); iData.setSpecialInvoiceSalesAmount1(getCellBigDecimalValue(cell6,evaluator));
Cell cell7 = sheet.getRow(7).getCell(j); Cell cell7 = sheet.getRow(7).getCell(j);
iData.setSpecialInvoiceSalesAmount2(getCellBigDecimalValue(cell7)); iData.setSpecialInvoiceSalesAmount2(getCellBigDecimalValue(cell7,evaluator));
Cell cell8 = sheet.getRow(8).getCell(j); Cell cell8 = sheet.getRow(8).getCell(j);
iData.setSpecialInvoiceSalesAmount3(getCellBigDecimalValue(cell8)); iData.setSpecialInvoiceSalesAmount3(getCellBigDecimalValue(cell8,evaluator));
Cell cell9 = sheet.getRow(9).getCell(j); Cell cell9 = sheet.getRow(9).getCell(j);
iData.setSpecialInvoiceSalesAmount4(getCellBigDecimalValue(cell9)); iData.setSpecialInvoiceSalesAmount4(getCellBigDecimalValue(cell9,evaluator));
Cell cell10 = sheet.getRow(10).getCell(j); Cell cell10 = sheet.getRow(10).getCell(j);
iData.setSpecialInvoiceSalesAmount5(getCellBigDecimalValue(cell10)); iData.setSpecialInvoiceSalesAmount5(getCellBigDecimalValue(cell10,evaluator));
Cell cell11 = sheet.getRow(11).getCell(j); Cell cell11 = sheet.getRow(11).getCell(j);
iData.setSpecialInvoiceTaxAmount1(getCellBigDecimalValue(cell11)); iData.setSpecialInvoiceTaxAmount1(getCellBigDecimalValue(cell11,evaluator));
Cell cell12 = sheet.getRow(12).getCell(j); Cell cell12 = sheet.getRow(12).getCell(j);
iData.setSpecialInvoiceTaxAmount2(getCellBigDecimalValue(cell12)); iData.setSpecialInvoiceTaxAmount2(getCellBigDecimalValue(cell12,evaluator));
Cell cell13 = sheet.getRow(13).getCell(j); Cell cell13 = sheet.getRow(13).getCell(j);
iData.setSpecialInvoiceTaxAmount3(getCellBigDecimalValue(cell13)); iData.setSpecialInvoiceTaxAmount3(getCellBigDecimalValue(cell13,evaluator));
Cell cell14 = sheet.getRow(14).getCell(j); Cell cell14 = sheet.getRow(14).getCell(j);
iData.setSpecialInvoiceTaxAmount4(getCellBigDecimalValue(cell14)); iData.setSpecialInvoiceTaxAmount4(getCellBigDecimalValue(cell14,evaluator));
Cell cell15 = sheet.getRow(15).getCell(j); Cell cell15 = sheet.getRow(15).getCell(j);
iData.setSpecialInvoiceTaxAmount5(getCellBigDecimalValue(cell15)); iData.setSpecialInvoiceTaxAmount5(getCellBigDecimalValue(cell15,evaluator));
Cell cell16 = sheet.getRow(16).getCell(j); Cell cell16 = sheet.getRow(16).getCell(j);
iData.setInvoiceAmount1(getCellLongDecimalValue(cell16)); iData.setInvoiceAmount1(getCellLongDecimalValue(cell16));
...@@ -884,34 +885,34 @@ public class DataImportService extends BaseService { ...@@ -884,34 +885,34 @@ public class DataImportService extends BaseService {
iData.setInvoiceAmount4(getCellLongDecimalValue(cell19)); iData.setInvoiceAmount4(getCellLongDecimalValue(cell19));
Cell cell20 = sheet.getRow(20).getCell(j); Cell cell20 = sheet.getRow(20).getCell(j);
iData.setInvoiceSalesAmount1(getCellBigDecimalValue(cell20)); iData.setInvoiceSalesAmount1(getCellBigDecimalValue(cell20,evaluator));
Cell cell21 = sheet.getRow(21).getCell(j); Cell cell21 = sheet.getRow(21).getCell(j);
iData.setInvoiceSalesAmount2(getCellBigDecimalValue(cell21)); iData.setInvoiceSalesAmount2(getCellBigDecimalValue(cell21,evaluator));
Cell cell22 = sheet.getRow(22).getCell(j); Cell cell22 = sheet.getRow(22).getCell(j);
iData.setInvoiceSalesAmount3(getCellBigDecimalValue(cell22)); iData.setInvoiceSalesAmount3(getCellBigDecimalValue(cell22,evaluator));
Cell cell23 = sheet.getRow(23).getCell(j); Cell cell23 = sheet.getRow(23).getCell(j);
iData.setInvoiceSalesAmount4(getCellBigDecimalValue(cell23)); iData.setInvoiceSalesAmount4(getCellBigDecimalValue(cell23,evaluator));
Cell cell24 = sheet.getRow(24).getCell(j); Cell cell24 = sheet.getRow(24).getCell(j);
iData.setInvoiceSalesAmount5(getCellBigDecimalValue(cell24)); iData.setInvoiceSalesAmount5(getCellBigDecimalValue(cell24,evaluator));
Cell cell25 = sheet.getRow(25).getCell(j); Cell cell25 = sheet.getRow(25).getCell(j);
iData.setInvoiceTaxAmount1(getCellBigDecimalValue(cell25)); iData.setInvoiceTaxAmount1(getCellBigDecimalValue(cell25,evaluator));
Cell cell26 = sheet.getRow(26).getCell(j); Cell cell26 = sheet.getRow(26).getCell(j);
iData.setInvoiceTaxAmount2(getCellBigDecimalValue(cell26)); iData.setInvoiceTaxAmount2(getCellBigDecimalValue(cell26,evaluator));
Cell cell27 = sheet.getRow(27).getCell(j); Cell cell27 = sheet.getRow(27).getCell(j);
iData.setInvoiceTaxAmount3(getCellBigDecimalValue(cell27)); iData.setInvoiceTaxAmount3(getCellBigDecimalValue(cell27,evaluator));
Cell cell28 = sheet.getRow(28).getCell(j); Cell cell28 = sheet.getRow(28).getCell(j);
iData.setInvoiceTaxAmount4(getCellBigDecimalValue(cell28)); iData.setInvoiceTaxAmount4(getCellBigDecimalValue(cell28,evaluator));
Cell cell29 = sheet.getRow(29).getCell(j); Cell cell29 = sheet.getRow(29).getCell(j);
iData.setInvoiceTaxAmount5(getCellBigDecimalValue(cell29)); iData.setInvoiceTaxAmount5(getCellBigDecimalValue(cell29,evaluator));
iDatas.add(iData); iDatas.add(iData);
} }
...@@ -951,6 +952,8 @@ public class DataImportService extends BaseService { ...@@ -951,6 +952,8 @@ public class DataImportService extends BaseService {
OperationResultDto operationResultDto = new OperationResultDto(); OperationResultDto operationResultDto = new OperationResultDto();
InputStream inputStream = file.getInputStream(); InputStream inputStream = file.getInputStream();
Workbook workbook = WorkbookFactory.create(inputStream); Workbook workbook = WorkbookFactory.create(inputStream);
FormulaEvaluator evaluator = workbook.getCreationHelper().createFormulaEvaluator();
evaluator.evaluateAll();
if (StringUtils.isBlank(periodDate) || "null".equals(periodDate)) { if (StringUtils.isBlank(periodDate) || "null".equals(periodDate)) {
throw new ServiceException(ErrorMessageCN.DoNotSelectPeriod); throw new ServiceException(ErrorMessageCN.DoNotSelectPeriod);
} }
...@@ -959,7 +962,7 @@ public class DataImportService extends BaseService { ...@@ -959,7 +962,7 @@ public class DataImportService extends BaseService {
for (int i = 0; i < workbook.getNumberOfSheets(); i++) { for (int i = 0; i < workbook.getNumberOfSheets(); i++) {
Sheet sheet = workbook.getSheetAt(i); Sheet sheet = workbook.getSheetAt(i);
if (isSheetEmpty(sheet)) continue; if (isSheetEmpty(sheet)) continue;
List<RedLetterInfoTable> rlits = generalRLITs(sheet); List<RedLetterInfoTable> rlits = generalRLITs(sheet,evaluator);
if (rlits.size() < 1) continue; if (rlits.size() < 1) continue;
// 根据主体分组处理 // 根据主体分组处理
Map<String, List<RedLetterInfoTable>> atsGroupRes = Map<String, List<RedLetterInfoTable>> atsGroupRes =
...@@ -1059,6 +1062,8 @@ public class DataImportService extends BaseService { ...@@ -1059,6 +1062,8 @@ public class DataImportService extends BaseService {
try { try {
InputStream inputStream = file.getInputStream(); InputStream inputStream = file.getInputStream();
Workbook workbook = WorkbookFactory.create(inputStream); Workbook workbook = WorkbookFactory.create(inputStream);
FormulaEvaluator evaluator = workbook.getCreationHelper().createFormulaEvaluator();
evaluator.evaluateAll();
if (StringUtils.isBlank(periodDate) || "null".equals(periodDate)) { if (StringUtils.isBlank(periodDate) || "null".equals(periodDate)) {
throw new ServiceException(ErrorMessageCN.DoNotSelectPeriod); throw new ServiceException(ErrorMessageCN.DoNotSelectPeriod);
} }
...@@ -1067,7 +1072,7 @@ public class DataImportService extends BaseService { ...@@ -1067,7 +1072,7 @@ public class DataImportService extends BaseService {
for (int i = 0; i < workbook.getNumberOfSheets(); i++) { for (int i = 0; i < workbook.getNumberOfSheets(); i++) {
Sheet sheet = workbook.getSheetAt(i); Sheet sheet = workbook.getSheetAt(i);
if (isSheetEmpty(sheet)) continue; if (isSheetEmpty(sheet)) continue;
List<AdjustmentTable> ats = generalATs(sheet); List<AdjustmentTable> ats = generalATs(sheet, evaluator);
if (ats.size() < 1) continue; if (ats.size() < 1) continue;
// 根据主体分组处理 // 根据主体分组处理
Map<String, List<AdjustmentTable>> atsGroupRes = Map<String, List<AdjustmentTable>> atsGroupRes =
...@@ -1165,6 +1170,8 @@ public class DataImportService extends BaseService { ...@@ -1165,6 +1170,8 @@ public class DataImportService extends BaseService {
try { try {
InputStream inputStream = file.getInputStream(); InputStream inputStream = file.getInputStream();
Workbook workbook = WorkbookFactory.create(inputStream); Workbook workbook = WorkbookFactory.create(inputStream);
FormulaEvaluator evaluator = workbook.getCreationHelper().createFormulaEvaluator();
evaluator.evaluateAll();
if (StringUtils.isBlank(periodDate) || "null".equals(periodDate)) { if (StringUtils.isBlank(periodDate) || "null".equals(periodDate)) {
throw new ServiceException(ErrorMessageCN.DoNotSelectPeriod); throw new ServiceException(ErrorMessageCN.DoNotSelectPeriod);
} }
...@@ -1173,7 +1180,7 @@ public class DataImportService extends BaseService { ...@@ -1173,7 +1180,7 @@ public class DataImportService extends BaseService {
for (int i = 0; i < workbook.getNumberOfSheets(); i++) { for (int i = 0; i < workbook.getNumberOfSheets(); i++) {
Sheet sheet = workbook.getSheetAt(i); Sheet sheet = workbook.getSheetAt(i);
if (isSheetEmpty(sheet)) continue; if (isSheetEmpty(sheet)) continue;
List<CoupaPurchasingReport> ats = generalCPRs(sheet); List<CoupaPurchasingReport> ats = generalCPRs(sheet,evaluator);
if (ats.size() < 1) continue; if (ats.size() < 1) continue;
// 根据主体分组处理 // 根据主体分组处理
Map<String, List<CoupaPurchasingReport>> atsGroupRes = Map<String, List<CoupaPurchasingReport>> atsGroupRes =
...@@ -1284,6 +1291,8 @@ public class DataImportService extends BaseService { ...@@ -1284,6 +1291,8 @@ public class DataImportService extends BaseService {
try { try {
InputStream inputStream = file.getInputStream(); InputStream inputStream = file.getInputStream();
Workbook workbook = WorkbookFactory.create(inputStream); Workbook workbook = WorkbookFactory.create(inputStream);
FormulaEvaluator evaluator = workbook.getCreationHelper().createFormulaEvaluator();
evaluator.evaluateAll();
if (StringUtils.isBlank(periodDate) || "null".equals(periodDate)) { if (StringUtils.isBlank(periodDate) || "null".equals(periodDate)) {
throw new ServiceException(ErrorMessageCN.DoNotSelectPeriod); throw new ServiceException(ErrorMessageCN.DoNotSelectPeriod);
} }
...@@ -1404,10 +1413,10 @@ public class DataImportService extends BaseService { ...@@ -1404,10 +1413,10 @@ public class DataImportService extends BaseService {
cil.setSalespersonName(getCellStringValue(cell6)); cil.setSalespersonName(getCellStringValue(cell6));
Cell cell7 = row.getCell(6); Cell cell7 = row.getCell(6);
cil.setAmount(getCellBigDecimalValue(cell7)); cil.setAmount(getCellBigDecimalValue(cell7,evaluator));
Cell cell8 = row.getCell(7); Cell cell8 = row.getCell(7);
cil.setTaxAmount(getCellBigDecimalValue(cell8)); cil.setTaxAmount(getCellBigDecimalValue(cell8,evaluator));
Cell cell9 = row.getCell(8); Cell cell9 = row.getCell(8);
...@@ -1462,7 +1471,7 @@ public class DataImportService extends BaseService { ...@@ -1462,7 +1471,7 @@ public class DataImportService extends BaseService {
//导入成功并将错误信息返回 //导入成功并将错误信息返回
OperationResultDto a=new OperationResultDto(); OperationResultDto a=new OperationResultDto();
a.setResult(true); a.setResult(true);
a.setResultMsg(JSONArray.toJSONString(errorDtos)); a.setResultMsg(reImportError(errorDtos));
return a; return a;
} catch (ServiceException e) { } catch (ServiceException e) {
throw e; throw e;
...@@ -1564,6 +1573,8 @@ public class DataImportService extends BaseService { ...@@ -1564,6 +1573,8 @@ public class DataImportService extends BaseService {
try { try {
InputStream inputStream = file.getInputStream(); InputStream inputStream = file.getInputStream();
Workbook workbook = WorkbookFactory.create(inputStream); Workbook workbook = WorkbookFactory.create(inputStream);
FormulaEvaluator evaluator = workbook.getCreationHelper().createFormulaEvaluator();
evaluator.evaluateAll();
if (StringUtils.isBlank(periodDate) || "null".equals(periodDate)) { if (StringUtils.isBlank(periodDate) || "null".equals(periodDate)) {
throw new ServiceException(ErrorMessageCN.DoNotSelectPeriod); throw new ServiceException(ErrorMessageCN.DoNotSelectPeriod);
} }
...@@ -1573,7 +1584,7 @@ public class DataImportService extends BaseService { ...@@ -1573,7 +1584,7 @@ public class DataImportService extends BaseService {
for (int i = 0; i < workbook.getNumberOfSheets(); i++) { for (int i = 0; i < workbook.getNumberOfSheets(); i++) {
Sheet sheet = workbook.getSheetAt(i); Sheet sheet = workbook.getSheetAt(i);
if (isSheetEmpty(sheet)) continue; if (isSheetEmpty(sheet)) continue;
DataImportResponseDto<InvoiceRecord> dataImportResponseDto= generalIRs(sheet); DataImportResponseDto<InvoiceRecord> dataImportResponseDto= generalIRs(sheet,evaluator);
dataImportResponseDto1.addAll(dataImportResponseDto.getDataImportErrorDtos()); dataImportResponseDto1.addAll(dataImportResponseDto.getDataImportErrorDtos());
//List<InvoiceRecord> irs = generalIRs(sheet); //List<InvoiceRecord> irs = generalIRs(sheet);
List<InvoiceRecord> irs=dataImportResponseDto.getObjectList(); List<InvoiceRecord> irs=dataImportResponseDto.getObjectList();
...@@ -1594,7 +1605,7 @@ public class DataImportService extends BaseService { ...@@ -1594,7 +1605,7 @@ public class DataImportService extends BaseService {
//导入成功并将错误信息返回 //导入成功并将错误信息返回
OperationResultDto a=new OperationResultDto(); OperationResultDto a=new OperationResultDto();
a.setResult(true); a.setResult(true);
a.setResultMsg(JSONArray.toJSONString(dataImportResponseDto1)); a.setResultMsg(reImportError(dataImportResponseDto1));
return a; return a;
} catch (ServiceException e) { } catch (ServiceException e) {
...@@ -1605,6 +1616,55 @@ public class DataImportService extends BaseService { ...@@ -1605,6 +1616,55 @@ public class DataImportService extends BaseService {
} }
} }
private String reImportError(List<DataImportErrorDto> errorDtos){
StringBuffer sb=new StringBuffer();
for(DataImportErrorDto row:errorDtos){
//Sheet
if(row.getSheet()!=null){
sb.append("第"+row.getSheet()+"Sheet,");
}
//行号
if(row.getCellLine()!=null){
sb.append("第"+ row.getCellLine() +"行,");
}
//发票类型
if(!Strings.isBlank(row.getInvoiceType())){
sb.append("发票类型"+row.getInvoiceType()+",");
}
//开票内容
if(!Strings.isBlank(row.getInvoiceDetail())){
sb.append("开票内容"+row.getInvoiceDetail()+",");
}
//开票主体
if(!Strings.isBlank(row.getOrg())){
sb.append("开票主体"+row.getOrg()+",");
}
//税率
if(!Strings.isBlank(row.getTaxRate())){
sb.append("税率"+row.getTaxRate()+",");
}
//税额
if(!Strings.isBlank(row.getAmountRate())){
sb.append("税额"+row.getAmountRate()+",");
}
//开票金额
if(!Strings.isBlank(row.getAmount())){
sb.append("开票金额"+row.getAmount()+",");
}
//确认/认证日期
if(!Strings.isBlank(row.getConfirmTime())){
sb.append("确认/认证日期"+row.getConfirmTime()+",");
}
//金额
if(!Strings.isBlank(row.getCilAmount())){
sb.append("金额"+row.getCilAmount()+",");
}
sb.append(";");
}
return sb.toString();
}
private void processIrs(String billingBody, List<InvoiceRecord> irs, List<String> orgIds, private void processIrs(String billingBody, List<InvoiceRecord> irs, List<String> orgIds,
Integer tmsPeriod, Integer importType, List<DataImportLog> dataImportLogs) { Integer tmsPeriod, Integer importType, List<DataImportLog> dataImportLogs) {
OrganizationExample organizationExample = new OrganizationExample(); OrganizationExample organizationExample = new OrganizationExample();
...@@ -1686,7 +1746,7 @@ public class DataImportService extends BaseService { ...@@ -1686,7 +1746,7 @@ public class DataImportService extends BaseService {
dataImportLogs.add(dataImportLog); dataImportLogs.add(dataImportLog);
} }
private List<RedLetterInfoTable> generalRLITs(Sheet sheet) { private List<RedLetterInfoTable> generalRLITs(Sheet sheet,FormulaEvaluator evaluator) {
List<RedLetterInfoTable> rlits = Lists.newArrayList(); List<RedLetterInfoTable> rlits = Lists.newArrayList();
for (int j = 1; j <= sheet.getLastRowNum(); j++) { for (int j = 1; j <= sheet.getLastRowNum(); j++) {
RedLetterInfoTable rlit = new RedLetterInfoTable(); RedLetterInfoTable rlit = new RedLetterInfoTable();
...@@ -1706,8 +1766,8 @@ public class DataImportService extends BaseService { ...@@ -1706,8 +1766,8 @@ public class DataImportService extends BaseService {
rlit.setFillInDate(row.getCell(3).getDateCellValue()); rlit.setFillInDate(row.getCell(3).getDateCellValue());
rlit.setSalesTaxNumber(getCellStringValue(row.getCell(4))); rlit.setSalesTaxNumber(getCellStringValue(row.getCell(4)));
rlit.setSalespersonName(getCellStringValue(row.getCell(5))); rlit.setSalespersonName(getCellStringValue(row.getCell(5)));
rlit.setTotalAmount(getCellBigDecimalValue(row.getCell(6))); rlit.setTotalAmount(getCellBigDecimalValue(row.getCell(6),evaluator));
rlit.setTotalTaxAmount(getCellBigDecimalValue(row.getCell(7))); rlit.setTotalTaxAmount(getCellBigDecimalValue(row.getCell(7),evaluator));
rlit.setApplicationDescription(getCellStringValue(row.getCell(8))); rlit.setApplicationDescription(getCellStringValue(row.getCell(8)));
rlit.setApplicantManager(getCellStringValue(row.getCell(9))); rlit.setApplicantManager(getCellStringValue(row.getCell(9)));
rlit.setInvoiceCode(getCellStringValue(row.getCell(10))); rlit.setInvoiceCode(getCellStringValue(row.getCell(10)));
...@@ -1717,7 +1777,7 @@ public class DataImportService extends BaseService { ...@@ -1717,7 +1777,7 @@ public class DataImportService extends BaseService {
return rlits; return rlits;
} }
private DataImportResponseDto<InvoiceRecord> generalIRs(Sheet sheet) { private DataImportResponseDto<InvoiceRecord> generalIRs(Sheet sheet,FormulaEvaluator evaluator) {
List<InvoiceRecord> irs = Lists.newArrayList(); List<InvoiceRecord> irs = Lists.newArrayList();
List<DataImportErrorDto> errorDtos = Lists.newArrayList(); List<DataImportErrorDto> errorDtos = Lists.newArrayList();
Set<String> orgsNot = new HashSet<>(); Set<String> orgsNot = new HashSet<>();
...@@ -1765,11 +1825,11 @@ public class DataImportService extends BaseService { ...@@ -1765,11 +1825,11 @@ public class DataImportService extends BaseService {
ir.setCustomerCompanyName(getCellStringValue(row.getCell(2))); ir.setCustomerCompanyName(getCellStringValue(row.getCell(2)));
ir.setInvoiceType(getCellStringValue(row.getCell(3))); ir.setInvoiceType(getCellStringValue(row.getCell(3)));
ir.setBillingContent(getCellStringValue(row.getCell(4))); ir.setBillingContent(getCellStringValue(row.getCell(4)));
ir.setInvoiceAmount(getCellBigDecimalValue(row.getCell(5))); ir.setInvoiceAmount(getCellBigDecimalValue(row.getCell(5),evaluator));
ir.setApplicant(getCellStringValue(row.getCell(6))); ir.setApplicant(getCellStringValue(row.getCell(6)));
ir.setOaApplicationNum(getCellStringValue(row.getCell(7))); ir.setOaApplicationNum(getCellStringValue(row.getCell(7)));
ir.setContractNo(getCellStringValue(row.getCell(8))); ir.setContractNo(getCellStringValue(row.getCell(8)));
ir.setContractAmount(getCellBigDecimalValue(row.getCell(9))); ir.setContractAmount(getCellBigDecimalValue(row.getCell(9),evaluator));
ir.setDepartment(getCellStringValue(row.getCell(10))); ir.setDepartment(getCellStringValue(row.getCell(10)));
ir.setApplicationDate(row.getCell(11).getDateCellValue()); ir.setApplicationDate(row.getCell(11).getDateCellValue());
ir.setBillingDate(row.getCell(12).getDateCellValue()); ir.setBillingDate(row.getCell(12).getDateCellValue());
...@@ -1781,8 +1841,8 @@ public class DataImportService extends BaseService { ...@@ -1781,8 +1841,8 @@ public class DataImportService extends BaseService {
ir.setInvoicesAmount(getCellIntegerValue(row.getCell(17))); ir.setInvoicesAmount(getCellIntegerValue(row.getCell(17)));
ir.setCustomerCompanyTaxNum(getCellStringValue(row.getCell(18))); ir.setCustomerCompanyTaxNum(getCellStringValue(row.getCell(18)));
ir.setContractSourceSystem(getCellStringValue(row.getCell(19))); ir.setContractSourceSystem(getCellStringValue(row.getCell(19)));
ir.setTaxRate(getCellBigDecimalValue(row.getCell(20))); ir.setTaxRate(getCellBigDecimalValue(row.getCell(20),evaluator));
ir.setTaxAmount(getCellBigDecimalValue(row.getCell(21))); ir.setTaxAmount(getCellBigDecimalValue(row.getCell(21),evaluator));
ir.setInvoiceStatus(getCellStringValue(row.getCell(22))); ir.setInvoiceStatus(getCellStringValue(row.getCell(22)));
ir.setSource(getCellStringValue(row.getCell(23))); ir.setSource(getCellStringValue(row.getCell(23)));
irs.add(ir); irs.add(ir);
...@@ -1863,7 +1923,7 @@ public class DataImportService extends BaseService { ...@@ -1863,7 +1923,7 @@ public class DataImportService extends BaseService {
return fg; return fg;
} }
private List<AdjustmentTable> generalATs(Sheet sheet) { private List<AdjustmentTable> generalATs(Sheet sheet,FormulaEvaluator evaluator) {
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++) {
AdjustmentTable at = new AdjustmentTable(); AdjustmentTable at = new AdjustmentTable();
...@@ -1905,15 +1965,15 @@ public class DataImportService extends BaseService { ...@@ -1905,15 +1965,15 @@ public class DataImportService extends BaseService {
at.setSegment8Name(getCellStringValue(row.getCell(18))); at.setSegment8Name(getCellStringValue(row.getCell(18)));
at.setSegment9Name(getCellStringValue(row.getCell(19))); at.setSegment9Name(getCellStringValue(row.getCell(19)));
at.setSegment10Name(getCellStringValue(row.getCell(20))); at.setSegment10Name(getCellStringValue(row.getCell(20)));
at.setPeriodDrBeq(getCellBigDecimalValue(row.getCell(21))); at.setPeriodDrBeq(getCellBigDecimalValue(row.getCell(22),evaluator));
at.setPeriodCrBeq(getCellBigDecimalValue(row.getCell(22))); at.setPeriodCrBeq(getCellBigDecimalValue(row.getCell(22),evaluator));
at.setEndBalBeq(getCellBigDecimalValue(row.getCell(23))); at.setEndBalBeq(getCellBigDecimalValue(row.getCell(23),evaluator));
ats.add(at); ats.add(at);
} }
return ats; return ats;
} }
private List<CoupaPurchasingReport> generalCPRs(Sheet sheet) { private List<CoupaPurchasingReport> generalCPRs(Sheet sheet,FormulaEvaluator evaluator) {
List<CoupaPurchasingReport> cprs = Lists.newArrayList(); List<CoupaPurchasingReport> cprs = Lists.newArrayList();
for (int j = 1; j <= sheet.getLastRowNum(); j++) { for (int j = 1; j <= sheet.getLastRowNum(); j++) {
CoupaPurchasingReport cpr = new CoupaPurchasingReport(); CoupaPurchasingReport cpr = new CoupaPurchasingReport();
...@@ -1934,7 +1994,7 @@ public class DataImportService extends BaseService { ...@@ -1934,7 +1994,7 @@ public class DataImportService extends BaseService {
cpr.setDescription(getCellStringValue(row.getCell(8))); cpr.setDescription(getCellStringValue(row.getCell(8)));
cpr.setSupplierNum(getCellStringValue(row.getCell(9))); cpr.setSupplierNum(getCellStringValue(row.getCell(9)));
cpr.setSupplier(getCellStringValue(row.getCell(10))); cpr.setSupplier(getCellStringValue(row.getCell(10)));
cpr.setTotalAmount(getCellBigDecimalValue(row.getCell(11))); cpr.setTotalAmount(getCellBigDecimalValue(row.getCell(11),evaluator));
cpr.setCurrency(getCellStringValue(row.getCell(12))); cpr.setCurrency(getCellStringValue(row.getCell(12)));
String billNum = getCellStringValue(row.getCell(13)); String billNum = getCellStringValue(row.getCell(13));
cpr.setBillNum(billNum); cpr.setBillNum(billNum);
...@@ -1951,8 +2011,8 @@ public class DataImportService extends BaseService { ...@@ -1951,8 +2011,8 @@ public class DataImportService extends BaseService {
cpr.setPeriod(DateUtils.dateToPeriod(cpr.getBillingDate())); cpr.setPeriod(DateUtils.dateToPeriod(cpr.getBillingDate()));
cpr.setLastUpdatedDate(DateUtils.strToDate3(getCellStringValue(row.getCell(24)))); cpr.setLastUpdatedDate(DateUtils.strToDate3(getCellStringValue(row.getCell(24))));
cpr.setLastUpdatedPerson(getCellStringValue(row.getCell(25))); cpr.setLastUpdatedPerson(getCellStringValue(row.getCell(25)));
cpr.setTotalTaxAmount(getCellBigDecimalValue(row.getCell(26))); cpr.setTotalTaxAmount(getCellBigDecimalValue(row.getCell(26),evaluator));
cpr.setTotalTaxAmountHeader(getCellBigDecimalValue(row.getCell(27))); cpr.setTotalTaxAmountHeader(getCellBigDecimalValue(row.getCell(27),evaluator));
cpr.setBillingNote(getCellStringValue(row.getCell(28))); cpr.setBillingNote(getCellStringValue(row.getCell(28)));
cprs.add(cpr); cprs.add(cpr);
} }
...@@ -2010,10 +2070,19 @@ public class DataImportService extends BaseService { ...@@ -2010,10 +2070,19 @@ public class DataImportService extends BaseService {
return null; return null;
} }
private BigDecimal getCellBigDecimalValue(Cell cell) { private BigDecimal getCellBigDecimalValue(Cell cell,FormulaEvaluator evaluator) {
if (null == cell) { if (null == cell) {
return null; return null;
} }
if(cell.getCellTypeEnum().equals(CellType.FORMULA)){
CellValue cellValue = evaluator.evaluate(cell);
if (cellValue.getCellTypeEnum().equals(CellType.STRING)) {
return new BigDecimal(cellValue.getStringValue().trim());
} else if (cellValue.getCellTypeEnum().equals(CellType.NUMERIC)) {
return new BigDecimal(cellValue.getNumberValue());
}
return null;
}
if (cell.getCellTypeEnum().equals(CellType.STRING)) { if (cell.getCellTypeEnum().equals(CellType.STRING)) {
return new BigDecimal(cell.getStringCellValue().trim()); return new BigDecimal(cell.getStringCellValue().trim());
} else if (cell.getCellTypeEnum().equals(CellType.NUMERIC)) { } else if (cell.getCellTypeEnum().equals(CellType.NUMERIC)) {
...@@ -2022,6 +2091,18 @@ public class DataImportService extends BaseService { ...@@ -2022,6 +2091,18 @@ public class DataImportService extends BaseService {
logger.warn("获取单元格数据类型未匹配"); logger.warn("获取单元格数据类型未匹配");
return null; return null;
} }
// private BigDecimal getCellBigDecimalValue(Cell cell) {
// if (null == cell) {
// return null;
// }
// if (cell.getCellTypeEnum().equals(CellType.STRING)) {
// return new BigDecimal(cell.getStringCellValue().trim());
// } else if (cell.getCellTypeEnum().equals(CellType.NUMERIC)) {
// return new BigDecimal(cell.getNumericCellValue());
// }
// logger.warn("获取单元格数据类型未匹配");
// return null;
// }
private Long getCellLongDecimalValue(Cell cell) { private Long getCellLongDecimalValue(Cell cell) {
if (null == cell) { if (null == cell) {
......
...@@ -623,6 +623,7 @@ ...@@ -623,6 +623,7 @@
"ImportOutputInvoice": "Import Output Invoices", "ImportOutputInvoice": "Import Output Invoices",
"ImportShipmentList": "Import Departure List", "ImportShipmentList": "Import Departure List",
"ImportShipmentListGd": "Import Departure List- GD", "ImportShipmentListGd": "Import Departure List- GD",
"ImportPartSuccess": "Part Import Success",
"ImportSuccess": "Import Success", "ImportSuccess": "Import Success",
"ImportTrialBalance": "Import TB", "ImportTrialBalance": "Import TB",
"ImportTypeTip": "Clear All Imported Financial Data for This Period, Proceed?", "ImportTypeTip": "Clear All Imported Financial Data for This Period, Proceed?",
...@@ -720,6 +721,7 @@ ...@@ -720,6 +721,7 @@
"IsConfirmCancelMap": "The System Has Reached the {status} State. Do You Confirm the Cancellation of Correspondence?", "IsConfirmCancelMap": "The System Has Reached the {status} State. Do You Confirm the Cancellation of Correspondence?",
"IsConfirmManualReClassify": "The System Has Reached the {status} State. Are You Sure to Save Manual Reclassification?", "IsConfirmManualReClassify": "The System Has Reached the {status} State. Are You Sure to Save Manual Reclassification?",
"IsConfirmReCalcuate": "The System Has Reached the {status} State. Do You Confirm Recalculation??", "IsConfirmReCalcuate": "The System Has Reached the {status} State. Do You Confirm Recalculation??",
"IsConfirmTimeNotSame": "数据处理期间非当前税款所属期,是否继续进行数据处理?",
"IsConfirmSaveReport": "The System Has Reached the {status} Status. Are You Sure to Save the Report?", "IsConfirmSaveReport": "The System Has Reached the {status} Status. Are You Sure to Save the Report?",
"IsConfirmToApproveReport": "Whether to Confirm the Approval?", "IsConfirmToApproveReport": "Whether to Confirm the Approval?",
"IsConfirmToCompleteDeclaration": "Whether to Confirm the Completion Of the Declaration?", "IsConfirmToCompleteDeclaration": "Whether to Confirm the Completion Of the Declaration?",
......
...@@ -779,6 +779,7 @@ ...@@ -779,6 +779,7 @@
"ImportOutputInvoice": "导入销项发票", "ImportOutputInvoice": "导入销项发票",
"ImportShipmentList": "导入发车清单", "ImportShipmentList": "导入发车清单",
"ImportShipmentListGd": "导入发车清单-GD", "ImportShipmentListGd": "导入发车清单-GD",
"ImportPartSuccess": "部分导入成功",
"ImportSuccess": "导入成功", "ImportSuccess": "导入成功",
"ImportSuccessCount": "导入成功,验证失败:", "ImportSuccessCount": "导入成功,验证失败:",
"ImportTrialBalance": "导入试算平衡表", "ImportTrialBalance": "导入试算平衡表",
...@@ -955,6 +956,7 @@ ...@@ -955,6 +956,7 @@
"IsConfirmCancelMap": "系统已到达{status}状态,是否确认取消对应?", "IsConfirmCancelMap": "系统已到达{status}状态,是否确认取消对应?",
"IsConfirmManualReClassify": "系统已到达{status}状态,是否确认保存手工重分类?", "IsConfirmManualReClassify": "系统已到达{status}状态,是否确认保存手工重分类?",
"IsConfirmReCalcuate": "系统已到达{status}状态,是否确认重新计算?", "IsConfirmReCalcuate": "系统已到达{status}状态,是否确认重新计算?",
"IsConfirmTimeNotSame": "数据处理期间非当前税款所属期,是否继续进行数据处理?",
"IsConfirmSaveReport": "系统已到达{status}状态,是否确认保存报表?", "IsConfirmSaveReport": "系统已到达{status}状态,是否确认保存报表?",
"IsConfirmToApproveReport": "是否确认通过审核?", "IsConfirmToApproveReport": "是否确认通过审核?",
"IsConfirmToApproveReportTitle": "是否确定审核通过?", "IsConfirmToApproveReportTitle": "是否确定审核通过?",
......
...@@ -191,8 +191,12 @@ ...@@ -191,8 +191,12 @@
if (ret.result) { if (ret.result) {
logDto.UpdateState = $translate.instant('ImportSuccess'); logDto.UpdateState = $translate.instant('ImportSuccess');
vatOperationLogService.addOperationLog(logDto); vatOperationLogService.addOperationLog(logDto);
if(ret.resultMsg){ //var errorObj=JSON.parse(ret.resultMsg);
swal($translate.instant('ImportSuccess'), ret.resultMsg, "warning"); if(ret.resultMsg!=""&&ret.resultMsg){
var reg = new RegExp(";","g");//g,表示全部替换
var error=ret.resultMsg.replace(reg,'\n');
swal($translate.instant('ImportPartSuccess'), error, "warning");
//swal($translate.instant('ImportSuccess'), ret.resultMsg, "warning");
//SweetAlert.warning(ret.resultMsg); //SweetAlert.warning(ret.resultMsg);
}else{ }else{
SweetAlert.success($translate.instant('ImportSuccess')); SweetAlert.success($translate.instant('ImportSuccess'));
......
...@@ -198,8 +198,12 @@ ...@@ -198,8 +198,12 @@
if (ret.result) { if (ret.result) {
logDto.UpdateState = $translate.instant('ImportSuccess'); logDto.UpdateState = $translate.instant('ImportSuccess');
vatOperationLogService.addOperationLog(logDto); vatOperationLogService.addOperationLog(logDto);
if(ret.resultMsg){ //var errorObj=JSON.parse(ret.resultMsg);
swal($translate.instant('ImportSuccess'), ret.resultMsg, "warning"); if(ret.resultMsg!=""&&ret.resultMsg){
var reg = new RegExp(";","g");//g,表示全部替换
var error=ret.resultMsg.replace(reg,'\n');
swal($translate.instant('ImportPartSuccess'), error, "warning");
//swal($translate.instant('ImportSuccess'), ret.resultMsg, "warning");
//SweetAlert.warning(ret.resultMsg); //SweetAlert.warning(ret.resultMsg);
}else{ }else{
SweetAlert.success($translate.instant('ImportSuccess')); SweetAlert.success($translate.instant('ImportSuccess'));
......
...@@ -744,7 +744,7 @@ ...@@ -744,7 +744,7 @@
<span class="required-tip"> * </span> <span class="required-tip"> * </span>
{{'Company Name' | translate}} {{'Company Name' | translate}}
</label> </label>
<div class="col-sm-11" style="width:61.67%" id="companyNameOptionsMap"> <div class="col-sm-11" style="width:61.67%;height: 13px" id="companyNameOptionsMap">
<div dx-select-box="editOrgOptions"></div> <div dx-select-box="editOrgOptions"></div>
<!--<select ng-model="editFieldModel.companyName" class="form-control"--> <!--<select ng-model="editFieldModel.companyName" class="form-control"-->
<!--title="{{editFieldModel.companyName}}" required--> <!--title="{{editFieldModel.companyName}}" required-->
...@@ -987,7 +987,7 @@ ...@@ -987,7 +987,7 @@
<span class="required-tip"> * </span> <span class="required-tip"> * </span>
{{'Company Name' | translate}} {{'Company Name' | translate}}
</label> </label>
<div class="col-sm-11" style="width:61.67%"> <div class="col-sm-11" style="width:61.67%;height: 13px">
<div ng-class="{'upload-fail-mark':!editFieldItem.companyName}" dx-select-box="editFieldItemOrgOptions"></div> <div ng-class="{'upload-fail-mark':!editFieldItem.companyName}" dx-select-box="editFieldItemOrgOptions"></div>
<!--<select ng-model="editFieldItem.companyName" class="form-control"--> <!--<select ng-model="editFieldItem.companyName" class="form-control"-->
<!--title="{{editFieldItem.companyName}}"--> <!--title="{{editFieldItem.companyName}}"-->
......
...@@ -375,6 +375,49 @@ ...@@ -375,6 +375,49 @@
} }
}; };
var checkYearMonthCaculate2 =function (){
var now=new Date();
var month=now.getMonth()+1;
var year=now.getFullYear();
var vatMonth=vatSessionService.month;
if(vatSessionService.year==year){
if(vatMonth<month-1){
return true;
}
}
if(vatSessionService.year==year-1&&vatMonth==12&&month==0){
return false;
}
return true;
}
var startCaculate3 = function () {
var bool=checkYearMonthCaculate2();
if(bool){
swal({
title: "warning!",
text: $translate.instant('IsConfirmTimeNotSame'),
type: "warning",
showCancelButton: true,
confirmButtonColor: "#dd6b55",
confirmButtonText: $translate.instant('Yes'),
cancelButtonText: $translate.instant('No'),
closeOnConfirm: true,
closeOnCancel: true
},
function (isConfirm) {
if(isConfirm){
startCaculate2();
}else{
return ;
}
})
}else{
startCaculate2();
}
}
var startCaculate2 = function () { var startCaculate2 = function () {
if (vatSessionService.project.projectStatusList[vatSessionService.month] >= constant.ProjectStatusEnum.Generated) { if (vatSessionService.project.projectStatusList[vatSessionService.month] >= constant.ProjectStatusEnum.Generated) {
swal({ swal({
...@@ -684,7 +727,7 @@ ...@@ -684,7 +727,7 @@
$scope.resolveRef = []; $scope.resolveRef = [];
initTasks(); initTasks();
$scope.startCaculate = startCaculate; $scope.startCaculate = startCaculate;
$scope.startCaculate2 = startCaculate2; $scope.startCaculate3 = startCaculate3;
$scope.$on('$destroy',function(){ $scope.$on('$destroy',function(){
if($scope.timer)$interval.cancel($scope.timer); if($scope.timer)$interval.cancel($scope.timer);
}); });
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<div class="vat-caculate-data-title" ng-if="tasks.length > 0"> <div class="vat-caculate-data-title" ng-if="tasks.length > 0">
<!--<span translate="vatCaculateDataDesc"></span>--> <!--<span translate="vatCaculateDataDesc"></span>-->
<!--<button class="btn btn-vat-primary" translate="startCaculateData" ng-disabled="readonly" ng-click="startCaculate()"></button>--> <!--<button class="btn btn-vat-primary" translate="startCaculateData" ng-disabled="readonly" ng-click="startCaculate()"></button>-->
<button class="btn btn-vat-primary" translate="startCaculateData" ng-disabled="readonly" ng-click="startCaculate2()"></button> <button class="btn btn-vat-primary" translate="startCaculateData" ng-disabled="readonly" ng-click="startCaculate3()"></button>
<span ng-click="showOperateLogPop()"><i class="fa fa-file-excel-o" aria-hidden="true"></i>{{'Remarks' | translate}}</span> <span ng-click="showOperateLogPop()"><i class="fa fa-file-excel-o" aria-hidden="true"></i>{{'Remarks' | translate}}</span>
</div> </div>
......
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