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
310b7040
Commit
310b7040
authored
Aug 09, 2018
by
neo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[bugfix] add bb log info
parent
022e2975
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
56 additions
and
50 deletions
+56
-50
BB.java
...wc/taxtech/atms/vat/service/impl/report/functions/BB.java
+56
-50
No files found.
atms-api/src/main/java/pwc/taxtech/atms/vat/service/impl/report/functions/BB.java
View file @
310b7040
...
...
@@ -15,6 +15,7 @@ import pwc.taxtech.atms.dto.vatdto.CellTemplatePerGroupDto;
import
pwc.taxtech.atms.dto.vatdto.CurrentPeriodBo
;
import
pwc.taxtech.atms.dto.vatdto.ReportCellDataSourceDto
;
import
pwc.taxtech.atms.exception.Exceptions
;
import
pwc.taxtech.atms.exception.FormulaException
;
import
pwc.taxtech.atms.vat.entity.CellData
;
import
java.math.BigDecimal
;
...
...
@@ -35,8 +36,10 @@ public class BB extends FunctionBase implements FreeRefFunction {
try
{
return
wrapExceptionEval
(
args
,
ec
);
}
catch
(
Exception
e
)
{
LOGGER
.
warn
(
"un expect exception"
,
e
);
e
.
printStackTrace
();
if
(
e
instanceof
FormulaException
)
LOGGER
.
warn
(
"Formula Exception || "
,
e
);
else
e
.
printStackTrace
();
return
defaultEval
;
}
}
...
...
@@ -46,6 +49,7 @@ public class BB extends FunctionBase implements FreeRefFunction {
}
public
BigDecimal
bb
(
BBParasBo
bo
,
OperationEvaluationContext
ec
)
throws
Exception
{
List
<
Object
>
ds
=
new
ArrayList
<>();
CurrentPeriodBo
curPeriod
=
CurrentPeriodBo
.
getPeriod
(
bo
.
getPeriod
().
intValue
(),
formulaContext
.
getPeriod
());
curPeriod
.
fixedCurYear
(
getYear
(
bo
.
getYear
()));
...
...
@@ -56,64 +60,66 @@ public class BB extends FunctionBase implements FreeRefFunction {
CellTemplatePerGroupDto
cellTemplateData
=
agent
.
getCellTemplateGroupDto
(
formulaContext
.
getReportTemplateGroupID
(),
formulaContext
.
getProjectID
()).
stream
().
filter
(
dto
->
dto
.
getRowIndex
()
==
bo
.
getColumnIndex
()
-
1
&&
dto
.
getColumnIndex
()
==
bo
.
getColumnIndex
()
-
1
).
findFirst
().
get
();
MyAsserts
.
assertNotNull
(
cellTemplateData
,
Exceptions
.
BB_CELL_TEMP_NULL
);
nullCellDto
.
fixedWithGroup
(
cellTemplateData
);
// todo: fix datasource name by templateList(neo)
if
(
curPeriod
.
getCurPeriod
()
==
-
99
)
{
ds
.
clear
();
BigDecimal
returnEval
=
defaultBigDecimal
;
if
(
formulaContext
.
getPeriod
()
<=
1
)
{
return
defaultBigDecimal
;
}
for
(
int
p
=
1
;
p
<
formulaContext
.
getPeriod
();
p
++)
{
returnEval
=
returnEval
.
add
(
bb
(
new
BBParasBo
(
bo
,
p
,
curPeriod
.
getCurYear
()),
ec
));
BigDecimal
cellValue
=
BigDecimal
.
ZERO
;
try
{
MyAsserts
.
assertNotNull
(
cellTemplateData
,
Exceptions
.
BB_CELL_TEMP_NULL
);
nullCellDto
.
fixedWithGroup
(
cellTemplateData
);
// todo: fix datasource name by templateList(neo)
if
(
curPeriod
.
getCurPeriod
()
==
-
99
)
{
ds
.
clear
();
BigDecimal
returnEval
=
defaultBigDecimal
;
if
(
formulaContext
.
getPeriod
()
<=
1
)
{
return
defaultBigDecimal
;
}
for
(
int
p
=
1
;
p
<
formulaContext
.
getPeriod
();
p
++)
{
returnEval
=
returnEval
.
add
(
bb
(
new
BBParasBo
(
bo
,
p
,
curPeriod
.
getCurYear
()),
ec
));
}
return
returnEval
;
}
return
returnEval
;
}
bo
.
disCount
();
String
dbName
=
agent
.
getPastProjectDbName
(
curPeriod
.
getCurYear
(),
formulaContext
.
getOrganizationID
());
bo
.
disCount
();
String
dbName
=
agent
.
getPastProjectDbName
(
curPeriod
.
getCurYear
(),
formulaContext
.
getOrganizationID
());
String
currentProjectDb
=
ShardingContextHolder
.
getDataSourceKey
();
CellData
cellData
=
null
;
if
(
currentProjectDb
.
equals
(
dbName
))
{
cellData
=
agent
.
getCellData
(
cellTemplateData
.
getReportTemplateID
(),
cellTemplateData
.
getCellTemplateID
(),
curPeriod
.
getCurPeriod
());
}
else
{
try
{
ShardingContextHolder
.
setDataSourceKey
(
dbName
);
String
currentProjectDb
=
ShardingContextHolder
.
getDataSourceKey
();
CellData
cellData
=
null
;
if
(
currentProjectDb
.
equals
(
dbName
))
{
cellData
=
agent
.
getCellData
(
cellTemplateData
.
getReportTemplateID
(),
cellTemplateData
.
getCellTemplateID
(),
curPeriod
.
getCurPeriod
());
}
catch
(
Exception
e
)
{
LOGGER
.
warn
(
"get data exception with dbName{} currentDb {}"
,
dbName
,
currentProjectDb
,
e
);
throw
e
;
}
finally
{
ShardingContextHolder
.
setDataSourceKey
(
currentProjectDb
);
}
else
{
try
{
ShardingContextHolder
.
setDataSourceKey
(
dbName
);
cellData
=
agent
.
getCellData
(
cellTemplateData
.
getReportTemplateID
(),
cellTemplateData
.
getCellTemplateID
(),
curPeriod
.
getCurPeriod
());
}
catch
(
Exception
e
)
{
LOGGER
.
warn
(
"get data exception with dbName{} currentDb {}"
,
dbName
,
currentProjectDb
,
e
);
throw
e
;
}
finally
{
ShardingContextHolder
.
setDataSourceKey
(
currentProjectDb
);
}
}
}
nullCellDto
=
ReportCellDataSourceDto
.
extractFromGroup
(
bo
,
curPeriod
,
cellData
,
cellTemplateData
);
ds
.
clear
();
ds
.
add
(
nullCellDto
);
// todo: fix datasource name by templateList(neo)
nullCellDto
=
ReportCellDataSourceDto
.
extractFromGroup
(
bo
,
curPeriod
,
cellData
,
cellTemplateData
);
ds
.
clear
();
ds
.
add
(
nullCellDto
);
// todo: fix datasource name by templateList(neo)
MyAsserts
.
assertNotNull
(
cellData
.
getData
(),
Exceptions
.
BB_CELL_DATA_NULL
);
MyAsserts
.
assertNotNull
(
cellData
.
getData
(),
Exceptions
.
BB_CELL_DATA_NULL
);
// cellValue= RoundValue(cellValue, cellDataType)TODO:maybe fixd round by cellDataTyep(KV neo)
BigDecimal
cellValue
=
new
BigDecimal
(
cellData
.
getData
()).
setScale
(
4
,
BigDecimal
.
ROUND_HALF_DOWN
);
Long
dataSourceID
=
saveDataSource
(
ec
,
ds
,
FormulaDataSourceDetailType
.
ReportCellDataSourceDto
,
cellValue
,
curPeriod
.
getCurPeriod
(),
formulaContext
.
getReportTemplateGroupID
());
saveFormulaBlock
(
curPeriod
.
getCurPeriod
(),
ec
,
bo
.
expression
(
curPeriod
.
getCurPeriod
(),
curPeriod
.
getCurYear
()),
cellValue
,
dataSourceID
);
nullCellDto
.
setAmount
(
cellValue
);
LOGGER
.
debug
(
"cell static value "
);
return
cellValue
;
cellValue
=
new
BigDecimal
(
cellData
.
getData
()).
setScale
(
4
,
BigDecimal
.
ROUND_HALF_DOWN
);
nullCellDto
.
setAmount
(
cellValue
);
LOGGER
.
debug
(
"cell static value "
);
return
cellValue
;
}
finally
{
Long
dataSourceID
=
saveDataSource
(
ec
,
ds
,
FormulaDataSourceDetailType
.
ReportCellDataSourceDto
,
cellValue
,
curPeriod
.
getCurPeriod
(),
formulaContext
.
getReportTemplateGroupID
());
saveFormulaBlock
(
curPeriod
.
getCurPeriod
(),
ec
,
bo
.
expression
(
curPeriod
.
getCurPeriod
(),
curPeriod
.
getCurYear
()),
cellValue
,
dataSourceID
);
}
}
}
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