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
4824a339
Commit
4824a339
authored
Nov 17, 2020
by
jianhua.zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增接口获取区块最新高度
parent
9732a72c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
11 deletions
+18
-11
TransactionControllerV1.java
...n/tron/explore/controller/v1/TransactionControllerV1.java
+18
-11
No files found.
src/main/java/com/wuban/tron/explore/controller/v1/TransactionControllerV1.java
View file @
4824a339
...
@@ -3,19 +3,13 @@ package com.wuban.tron.explore.controller.v1;
...
@@ -3,19 +3,13 @@ package com.wuban.tron.explore.controller.v1;
import
com.github.pagehelper.PageInfo
;
import
com.github.pagehelper.PageInfo
;
import
com.wuban.tron.explore.constant.Constant
;
import
com.wuban.tron.explore.constant.Constant
;
import
com.wuban.tron.explore.constant.HomeSearchTypeEnum
;
import
com.wuban.tron.explore.constant.HomeSearchTypeEnum
;
import
com.wuban.tron.explore.entity.Address
;
import
com.wuban.tron.explore.entity.*
;
import
com.wuban.tron.explore.entity.BlockDayCensus
;
import
com.wuban.tron.explore.entity.BlockHeader
;
import
com.wuban.tron.explore.entity.Transaction
;
import
com.wuban.tron.explore.entity.example.AddressExample
;
import
com.wuban.tron.explore.entity.example.AddressExample
;
import
com.wuban.tron.explore.entity.example.BlockDayCensusExample
;
import
com.wuban.tron.explore.entity.example.BlockDayCensusExample
;
import
com.wuban.tron.explore.entity.example.BlockHeaderExample
;
import
com.wuban.tron.explore.entity.example.BlockHeaderExample
;
import
com.wuban.tron.explore.entity.example.TransactionExample
;
import
com.wuban.tron.explore.entity.example.TransactionExample
;
import
com.wuban.tron.explore.param.response.*
;
import
com.wuban.tron.explore.param.response.*
;
import
com.wuban.tron.explore.service.AddressService
;
import
com.wuban.tron.explore.service.*
;
import
com.wuban.tron.explore.service.BlockDayCensusService
;
import
com.wuban.tron.explore.service.BlockHeaderService
;
import
com.wuban.tron.explore.service.TransactionService
;
import
com.wuban.tron.explore.util.ApiResponse
;
import
com.wuban.tron.explore.util.ApiResponse
;
import
com.wuban.tron.explore.util.DateUtil
;
import
com.wuban.tron.explore.util.DateUtil
;
import
com.wuban.tron.explore.util.ResponseKit
;
import
com.wuban.tron.explore.util.ResponseKit
;
...
@@ -52,6 +46,8 @@ public class TransactionControllerV1 {
...
@@ -52,6 +46,8 @@ public class TransactionControllerV1 {
private
final
AddressService
addressService
;
private
final
AddressService
addressService
;
private
final
LastBlockService
lastBlockService
;
/**
/**
* 首页 - 搜索
* 首页 - 搜索
*
*
...
@@ -118,7 +114,7 @@ public class TransactionControllerV1 {
...
@@ -118,7 +114,7 @@ public class TransactionControllerV1 {
List
<
Transaction
>
txList
=
this
.
transactionService
.
getByExample
(
example
);
List
<
Transaction
>
txList
=
this
.
transactionService
.
getByExample
(
example
);
if
(!
CollectionUtils
.
isEmpty
(
txList
))
{
if
(!
CollectionUtils
.
isEmpty
(
txList
))
{
Transaction
trans
=
txList
.
get
(
0
);
Transaction
trans
=
txList
.
get
(
0
);
model
.
setHash
(
condition
);
model
.
setHash
(
trans
.
getTxId
()
);
model
.
setBlockHash
(
trans
.
getBlockId
());
model
.
setBlockHash
(
trans
.
getBlockId
());
model
.
setBlockNumber
(
trans
.
getNumber
().
intValue
());
model
.
setBlockNumber
(
trans
.
getNumber
().
intValue
());
model
.
setFrom
(
trans
.
getOwnerAddress
());
model
.
setFrom
(
trans
.
getOwnerAddress
());
...
@@ -228,7 +224,7 @@ public class TransactionControllerV1 {
...
@@ -228,7 +224,7 @@ public class TransactionControllerV1 {
if
(!
CollectionUtils
.
isEmpty
(
pageInfo
.
getList
()))
{
if
(!
CollectionUtils
.
isEmpty
(
pageInfo
.
getList
()))
{
pageInfo
.
getList
().
forEach
(
o
->
{
pageInfo
.
getList
().
forEach
(
o
->
{
TransInfoModel
model
=
TransInfoModel
.
getInstance
();
TransInfoModel
model
=
TransInfoModel
.
getInstance
();
model
.
setHash
(
o
.
get
Block
Id
());
model
.
setHash
(
o
.
get
Tx
Id
());
model
.
setBlockHash
(
o
.
getTxId
());
model
.
setBlockHash
(
o
.
getTxId
());
model
.
setBlockNumber
(
o
.
getNumber
().
intValue
());
model
.
setBlockNumber
(
o
.
getNumber
().
intValue
());
model
.
setFrom
(
o
.
getOwnerAddress
());
model
.
setFrom
(
o
.
getOwnerAddress
());
...
@@ -329,7 +325,7 @@ public class TransactionControllerV1 {
...
@@ -329,7 +325,7 @@ public class TransactionControllerV1 {
List
<
Transaction
>
txList
=
this
.
transactionService
.
getByExample
(
example
);
List
<
Transaction
>
txList
=
this
.
transactionService
.
getByExample
(
example
);
if
(!
CollectionUtils
.
isEmpty
(
txList
))
{
if
(!
CollectionUtils
.
isEmpty
(
txList
))
{
Transaction
trans
=
txList
.
get
(
0
);
Transaction
trans
=
txList
.
get
(
0
);
model
.
setHash
(
hash
);
model
.
setHash
(
trans
.
getTxId
()
);
model
.
setBlockHash
(
trans
.
getBlockId
());
model
.
setBlockHash
(
trans
.
getBlockId
());
model
.
setBlockNumber
(
trans
.
getNumber
().
intValue
());
model
.
setBlockNumber
(
trans
.
getNumber
().
intValue
());
model
.
setFrom
(
trans
.
getOwnerAddress
());
model
.
setFrom
(
trans
.
getOwnerAddress
());
...
@@ -421,6 +417,17 @@ public class TransactionControllerV1 {
...
@@ -421,6 +417,17 @@ public class TransactionControllerV1 {
return
ResponseKit
.
success
(
modelList
);
return
ResponseKit
.
success
(
modelList
);
}
}
/**
* 首页图表
*
* @return
*/
@RequestMapping
(
value
=
"getBlockNumber"
,
method
=
RequestMethod
.
GET
)
public
ApiResponse
getBlockNumber
()
{
LastBlock
lastBlock
=
this
.
lastBlockService
.
getOneByExample
();
return
ResponseKit
.
success
(
lastBlock
.
getLastBlockNum
());
}
public
final
static
boolean
isNumeric
(
String
s
)
{
public
final
static
boolean
isNumeric
(
String
s
)
{
if
(
s
!=
null
&&
!
""
.
equals
(
s
.
trim
()))
{
if
(
s
!=
null
&&
!
""
.
equals
(
s
.
trim
()))
{
return
s
.
matches
(
"^[0-9]*$"
);
return
s
.
matches
(
"^[0-9]*$"
);
...
...
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