Commit b5c11386 authored by sherlock's avatar sherlock

export bug

parent 1519bf01
......@@ -22,6 +22,7 @@ import pwc.taxtech.atms.vat.service.impl.InputInvoiceDataImportServiceImpl;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.OutputStream;
import java.math.BigDecimal;
import java.util.*;
import static javax.servlet.http.HttpServletResponse.SC_NO_CONTENT;
......@@ -54,7 +55,7 @@ public class InputInvoiceImportController {
try {
response.addHeader("Content-Disposition", "attachment;filename="
+ UUID.randomUUID() + ".xls");
response.addHeader("x-file-name", fileName + ".xls");
response.addHeader("x-file-name", fileName);
os = response.getOutputStream();
int count = getDownloadFilePath(paras, os, projectId);
......@@ -100,7 +101,7 @@ public class InputInvoiceImportController {
List<InputInvoiceExportDto> inputInvoiceExportDtos = Lists.newArrayList();
for(InputInvoice inputInvoice : list){
InputInvoiceExportDto inputInvoiceExportDto = new InputInvoiceExportDto();
inputInvoiceExportDto.setAmount(inputInvoice.getHJJE());
inputInvoiceExportDto.setAmount(inputInvoice.getHJJE() != null ? new BigDecimal(inputInvoice.getHJJE().replace(",","")): BigDecimal.ZERO);
inputInvoiceExportDto.setCertificationDate(inputInvoice.getRZSJ());
inputInvoiceExportDto.setInvoiceCode(inputInvoice.getFPDM());
inputInvoiceExportDto.setInvoiceDate(inputInvoice.getKPRQ());
......@@ -108,7 +109,7 @@ public class InputInvoiceImportController {
inputInvoiceExportDto.setInvoiceTypeName(getFplx(inputInvoice.getFPLX()));
inputInvoiceExportDto.setPeriodId(Integer.parseInt(inputInvoice.getRZSJ().substring(5, 7)));
inputInvoiceExportDto.setSellerTaxNumber(inputInvoice.getXFSH());
inputInvoiceExportDto.setTaxAmount(inputInvoice.getHJSE());
inputInvoiceExportDto.setTaxAmount(inputInvoice.getHJSE() != null ? new BigDecimal(inputInvoice.getHJJE().replace(",","")) : BigDecimal.ZERO);
inputInvoiceExportDtos.add(inputInvoiceExportDto);
}
Map<String, String> header = new HashMap<>();
......@@ -122,6 +123,12 @@ public class InputInvoiceImportController {
header.put("TaxAmount", "税额");
header.put("CertificationDate", "认证日期");
InputInvoiceExportDto inputInvoiceExportDto = new InputInvoiceExportDto();
inputInvoiceExportDto.setTaxAmount(inputInvoiceExportDtos.stream().map(InputInvoiceExportDto::getTaxAmount).reduce(BigDecimal::add).get());
inputInvoiceExportDto.setAmount(inputInvoiceExportDtos.stream().map(InputInvoiceExportDto::getAmount).reduce(BigDecimal::add).get());
InputInvoiceExportDto black = new InputInvoiceExportDto();
inputInvoiceExportDtos.add(black);
inputInvoiceExportDtos.add(inputInvoiceExportDto);
ExcelSheet excelSheetA = new ExcelSheet<>();
excelSheetA.setHeaders(header);
excelSheetA.setDataset(inputInvoiceExportDtos);
......@@ -146,16 +153,26 @@ public class InputInvoiceImportController {
List<InputInvoiceDetail> inputInvoiceDetailList = inputInvoiceDataImportService.getInputInvoiceItemList(item.getID());
for(InputInvoiceDetail inputInvoiceDetail : inputInvoiceDetailList){
InputInvoiceDetailExportDto inputInvoiceDetailExportDto = new InputInvoiceDetailExportDto();
inputInvoiceDetailExportDto.setAmount(inputInvoiceDetail.getJE());
inputInvoiceDetailExportDto.setAmount(inputInvoiceDetail.getJE() != null ? new BigDecimal(inputInvoiceDetail.getJE().replace(",","")) : BigDecimal.ZERO);
inputInvoiceDetailExportDto.setInvoiceCode(inputInvoiceDetail.getFPDM());
inputInvoiceDetailExportDto.setInvoiceNumber(inputInvoiceDetail.getFPHM());
inputInvoiceDetailExportDto.setPeriodId(Integer.parseInt(item.getRZSJ().substring(5, 7)));
inputInvoiceDetailExportDto.setProductionName(inputInvoiceDetail.getSPMC());
inputInvoiceDetailExportDto.setTaxAmount(inputInvoiceDetail.getSE());
inputInvoiceDetailExportDto.setTaxAmount(inputInvoiceDetail.getSE() != null ? new BigDecimal(inputInvoiceDetail.getSE().replace(",","")) : BigDecimal.ZERO);
inputInvoiceDetailExportDto.setTaxRate(inputInvoiceDetail.getSLV());
inputInvoiceItemList.add(inputInvoiceDetailExportDto);
}
}
InputInvoiceDetailExportDto inputInvoiceDetailExportDto = new InputInvoiceDetailExportDto();
inputInvoiceDetailExportDto.setTaxAmount(inputInvoiceItemList.stream().map(InputInvoiceDetailExportDto::getTaxAmount).reduce(BigDecimal::add).get());
inputInvoiceDetailExportDto.setAmount(inputInvoiceItemList.stream().map(InputInvoiceDetailExportDto::getAmount).reduce(BigDecimal::add).get());
InputInvoiceDetailExportDto detailBlack = new InputInvoiceDetailExportDto();
inputInvoiceItemList.add(detailBlack);
inputInvoiceItemList.add(inputInvoiceDetailExportDto);
excelSheetB.setDataset(inputInvoiceItemList);
List<ExcelSheet<InputVATInvoiceBaseDto>> sheets = new ArrayList<>();
sheets.add(excelSheetA);
......
......@@ -2,6 +2,7 @@ package pwc.taxtech.atms.controller;
import com.github.pagehelper.PageInfo;
import com.github.pagehelper.util.StringUtil;
import com.google.common.collect.Lists;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
......@@ -24,6 +25,7 @@ import pwc.taxtech.atms.vat.service.impl.OutputInvoiceServiceImpl;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.OutputStream;
import java.math.BigDecimal;
import java.util.*;
import static javax.servlet.http.HttpServletResponse.SC_NO_CONTENT;
......@@ -60,7 +62,7 @@ public class OutputInvoiceController {
try {
response.addHeader("Content-Disposition", "attachment;filename="
+ UUID.randomUUID() + ".xls");
response.addHeader("x-file-name", fileName + ".xls");
response.addHeader("x-file-name", fileName);
os = response.getOutputStream();
int count = getDownloadFilePath(paras, projectId, os);
......@@ -89,6 +91,13 @@ public class OutputInvoiceController {
if (list.size() == 0) {
return 0;
}
OutputVATInvoiceInfoDto outputVATInvoiceInfoDto = new OutputVATInvoiceInfoDto();
outputVATInvoiceInfoDto.setTaxAmount(list.stream().map(OutputVATInvoiceInfoDto::getTaxAmount).reduce(BigDecimal::add).get());
outputVATInvoiceInfoDto.setAmount(list.stream().map(OutputVATInvoiceInfoDto::getAmount).reduce(BigDecimal::add).get());
OutputVATInvoiceInfoDto black = new OutputVATInvoiceInfoDto();
list.add(black);
list.add(outputVATInvoiceInfoDto);
List<pwc.taxtech.atms.dto.vatdto.OutputVATInvoiceInfoDto> list2 = new ArrayList<>();
list.stream().forEach(x -> {
pwc.taxtech.atms.dto.vatdto.OutputVATInvoiceInfoDto d =
......@@ -117,6 +126,7 @@ public class OutputInvoiceController {
header.put("TaxRate", "税率");
header.put("TaxAmount", "税额");
header.put("TaxClassCode", "税收分类编码");
ExcelUtil.exportExcel(header, list2, outputStream);
return list.size();
}
......
......@@ -3,6 +3,7 @@ package pwc.taxtech.atms.dto.vatdto;
import pwc.taxtech.atms.thirdparty.ExcelCell;
import java.io.Serializable;
import java.math.BigDecimal;
public class InputInvoiceDetailExportDto implements Serializable {
......@@ -16,10 +17,10 @@ public class InputInvoiceDetailExportDto implements Serializable {
private String invoiceNumber;
@ExcelCell(index=2)
private String amount;
private BigDecimal amount;
@ExcelCell(index=1)
private String taxAmount;
private BigDecimal taxAmount;
@ExcelCell(index=3)
private String taxRate;
......@@ -51,19 +52,19 @@ public class InputInvoiceDetailExportDto implements Serializable {
this.invoiceNumber = invoiceNumber;
}
public String getAmount() {
public BigDecimal getAmount() {
return amount;
}
public void setAmount(String amount) {
public void setAmount(BigDecimal amount) {
this.amount = amount;
}
public String getTaxAmount() {
public BigDecimal getTaxAmount() {
return taxAmount;
}
public void setTaxAmount(String taxAmount) {
public void setTaxAmount(BigDecimal taxAmount) {
this.taxAmount = taxAmount;
}
......
......@@ -3,11 +3,12 @@ package pwc.taxtech.atms.dto.vatdto;
import pwc.taxtech.atms.thirdparty.ExcelCell;
import java.io.Serializable;
import java.math.BigDecimal;
public class InputInvoiceExportDto implements Serializable {
@ExcelCell(index=6)
private int periodId;
private Integer periodId;
@ExcelCell(index=7)
private String invoiceDate;
......@@ -25,19 +26,19 @@ public class InputInvoiceExportDto implements Serializable {
private String invoiceTypeName;
@ExcelCell(index=4)
private String amount;
private BigDecimal amount;
@ExcelCell(index=1)
private String taxAmount;
private BigDecimal taxAmount;
@ExcelCell(index=2)
private String certificationDate;
public int getPeriodId() {
public Integer getPeriodId() {
return periodId;
}
public void setPeriodId(int periodId) {
public void setPeriodId(Integer periodId) {
this.periodId = periodId;
}
......@@ -81,19 +82,19 @@ public class InputInvoiceExportDto implements Serializable {
this.invoiceTypeName = invoiceTypeName;
}
public String getAmount() {
public BigDecimal getAmount() {
return amount;
}
public void setAmount(String amount) {
public void setAmount(BigDecimal amount) {
this.amount = amount;
}
public String getTaxAmount() {
public BigDecimal getTaxAmount() {
return taxAmount;
}
public void setTaxAmount(String taxAmount) {
public void setTaxAmount(BigDecimal taxAmount) {
this.taxAmount = taxAmount;
}
......
......@@ -337,6 +337,9 @@ public class TemplateGroupServiceImpl extends AbstractService {
Workbook workbook = WorkbookFactory.create(inputStream);
List<Template> filePathList = Lists.newArrayList();
Date now = new Date();
TemplateExample t = new TemplateExample();
t.createCriteria().andTemplateGroupIdEqualTo(templateGroupId);
int length = templateMapper.selectByExample(t).size();
for (int i = 0; i < workbook.getNumberOfSheets(); i++) {
String sheetName = workbook.getSheetName(i);
String newName = sheetName + CommonUtils.getUUID() + POIUtil.getFileSuffix(fileName).get();
......@@ -369,7 +372,7 @@ public class TemplateGroupServiceImpl extends AbstractService {
template.setIsActiveAssociation(true);
template.setIsSystemType(false);
template.setName(name);
template.setOrderIndex(i + 1);
template.setOrderIndex(i + length);
template.setPath(tmpPath);
template.setReportType(StringUtils.isBlank(reportType) ? null : Integer.valueOf(reportType));
template.setTemplateGroupId(templateGroupId);
......
#jdbc_url=jdbc:oracle:thin:@10.158.230.144:11521:XE
#jdbc_user=TAX_ADMIN
#jdbc_password=taxadmin2018
##jdbc_password=111111
#jdbc_admin_db=tax_admin
jdbc_url=jdbc:oracle:thin:@10.158.230.144:11521:XE
jdbc_user=tax_admin_longi
jdbc_password=tax_admin_longi
jdbc_user=TAX_ADMIN
jdbc_password=taxadmin2018
#jdbc_password=111111
jdbc_admin_db=tax_admin_longi
jdbc_admin_db=tax_admin
#jdbc_url=jdbc:oracle:thin:@10.158.230.144:11521:XE
#jdbc_user=tax_admin_longi
#jdbc_password=tax_admin_longi
##jdbc_password=111111
#jdbc_admin_db=tax_admin_longi
jdbc2_url=jdbc:oracle:thin:@10.158.230.144:11521:XE
jdbc2_user=pwc_invoice
......
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