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
c9b75fef
Commit
c9b75fef
authored
Nov 17, 2020
by
jianhua.zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
账户余额接口:提供所有账户余额总额
parent
4824a339
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
31 additions
and
3 deletions
+31
-3
TransactionControllerV1.java
...n/tron/explore/controller/v1/TransactionControllerV1.java
+20
-1
AddressRepository.java
...in/java/com/wuban/tron/explore/dao/AddressRepository.java
+2
-0
ResDataModel.java
...a/com/wuban/tron/explore/param/response/ResDataModel.java
+1
-1
AddressService.java
...n/java/com/wuban/tron/explore/service/AddressService.java
+2
-0
AddressServiceImpl.java
...m/wuban/tron/explore/service/impl/AddressServiceImpl.java
+5
-0
AddressMapper.xml
src/main/resources/mapper/AddressMapper.xml
+1
-1
No files found.
src/main/java/com/wuban/tron/explore/controller/v1/TransactionControllerV1.java
View file @
c9b75fef
...
...
@@ -11,6 +11,7 @@ import com.wuban.tron.explore.entity.example.TransactionExample;
import
com.wuban.tron.explore.param.response.*
;
import
com.wuban.tron.explore.service.*
;
import
com.wuban.tron.explore.util.ApiResponse
;
import
com.wuban.tron.explore.util.BigDecimalUtil
;
import
com.wuban.tron.explore.util.DateUtil
;
import
com.wuban.tron.explore.util.ResponseKit
;
import
lombok.RequiredArgsConstructor
;
...
...
@@ -23,6 +24,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.math.BigDecimal
;
import
java.util.ArrayList
;
import
java.util.List
;
...
...
@@ -383,12 +385,29 @@ public class TransactionControllerV1 {
modelList
.
add
(
infoModel
);
});
}
BigDecimal
bg
=
this
.
totalBalance
();
resDataModel
.
setSum
(
bg
.
toPlainString
());
resDataModel
.
setData
(
modelList
);
return
ResponseKit
.
success
(
resDataModel
);
}
private
BigDecimal
totalBalance
()
{
AddressExample
example
=
new
AddressExample
();
example
.
createCriteria
().
andBalanceGreaterThan
(
0L
);
List
<
Address
>
list
=
this
.
addressService
.
selectByExample
(
example
);
BigDecimal
totalBalance
=
new
BigDecimal
(
0
);
if
(!
CollectionUtils
.
isEmpty
(
list
))
{
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++)
{
if
(
list
.
get
(
i
).
getBalance
()
!=
null
)
{
totalBalance
=
BigDecimalUtil
.
getAdd
(
totalBalance
,
new
BigDecimal
(
list
.
get
(
i
).
getBalance
()));
}
}
}
return
totalBalance
;
}
/**
* 首页图表
*
...
...
src/main/java/com/wuban/tron/explore/dao/AddressRepository.java
View file @
c9b75fef
...
...
@@ -47,4 +47,6 @@ public interface AddressRepository {
*/
List
<
Address
>
selectByPager
(
@Param
(
"example"
)
AddressExample
example
);
List
<
Address
>
selectByExample
(
@Param
(
"example"
)
AddressExample
example
);
}
\ No newline at end of file
src/main/java/com/wuban/tron/explore/param/response/ResDataModel.java
View file @
c9b75fef
...
...
@@ -12,7 +12,7 @@ import lombok.Data;
public
class
ResDataModel
<
T
>
{
private
int
total
;
private
int
sum
;
private
String
sum
;
private
int
t
;
private
long
total_balance
;
private
Object
data
;
...
...
src/main/java/com/wuban/tron/explore/service/AddressService.java
View file @
c9b75fef
...
...
@@ -47,4 +47,6 @@ public interface AddressService {
*/
PageInfo
<
Address
>
selectByPager
(
Integer
startIndex
,
Integer
pageSize
,
AddressExample
example
);
List
<
Address
>
selectByExample
(
@Param
(
"example"
)
AddressExample
example
);
}
src/main/java/com/wuban/tron/explore/service/impl/AddressServiceImpl.java
View file @
c9b75fef
...
...
@@ -59,4 +59,9 @@ public class AddressServiceImpl implements AddressService {
return
pageInfo
;
}
@Override
public
List
<
Address
>
selectByExample
(
AddressExample
example
)
{
return
this
.
addressRepository
.
selectByExample
(
example
);
}
}
src/main/resources/mapper/AddressMapper.xml
View file @
c9b75fef
...
...
@@ -153,7 +153,7 @@
<if
test=
"example != null and example.distinct"
>
distinct
</if>
<include
refid=
"Base_Column_List"
/>
address,balance
from
<include
refid=
"Table_Name"
/>
<if
test=
"example != null"
>
<include
refid=
"Example_Where_Clause"
/>
...
...
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