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
e6495005
Commit
e6495005
authored
Jul 18, 2018
by
frank.xa.zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add key value formula to report for calculate
parent
3e33988f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
3 deletions
+17
-3
ReportGeneratorImpl.java
...wc/taxtech/atms/vat/service/impl/ReportGeneratorImpl.java
+5
-3
ReportServiceImpl.java
.../pwc/taxtech/atms/vat/service/impl/ReportServiceImpl.java
+10
-0
VatAbstractService.java
...pwc/taxtech/atms/vat/service/impl/VatAbstractService.java
+2
-0
No files found.
atms-api/src/main/java/pwc/taxtech/atms/vat/service/impl/ReportGeneratorImpl.java
View file @
e6495005
...
...
@@ -135,6 +135,9 @@ public class ReportGeneratorImpl extends VatAbstractService implements ReportGen
//todo:后面单独处理kv的公式
if
(
StringUtils
.
isNotBlank
(
v
.
getFormula
())
&&
!
v
.
getFormula
().
contains
(
"@"
))
{
cell
.
setCellFormula
(
v
.
getFormula
());
//kv 公式处理
}
else
if
(
v
.
getFormula
().
startsWith
(
"@"
))
{
cell
.
setCellFormula
(
v
.
getKeyValueParsedFormula
());
}
});
}
...
...
@@ -203,7 +206,6 @@ public class ReportGeneratorImpl extends VatAbstractService implements ReportGen
periodFormulaBlockExample
.
createCriteria
().
andPeriodEqualTo
(
period
)
.
andCellTemplateIdEqualTo
(
tempPeriodCellTemplate
.
get
().
getCellTemplateId
());
//todo: 这里可能一个单元格不止一个公式,需要根据公式的内容来进行替换具体的解析公式
Optional
<
PeriodFormulaBlock
>
periodFormulaBlock
=
periodFormulaBlockMapper
.
selectByExample
(
periodFormulaBlockExample
).
stream
().
findFirst
();
...
...
@@ -277,9 +279,9 @@ public class ReportGeneratorImpl extends VatAbstractService implements ReportGen
* @param workbook 工作簿
*/
private
void
addFunctionsToWorkbook
(
Workbook
workbook
,
FormulaContext
formulaContext
)
{
String
[]
functionNames
=
{
"SGSR"
,
"FSJZ"
,
"ND"
,
"BB"
,
"XXFP"
};
String
[]
functionNames
=
{
"SGSR"
,
"FSJZ"
,
"ND"
,
"BB"
,
"XXFP"
};
FreeRefFunction
[]
functionImpls
=
{
new
SGSR
(
formulaContext
),
new
FSJZ
(
formulaContext
),
new
ND
(
formulaContext
),
new
BB
(
formulaContext
),
new
XXFP
(
formulaContext
)};
new
BB
(
formulaContext
),
new
XXFP
(
formulaContext
)};
UDFFinder
udfs
=
new
DefaultUDFFinder
(
functionNames
,
functionImpls
);
UDFFinder
udfToolpack
=
new
AggregatingUDFFinder
(
udfs
);
workbook
.
addToolPack
(
udfToolpack
);
...
...
atms-api/src/main/java/pwc/taxtech/atms/vat/service/impl/ReportServiceImpl.java
View file @
e6495005
...
...
@@ -4,6 +4,7 @@ import org.apache.commons.lang3.StringUtils;
import
org.springframework.stereotype.Service
;
import
pwc.taxtech.atms.common.datasource.ShardingContextHolder
;
import
pwc.taxtech.atms.constant.enums.EnumServiceType
;
import
pwc.taxtech.atms.dao.KeyValueConfigMapper
;
import
pwc.taxtech.atms.dto.OperationResultDto
;
import
pwc.taxtech.atms.dto.vatdto.*
;
import
pwc.taxtech.atms.entitiy.*
;
...
...
@@ -200,6 +201,15 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi
periodCellTemplateConfig
.
setValidationDescription
(
cellTemplateConfig
.
getValidationDescription
());
periodCellTemplateConfig
.
setVoucherKeyword
(
cellTemplateConfig
.
getVoucherKeyword
());
periodCellTemplateConfig
.
setCellTemplateConfigId
(
cellTemplateConfig
.
getId
());
if
(
cellTemplateConfig
.
getFormula
().
startsWith
(
"@"
))
{
//todo: get the keyvalue from table add to keyvalue parsed formula
KeyValueConfigExample
keyValueConfigExample
=
new
KeyValueConfigExample
();
keyValueConfigExample
.
createCriteria
().
andKeyCodeEqualTo
(
StringUtils
.
removeStart
(
cellTemplateConfig
.
getFormula
(),
"@"
));
Optional
<
KeyValueConfig
>
keyValueConfig
=
keyValueConfigMapper
.
selectByExample
(
keyValueConfigExample
).
stream
().
findFirst
();
if
(
keyValueConfig
.
isPresent
())
{
periodCellTemplateConfig
.
setKeyValueParsedFormula
(
keyValueConfig
.
get
().
getFormula
());
}
}
periodCellTemplateConfigList
.
add
(
periodCellTemplateConfig
);
}
...
...
atms-api/src/main/java/pwc/taxtech/atms/vat/service/impl/VatAbstractService.java
View file @
e6495005
...
...
@@ -80,5 +80,7 @@ public class VatAbstractService {
public
FormulaAgent
formulaAgent
;
@Autowired
public
CellCommentMapper
cellCommentMapper
;
@Autowired
public
KeyValueConfigMapper
keyValueConfigMapper
;
}
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