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
40dce554
Commit
40dce554
authored
Aug 09, 2018
by
neo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[dev] bb determine target data source
parent
1bcd2fff
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
37 deletions
+14
-37
FormulaAgent.java
.../java/pwc/taxtech/atms/vat/service/impl/FormulaAgent.java
+1
-34
BB.java
...wc/taxtech/atms/vat/service/impl/report/functions/BB.java
+12
-2
CreateProjectDB.sql
...main/resources/RuntimeDbScripts/MYSQL/CreateProjectDB.sql
+1
-1
No files found.
atms-api/src/main/java/pwc/taxtech/atms/vat/service/impl/FormulaAgent.java
View file @
40dce554
...
...
@@ -78,50 +78,17 @@ public class FormulaAgent extends VatAbstractService {
return
null
;
}
public
void
save
(
List
<
ReportCellDataSourceDto
>
dataSourceDtos
)
{
dataSourceDtos
.
forEach
(
m
->
{
DataSource
ds
=
new
DataSource
();
ds
.
setAmount
(
m
.
getAmount
()
==
null
?
new
BigDecimal
(
0
)
:
m
.
getAmount
());
ds
.
setCreateBy
(
m
.
getCreator
()
==
null
?
"Admin"
:
m
.
getCreator
());
ds
.
setCreateTime
(
m
.
getCreateTime
()
==
null
?
new
Date
()
:
m
.
getCreateTime
());
ds
.
setDescription
(
m
.
getDescription
()
==
null
?
""
:
m
.
getDescription
());
ds
.
setKeyValueDataId
(
m
.
getKeyValueDataID
());
ds
.
setName
(
m
.
getName
());
ds
.
setType
(
m
.
type
);
ds
.
setUpdateBy
(
m
.
getUpdater
()
==
null
?
"Admin"
:
m
.
getUpdater
());
ds
.
setUpdateTime
(
m
.
getUpdateTime
()
==
null
?
new
Date
()
:
m
.
getUpdateTime
());
ds
.
setId
(
distributedIDService
.
nextId
());
ds
.
setKeyValueDataId
(
m
.
getDescription
()
==
null
?
""
:
m
.
getDescription
());
//TODO: tobe fixed
ds
.
setRowName
(
m
.
getRowName
()
==
null
?
""
:
m
.
getRowName
());
ds
.
setColumnName
(
m
.
getColumnName
()
==
null
?
""
:
m
.
getColumnName
());
ds
.
setRowIndex
(
m
.
getRowIndex
());
ds
.
setColumnIndex
(
m
.
getColumnIndex
());
ds
.
setRemapBatchId
(
"0"
);
//TODO: tobe fixed
ds
.
setCellTemplateId
(
Long
.
parseLong
(
m
.
getCellTemplateID
()));
ds
.
setPeriod
(
m
.
getPeriod
());
dataSourceMapper
.
insert
(
ds
);
});
}
public
String
getPastProjectDbName
(
int
year
,
String
orgId
)
{
return
adminMp
.
getPastProjectDbName
(
year
,
orgId
);
}
public
CellData
getCellData
(
String
dbName
,
String
templateId
,
String
cellId
,
int
periodId
)
{
String
currentProjectDb
=
ShardingContextHolder
.
getDataSourceKey
();
try
{
ShardingContextHolder
.
setDataSourceKey
(
dbName
);
public
CellData
getCellData
(
String
templateId
,
String
cellId
,
int
periodId
)
{
Report
report
=
getReportByTemplate
(
templateId
,
periodId
);
MyAsserts
.
assertNotNull
(
report
,
Exceptions
.
BB_REPORT_NULL
);
CellData
cellData
=
getCellDataListByTemplate
(
cellId
,
report
.
getId
());
MyAsserts
.
assertNotNull
(
cellData
,
Exceptions
.
BB_CELL_DATA_NULL
);
return
cellData
;
}
finally
{
ShardingContextHolder
.
setDataSourceKey
(
currentProjectDb
);
}
}
}
atms-api/src/main/java/pwc/taxtech/atms/vat/service/impl/report/functions/BB.java
View file @
40dce554
...
...
@@ -7,6 +7,7 @@ import org.apache.poi.ss.formula.eval.ValueEval;
import
org.apache.poi.ss.formula.functions.FreeRefFunction
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
pwc.taxtech.atms.common.datasource.ShardingContextHolder
;
import
pwc.taxtech.atms.common.util.MyAsserts
;
import
pwc.taxtech.atms.constant.enums.FormulaDataSourceDetailType
;
import
pwc.taxtech.atms.dto.vatdto.BBParasBo
;
...
...
@@ -77,8 +78,17 @@ public class BB extends FunctionBase implements FreeRefFunction {
bo
.
disCount
();
String
dbName
=
agent
.
getPastProjectDbName
(
curPeriod
.
getCurYear
(),
formulaContext
.
getOrganizationID
());
CellData
cellData
=
agent
.
getCellData
(
dbName
,
cellTemplateData
.
getReportTemplateID
(),
cellTemplateData
.
getCellTemplateID
(),
curPeriod
.
getCurPeriod
());
String
currentProjectDb
=
ShardingContextHolder
.
getDataSourceKey
();
CellData
cellData
=
null
;
try
{
ShardingContextHolder
.
setDataSourceKey
(
dbName
);
cellData
=
agent
.
getCellData
(
cellTemplateData
.
getReportTemplateID
(),
cellTemplateData
.
getCellTemplateID
(),
curPeriod
.
getCurPeriod
());
}
finally
{
ShardingContextHolder
.
setDataSourceKey
(
currentProjectDb
);
}
nullCellDto
=
ReportCellDataSourceDto
.
extractFromGroup
(
bo
,
curPeriod
,
cellData
,
cellTemplateData
);
ds
.
clear
();
ds
.
add
(
nullCellDto
);
...
...
atms-api/src/main/resources/RuntimeDbScripts/MYSQL/CreateProjectDB.sql
View file @
40dce554
...
...
@@ -958,7 +958,7 @@ CREATE TABLE IF NOT EXISTS `DBKeyword_ProjectDbName`.`data_source_detail` (
`id`
bigint
(
18
)
unsigned
NOT
NULL
,
`data_source_id`
bigint
(
18
)
unsigned
NOT
NULL
DEFAULT
'0'
,
`data_source_type`
int
(
11
)
unsigned
NOT
NULL
DEFAULT
'0'
,
`item_value`
varchar
(
128
)
NOT
NULL
DEFAULT
''
,
`item_value`
varchar
(
256
)
NOT
NULL
DEFAULT
''
,
PRIMARY
KEY
(
`id`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8mb4
;
...
...
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