Commit 4dfe6ef0 authored by sherlock's avatar sherlock

import template with formula/ export output-invoice

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