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
a9d15003
Commit
a9d15003
authored
Sep 03, 2018
by
neo
Browse files
Options
Browse Files
Download
Plain Diff
[merge] merge confilict
parents
5ee3f338
e3f2030c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
66 additions
and
10 deletions
+66
-10
ReportGeneratorImpl.java
...wc/taxtech/atms/vat/service/impl/ReportGeneratorImpl.java
+5
-2
ReportServiceImpl.java
.../pwc/taxtech/atms/vat/service/impl/ReportServiceImpl.java
+28
-7
GZSD.java
.../taxtech/atms/vat/service/impl/report/functions/GZSD.java
+33
-1
No files found.
atms-api/src/main/java/pwc/taxtech/atms/vat/service/impl/ReportGeneratorImpl.java
View file @
a9d15003
...
...
@@ -162,7 +162,7 @@ public class ReportGeneratorImpl extends VatAbstractService implements ReportGen
otherFormulaCells
.
add
(
cell
);
}
//kv 公式处理
}
else
if
(
v
.
getFormula
().
startsWith
(
"@"
))
{
}
else
if
(
v
.
getFormula
().
contains
(
"@"
))
{
if
(
StringUtils
.
isNotBlank
(
v
.
getKeyValueParsedFormula
()))
{
cell
.
setCellFormula
(
v
.
getKeyValueParsedFormula
());
logger
.
debug
(
"formula:"
+
v
.
getKeyValueParsedFormula
());
...
...
@@ -337,7 +337,6 @@ public class ReportGeneratorImpl extends VatAbstractService implements ReportGen
}
}
Optional
<
PeriodCellTemplate
>
tempPeriodCellTemplate
=
periodCellTemplateList
.
stream
()
.
filter
(
a
->
a
.
getCellTemplateId
().
equals
(
periodCellTemplateConfig
.
getCellTemplateId
()))
.
findFirst
();
...
...
@@ -354,6 +353,10 @@ public class ReportGeneratorImpl extends VatAbstractService implements ReportGen
Cell
cell
=
sheet
.
getRow
(
tempPeriodCellTemplate
.
get
().
getRowIndex
())
.
getCell
(
tempPeriodCellTemplate
.
get
().
getColumnIndex
());
data
=
((
XSSFCell
)
cell
).
getRawValue
();
if
(
data
!=
null
&&
data
.
equals
(
"#VALUE!"
))
{
data
=
"0.0"
;
}
//evaluator.evaluate(cell)
// if (cell.getCellTypeEnum().equals(CellType.NUMERIC)||cell.getCellTypeEnum().equals(CellType.FORMULA)) {
// data = Double.toString(cell.getNumericCellValue());
// } else {
...
...
atms-api/src/main/java/pwc/taxtech/atms/vat/service/impl/ReportServiceImpl.java
View file @
a9d15003
...
...
@@ -29,6 +29,8 @@ import java.util.HashMap;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Optional
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
import
java.util.stream.Collectors
;
@Component
...
...
@@ -255,14 +257,33 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi
periodCellTemplateConfig
.
setCellTemplateConfigId
(
cellTemplateConfig
.
getId
());
periodCellTemplateConfig
.
setKeyValueParsedFormula
(
StringUtils
.
EMPTY
);
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
());
if
(
cellTemplateConfig
.
getFormula
().
contains
(
"@"
))
{
String
regex
=
"@[0-9A-Z.]+"
;
Pattern
pp
=
Pattern
.
compile
(
regex
);
Matcher
mm
=
pp
.
matcher
(
cellTemplateConfig
.
getFormula
());
String
replace_result
=
cellTemplateConfig
.
getFormula
();
Boolean
replace
=
true
;
while
(
mm
.
find
())
{
KeyValueConfigExample
keyValueConfigExample
=
new
KeyValueConfigExample
();
keyValueConfigExample
.
createCriteria
().
andKeyCodeEqualTo
(
StringUtils
.
removeStart
(
mm
.
group
(),
"@"
));
Optional
<
KeyValueConfig
>
keyValueConfig
=
keyValueConfigMapper
.
selectByExample
(
keyValueConfigExample
).
stream
().
findFirst
();
if
(
keyValueConfig
.
isPresent
()
&&
StringUtils
.
isNotBlank
(
keyValueConfig
.
get
().
getFormula
()))
{
replace_result
=
replace_result
.
replace
(
mm
.
group
(),
keyValueConfig
.
get
().
getFormula
());
}
else
{
replace
=
false
;
}
}
if
(
replace
)
{
periodCellTemplateConfig
.
setKeyValueParsedFormula
(
replace_result
);
}
//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
);
//logger.debug("cellTemplateConfig copy end,used time: " + (System.currentTimeMillis() - startTime) + " ms");
...
...
atms-api/src/main/java/pwc/taxtech/atms/vat/service/impl/report/functions/GZSD.java
View file @
a9d15003
...
...
@@ -40,6 +40,8 @@ public class GZSD extends FunctionBase implements FreeRefFunction {
return
null
;
}
BigDecimal
decimal_zero
=
new
BigDecimal
(
"0.0"
);
Integer
taxCategory
=
getIntParam
(
args
[
0
],
ec
);
Integer
resultType
=
getIntParam
(
args
[
1
],
ec
);
String
formulaExpression
=
"GZSD("
+
taxCategory
+
","
+
resultType
+
")"
;
...
...
@@ -74,6 +76,20 @@ public class GZSD extends FunctionBase implements FreeRefFunction {
matchedRule
=
Optional
.
ofNullable
(
taxRuleSettings
.
size
()>
0
?
taxRuleSettings
.
get
(
0
):
null
);
if
(!
matchedRule
.
isPresent
())
{
NumberFormat
nf
=
NumberFormat
.
getPercentInstance
();
nf
.
setMaximumFractionDigits
(
2
);
List
<
FormulaDataSourceDto
>
dataSourceDtoList
=
new
ArrayList
<>();
FormulaDataSourceDto
formulaDataSourceDto
=
new
FormulaDataSourceDto
();
formulaDataSourceDto
.
setOperationType
(
EnumOperationType
.
Single
.
getCode
());
formulaDataSourceDto
.
setType
(
FormulaDataSourceType
.
Report
.
getCode
());
formulaDataSourceDto
.
setResultType
(
KeyValueConfigResultType
.
Percentage
.
getCode
());
formulaDataSourceDto
.
setAmount
(
decimal_zero
);
formulaDataSourceDto
.
setName
(
nf
.
format
(
decimal_zero
));
dataSourceDtoList
.
add
(
formulaDataSourceDto
);
Long
dataSourceId
=
saveDataSource
(
ec
,
Collections
.
singletonList
(
dataSourceDtoList
),
FormulaDataSourceDetailType
.
FormulaDataSourceDto
,
decimal_zero
,
formulaContext
.
getPeriod
(),
formulaContext
.
getReportTemplateGroupID
());
saveFormulaBlock
(
formulaContext
.
getPeriod
(),
ec
,
formulaExpression
,
decimal_zero
,
dataSourceId
);
return
NumberEval
.
ZERO
;
}
}
...
...
@@ -102,7 +118,23 @@ public class GZSD extends FunctionBase implements FreeRefFunction {
//todo: @本期应(实)纳税额 ,@GDZC.BQ.QMYE 这种类型的数据,重新计算,按照keyvalue的配置
//return new NumberEval(matchedRule.get().getTaxBase());
NumberFormat
nf
=
NumberFormat
.
getPercentInstance
();
nf
.
setMaximumFractionDigits
(
2
);
List
<
FormulaDataSourceDto
>
dataSourceDtoList
=
new
ArrayList
<>();
FormulaDataSourceDto
formulaDataSourceDto
=
new
FormulaDataSourceDto
();
formulaDataSourceDto
.
setOperationType
(
EnumOperationType
.
Single
.
getCode
());
formulaDataSourceDto
.
setType
(
FormulaDataSourceType
.
Report
.
getCode
());
formulaDataSourceDto
.
setResultType
(
KeyValueConfigResultType
.
Percentage
.
getCode
());
formulaDataSourceDto
.
setAmount
(
decimal_zero
);
formulaDataSourceDto
.
setName
(
nf
.
format
(
decimal_zero
));
dataSourceDtoList
.
add
(
formulaDataSourceDto
);
Long
dataSourceId
=
saveDataSource
(
ec
,
Collections
.
singletonList
(
dataSourceDtoList
),
FormulaDataSourceDetailType
.
FormulaDataSourceDto
,
decimal_zero
,
formulaContext
.
getPeriod
(),
formulaContext
.
getReportTemplateGroupID
());
saveFormulaBlock
(
formulaContext
.
getPeriod
(),
ec
,
formulaExpression
,
decimal_zero
,
dataSourceId
);
return
NumberEval
.
ZERO
;
}
return
NumberEval
.
ZERO
;
//
return NumberEval.ZERO;
}
}
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