Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
T
traffic-front
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wangxiaoming
traffic-front
Commits
cb092a3f
Commit
cb092a3f
authored
Jul 13, 2018
by
frank.xa.zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed issues for formula validate
parent
c1904df7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
53 additions
and
29 deletions
+53
-29
CellTemplateServiceImpl.java
...wc/taxtech/atms/service/impl/CellTemplateServiceImpl.java
+2
-1
FormulaHelper.java
...ain/java/pwc/taxtech/atms/service/impl/FormulaHelper.java
+3
-1
TemplateFormulaServiceImpl.java
...taxtech/atms/service/impl/TemplateFormulaServiceImpl.java
+16
-2
DataSourceMapper.java
.../main/java/pwc/taxtech/atms/vat/dao/DataSourceMapper.java
+4
-1
PeriodFormulaBlockMapper.java
...va/pwc/taxtech/atms/vat/dao/PeriodFormulaBlockMapper.java
+3
-0
ReportGeneratorImpl.java
...wc/taxtech/atms/vat/service/impl/ReportGeneratorImpl.java
+0
-0
ReportServiceImpl.java
.../pwc/taxtech/atms/vat/service/impl/ReportServiceImpl.java
+2
-1
FSJZ.java
.../taxtech/atms/vat/service/impl/report/functions/FSJZ.java
+1
-1
FormulaContext.java
...tms/vat/service/impl/report/functions/FormulaContext.java
+0
-2
DataSourceMapper.xml
...n/resources/pwc/taxtech/atms/vat/dao/DataSourceMapper.xml
+22
-20
PeriodFormulaBlockMapper.xml
...ces/pwc/taxtech/atms/vat/dao/PeriodFormulaBlockMapper.xml
+0
-0
No files found.
atms-api/src/main/java/pwc/taxtech/atms/service/impl/CellTemplateServiceImpl.java
View file @
cb092a3f
...
...
@@ -248,7 +248,8 @@ public class CellTemplateServiceImpl extends AbstractService implements CellTemp
List
<
FormulaConfig
>
dataSourceList
=
formulaConfigMapper
.
selectByExample
(
example
);
List
<
String
>
nameList
=
new
ArrayList
<>();
FormulaHelper
formulaHelper
=
new
FormulaHelper
();
String
tmpFormula
=
formulaHelper
.
formatFormula
(
formula
).
toUpperCase
();
// String tmpFormula = formulaHelper.formatFormula(formula).toUpperCase();
String
tmpFormula
=
formula
.
toUpperCase
();
for
(
FormulaConfig
dataSource
:
dataSourceList
)
{
if
(
tmpFormula
.
contains
(
dataSource
.
getFormulaName
().
toUpperCase
()
+
"("
)
&&
!
nameList
.
contains
(
dataSource
.
getDataSourceName
()))
{
...
...
atms-api/src/main/java/pwc/taxtech/atms/service/impl/FormulaHelper.java
View file @
cb092a3f
...
...
@@ -65,7 +65,9 @@ public final class FormulaHelper {
while
(!
regexMatchObjectStack
.
empty
())
{
RegexMatchObject
obj
=
regexMatchObjectStack
.
pop
();
formula
=
formula
.
substring
(
0
,
obj
.
getIndex
())
+
obj
.
getExpression
()
+
formula
.
substring
(
obj
.
getIndex
(),
obj
.
getLength
());
formula
=
formula
.
substring
(
0
,
obj
.
getIndex
())
+
obj
.
getExpression
()
+
formula
.
substring
(
obj
.
getIndex
(),
obj
.
getIndex
()
+
obj
.
getLength
());
}
return
formula
.
trim
();
}
...
...
atms-api/src/main/java/pwc/taxtech/atms/service/impl/TemplateFormulaServiceImpl.java
View file @
cb092a3f
package
pwc
.
taxtech
.
atms
.
service
.
impl
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.poi.ss.formula.FormulaParseException
;
import
org.apache.poi.ss.formula.FormulaParser
;
import
org.apache.poi.ss.formula.FormulaType
;
import
org.apache.poi.xssf.usermodel.XSSFEvaluationWorkbook
;
import
org.apache.poi.xssf.usermodel.XSSFWorkbook
;
import
org.springframework.stereotype.Service
;
import
pwc.taxtech.atms.dto.OperationResultDto
;
import
pwc.taxtech.atms.service.TemplateFormulaService
;
...
...
@@ -22,8 +27,17 @@ public class TemplateFormulaServiceImpl extends AbstractService implements Templ
}
try
{
String
tidyFormula
=
formulaHelper
.
formatFormula
(
formula
);
//String tidyFormula = formulaHelper.formatFormula(formula);
XSSFWorkbook
workbook
=
new
XSSFWorkbook
();
XSSFEvaluationWorkbook
xssfEvaluationWorkbook
=
XSSFEvaluationWorkbook
.
create
(
workbook
);
try
{
FormulaParser
.
parse
(
formula
,
xssfEvaluationWorkbook
,
FormulaType
.
CELL
,
0
);
result
.
setResult
(
true
);
return
result
;
}
catch
(
FormulaParseException
e
)
{
result
.
setResult
(
false
);
result
.
setResultMsg
(
e
.
getMessage
());
}
/*todo: find the replace solution for here to check formual is correct or not
//var sourceCode = m_engine.CreateScriptSourceFromString(tidyFormula, SourceCodeKind.AutoDetect);
//var compileCode = sourceCode.Compile();
...
...
atms-api/src/main/java/pwc/taxtech/atms/vat/dao/DataSourceMapper.java
View file @
cb092a3f
...
...
@@ -124,7 +124,9 @@ public interface DataSourceMapper extends MyVatMapper {
void
clearDataSourceDetailWithPeriod
(
@Param
(
"period"
)
Integer
period
);
void
clearCellDataWithPeriod
(
@Param
(
"exceptReportTemplateIDs"
)
String
exceptReportTemplateIDs
);
void
clearCellDataWithPeriod
(
@Param
(
"exceptReportTemplateIDs"
)
String
exceptReportTemplateIDs
,
@Param
(
"period"
)
Integer
period
);
void
clearReportWithPeriod
(
Integer
period
);
List
<
DataSourceExtendDto
>
getFormulaDataSource
(
Long
reportID
);
}
\ No newline at end of file
atms-api/src/main/java/pwc/taxtech/atms/vat/dao/PeriodFormulaBlockMapper.java
View file @
cb092a3f
...
...
@@ -105,4 +105,6 @@ public interface PeriodFormulaBlockMapper extends MyVatMapper {
* @mbg.generated
*/
int
updateByPrimaryKey
(
PeriodFormulaBlock
record
);
void
updateReportId
(
@Param
(
"reportId"
)
Long
reportId
,
@Param
(
"cellTemplateConfigIds"
)
List
<
Long
>
cellTemplateConfigIds
,
@Param
(
"period"
)
Integer
period
);
}
\ No newline at end of file
atms-api/src/main/java/pwc/taxtech/atms/vat/service/impl/ReportGeneratorImpl.java
View file @
cb092a3f
This diff is collapsed.
Click to expand it.
atms-api/src/main/java/pwc/taxtech/atms/vat/service/impl/ReportServiceImpl.java
View file @
cb092a3f
...
...
@@ -114,7 +114,8 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi
dataSourceMapper
.
clearTaxPayerReportWithPeriod
(
period
);
dataSourceMapper
.
clearDataSourceWithPeriod
(
period
);
dataSourceMapper
.
clearDataSourceDetailWithPeriod
(
period
);
dataSourceMapper
.
clearCellDataWithPeriod
(
strExceptTemplateIDs
);
dataSourceMapper
.
clearCellDataWithPeriod
(
strExceptTemplateIDs
,
period
);
dataSourceMapper
.
clearReportWithPeriod
(
period
);
// 根据templategroupid 把 template 插入到 periodTemplate
TemplateExample
example
=
new
TemplateExample
();
...
...
atms-api/src/main/java/pwc/taxtech/atms/vat/service/impl/report/functions/FSJZ.java
View file @
cb092a3f
...
...
@@ -267,7 +267,7 @@ public class FSJZ extends FunctionBase implements FreeRefFunction {
PeriodFormulaBlock
periodFormulaBlock
=
new
PeriodFormulaBlock
();
periodFormulaBlock
.
setId
(
SpringContextUtil
.
distributedIDService
.
nextId
());
periodFormulaBlock
.
setPeriod
(
period
);
periodFormulaBlock
.
setReportId
(
0L
);
periodFormulaBlock
.
setReportId
(
0L
);
//todo:update reportID when report data generated
periodFormulaBlock
.
setCellTemplateId
(
cellTemplateID
);
periodFormulaBlock
.
setFormulaExpression
(
formulaExpression
);
periodFormulaBlock
.
setData
(
val
.
toString
());
...
...
atms-api/src/main/java/pwc/taxtech/atms/vat/service/impl/report/functions/FormulaContext.java
View file @
cb092a3f
...
...
@@ -36,6 +36,4 @@ public class FormulaContext {
private
FormulaAgent
formulaAgent
;
//private Map<String, FormulaResult> replaceSpecialCellFormulaDic;
}
atms-api/src/main/resources/pwc/taxtech/atms/vat/dao/DataSourceMapper.xml
View file @
cb092a3f
...
...
@@ -93,7 +93,7 @@
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
id, `type`, `name`, amount, description, key_value_data_id, create_by, create_time,
id, `type`, `name`, amount, description, key_value_data_id, create_by, create_time,
update_by, update_time, row_name, `column_name`, row_index, remap_batch_id, column_index
</sql>
<select
id=
"selectByExample"
parameterType=
"pwc.taxtech.atms.vat.entity.DataSourceExample"
resultMap=
"BaseResultMap"
>
...
...
@@ -119,7 +119,7 @@
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
select
select
<include
refid=
"Base_Column_List"
/>
from data_source
where id = #{id,jdbcType=BIGINT}
...
...
@@ -147,16 +147,16 @@
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
insert into data_source (id, `type`, `name`,
amount, description, key_value_data_id,
create_by, create_time, update_by,
update_time, row_name, `column_name`,
insert into data_source (id, `type`, `name`,
amount, description, key_value_data_id,
create_by, create_time, update_by,
update_time, row_name, `column_name`,
row_index, remap_batch_id, column_index
)
values (#{id,jdbcType=BIGINT}, #{type,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR},
#{amount,jdbcType=DECIMAL}, #{description,jdbcType=VARCHAR}, #{keyValueDataId,jdbcType=VARCHAR},
#{createBy,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{updateBy,jdbcType=VARCHAR},
#{updateTime,jdbcType=TIMESTAMP}, #{rowName,jdbcType=VARCHAR}, #{columnName,jdbcType=VARCHAR},
values (#{id,jdbcType=BIGINT}, #{type,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR},
#{amount,jdbcType=DECIMAL}, #{description,jdbcType=VARCHAR}, #{keyValueDataId,jdbcType=VARCHAR},
#{createBy,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{updateBy,jdbcType=VARCHAR},
#{updateTime,jdbcType=TIMESTAMP}, #{rowName,jdbcType=VARCHAR}, #{columnName,jdbcType=VARCHAR},
#{rowIndex,jdbcType=INTEGER}, #{remapBatchId,jdbcType=VARCHAR}, #{columnIndex,jdbcType=INTEGER}
)
</insert>
...
...
@@ -454,35 +454,38 @@
<delete
id=
"clearCellTemplateWithPeriod"
>
DELETE FROM period_cell_template WHERE period=#{period,jdbcType=INTEGER}
<if
test=
"exceptReportTemplateIDs!=null and exceptReportTemplateIDs!=''"
>
and id not in (${exceptReportTemplateIDs});
and
report_template_
id not in (${exceptReportTemplateIDs});
</if>
</delete>
<delete
id=
"clearCellTemplateConfigWithPeriod"
>
DELETE FROM period_cell_template_config WHERE period=#{period,jdbcType=INTEGER}
<if
test=
"exceptReportTemplateIDs!=null and exceptReportTemplateIDs!=''"
>
and id not in (${exceptReportTemplateIDs});
and
report_template_
id not in (${exceptReportTemplateIDs});
</if>
</delete>
<delete
id=
"clearTemplateWithPeriod"
>
DELETE FROM period_template WHERE period=#{period,jdbcType=INTEGER}
<if
test=
"exceptReportTemplateIDs!=null and exceptReportTemplateIDs!=''"
>
and id not in (${exceptReportTemplateIDs});
and
template_
id not in (${exceptReportTemplateIDs});
</if>
</delete>
<delete
id=
"clearTaxPayerReportWithPeriod"
>
DELETE FROM period_tax_payer_report_rule WHERE period=#{period,jdbcType=INTEGER};
</delete>
<delete
id=
"clearDataSourceWithPeriod"
>
DELETE d FROM data_source d JOIN period_formula_block f ON d.id = f.data_source_id WHERE f.
P
eriod = #{period,jdbcType=INTEGER};
DELETE d FROM data_source d JOIN period_formula_block f ON d.id = f.data_source_id WHERE f.
p
eriod = #{period,jdbcType=INTEGER};
</delete>
<delete
id=
"clearDataSourceDetailWithPeriod"
>
DELETE d FROM data_source_detail d JOIN period_formula_block f ON d.data_source_id = f.data_source_id WHERE f.
P
eriod = #{period,jdbcType=INTEGER};
DELETE d FROM data_source_detail d JOIN period_formula_block f ON d.data_source_id = f.data_source_id WHERE f.
p
eriod = #{period,jdbcType=INTEGER};
</delete>
<delete
id=
"clearCellDataWithPeriod"
>
DELETE FROM cell_data
<if
test=
"exceptReportTemplateIDs!=null and exceptReportTemplateIDs!=''"
>
WHERE report_id not in (${exceptReportTemplateIDs});
</if>
DELETE c FROM cell_data c join report r on c.report_id=r.id where r.period = #{period,jdbcType=INTEGER};
<!--<if test="exceptReportTemplateIDs!=null and exceptReportTemplateIDs!=''">-->
<!--WHERE report_id not in (${exceptReportTemplateIDs});-->
<!--</if>-->
</delete>
<delete
id=
"clearReportWithPeriod"
>
DELETE FROM report WHERE period=#{period,jdbcType=INTEGER};
</delete>
<resultMap
id=
"DataSourceExtendDtoMap"
type=
"pwc.taxtech.atms.dto.vatdto.DataSourceExtendDto"
>
<id
column=
"id"
jdbcType=
"BIGINT"
property=
"id"
/>
...
...
@@ -504,7 +507,6 @@
<result
column=
"cell_template_id"
jdbcType=
"BIGINT"
property=
"cellTemplateID"
/>
<result
column=
"cell_data_id"
jdbcType=
"BIGINT"
property=
"cellDataID"
/>
</resultMap>
<select
id=
"getFormulaDataSource"
parameterType=
"java.lang.Long"
resultMap=
"DataSourceExtendDtoMap"
>
SELECT
ds.*,
...
...
atms-api/src/main/resources/pwc/taxtech/atms/vat/dao/PeriodFormulaBlockMapper.xml
View file @
cb092a3f
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment