Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
tron-explore
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张建华@五瓣科技
tron-explore
Commits
1ec79e6e
Commit
1ec79e6e
authored
Nov 18, 2020
by
jianhua.zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增交易统计数据接口
parent
90225ca1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
70 additions
and
2 deletions
+70
-2
TransactionControllerV1.java
...n/tron/explore/controller/v1/TransactionControllerV1.java
+32
-1
Engine.java
src/main/java/com/wuban/tron/explore/fetch/Engine.java
+1
-1
ChartModel.java
...ava/com/wuban/tron/explore/param/response/ChartModel.java
+37
-0
No files found.
src/main/java/com/wuban/tron/explore/controller/v1/TransactionControllerV1.java
View file @
1ec79e6e
...
...
@@ -331,6 +331,7 @@ public class TransactionControllerV1 {
model
.
setBlockHash
(
trans
.
getBlockId
());
model
.
setBlockNumber
(
trans
.
getNumber
().
intValue
());
model
.
setFrom
(
trans
.
getOwnerAddress
());
model
.
setInput
(
trans
.
getData
());
if
(!
StringUtils
.
isEmpty
(
trans
.
getContractAddress
()))
{
model
.
setTo
(
trans
.
getContractAddress
());
}
else
{
...
...
@@ -438,7 +439,7 @@ public class TransactionControllerV1 {
}
/**
*
首页图表
*
获取最新块高度
*
* @return
*/
...
...
@@ -448,6 +449,36 @@ public class TransactionControllerV1 {
return
ResponseKit
.
success
(
lastBlock
.
getLastBlockNum
());
}
/**
* 图表
*
* @return
*/
@RequestMapping
(
value
=
"indexGetChartDetailInfo"
,
method
=
RequestMethod
.
GET
)
public
ApiResponse
indexGetChartDetailInfo
()
{
List
<
BlockDayCensus
>
list
=
this
.
blockDayCensusService
.
getByExample
(
new
BlockDayCensusExample
());
List
<
ChartModel
>
modelList
=
new
ArrayList
<>();
if
(!
CollectionUtils
.
isEmpty
(
list
))
{
ChartModel
model
;
int
id
=
1
;
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++)
{
model
=
ChartModel
.
getInstance
();
model
.
setId
(
id
);
long
time
=
DateUtil
.
getDateFromDateStr
(
list
.
get
(
i
).
getCensusDate
(),
DateUtil
.
PATTERN_YMD
);
model
.
setTime
(
time
/
1000
);
model
.
setValue
(
list
.
get
(
i
).
getTotalVolume
());
model
.
setAvg_block_time
(
list
.
get
(
i
).
getGenBlockAverTime
());
model
.
setAvg_block_size
(
list
.
get
(
i
).
getTotalBlockBytes
());
model
.
setTotal_block_count
(
list
.
get
(
i
).
getGenBlockTotalNum
());
modelList
.
add
(
model
);
id
++;
}
}
return
ResponseKit
.
success
(
modelList
);
}
public
final
static
boolean
isNumeric
(
String
s
)
{
if
(
s
!=
null
&&
!
""
.
equals
(
s
.
trim
()))
{
return
s
.
matches
(
"^[0-9]*$"
);
...
...
src/main/java/com/wuban/tron/explore/fetch/Engine.java
View file @
1ec79e6e
...
...
@@ -45,7 +45,7 @@ public class Engine {
*/
private
AddressBalanceHandler
addressHandler
;
public
static
final
int
FETCHER_NUM
=
5
;
public
static
final
int
FETCHER_NUM
=
10
;
public
Engine
(
String
name
)
{
this
.
executor
=
new
Executor
(
name
);
...
...
src/main/java/com/wuban/tron/explore/param/response/ChartModel.java
0 → 100644
View file @
1ec79e6e
package
com
.
wuban
.
tron
.
explore
.
param
.
response
;
import
lombok.Builder
;
import
lombok.Data
;
@Data
@Builder
public
class
ChartModel
{
private
int
id
;
private
long
time
;
private
int
value
;
private
long
avg_difficulty
;
private
int
est_hash_rate
;
private
long
avg_block_time
;
private
int
avg_block_size
;
private
int
total_block_count
;
private
int
total_uncles_count
;
private
int
new_address_seen
;
public
static
ChartModel
getInstance
()
{
return
ChartModel
.
builder
()
.
id
(
0
)
.
time
(
0
)
.
value
(
0
)
.
avg_difficulty
(
0L
)
.
est_hash_rate
(
0
)
.
avg_block_time
(
0
)
.
avg_block_size
(
0
)
.
total_block_count
(
0
)
.
total_uncles_count
(
0
)
.
new_address_seen
(
0
)
.
build
();
}
}
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