Commit f9227c49 authored by frank.xa.zhang's avatar frank.xa.zhang

add code for jxfpmx, need debug later

parent 5ace3d48
......@@ -39,7 +39,7 @@ public class SpringContextUtil implements ApplicationContextAware {
public static OutputVATInvoiceMapper outputVATInvoiceMapper;
public static PeriodTaxRuleSettingMapper periodTaxRuleSettingMapper;
public static InputVatInvoiceDao inputVatInvoiceDao;
public static InputVATInvoiceMapper inputVATInvoiceMapper;
/**
* 获取bean
......@@ -68,7 +68,7 @@ public class SpringContextUtil implements ApplicationContextAware {
projectDao = webApplicationContext.getBean(ProjectDao.class);
balanceMapper = webApplicationContext.getBean(BalanceMapper.class);
dataSourceMapper = webApplicationContext.getBean(DataSourceMapper.class);
dataSourceDetailMapper=webApplicationContext.getBean(DataSourceDetailMapper.class);
dataSourceDetailMapper = webApplicationContext.getBean(DataSourceDetailMapper.class);
periodFormulaBlockMapper = webApplicationContext.getBean(PeriodFormulaBlockMapper.class);
vatEnterpriseAccountDao = webApplicationContext.getBean(VatEnterpriseAccountDao.class);
vatEnterpriseAccountMapper = webApplicationContext.getBean(VatEnterpriseAccountMapper.class);
......@@ -76,5 +76,6 @@ public class SpringContextUtil implements ApplicationContextAware {
outputVATInvoiceMapper = webApplicationContext.getBean(OutputVATInvoiceMapper.class);
periodTaxRuleSettingMapper = webApplicationContext.getBean(PeriodTaxRuleSettingMapper.class);
inputVatInvoiceDao = webApplicationContext.getBean(InputVatInvoiceDao.class);
inputVATInvoiceMapper = webApplicationContext.getBean(InputVATInvoiceMapper.class);
}
}
......@@ -4,19 +4,24 @@ public enum FormulaDataSourceDetailType {
BSPLFormulaDataSourceDto(1, pwc.taxtech.atms.dto.vatdto.BSPLFormulaDataSourceDto.class),
FormulaDataSourceDto(2, pwc.taxtech.atms.dto.vatdto.FormulaDataSourceDto.class),
InputInvoiceDataSourceDto(3, pwc.taxtech.atms.dto.vatdto.FormulaDataSourceDto.class),
OutputInvoiceDataSourceDto(4, pwc.taxtech.atms.dto.vatdto.OutputInvoiceDataSourceDto.class);
InputInvoiceDataSourceDto(3, pwc.taxtech.atms.dto.vatdto.InputInvoiceDataSourceDto.class),
InputInvoiceDetailDataSourceDto(4, pwc.taxtech.atms.dto.vatdto.InputInvoiceDetailDataSourceDto.class),
OutputInvoiceDataSourceDto(5, pwc.taxtech.atms.dto.vatdto.OutputInvoiceDataSourceDto.class);
private Integer code;
private Class clas;
FormulaDataSourceDetailType(Integer code,Class clas) {
this.code = code;this.clas = clas;
FormulaDataSourceDetailType(Integer code, Class clas) {
this.code = code;
this.clas = clas;
}
public Integer getCode() {
return code;
}
public Class getClas(){return clas;}
public Class getClas() {
return clas;
}
}
package pwc.taxtech.atms.dto.vatdto;
import lombok.Getter;
import lombok.Setter;
import pwc.taxtech.atms.constant.enums.FormulaDataSourceType;
import java.math.BigDecimal;
import java.util.Date;
@Setter
@Getter
public class InputInvoiceDetailDataSourceDto extends FormulaDataSourceDto {
public InputInvoiceDetailDataSourceDto() {
super();
this.setType(FormulaDataSourceType.InputInvoiceDetail.getCode());
}
public int Period;
public Date InvoiceDate;
public String InvoiceCode;
public String InvoiceNumber;
public BigDecimal TaxAmount;
public BigDecimal TaxRate;
public String ProductionName;
}
package pwc.taxtech.atms.dto.vatdto;
import lombok.Getter;
import lombok.Setter;
import pwc.taxtech.atms.vat.entity.GoodsMapping;
import pwc.taxtech.atms.vat.entity.InputVATInvoice;
import pwc.taxtech.atms.vat.entity.InputVATInvoiceItem;
@Setter
@Getter
public class InputVATInvoiceResultDto {
private String invoiceID;
private InputVATInvoice inputVATInvoice;
private InputVATInvoiceItem inputVATInvoiceItem;
private GoodsMapping goodsMapping;
}
......@@ -197,7 +197,7 @@ public class PermissionServiceImpl extends AbstractService implements Permission
.filter(rPermissionDto -> currentNode.getId().equals(rPermissionDto.getParentID())).collect(Collectors.toList());
if(subRolePermissionDtoList!=null && !subRolePermissionDtoList.isEmpty()) {
currentNode.setExpanded(true);
currentNode.setItems(new ArrayList());
currentNode.setItems(new ArrayList<>());
for(RolePermissionDto rolePermissionDto : subRolePermissionDtoList) {
DevTreeDto subNode = new DevTreeDto();
subNode.setId(rolePermissionDto.getPermissionID());
......@@ -210,7 +210,7 @@ public class PermissionServiceImpl extends AbstractService implements Permission
}
else {
currentNode.setExpanded(false);
currentNode.setItems(new ArrayList());
currentNode.setItems(new ArrayList<>());
}
}
......@@ -221,7 +221,7 @@ public class PermissionServiceImpl extends AbstractService implements Permission
.filter(permission -> currentNode.getId().equals(permission.getParentID())).collect(Collectors.toList());
if(subPermissionList!=null && !subPermissionList.isEmpty()) {
currentNode.setExpanded(true);
currentNode.setItems(new ArrayList());
currentNode.setItems(new ArrayList<>());
for(Permission permission : subPermissionList) {
DevTreeDto subNode = new DevTreeDto();
subNode.setId(permission.getID());
......@@ -235,7 +235,7 @@ public class PermissionServiceImpl extends AbstractService implements Permission
}
else {
currentNode.setExpanded(false);
currentNode.setItems(new ArrayList());
currentNode.setItems(new ArrayList<>());
}
}
}
......@@ -6,6 +6,8 @@ import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.session.RowBounds;
import pwc.taxtech.atms.MyVatMapper;
import pwc.taxtech.atms.dto.vatdto.InputInvoicePreviewQueryParam;
import pwc.taxtech.atms.dto.vatdto.InputVATInvoiceDto;
import pwc.taxtech.atms.dto.vatdto.InputVATInvoiceResultDto;
import pwc.taxtech.atms.vat.entity.InputVATInvoice;
import pwc.taxtech.atms.vat.entity.InputVATInvoiceExample;
......@@ -110,4 +112,6 @@ public interface InputVATInvoiceMapper extends MyVatMapper {
long getInputVATInvoiceCountByCondition(@Param("paras") InputInvoicePreviewQueryParam param);
List<InputVATInvoice> getInputVATInvoiceCountByConditionWithPaging(@Param("paras") InputInvoicePreviewQueryParam param,@Param("limitFrom") int limitFrom);
List<InputVATInvoiceResultDto> getInputVATInvoiceResultDto(String dbName);
}
\ No newline at end of file
......@@ -263,7 +263,7 @@ public class VoucherServiceImpl extends VatAbstractService implements VoucherSer
"`VID`";
}
List<Map<String, Object>> queryForList = jdbcTemplate.queryForList(sql);
List<VoucherDto> voucherDtos = new ArrayList();
List<VoucherDto> voucherDtos = new ArrayList<>();
queryForList.forEach(a -> {
VoucherDto dto = new VoucherDto();
dto.setVoucherID(a.get("VoucherID").toString());
......
......@@ -20,7 +20,8 @@ import java.util.List;
public class FunctionBase {
protected final Logger logger = LoggerFactory.getLogger(this.getClass());
public static final BigDecimal[] defaultTaxRates = {new BigDecimal("0.17"), new BigDecimal("0.13")
, new BigDecimal("0.11"), new BigDecimal("0.06"), new BigDecimal(" 0.05"), new BigDecimal("0.03")};
protected FormulaContext formulaContext;
final FormulaAgent agent;
......
......@@ -121,7 +121,7 @@ public class JXFP extends FunctionBase implements FreeRefFunction {
}
}
List<InputInvoiceDataSourceDto> dataSource = new ArrayList();
List<InputInvoiceDataSourceDto> dataSource = new ArrayList<>();
for (InputVATInvoice x : inputVATInvoices) {
InputInvoiceDataSourceDto inputInvoiceDataSourceDto = new InputInvoiceDataSourceDto();
inputInvoiceDataSourceDto.setAmount(FormulaHelper.roundValue(x.getAmount(), KeyValueConfigResultType.Accounting,
......
......@@ -5,9 +5,17 @@ import org.apache.poi.ss.formula.OperationEvaluationContext;
import org.apache.poi.ss.formula.eval.NumberEval;
import org.apache.poi.ss.formula.eval.ValueEval;
import org.apache.poi.ss.formula.functions.FreeRefFunction;
import pwc.taxtech.atms.common.util.SpringContextUtil;
import pwc.taxtech.atms.constant.Constant;
import pwc.taxtech.atms.constant.enums.EnumOperationType;
import pwc.taxtech.atms.constant.enums.FormulaDataSourceDetailType;
import pwc.taxtech.atms.constant.enums.KeyValueConfigResultType;
import pwc.taxtech.atms.dto.vatdto.InputInvoiceDetailDataSourceDto;
import pwc.taxtech.atms.dto.vatdto.InputVATInvoiceResultDto;
import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;
/// <summary>
......@@ -64,8 +72,67 @@ public class JXFPMX extends FunctionBase implements FreeRefFunction {
taxRateVal = taxRateVal.divide(new BigDecimal("100"), 2, BigDecimal.ROUND_HALF_UP);
}
String dbName = SpringContextUtil.projectDao.getDbNameWithYearAndOrgID(formulaContext.getOrganizationID(), curYear);
List<InputVATInvoiceResultDto> inputInvoice = SpringContextUtil.inputVATInvoiceMapper.getInputVATInvoiceResultDto(dbName);
if (!goodsName.equals("99")) {
inputInvoice = inputInvoice.stream()
.filter(a -> a.getGoodsMapping() != null && a.getGoodsMapping().getStdGoodsName().equals(goodsName))
.collect(Collectors.toList());
}
if (taxRateVal.compareTo(new BigDecimal("-1")) == 0) {
inputInvoice = inputInvoice.stream()
.filter(a -> Arrays.asList(FunctionBase.defaultTaxRates).contains(a.getInputVATInvoiceItem().getTaxRate()))
.collect(Collectors.toList());
} else if (taxRateVal.compareTo(new BigDecimal("99")) != 0) {
BigDecimal finalTaxRateVal = taxRateVal;
inputInvoice = inputInvoice.stream()
.filter(a -> a.getInputVATInvoiceItem().getTaxRate().equals(finalTaxRateVal))
.collect(Collectors.toList());
}
if (period != 99) {
int finalPeriod = period;
inputInvoice = inputInvoice.stream()
.filter(a -> a.getInputVATInvoice().getPeriodID() == finalPeriod)
.collect(Collectors.toList());
}
List<InputInvoiceDetailDataSourceDto> dataSouce = new ArrayList<>();
for (InputVATInvoiceResultDto x : inputInvoice) {
InputInvoiceDetailDataSourceDto inputInvoiceDetailDataSourceDto = new InputInvoiceDetailDataSourceDto();
inputInvoiceDetailDataSourceDto.setAmount(FormulaHelper.roundValue(x.getInputVATInvoiceItem().getAmount(), KeyValueConfigResultType.Accounting, null, formulaContext));
inputInvoiceDetailDataSourceDto.setResultType(KeyValueConfigResultType.Accounting.getCode());
inputInvoiceDetailDataSourceDto.setTaxAmount(FormulaHelper.roundValue(x.getInputVATInvoiceItem().getTaxAmount(), KeyValueConfigResultType.Accounting, null, formulaContext));
inputInvoiceDetailDataSourceDto.setTaxRate(x.getInputVATInvoiceItem().getTaxRate());
inputInvoiceDetailDataSourceDto.setInvoiceNumber(x.getInputVATInvoice().getInvoiceNumber());
inputInvoiceDetailDataSourceDto.setInvoiceDate(x.getInputVATInvoice().getInvoiceDate());
inputInvoiceDetailDataSourceDto.setInvoiceCode(x.getInputVATInvoice().getInvoiceCode());
inputInvoiceDetailDataSourceDto.setPeriod(x.getInputVATInvoice().getPeriodID());
inputInvoiceDetailDataSourceDto.setProductionName(x.getInputVATInvoiceItem().getProductionName());
inputInvoiceDetailDataSourceDto.setName(Constant.DataSourceName.InputDetailInvoiceDataSource);
inputInvoiceDetailDataSourceDto.setOperationType(EnumOperationType.Single.getCode());
dataSouce.add(inputInvoiceDetailDataSourceDto);
}
dataSouce = dataSouce.stream()
.sorted(Comparator.comparing(InputInvoiceDetailDataSourceDto::getInvoiceDate)
.thenComparing(InputInvoiceDetailDataSourceDto::getInvoiceCode)
.thenComparing(InputInvoiceDetailDataSourceDto::getInvoiceNumber))
.collect(Collectors.toList());
if (amountType == 0) {
double val = dataSouce.stream().mapToDouble(a -> a.getAmount().doubleValue()).sum();
Long dataSourceId = saveDataSource(ec, Collections.singletonList(dataSouce), FormulaDataSourceDetailType.InputInvoiceDetailDataSourceDto, new BigDecimal(val));
saveFormulaBlock(period, ec, formulaExpression, new BigDecimal(val), dataSourceId);
return new NumberEval(val);
} else if (amountType == 1) {
double val = dataSouce.stream().mapToDouble(a -> a.getTaxAmount().doubleValue()).sum();
Long dataSourceId = saveDataSource(ec, Collections.singletonList(dataSouce), FormulaDataSourceDetailType.InputInvoiceDetailDataSourceDto, new BigDecimal(val));
saveFormulaBlock(period, ec, formulaExpression, new BigDecimal(val), dataSourceId);
return new NumberEval(val);
}
return NumberEval.ZERO;
}
......
......@@ -91,7 +91,7 @@ public class XXFP extends FunctionBase implements FreeRefFunction {
outputInvoice = outputInvoice.stream().filter(a -> a.getInvoice().getPeriodID().equals(finalPeriod)).collect(Collectors.toList());
}
List<OutputInvoiceDataSourceDto> dataSource = new ArrayList();
List<OutputInvoiceDataSourceDto> dataSource = new ArrayList<>();
for (OutputVATInvoiceDto x : outputInvoice) {
OutputInvoiceDataSourceDto outputInvoiceDataSourceDto = new OutputInvoiceDataSourceDto();
outputInvoiceDataSourceDto.setAmount(FormulaHelper.roundValue(x.getInvoiceItem().getAmount(),
......
......@@ -6,22 +6,22 @@
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<id column="ID" jdbcType="VARCHAR" property="ID" />
<result column="PeriodID" jdbcType="INTEGER" property="periodID" />
<result column="InvoiceCode" jdbcType="VARCHAR" property="invoiceCode" />
<result column="InvoiceNumber" jdbcType="VARCHAR" property="invoiceNumber" />
<result column="InvoiceDate" jdbcType="TIMESTAMP" property="invoiceDate" />
<result column="SellerTaxNumber" jdbcType="VARCHAR" property="sellerTaxNumber" />
<result column="Amount" jdbcType="DECIMAL" property="amount" />
<result column="TaxAmount" jdbcType="DECIMAL" property="taxAmount" />
<result column="InvoiceType" jdbcType="INTEGER" property="invoiceType" />
<result column="CertificationResult" jdbcType="VARCHAR" property="certificationResult" />
<result column="CertificationDate" jdbcType="TIMESTAMP" property="certificationDate" />
<result column="CreatorID" jdbcType="VARCHAR" property="creatorID" />
<result column="CreateTime" jdbcType="TIMESTAMP" property="createTime" />
<result column="Status" jdbcType="INTEGER" property="status" />
<result column="PartAccntedPeriod" jdbcType="INTEGER" property="partAccntedPeriod" />
<result column="AccntedPeriod" jdbcType="INTEGER" property="accntedPeriod" />
<id column="ID" jdbcType="VARCHAR" property="ID"/>
<result column="PeriodID" jdbcType="INTEGER" property="periodID"/>
<result column="InvoiceCode" jdbcType="VARCHAR" property="invoiceCode"/>
<result column="InvoiceNumber" jdbcType="VARCHAR" property="invoiceNumber"/>
<result column="InvoiceDate" jdbcType="TIMESTAMP" property="invoiceDate"/>
<result column="SellerTaxNumber" jdbcType="VARCHAR" property="sellerTaxNumber"/>
<result column="Amount" jdbcType="DECIMAL" property="amount"/>
<result column="TaxAmount" jdbcType="DECIMAL" property="taxAmount"/>
<result column="InvoiceType" jdbcType="INTEGER" property="invoiceType"/>
<result column="CertificationResult" jdbcType="VARCHAR" property="certificationResult"/>
<result column="CertificationDate" jdbcType="TIMESTAMP" property="certificationDate"/>
<result column="CreatorID" jdbcType="VARCHAR" property="creatorID"/>
<result column="CreateTime" jdbcType="TIMESTAMP" property="createTime"/>
<result column="Status" jdbcType="INTEGER" property="status"/>
<result column="PartAccntedPeriod" jdbcType="INTEGER" property="partAccntedPeriod"/>
<result column="AccntedPeriod" jdbcType="INTEGER" property="accntedPeriod"/>
</resultMap>
<sql id="Example_Where_Clause">
<!--
......@@ -45,7 +45,8 @@
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
<foreach close=")" collection="criterion.value" item="listItem" open="("
separator=",">
#{listItem}
</foreach>
</when>
......@@ -78,7 +79,8 @@
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
<foreach close=")" collection="criterion.value" item="listItem" open="("
separator=",">
#{listItem}
</foreach>
</when>
......@@ -98,7 +100,8 @@
InvoiceType, CertificationResult, CertificationDate, CreatorID, CreateTime, `Status`,
PartAccntedPeriod, AccntedPeriod
</sql>
<select id="selectByExample" parameterType="pwc.taxtech.atms.vat.entity.InputVATInvoiceExample" resultMap="BaseResultMap">
<select id="selectByExample" parameterType="pwc.taxtech.atms.vat.entity.InputVATInvoiceExample"
resultMap="BaseResultMap">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
......@@ -107,10 +110,10 @@
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
<include refid="Base_Column_List"/>
from InputVATInvoice
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
<include refid="Example_Where_Clause"/>
</if>
<if test="orderByClause != null">
order by ${orderByClause}
......@@ -122,7 +125,7 @@
This element is automatically generated by MyBatis Generator, do not modify.
-->
select
<include refid="Base_Column_List" />
<include refid="Base_Column_List"/>
from InputVATInvoice
where ID = #{ID,jdbcType=VARCHAR}
</select>
......@@ -141,7 +144,7 @@
-->
delete from InputVATInvoice
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
<include refid="Example_Where_Clause"/>
</if>
</delete>
<insert id="insert" parameterType="pwc.taxtech.atms.vat.entity.InputVATInvoice">
......@@ -269,14 +272,15 @@
</if>
</trim>
</insert>
<select id="countByExample" parameterType="pwc.taxtech.atms.vat.entity.InputVATInvoiceExample" resultType="java.lang.Long">
<select id="countByExample" parameterType="pwc.taxtech.atms.vat.entity.InputVATInvoiceExample"
resultType="java.lang.Long">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
select count(*) from InputVATInvoice
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
<include refid="Example_Where_Clause"/>
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
......@@ -336,7 +340,7 @@
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
<include refid="Update_By_Example_Where_Clause"/>
</if>
</update>
<update id="updateByExample" parameterType="map">
......@@ -362,7 +366,7 @@
PartAccntedPeriod = #{record.partAccntedPeriod,jdbcType=INTEGER},
AccntedPeriod = #{record.accntedPeriod,jdbcType=INTEGER}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
<include refid="Update_By_Example_Where_Clause"/>
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="pwc.taxtech.atms.vat.entity.InputVATInvoice">
......@@ -443,7 +447,8 @@
AccntedPeriod = #{accntedPeriod,jdbcType=INTEGER}
where ID = #{ID,jdbcType=VARCHAR}
</update>
<select id="selectByExampleWithRowbounds" parameterType="pwc.taxtech.atms.vat.entity.InputVATInvoiceExample" resultMap="BaseResultMap">
<select id="selectByExampleWithRowbounds" parameterType="pwc.taxtech.atms.vat.entity.InputVATInvoiceExample"
resultMap="BaseResultMap">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
......@@ -452,16 +457,17 @@
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
<include refid="Base_Column_List"/>
from InputVATInvoice
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
<include refid="Example_Where_Clause"/>
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="getInputVATInvoiceCountByCondition" parameterType="pwc.taxtech.atms.dto.vatdto.InputInvoicePreviewQueryParam" resultType="java.lang.Long">
<select id="getInputVATInvoiceCountByCondition"
parameterType="pwc.taxtech.atms.dto.vatdto.InputInvoicePreviewQueryParam" resultType="java.lang.Long">
SELECT COUNT(1) FROM InputVATInvoice WHERE 1=1
<if test="paras.periodStart">
AND PeriodID&gt;=#{paras.periodStart,jdbcType=VARCHAR}
......@@ -555,4 +561,91 @@
LIMIT #{limitFrom,jdbcType=INTEGER},#{paras.pageInfo.pageSize,jdbcType=INTEGER}
</if>
</select>
<resultMap id="inputVATInvoiceResultDto" type="pwc.taxtech.atms.dto.vatdto.InputVATInvoiceResultDto">
<id property="invoiceID" column="invoice_id"/>
<association property="inputVATInvoice" javaType="pwc.taxtech.atms.vat.entity.InputVATInvoice">
<id column="ID" jdbcType="VARCHAR" property="ID"/>
<result column="PeriodID" jdbcType="INTEGER" property="periodID"/>
<result column="InvoiceCode" jdbcType="VARCHAR" property="invoiceCode"/>
<result column="InvoiceNumber" jdbcType="VARCHAR" property="invoiceNumber"/>
<result column="InvoiceDate" jdbcType="TIMESTAMP" property="invoiceDate"/>
<result column="SellerTaxNumber" jdbcType="VARCHAR" property="sellerTaxNumber"/>
<result column="Amount" jdbcType="DECIMAL" property="amount"/>
<result column="TaxAmount" jdbcType="DECIMAL" property="taxAmount"/>
<result column="InvoiceType" jdbcType="INTEGER" property="invoiceType"/>
<result column="CertificationResult" jdbcType="VARCHAR" property="certificationResult"/>
<result column="CertificationDate" jdbcType="TIMESTAMP" property="certificationDate"/>
<result column="CreatorID" jdbcType="VARCHAR" property="creatorID"/>
<result column="CreateTime" jdbcType="TIMESTAMP" property="createTime"/>
<result column="Status" jdbcType="INTEGER" property="status"/>
<result column="PartAccntedPeriod" jdbcType="INTEGER" property="partAccntedPeriod"/>
<result column="AccntedPeriod" jdbcType="INTEGER" property="accntedPeriod"/>
</association>
<association property="inputVATInvoiceItem" javaType="pwc.taxtech.atms.vat.entity.InputVATInvoiceItem">
<id column="ID" jdbcType="VARCHAR" property="ID"/>
<result column="InputVATInvoiceID" jdbcType="VARCHAR" property="inputVATInvoiceID"/>
<result column="PeriodID" jdbcType="INTEGER" property="periodID"/>
<result column="InvoiceCode" jdbcType="VARCHAR" property="invoiceCode"/>
<result column="InvoiceNumber" jdbcType="VARCHAR" property="invoiceNumber"/>
<result column="Amount" jdbcType="DECIMAL" property="amount"/>
<result column="TaxAmount" jdbcType="DECIMAL" property="taxAmount"/>
<result column="TaxRate" jdbcType="DECIMAL" property="taxRate"/>
<result column="ProductionName" jdbcType="VARCHAR" property="productionName"/>
<result column="CreatorID" jdbcType="VARCHAR" property="creatorID"/>
<result column="CreateTime" jdbcType="TIMESTAMP" property="createTime"/>
<result column="ProductionCode" jdbcType="VARCHAR" property="productionCode"/>
</association>
<association property="goodsMapping" javaType="pwc.taxtech.atms.vat.entity.GoodsMapping">
<id column="ID" jdbcType="VARCHAR" property="ID"/>
<result column="CustGoodsName" jdbcType="VARCHAR" property="custGoodsName"/>
<result column="StdGoodsName" jdbcType="VARCHAR" property="stdGoodsName"/>
<result column="CreatorID" jdbcType="VARCHAR" property="creatorID"/>
<result column="CreateTime" jdbcType="TIMESTAMP" property="createTime"/>
<result column="UpdateTime" jdbcType="TIMESTAMP" property="updateTime"/>
</association>
</resultMap>
<select id="getInputVATInvoiceResultDto" resultMap="inputVATInvoiceResultDto" parameterType="java.lang.String">
SELECT
inputVatInvoice.ID AS invoice_id,
inputVatInvoice.ID,
inputVatInvoice.PeriodID,
inputVatInvoice.InvoiceCode,
inputVatInvoice.InvoiceNumber,
inputVatInvoice.InvoiceDate,
inputVatInvoice.SellerTaxNumber,
inputVatInvoice.Amount,
inputVatInvoice.TaxAmount,
inputVatInvoice.InvoiceType,
inputVatInvoice.CertificationResult,
inputVatInvoice.CertificationDate,
inputVatInvoice.CreatorID,
inputVatInvoice.CreateTime,
inputVatInvoice.`STATUS`,
inputVatInvoice.PartAccntedPeriod,
inputVatInvoice.AccntedPeriod,
inputVatInvoiceItem.ID,
inputVatInvoiceItem.InputVATInvoiceID,
inputVatInvoiceItem.PeriodID,
inputVatInvoiceItem.InvoiceCode,
inputVatInvoiceItem.InvoiceNumber,
inputVatInvoiceItem.Amount,
inputVatInvoiceItem.TaxAmount,
inputVatInvoiceItem.TaxRate,
inputVatInvoiceItem.ProductionName,
inputVatInvoiceItem.CreatorID,
inputVatInvoiceItem.CreateTime,
inputVatInvoiceItem.ProductionCode,
goodsMapping.ID,
goodsMapping.CustGoodsName,
goodsMapping.StdGoodsName,
goodsMapping.CreatorID,
goodsMapping.CreateTime,
goodsMapping.UpdateTime
FROM ${dbName}.InputVATInvoice inputVatInvoice
JOIN ${dbName}.InputVATInvoiceItem inputVatInvoiceItem
ON inputVatInvoice.ID = inputVatInvoiceItem.InputVATInvoiceID
AND inputVatInvoice.PeriodID = inputVatInvoiceItem.PeriodID
LEFT JOIN ${dbName}.GoodsMapping goodsMapping
ON inputVatInvoiceItem.ProductionName = goodsMapping.CustGoodsName
</select>
</mapper>
\ No newline at end of file
......@@ -607,7 +607,7 @@
invoiceItem.PeriodID
FROM ${dbName}.OutputVATInvoice invoice
JOIN ${dbName}.OutputVATInvoiceItem invoiceItem
ON invoice.InvoiceID = invoiceItem.InvoiceID
ON invoice.InvoiceID = invoiceItem.InvoiceID AND invoice.PeriodID=invoiceItem.PeriodID
ORDER BY invoice.PeriodID,invoice.ClassCode,invoice.InvoiceNumber,invoiceItem.SeqNo
</select>
</mapper>
\ No newline at end of file
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