Commit 3006acfe authored by chase's avatar chase

修改税金公式支持不传参数

parent 2caf2528
......@@ -2,6 +2,7 @@ package pwc.taxtech.atms.dto.vatdto;
import org.apache.poi.ss.formula.OperationEvaluationContext;
import org.apache.poi.ss.formula.eval.EvaluationException;
import org.apache.poi.ss.formula.eval.MissingArgEval;
import org.apache.poi.ss.formula.eval.ValueEval;
import java.math.BigDecimal;
......@@ -68,15 +69,27 @@ public class WPTYPEParasBo {
}
rowColumnIndex = rtn;
}
taxRate = new BigDecimal(resolverString(args, ec, 2));
split(expression);
concatPara(expression, String.valueOf(taxRate));
revenueType = resolverInteger(args, ec, 3);
split(expression);
concatPara(expression, revenueType);
taxType = resolverInteger(args, ec, 4);
split(expression);
concatPara(expression, taxType);
if(args[2] instanceof MissingArgEval){
split(expression);
}else{
taxRate = new BigDecimal(resolverString(args, ec, 2));
split(expression);
concatPara(expression, String.valueOf(taxRate));
}
if(args[3] instanceof MissingArgEval){
split(expression);
}else{
revenueType = resolverInteger(args, ec, 3);
split(expression);
concatPara(expression, revenueType);
}
if(args[4] instanceof MissingArgEval){
split(expression);
}else{
taxType = resolverInteger(args, ec, 4);
split(expression);
concatPara(expression, taxType);
}
try {
columnIndex = resolverInteger(args, ec, 5);
split(expression);
......
......@@ -131,52 +131,7 @@ public interface FormulaAdminMapper extends MyMapper {
@Param("period") Integer period);
@Select("select " +
" detail.*, " +
" source_cell.cell_template_id AS cellTemplateID," +
" source_cell.column_index AS columnIndex," +
" source_cell.column_name AS columnName," +
" source_cell.row_name AS rowName," +
" source_cell.data_type AS resultType " +
"from (" +
" select " +
" template.template_id AS reportTemplateID," +
" template.template_group_id AS reportTemplateGroupID," +
" template.code AS reportCode," +
" cell_template.row_index AS rowIndex " +
" from " +
" revenue_config revenue " +
" inner join " +
" period_cell_template as cell_template " +
" on " +
" revenue.name = cell_template.row_name " +
" and " +
" cell_template.column_index = #{rowColumnIndex}" +
" inner join " +
" period_template as template " +
" on template.template_id = cell_template.report_template_id" +
" where " +
" revenue.org_id = #{orgId}" +
" and revenue.tax_rate = #{taxRate}" +
" and revenue.revenue_type = #{revenueType}" +
" and revenue.tax_type = #{taxType}" +
" and revenue.start_date <= #{startDate}" +
" and revenue.end_date>= #{endDate}" +
" and template.template_group_id = #{templateGroupId}" +
" and template.is_active_association = 1" +
" and template.code = #{code}" +
" and template.project_id = #{projectId}" +
" and template.period = #{period}" +
" and cell_template.project_id = #{projectId}" +
" and cell_template.period = #{period}) as detail," +
" period_cell_template as source_cell" +
" where source_cell.project_id = #{projectId}" +
" and source_cell.period = #{period}" +
" and detail.reportTemplateID = source_cell.report_template_id" +
" and detail.rowIndex = source_cell.row_index" +
" and source_cell.column_index = #{columnIndex}"
)
List<CellTemplatePerGroupDto> getCellTemplateByTypeAndIndex(
List<CellTemplatePerGroupDto> getCellTemplateByTypeAndIndex(
@Param("templateGroupId") Long templateGroupId,
@Param("projectId") String projectId,
@Param("code") String code,
......
<?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.dao.FormulaAdminMapper">
<select id="getCellTemplateByTypeAndIndex" resultType="pwc.taxtech.atms.dpo.CellTemplatePerGroupDto">
select detail.*,
source_cell.cell_template_id AS cellTemplateID,
source_cell.column_index AS columnIndex,
source_cell.column_name AS columnName,
source_cell.row_name AS rowName,
source_cell.data_type AS resultType
from (
select template.template_id AS reportTemplateID,
template.template_group_id AS reportTemplateGroupID,
template.code AS reportCode,
cell_template.row_index AS rowIndex
from revenue_config revenue
inner join period_cell_template as cell_template
on revenue.name = cell_template.row_name and cell_template.column_index = #{rowColumnIndex}
inner join period_template as template on template.template_id = cell_template.report_template_id
where revenue.org_id = #{orgId}
<if test="taxRate != null">
and revenue.tax_rate = #{taxRate}
</if>
<if test="revenueType != null">
and revenue.revenue_type = #{revenueType}
</if>
<if test="taxType != null">
and revenue.tax_type = #{taxType}
</if>
<![CDATA[ and revenue.start_date <= #{startDate}]]>
<![CDATA[ and revenue.end_date >= #{endDate}]]>
and template.template_group_id = #{templateGroupId}
and template.is_active_association = 1
and template.code = #{code}
and template.project_id = #{projectId}
and template.period = #{period}
and cell_template.project_id = #{projectId}
and cell_template.period = #{period}) as detail,
period_cell_template as source_cell
where source_cell.project_id = #{projectId}
and source_cell.period = #{period}
and detail.reportTemplateID = source_cell.report_template_id
and detail.rowIndex = source_cell.row_index
and source_cell.column_index = #{columnIndex}
</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