Commit 4dfe6ef0 authored by sherlock's avatar sherlock

import template with formula/ export output-invoice

parent 34e82a7f
package pwc.taxtech.atms.constant.enums;
public enum EnumOutputInvoiceType {
Normal(0, "普通发票"),
Special(1, "专用发票"),
MotorVehicle(2, "机动车销售发票");
Normal(7, "普通发票"),
Special(4, "专用发票"),
MotorVehicle(26, "机动车销售发票");
private int code;
private String name;
......
......@@ -7,6 +7,7 @@ import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import pwc.taxtech.atms.common.util.BeanUtil;
import pwc.taxtech.atms.constant.enums.EnumModule;
import pwc.taxtech.atms.dpo.PagingResultDto;
import pwc.taxtech.atms.dto.vatdto.ImportOutputInvoiceDto;
......@@ -23,11 +24,7 @@ import pwc.taxtech.atms.vat.service.impl.OutputInvoiceServiceImpl;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.OutputStream;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.*;
import static javax.servlet.http.HttpServletResponse.SC_NO_CONTENT;
import static javax.servlet.http.HttpServletResponse.SC_OK;
......@@ -38,6 +35,8 @@ import static pwc.taxtech.atms.constant.Constant.TEMP_FILE_NAME;
@RequestMapping(value = "api/v1/outputInvoiceImport")
public class OutputInvoiceController {
@Autowired
private BeanUtil beanUtil;
@Autowired
OutputInvoiceServiceImpl outputInvoiceService;
@Autowired
......@@ -87,6 +86,14 @@ public class OutputInvoiceController {
if (list.size() == 0) {
return 0;
}
List<pwc.taxtech.atms.dto.vatdto.OutputVATInvoiceInfoDto> list2 = new ArrayList<>();
list.stream().forEach(x -> {
pwc.taxtech.atms.dto.vatdto.OutputVATInvoiceInfoDto d =
new pwc.taxtech.atms.dto.vatdto.OutputVATInvoiceInfoDto();
d = beanUtil.copyProperties(x,d);
d.setInvoiceTypeName(d.getInvoiceTypeName());
list2.add(d);
});
Map<String, String> header = new HashMap<>();
header.put("InvoiceTypeName", "发票类型");
header.put("ClassCode", "发票代码");
......@@ -107,7 +114,7 @@ public class OutputInvoiceController {
header.put("TaxRate", "税率");
header.put("TaxAmount", "税额");
header.put("TaxClassCode", "税收分类编码");
ExcelUtil.exportExcel(header, list, outputStream);
ExcelUtil.exportExcel(header, list2, outputStream);
return list.size();
}
......
......@@ -2,6 +2,7 @@ package pwc.taxtech.atms.dto.vatdto;
import com.fasterxml.jackson.annotation.JsonProperty;
import pwc.taxtech.atms.constant.enums.EnumOutputInvoiceType;
import pwc.taxtech.atms.thirdparty.ExcelCell;
import java.math.BigDecimal;
import java.util.Date;
......@@ -9,31 +10,55 @@ import java.util.Date;
public class OutputVATInvoiceInfoDto {
@JsonProperty("invoiceID")
private String invoiceId;
private Integer invoiceType;
@ExcelCell(index=13)
private String invoiceTypeName;
@ExcelCell(index=11)
private String classCode;
@ExcelCell(index=18)
private String invoiceNumber;
@ExcelCell(index=17)
private String buyerName;
@ExcelCell(index=1)
private String buyerTaxNumber;
@ExcelCell(index=5)
private String bankAccount;
@ExcelCell(index=12)
private String phoneNum;
@ExcelCell(index=19)
private Date invoiceDate;
@ExcelCell(index=16)
private String codeVersion;
@ExcelCell(index=2)
private String productName;
@ExcelCell(index=14)
private String documentNum;
@ExcelCell(index=7)
private String productStandard;
@ExcelCell(index=6)
private String unit;
@ExcelCell(index=4)
private Integer quantity;
@ExcelCell(index=9)
private Double unitPrice;
@ExcelCell(index=3)
private BigDecimal amount;
@ExcelCell(index=15)
private BigDecimal taxRate;
@ExcelCell(index=10)
private BigDecimal taxAmount;
@ExcelCell(index=8)
private String taxClassCode;
@JsonProperty("periodID")
private int periodId;
private boolean isDuplicate;
private BigDecimal amountDifference;
public void setInvoiceTypeName(String invoiceTypeName) {
this.invoiceTypeName = invoiceTypeName;
}
public String getInvoiceId() {
return invoiceId;
}
......@@ -202,11 +227,11 @@ public class OutputVATInvoiceInfoDto {
this.periodId = periodId;
}
public boolean isDuplicate() {
public boolean getIsDuplicate() {
return isDuplicate;
}
public void setDuplicate(boolean duplicate) {
public void setIsDuplicate(boolean duplicate) {
isDuplicate = duplicate;
}
......@@ -219,6 +244,19 @@ public class OutputVATInvoiceInfoDto {
}
public String getInvoiceTypeName() {
return EnumOutputInvoiceType.values()[this.invoiceType].getName();
if(this.invoiceType == null){
return "";
}
switch (this.invoiceType) {
case 4:
return "专用发票";
case 8:
return "普通发票";
case 26:
return "机动车销售发票";
default: return "";
}
// return EnumOutputInvoiceType.values()[this.invoiceType].getName();
}
}
......@@ -5,11 +5,7 @@ import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.usermodel.WorkbookFactory;
import org.apache.poi.ss.usermodel.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
......@@ -267,17 +263,19 @@ public class TemplateGroupServiceImpl extends AbstractService {
cellTemplate.setIsReadOnly(cell.getCellStyle().getLocked());
cellTemplateList.add(cellTemplate);
//todo: 这里没有Config数据只有在上传模板以后,在界面里面可以配置公式
// CellTemplateConfig config = new CellTemplateConfig();
// config.setId(distributedIdService.nextId());
// config.setCellTemplateId(cellTemplate.getId());
// config.setReportTemplateId(template.getId());
// config.setDataSourceType(1);//todo 枚举
// config.setFormula(POIUtil.getCellFormulaString(cell));
// //config.setFormula(cell.getCellFormula());
//// config.setFormulaDataSource(); //todo KV相关
// config.setUpdateTime(now);
// config.setUpdateBy(authUserHelper.getCurrentUserId());
// cellTemplateConfigList.add(config);
if(!cell.getCellStyle().getLocked() && StringUtils.isNotBlank(POIUtil.getCellFormulaString(cell))) {
CellTemplateConfig config = new CellTemplateConfig();
config.setId(distributedIdService.nextId());
config.setCellTemplateId(cellTemplate.getId());
config.setReportTemplateId(template.getId());
config.setDataSourceType(1);//todo 枚举
config.setFormula(POIUtil.getCellFormulaString(cell));
// config.setFormula(cell.getCellFormula());
// config.setFormulaDataSource(); //todo KV相关
config.setUpdateTime(now);
config.setUpdateBy(authUserHelper.getCurrentUserId());
cellTemplateConfigList.add(config);
}
}
}
List<List<CellTemplate>> tmpList = CommonUtils.subListWithLen(cellTemplateList, CommonUtils.BATCH_NUM);
......
......@@ -51,7 +51,8 @@
<property name="patterns">
<list>
<value>pwc.taxtech.atms.dao.*</value>
<value>pwc.taxtech.atms.vatDao.*</value>
<value>pwc.taxtech.atms.vat.dao.*</value>
<value>pwc.taxtech.atms.invoice.*</value>
</list>
</property>
</bean>
......
package pwc.taxtech.atms.invoice;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
......@@ -8,10 +7,13 @@ import org.apache.ibatis.session.RowBounds;
import pwc.taxtech.atms.MyVatMapper;
import pwc.taxtech.atms.vat.dpo.OutputInvoiceDto;
import pwc.taxtech.atms.vat.dpo.OutputVATInvoiceInfoDto;
import pwc.taxtech.atms.vat.dpo.QueryOutputDto;
import pwc.taxtech.atms.vat.entity.OutputInvoice;
import pwc.taxtech.atms.vat.entity.OutputInvoiceExample;
import pwc.taxtech.atms.vat.entity.OutputInvoiceKey;
import java.util.List;
@Mapper
public interface OutputInvoiceMapper extends MyVatMapper {
/**
......@@ -183,4 +185,6 @@ public interface OutputInvoiceMapper extends MyVatMapper {
List<OutputInvoiceDto> getOutputInvoiceWithDetail();
List<OutputVATInvoiceInfoDto> selectOutputInvoiceInfoLeftJoinItem(QueryOutputDto queryDto);
}
\ No newline at end of file
......@@ -9,6 +9,7 @@ public class OutputVATInvoiceInfoDto {
private Integer invoiceType;
private String invoiceTypeName;
private String classCode;
private String invoiceNumber;
private String buyerName;
private String buyerTaxNumber;
......@@ -21,6 +22,7 @@ public class OutputVATInvoiceInfoDto {
private String productStandard;
private String unit;
private Integer quantity;
private String fpqqlsh;
private Double unitPrice;
private BigDecimal amount;
private BigDecimal taxRate;
......@@ -30,6 +32,18 @@ public class OutputVATInvoiceInfoDto {
private boolean isDuplicate;
private BigDecimal amountDifference;
public void setInvoiceTypeName(String invoiceTypeName) {
this.invoiceTypeName = invoiceTypeName;
}
public String getFpqqlsh() {
return fpqqlsh;
}
public void setFpqqlsh(String fpqqlsh) {
this.fpqqlsh = fpqqlsh;
}
public String getInvoiceId() {
return invoiceId;
}
......@@ -198,13 +212,19 @@ public class OutputVATInvoiceInfoDto {
this.periodId = periodId;
}
public boolean isDuplicate() {
public boolean getIsDuplicate() {
return isDuplicate;
}
public boolean isDuplicate() {
return isDuplicate;
}
public void setDuplicate(boolean duplicate) {
isDuplicate = duplicate;
}
public void setIsDuplicate(boolean duplicate) {
isDuplicate = duplicate;
}
public BigDecimal getAmountDifference() {
return amountDifference;
......
......@@ -131,7 +131,7 @@
#{item.createTime,jdbcType=TIMESTAMP},
</when>
<otherwise>
'1970-01-01 08:00:00',
TO_DATE('1970-01-01 08:00:00','yyyy-mm-dd hh24:mi:ss'),
</otherwise>
</choose>
<choose>
......@@ -147,7 +147,7 @@
#{item.updateTime,jdbcType=TIMESTAMP},
</when>
<otherwise>
'1970-01-01 08:00:00',
TO_DATE('1970-01-01 08:00:00','yyyy-mm-dd hh24:mi:ss'),
</otherwise>
</choose>
<choose>
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="pwc.taxtech.atms.invoice.OutputInvoiceMapper">
<resultMap id="OutputVATInvoiceInfoDto" type="pwc.taxtech.atms.dto.vatdto.OutputVATInvoiceInfoDto">
<id column="InvoiceID" jdbcType="VARCHAR" property="invoiceID"/>
<resultMap id="OutputInvoiceInfoDto" type="pwc.taxtech.atms.vat.dpo.OutputVATInvoiceInfoDto">
<id column="Invoice_ID" jdbcType="VARCHAR" property="invoiceId"/>
<result column="INVOICE_TYPE" jdbcType="INTEGER" property="invoiceType"/>
<result column="INVOICE_TYPE_NAME" jdbcType="VARCHAR" property="invoiceTypeName"/>
<result column="CLASS_CODE" jdbcType="VARCHAR" property="classCode"/>
<result column="INVOICE_NUMBER" jdbcType="VARCHAR" property="invoiceNumber"/>
<result column="FPQQLSH" jdbcType="VARCHAR" property="fpqqlsh"/>
<result column="BUYER_NAME" jdbcType="VARCHAR" property="buyerName"/>
<result column="BUYER_TAX_NUMBER" jdbcType="VARCHAR" property="buyerTaxNumber"/>
<result column="BANK_ACCOUNT" jdbcType="VARCHAR" property="bankAccount"/>
......@@ -28,68 +29,68 @@
<result column="AMOUNT_DIFFERENCE" jdbcType="DECIMAL" property="amountDifference"/>
</resultMap>
<select id="selectOutputVATInvoiceInfoLeftJoinItem" parameterType="pwc.taxtech.atms.dto.vatdto.QueryOutputDto" resultMap="OutputVATInvoiceInfoDto">
<select id="selectOutputInvoiceInfoLeftJoinItem" parameterType="pwc.taxtech.atms.vat.dpo.QueryOutputDto" resultMap="OutputInvoiceInfoDto">
SELECT
O.ID AS INVOICE_ID,
O.FPLX AS INVOICE_TYPE,
O.CLASS_CODE,
O.FPLXDM AS INVOICE_TYPE,
O.FPDM AS CLASS_CODE,
O.FPHM AS INVOICE_NUMBER,
O.FPQQLSH,
O.GFMC AS BUYER_NAME,
O.GFSH AS BUYER_TAX_NUMBER,
O.GFYHZH AS BANK_ACCOUNT,
O.GFDZDH AS PHONE_NUM,
O.INVOICE_DATE,
IFNULL (
O.KPRQ AS INVOICE_DATE,
/*nvl (
OI.CODE_VERSION,
''
)
AS CODE_VERSION,
IFNULL (
AS CODE_VERSION,*/
nvl (
OI.SPMC,
''
)
AS PRODUCT_NAME,
IFNULL (
nvl (
OI.MXXH,
''
)
AS DOCUMENT_NUM,
IFNULL (
nvl (
OI.GGXH,
''
)
AS PRODUCT_STANDARD,
IFNULL (
nvl (
OI.DW,
''
)
AS UNIT,
IFNULL (
nvl (
OI.SL,
''
)
AS QUANTITY,
IFNULL (
nvl (
OI.DJ,
''
)
AS UNIT_PRICE,
IFNULL (
nvl (
OI.JE,
''
)
AS AMOUNT,
IFNULL (
nvl (
OI.SE,
''
)
AS TAX_AMOUNT,
IFNULL (
nvl (
OI.SSFLDM,
''
)
AS TAX_CLASS_CODE,
O.PERIOD_ID
AS TAX_CLASS_CODE
FROM
OUTPUT_INVOICE O
LEFT JOIN
......@@ -104,10 +105,10 @@
<!--<if test="queryDto.periodEnd">-->
<!--AND O.PERIOD_ID &lt;= #{queryDto.periodEnd,jdbcType=VARCHAR}-->
<!--</if>-->
<if test="queryDto.productName!=null and queryDto.productName!=''">
AND PRODUCT_NAME LIKE concat (
<if test="productName!=null and productName!=''">
AND OI.SPMC LIKE concat (
'%',
#{query.productName,jdbcType=VARCHAR,'%'}
#{ productName,jdbcType=VARCHAR,'%'}
)
</if>
</select>
......
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