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
e6bd41d9
Commit
e6bd41d9
authored
Jul 19, 2018
by
frank.xa.zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed formula datasource issues ----> next step is fixed report datasource display issue
parent
9c4fd097
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
22 additions
and
13 deletions
+22
-13
DataSourceMapper.java
.../main/java/pwc/taxtech/atms/vat/dao/DataSourceMapper.java
+2
-0
ReportGeneratorImpl.java
...wc/taxtech/atms/vat/service/impl/ReportGeneratorImpl.java
+7
-6
ReportServiceImpl.java
.../pwc/taxtech/atms/vat/service/impl/ReportServiceImpl.java
+6
-3
GZSD.java
.../taxtech/atms/vat/service/impl/report/functions/GZSD.java
+2
-2
DataSourceMapper.xml
...n/resources/pwc/taxtech/atms/vat/dao/DataSourceMapper.xml
+5
-2
No files found.
atms-api/src/main/java/pwc/taxtech/atms/vat/dao/DataSourceMapper.java
View file @
e6bd41d9
...
@@ -124,6 +124,8 @@ public interface DataSourceMapper extends MyVatMapper {
...
@@ -124,6 +124,8 @@ public interface DataSourceMapper extends MyVatMapper {
void
clearDataSourceDetailWithPeriod
(
@Param
(
"period"
)
Integer
period
);
void
clearDataSourceDetailWithPeriod
(
@Param
(
"period"
)
Integer
period
);
void
clearCellDataSourceDataWithPeriod
(
@Param
(
"period"
)
Integer
period
);
void
clearCellDataWithPeriod
(
@Param
(
"exceptReportTemplateIDs"
)
String
exceptReportTemplateIDs
,
@Param
(
"period"
)
Integer
period
);
void
clearCellDataWithPeriod
(
@Param
(
"exceptReportTemplateIDs"
)
String
exceptReportTemplateIDs
,
@Param
(
"period"
)
Integer
period
);
void
clearReportWithPeriod
(
Integer
period
);
void
clearReportWithPeriod
(
Integer
period
);
...
...
atms-api/src/main/java/pwc/taxtech/atms/vat/service/impl/ReportGeneratorImpl.java
View file @
e6bd41d9
...
@@ -85,6 +85,7 @@ public class ReportGeneratorImpl extends VatAbstractService implements ReportGen
...
@@ -85,6 +85,7 @@ public class ReportGeneratorImpl extends VatAbstractService implements ReportGen
formulaContext
.
setProjectID
(
project
.
getID
());
formulaContext
.
setProjectID
(
project
.
getID
());
formulaContext
.
setYear
(
project
.
getYear
());
formulaContext
.
setYear
(
project
.
getYear
());
formulaContext
.
setOrganizationID
(
project
.
getOrganizationID
());
formulaContext
.
setOrganizationID
(
project
.
getOrganizationID
());
formulaContext
.
setIfRound
(
true
);
addFunctionsToWorkbook
(
newWorkbook
,
formulaContext
);
addFunctionsToWorkbook
(
newWorkbook
,
formulaContext
);
int
sheetCount
=
newWorkbook
.
getNumberOfSheets
();
int
sheetCount
=
newWorkbook
.
getNumberOfSheets
();
...
@@ -182,11 +183,11 @@ public class ReportGeneratorImpl extends VatAbstractService implements ReportGen
...
@@ -182,11 +183,11 @@ public class ReportGeneratorImpl extends VatAbstractService implements ReportGen
periodFormulaBlockMapper
.
updateReportId
(
reportID
,
cellTemplateConfigIds
,
period
);
periodFormulaBlockMapper
.
updateReportId
(
reportID
,
cellTemplateConfigIds
,
period
);
}
}
PeriodFormulaBlockExample
periodFormulaBlockExample2
=
new
PeriodFormulaBlockExample
();
periodFormulaBlockExample2
.
createCriteria
().
andCellTemplateIdEqualTo
(
templateID
);
List
<
PeriodFormulaBlock
>
periodFormulaBlocks
=
periodFormulaBlockMapper
.
selectByExample
(
periodFormulaBlockExample2
);
for
(
PeriodCellTemplateConfig
periodCellTemplateConfig
:
periodCellTemplateConfigs
)
{
for
(
PeriodCellTemplateConfig
periodCellTemplateConfig
:
periodCellTemplateConfigs
)
{
PeriodFormulaBlockExample
periodFormulaBlockExample2
=
new
PeriodFormulaBlockExample
();
periodFormulaBlockExample2
.
createCriteria
().
andCellTemplateIdEqualTo
(
periodCellTemplateConfig
.
getCellTemplateId
());
List
<
PeriodFormulaBlock
>
periodFormulaBlocks
=
periodFormulaBlockMapper
.
selectByExample
(
periodFormulaBlockExample2
);
//TODO:如果formula 为 ND(100) +ND(22) ,需要使用正则表达式拆分出自定义公式,然后根据自定义公式取formulablock 的数据进行替换
//TODO:如果formula 为 ND(100) +ND(22) ,需要使用正则表达式拆分出自定义公式,然后根据自定义公式取formulablock 的数据进行替换
String
regex
=
"[A-Z]*\\([A-Za-z0-9\\\"\\,\\.\\u4e00-\\u9fa5\\%]*\\)"
;
String
regex
=
"[A-Z]*\\([A-Za-z0-9\\\"\\,\\.\\u4e00-\\u9fa5\\%]*\\)"
;
Pattern
p
=
Pattern
.
compile
(
regex
);
Pattern
p
=
Pattern
.
compile
(
regex
);
...
@@ -381,9 +382,9 @@ public class ReportGeneratorImpl extends VatAbstractService implements ReportGen
...
@@ -381,9 +382,9 @@ public class ReportGeneratorImpl extends VatAbstractService implements ReportGen
* @param workbook 工作簿
* @param workbook 工作簿
*/
*/
private
void
addFunctionsToWorkbook
(
Workbook
workbook
,
FormulaContext
formulaContext
)
{
private
void
addFunctionsToWorkbook
(
Workbook
workbook
,
FormulaContext
formulaContext
)
{
String
[]
functionNames
=
{
"SGSR"
,
"FSJZ"
,
"ND"
,
"BB"
,
"XXFP"
};
String
[]
functionNames
=
{
"SGSR"
,
"FSJZ"
,
"ND"
,
"BB"
,
"XXFP"
,
"GZSD"
};
FreeRefFunction
[]
functionImpls
=
{
new
SGSR
(
formulaContext
),
new
FSJZ
(
formulaContext
),
new
ND
(
formulaContext
),
FreeRefFunction
[]
functionImpls
=
{
new
SGSR
(
formulaContext
),
new
FSJZ
(
formulaContext
),
new
ND
(
formulaContext
),
new
BB
(
formulaContext
),
new
XXFP
(
formulaContext
)};
new
BB
(
formulaContext
),
new
XXFP
(
formulaContext
)
,
new
GZSD
(
formulaContext
)
};
UDFFinder
udfs
=
new
DefaultUDFFinder
(
functionNames
,
functionImpls
);
UDFFinder
udfs
=
new
DefaultUDFFinder
(
functionNames
,
functionImpls
);
UDFFinder
udfToolpack
=
new
AggregatingUDFFinder
(
udfs
);
UDFFinder
udfToolpack
=
new
AggregatingUDFFinder
(
udfs
);
workbook
.
addToolPack
(
udfToolpack
);
workbook
.
addToolPack
(
udfToolpack
);
...
...
atms-api/src/main/java/pwc/taxtech/atms/vat/service/impl/ReportServiceImpl.java
View file @
e6bd41d9
...
@@ -108,13 +108,16 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi
...
@@ -108,13 +108,16 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi
if
(
templateGroupID
!=
null
&&
templateGroupID
!=
0
)
{
if
(
templateGroupID
!=
null
&&
templateGroupID
!=
0
)
{
// 先进行数据清理,包括period开头的所有报表配置表 条件Period
// 先进行数据清理,包括period开头的所有报表配置表 条件Period
dataSourceMapper
.
clearFormulaBlockWithPeriod
(
period
);
dataSourceMapper
.
clearFormulaBlockWithPeriod
(
period
);
dataSourceMapper
.
clearTaxRuleSettingWithPeriod
(
period
);
//todo: reopen it later
//dataSourceMapper.clearTaxRuleSettingWithPeriod(period);
dataSourceMapper
.
clearCellTemplateWithPeriod
(
period
,
strExceptTemplateIDs
);
dataSourceMapper
.
clearCellTemplateWithPeriod
(
period
,
strExceptTemplateIDs
);
dataSourceMapper
.
clearCellTemplateConfigWithPeriod
(
period
,
strExceptTemplateIDs
);
dataSourceMapper
.
clearCellTemplateConfigWithPeriod
(
period
,
strExceptTemplateIDs
);
dataSourceMapper
.
clearTemplateWithPeriod
(
period
,
strExceptTemplateIDs
);
dataSourceMapper
.
clearTemplateWithPeriod
(
period
,
strExceptTemplateIDs
);
dataSourceMapper
.
clearTaxPayerReportWithPeriod
(
period
);
//todo: reopen it later
dataSourceMapper
.
clearDataSourceWithPeriod
(
period
);
//dataSourceMapper.clearTaxPayerReportWithPeriod(period);
dataSourceMapper
.
clearCellDataSourceDataWithPeriod
(
period
);
dataSourceMapper
.
clearDataSourceDetailWithPeriod
(
period
);
dataSourceMapper
.
clearDataSourceDetailWithPeriod
(
period
);
dataSourceMapper
.
clearDataSourceWithPeriod
(
period
);
dataSourceMapper
.
clearCellDataWithPeriod
(
strExceptTemplateIDs
,
period
);
dataSourceMapper
.
clearCellDataWithPeriod
(
strExceptTemplateIDs
,
period
);
dataSourceMapper
.
clearReportWithPeriod
(
period
);
dataSourceMapper
.
clearReportWithPeriod
(
period
);
...
...
atms-api/src/main/java/pwc/taxtech/atms/vat/service/impl/report/functions/GZSD.java
View file @
e6bd41d9
...
@@ -71,7 +71,7 @@ public class GZSD extends FunctionBase implements FreeRefFunction {
...
@@ -71,7 +71,7 @@ public class GZSD extends FunctionBase implements FreeRefFunction {
Optional
<
PeriodTaxRuleSetting
>
matchedRule
=
taxRuleSettings
.
stream
().
filter
(
a
->
a
.
getIsDefault
()
!=
Constant
.
IsDefault
.
Yes
).
findFirst
();
Optional
<
PeriodTaxRuleSetting
>
matchedRule
=
taxRuleSettings
.
stream
().
filter
(
a
->
a
.
getIsDefault
()
!=
Constant
.
IsDefault
.
Yes
).
findFirst
();
if
(!
matchedRule
.
isPresent
())
{
if
(!
matchedRule
.
isPresent
())
{
matchedRule
=
Optional
.
ofNullable
(
taxRuleSettings
.
get
(
0
)
);
matchedRule
=
Optional
.
ofNullable
(
taxRuleSettings
.
size
()>
0
?
taxRuleSettings
.
get
(
0
):
null
);
if
(!
matchedRule
.
isPresent
())
{
if
(!
matchedRule
.
isPresent
())
{
return
NumberEval
.
ZERO
;
return
NumberEval
.
ZERO
;
...
@@ -94,7 +94,7 @@ public class GZSD extends FunctionBase implements FreeRefFunction {
...
@@ -94,7 +94,7 @@ public class GZSD extends FunctionBase implements FreeRefFunction {
formulaDataSourceDto
.
setName
(
nf
.
format
(
matchedRule
.
get
().
getTaxRate
()));
formulaDataSourceDto
.
setName
(
nf
.
format
(
matchedRule
.
get
().
getTaxRate
()));
dataSourceDtoList
.
add
(
formulaDataSourceDto
);
dataSourceDtoList
.
add
(
formulaDataSourceDto
);
Long
dataSourceId
=
saveDataSource
(
ec
,
Collections
.
singletonList
(
dataSourceDtoList
),
Long
dataSourceId
=
saveDataSource
(
ec
,
Collections
.
singletonList
(
dataSourceDtoList
),
FormulaDataSourceDetailType
.
FormulaDataSourceDto
,
val
,
formulaContext
.
getPeriod
(),
FormulaDataSourceDetailType
.
FormulaDataSourceDto
,
val
,
formulaContext
.
getPeriod
(),
formulaContext
.
getReportTemplateGroupID
());
formulaContext
.
getReportTemplateGroupID
());
saveFormulaBlock
(
formulaContext
.
getPeriod
(),
ec
,
formulaExpression
,
val
,
dataSourceId
);
saveFormulaBlock
(
formulaContext
.
getPeriod
(),
ec
,
formulaExpression
,
val
,
dataSourceId
);
return
new
NumberEval
(
val
.
doubleValue
());
return
new
NumberEval
(
val
.
doubleValue
());
...
...
atms-api/src/main/resources/pwc/taxtech/atms/vat/dao/DataSourceMapper.xml
View file @
e6bd41d9
...
@@ -504,10 +504,13 @@
...
@@ -504,10 +504,13 @@
DELETE FROM period_tax_payer_report_rule WHERE period=#{period,jdbcType=INTEGER};
DELETE FROM period_tax_payer_report_rule WHERE period=#{period,jdbcType=INTEGER};
</delete>
</delete>
<delete
id=
"clearDataSourceWithPeriod"
>
<delete
id=
"clearDataSourceWithPeriod"
>
DELETE d FROM data_source d
JOIN period_formula_block f ON d.id = f.data_source_id WHERE f
.period = #{period,jdbcType=INTEGER};
DELETE d FROM data_source d
WHERE d
.period = #{period,jdbcType=INTEGER};
</delete>
</delete>
<delete
id=
"clearDataSourceDetailWithPeriod"
>
<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.period = #{period,jdbcType=INTEGER};
DELETE d FROM data_source_detail d JOIN data_source f ON d.data_source_id = f.id WHERE f.period = #{period,jdbcType=INTEGER};
</delete>
<delete
id=
"clearCellDataSourceDataWithPeriod"
>
DELETE d FROM cell_data_source d JOIN data_source f ON d.data_source_id = f.id WHERE f.period = #{period,jdbcType=INTEGER};
</delete>
</delete>
<delete
id=
"clearCellDataWithPeriod"
>
<delete
id=
"clearCellDataWithPeriod"
>
DELETE c FROM cell_data c join report r on c.report_id=r.id where r.period = #{period,jdbcType=INTEGER};
DELETE c FROM cell_data c join report r on c.report_id=r.id where r.period = #{period,jdbcType=INTEGER};
...
...
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