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
a3ce0a4e
Commit
a3ce0a4e
authored
Jul 06, 2018
by
frank.xa.zhang
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/dev' into dev
parents
66cfa607
c53634a9
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
15 deletions
+26
-15
BBParasBo.java
.../src/main/java/pwc/taxtech/atms/dto/vatdto/BBParasBo.java
+7
-0
Exceptions.java
.../src/main/java/pwc/taxtech/atms/exception/Exceptions.java
+1
-0
ReportFormulaFactory.java
...c/taxtech/atms/vat/service/impl/ReportFormulaFactory.java
+18
-15
No files found.
atms-api/src/main/java/pwc/taxtech/atms/dto/vatdto/BBParasBo.java
View file @
a3ce0a4e
...
...
@@ -29,4 +29,11 @@ public class BBParasBo {
columnIndex
--;
}
public
BBParasBo
(
BBParasBo
otherBo
,
int
period
,
int
curYear
)
{
this
.
reportCode
=
otherBo
.
reportCode
;
this
.
columnIndex
=
otherBo
.
getColumnIndex
();
this
.
rowIndex
=
otherBo
.
rowIndex
;
this
.
period
=
period
;
this
.
year
=
curYear
;
}
}
atms-api/src/main/java/pwc/taxtech/atms/exception/Exceptions.java
View file @
a3ce0a4e
...
...
@@ -4,4 +4,5 @@ public class Exceptions {
public
static
final
FormulaException
BB_CELL_TEMP_NULL
=
new
FormulaException
(
"cell template data is null"
);
public
static
final
FormulaException
BB_REPORT_NULL
=
new
FormulaException
(
"cell report is null"
);
public
static
final
FormulaException
BB_CELL_DATA_NULL
=
new
FormulaException
(
"cell data is null"
);
public
static
final
FormulaException
BB_CELL_DATA_EMPTY
=
new
FormulaException
(
"cell data is empty"
);
}
atms-api/src/main/java/pwc/taxtech/atms/vat/service/impl/ReportFormulaFactory.java
View file @
a3ce0a4e
package
pwc
.
taxtech
.
atms
.
vat
.
service
.
impl
;
import
com.github.pagehelper.util.StringUtil
;
import
org.apache.poi.ss.formula.OperationEvaluationContext
;
import
org.apache.poi.ss.formula.eval.NumberEval
;
import
org.apache.poi.ss.formula.eval.StringEval
;
...
...
@@ -26,6 +25,7 @@ import java.math.BigDecimal;
public
class
ReportFormulaFactory
{
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
ReportFormulaFactory
.
class
);
final
static
ValueEval
defaultEval
=
new
StringEval
(
"0"
);
final
static
BigDecimal
defaultBigDecimal
=
new
BigDecimal
(
"0"
);
public
static
abstract
class
ReportBaseFormula
implements
FreeRefFunction
{
final
FormulaContext
context
;
...
...
@@ -68,8 +68,11 @@ public class ReportFormulaFactory {
@Override
public
ValueEval
wrapExceptionEval
(
ValueEval
[]
args
,
OperationEvaluationContext
ec
)
throws
Exception
{
return
new
NumberEval
(
bb
(
new
BBParasBo
(
args
,
ec
)).
doubleValue
());
}
public
BigDecimal
bb
(
BBParasBo
bo
)
throws
Exception
{
try
(
CloseableFormulaDataSource
closeDataSource
=
new
CloseableFormulaDataSource
(
context
.
getFormulaAgent
()))
{
BBParasBo
bo
=
new
BBParasBo
(
args
,
ec
);
CurrentPeriodBo
curPeriod
=
CurrentPeriodBo
.
getPeriod
(
bo
.
getPeriod
().
intValue
(),
context
.
getPeriod
());
curPeriod
.
fixedCurYear
(
getYear
(
curPeriod
.
getCurYear
()));
...
...
@@ -88,13 +91,13 @@ public class ReportFormulaFactory {
// todo: fix datasource name by templateList(neo)
if
(
curPeriod
.
getCurPeriod
()
==
-
99
)
{
closeDataSource
.
clean
();
ValueEval
returnEval
=
nul
l
;
BigDecimal
returnEval
=
defaultBigDecima
l
;
if
(
context
.
getPeriod
()
<=
1
)
{
return
default
Ev
al
;
return
default
BigDecim
al
;
}
for
(
int
p
=
1
;
p
<
context
.
getPeriod
();
p
++)
{
// returnEval=And(returnEval,BB)//TODO: to impl add vormular
returnEval
=
returnEval
.
add
(
bb
(
new
BBParasBo
(
bo
,
p
,
curPeriod
.
getCurYear
())));
}
return
returnEval
;
...
...
@@ -114,25 +117,25 @@ public class ReportFormulaFactory {
nullCellDto
=
ReportCellDataSourceDto
.
extractFromGroup
(
bo
,
curPeriod
,
cellData
,
cellTemplateData
);
// todo: fix datasource name by templateList(neo)
if
(!
StringUtil
.
isEmpty
(
cellData
.
getData
()))
{
// cellValue= RoundValue(cellValue, cellDataType)TODO:maybe fixd round by cellDataTyep(KV neo)
BigDecimal
cellValue
=
new
BigDecimal
(
cellData
.
getData
()).
setScale
(
4
,
BigDecimal
.
ROUND_HALF_DOWN
);
MyAsserts
.
assertNotNull
(
cellData
.
getData
(),
Exceptions
.
BB_CELL_DATA_NULL
);
nullCellDto
.
setAmount
(
cellValue
);
LOGGER
.
debug
(
"cell static value "
);
ShardingContextHolder
.
setDataSourceKey
(
currentProjectDb
);
return
new
NumberEval
(
cellValue
.
doubleValue
());
}
// cellValue= RoundValue(cellValue, cellDataType)TODO:maybe fixd round by cellDataTyep(KV neo)
BigDecimal
cellValue
=
new
BigDecimal
(
cellData
.
getData
()).
setScale
(
4
,
BigDecimal
.
ROUND_HALF_DOWN
);
nullCellDto
.
setAmount
(
cellValue
);
LOGGER
.
debug
(
"cell static value "
);
ShardingContextHolder
.
setDataSourceKey
(
currentProjectDb
);
return
cellValue
;
}
catch
(
Exception
e
)
{
LOGGER
.
warn
(
"un support exception"
,
e
);
ShardingContextHolder
.
setDataSourceKey
(
currentProjectDb
);
throw
e
;
}
}
return
defaultEval
;
}
}
}
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