Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
B
browser-backend
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
browser-backend
Commits
ea679c63
Commit
ea679c63
authored
May 22, 2020
by
renjie
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev-zrj' into 'staging'
Dev zrj See merge request
!137
parents
3d2c9233
12072ebb
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
56 additions
and
9 deletions
+56
-9
AdministratorController.java
...erbackend/account/controller/AdministratorController.java
+2
-1
UserUsedDto.java
...ava/com/edgec/browserbackend/account/dto/UserUsedDto.java
+24
-0
AdministratorService.java
.../browserbackend/account/service/AdministratorService.java
+2
-1
AdministratorServiceImpl.java
...ackend/account/service/impl/AdministratorServiceImpl.java
+27
-7
IpResourceRepository.java
...owserbackend/browser/repository/IpResourceRepository.java
+1
-0
No files found.
src/main/java/com/edgec/browserbackend/account/controller/AdministratorController.java
View file @
ea679c63
...
@@ -3,6 +3,7 @@ package com.edgec.browserbackend.account.controller;
...
@@ -3,6 +3,7 @@ package com.edgec.browserbackend.account.controller;
import
com.edgec.browserbackend.account.dto.BillQueryResultDto
;
import
com.edgec.browserbackend.account.dto.BillQueryResultDto
;
import
com.edgec.browserbackend.account.dto.ResultDto
;
import
com.edgec.browserbackend.account.dto.ResultDto
;
import
com.edgec.browserbackend.account.dto.UserUsedDto
;
import
com.edgec.browserbackend.account.service.*
;
import
com.edgec.browserbackend.account.service.*
;
import
com.edgec.browserbackend.account.domain.*
;
import
com.edgec.browserbackend.account.domain.*
;
import
com.edgec.browserbackend.browser.ErrorCode.BrowserErrorCode
;
import
com.edgec.browserbackend.browser.ErrorCode.BrowserErrorCode
;
...
@@ -206,7 +207,7 @@ public class AdministratorController {
...
@@ -206,7 +207,7 @@ public class AdministratorController {
// 查询所有用户消费
// 查询所有用户消费
@PreAuthorize
(
Securitys
.
ADMIN_EL
)
@PreAuthorize
(
Securitys
.
ADMIN_EL
)
@RequestMapping
(
path
=
"/0xadministrator/allused"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
path
=
"/0xadministrator/allused"
,
method
=
RequestMethod
.
GET
)
public
Page
<
User
Balance
>
findAllused
(
@RequestParam
(
value
=
"page"
)
int
page
,
@RequestParam
(
value
=
"size"
)
int
size
)
{
public
Page
<
User
UsedDto
>
findAllused
(
@RequestParam
(
value
=
"page"
)
int
page
,
@RequestParam
(
value
=
"size"
)
int
size
)
{
Pageable
pageable
=
PageRequest
.
of
(
page
,
size
);
Pageable
pageable
=
PageRequest
.
of
(
page
,
size
);
return
administratorService
.
getAllUserUsed
(
pageable
);
return
administratorService
.
getAllUserUsed
(
pageable
);
}
}
...
...
src/main/java/com/edgec/browserbackend/account/dto/UserUsedDto.java
0 → 100644
View file @
ea679c63
package
com
.
edgec
.
browserbackend
.
account
.
dto
;
import
com.edgec.browserbackend.account.domain.UserBalance
;
public
class
UserUsedDto
{
UserBalance
userBalance
;
String
promotionCode
;
public
String
getPromotionCode
()
{
return
promotionCode
;
}
public
void
setPromotionCode
(
String
promotionCode
)
{
this
.
promotionCode
=
promotionCode
;
}
public
UserBalance
getUserBalance
()
{
return
userBalance
;
}
public
void
setUserBalance
(
UserBalance
userBalance
)
{
this
.
userBalance
=
userBalance
;
}
}
src/main/java/com/edgec/browserbackend/account/service/AdministratorService.java
View file @
ea679c63
...
@@ -4,6 +4,7 @@ import com.edgec.browserbackend.account.domain.*;
...
@@ -4,6 +4,7 @@ import com.edgec.browserbackend.account.domain.*;
import
com.edgec.browserbackend.account.dto.BillQueryResultDto
;
import
com.edgec.browserbackend.account.dto.BillQueryResultDto
;
import
com.edgec.browserbackend.account.dto.IpCountQueryResultDto
;
import
com.edgec.browserbackend.account.dto.IpCountQueryResultDto
;
import
com.edgec.browserbackend.account.dto.PromotionQueryResultDto
;
import
com.edgec.browserbackend.account.dto.PromotionQueryResultDto
;
import
com.edgec.browserbackend.account.dto.UserUsedDto
;
import
com.edgec.browserbackend.browser.domain.IpResource
;
import
com.edgec.browserbackend.browser.domain.IpResource
;
import
com.edgec.browserbackend.browser.dto.IpResourceDto
;
import
com.edgec.browserbackend.browser.dto.IpResourceDto
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.Page
;
...
@@ -66,5 +67,5 @@ public interface AdministratorService {
...
@@ -66,5 +67,5 @@ public interface AdministratorService {
File
getProxyConfig
();
File
getProxyConfig
();
Page
<
User
Balance
>
getAllUserUsed
(
Pageable
pageable
);
Page
<
User
UsedDto
>
getAllUserUsed
(
Pageable
pageable
);
}
}
src/main/java/com/edgec/browserbackend/account/service/impl/AdministratorServiceImpl.java
View file @
ea679c63
package
com
.
edgec
.
browserbackend
.
account
.
service
.
impl
;
package
com
.
edgec
.
browserbackend
.
account
.
service
.
impl
;
import
com.edgec.browserbackend.account.domain.*
;
import
com.edgec.browserbackend.account.domain.*
;
import
com.edgec.browserbackend.account.dto.AccountPromotionDto
;
import
com.edgec.browserbackend.account.dto.*
;
import
com.edgec.browserbackend.account.dto.BillQueryResultDto
;
import
com.edgec.browserbackend.account.dto.IpCountQueryResultDto
;
import
com.edgec.browserbackend.account.dto.PromotionQueryResultDto
;
import
com.edgec.browserbackend.account.exception.AccountErrorCode
;
import
com.edgec.browserbackend.account.exception.AccountErrorCode
;
import
com.edgec.browserbackend.account.repository.*
;
import
com.edgec.browserbackend.account.repository.*
;
import
com.edgec.browserbackend.account.service.AdministratorService
;
import
com.edgec.browserbackend.account.service.AdministratorService
;
...
@@ -36,6 +33,7 @@ import java.time.ZonedDateTime;
...
@@ -36,6 +33,7 @@ import java.time.ZonedDateTime;
import
java.time.temporal.ChronoUnit
;
import
java.time.temporal.ChronoUnit
;
import
java.util.*
;
import
java.util.*
;
import
java.util.concurrent.atomic.AtomicLong
;
import
java.util.concurrent.atomic.AtomicLong
;
import
java.util.stream.Collectors
;
@Service
@Service
...
@@ -454,11 +452,21 @@ public class AdministratorServiceImpl implements AdministratorService {
...
@@ -454,11 +452,21 @@ public class AdministratorServiceImpl implements AdministratorService {
promotion
.
setCommission
(
promotion
.
getCommission
()
+
x
.
getPromotion
().
getCommission
());
promotion
.
setCommission
(
promotion
.
getCommission
()
+
x
.
getPromotion
().
getCommission
());
double
secondCommission
=
0
;
double
secondCommission
=
0
;
ipCount
.
addAndGet
(
ipResourceRepository
.
countAllByOwnerAndIsDeletedAndValidTimeGreaterThan
(
x
.
getName
(),
false
,
Instant
.
now
().
toEpochMilli
()));
ipCount
.
addAndGet
(
ipResourceRepository
.
countAllByOwnerAndIsDeletedAndValidTimeGreaterThan
(
x
.
getName
(),
false
,
Instant
.
now
().
toEpochMilli
()));
List
<
Account
>
children
=
accountRepository
.
findByParent
(
x
.
getName
());
if
(
children
!=
null
&&
children
.
size
()
>
0
)
{
ipCount
.
addAndGet
(
ipResourceRepository
.
countAllByOwnerInAndIsDeletedAndValidTimeGreaterThan
(
children
.
stream
().
map
(
Account:
:
getName
).
collect
(
Collectors
.
toList
()),
false
,
Instant
.
now
().
toEpochMilli
()));
}
if
(
finalAccount
.
getPromotion
().
isSale
()
&&
x
.
getParent
()
==
null
)
{
if
(
finalAccount
.
getPromotion
().
isSale
()
&&
x
.
getParent
()
==
null
)
{
List
<
Account
>
secondPromotes
=
accountRepository
.
findByPromotionCodeAndParentIsNull
(
x
.
getPromotion
().
getCode
());
List
<
Account
>
secondPromotes
=
accountRepository
.
findByPromotionCodeAndParentIsNull
(
x
.
getPromotion
().
getCode
());
if
(
secondPromotes
!=
null
&&
secondPromotes
.
size
()
>
0
)
{
if
(
secondPromotes
!=
null
&&
secondPromotes
.
size
()
>
0
)
{
for
(
Account
secondPromote
:
secondPromotes
)
{
for
(
Account
secondPromote
:
secondPromotes
)
{
ipCount
.
addAndGet
(
ipResourceRepository
.
countAllByOwnerAndIsDeletedAndValidTimeGreaterThan
(
secondPromote
.
getName
(),
false
,
Instant
.
now
().
toEpochMilli
()));
if
(
finalAccount
.
getPromotion
().
isSale
())
{
ipCount
.
addAndGet
(
ipResourceRepository
.
countAllByOwnerAndIsDeletedAndValidTimeGreaterThan
(
secondPromote
.
getName
(),
false
,
Instant
.
now
().
toEpochMilli
()));
List
<
Account
>
secondChildren
=
accountRepository
.
findByParent
(
secondPromote
.
getName
());
if
(
children
!=
null
&&
children
.
size
()
>
0
)
{
ipCount
.
addAndGet
(
ipResourceRepository
.
countAllByOwnerInAndIsDeletedAndValidTimeGreaterThan
(
secondChildren
.
stream
().
map
(
Account:
:
getName
).
collect
(
Collectors
.
toList
()),
false
,
Instant
.
now
().
toEpochMilli
()));
}
}
List
<
UserPrePaidBilling
>
userPrePaidBillings1
=
userPrePaidBillingRepository
.
findByAdministratorAndPayMethodInAndTimestampBetween
(
secondPromote
.
getName
(),
Arrays
.
asList
(
1
,
2
,
3
),
dateTime1
.
getTime
(),
dateTime2
.
getTime
());
List
<
UserPrePaidBilling
>
userPrePaidBillings1
=
userPrePaidBillingRepository
.
findByAdministratorAndPayMethodInAndTimestampBetween
(
secondPromote
.
getName
(),
Arrays
.
asList
(
1
,
2
,
3
),
dateTime1
.
getTime
(),
dateTime2
.
getTime
());
if
(
userPrePaidBillings1
!=
null
&&
userPrePaidBillings1
.
size
()
>
0
)
if
(
userPrePaidBillings1
!=
null
&&
userPrePaidBillings1
.
size
()
>
0
)
secondCommission
+=
userPrePaidBillings1
.
stream
().
mapToDouble
(
UserPrePaidBilling:
:
getTotal
).
sum
();
secondCommission
+=
userPrePaidBillings1
.
stream
().
mapToDouble
(
UserPrePaidBilling:
:
getTotal
).
sum
();
...
@@ -514,9 +522,21 @@ public class AdministratorServiceImpl implements AdministratorService {
...
@@ -514,9 +522,21 @@ public class AdministratorServiceImpl implements AdministratorService {
}
}
@Override
@Override
public
Page
<
User
Balance
>
getAllUserUsed
(
Pageable
pageable
)
{
public
Page
<
User
UsedDto
>
getAllUserUsed
(
Pageable
pageable
)
{
Page
<
UserBalance
>
userBalances
=
userBalanceRepository
.
findAllOrderByUsedDesc
(
pageable
);
Page
<
UserBalance
>
userBalances
=
userBalanceRepository
.
findAllOrderByUsedDesc
(
pageable
);
return
userBalances
;
List
<
UserBalance
>
userBalanceList
=
userBalances
.
toList
();
List
<
UserUsedDto
>
userUsedDtos
=
new
ArrayList
<>();
if
(
userBalanceList
!=
null
&&
userBalanceList
.
size
()
>
0
)
{
userBalanceList
.
forEach
(
x
->
{
UserUsedDto
userUsedDto
=
new
UserUsedDto
();
Account
account
=
accountRepository
.
findByName
(
x
.
getUsername
());
userUsedDto
.
setPromotionCode
(
account
.
getPromotionCode
());
userUsedDto
.
setUserBalance
(
x
);
userUsedDtos
.
add
(
userUsedDto
);
});
}
Page
<
UserUsedDto
>
userUsedDtopage
=
new
PageImpl
<>(
userUsedDtos
,
pageable
,
userBalances
.
getTotalElements
());
return
userUsedDtopage
;
}
}
}
}
...
...
src/main/java/com/edgec/browserbackend/browser/repository/IpResourceRepository.java
View file @
ea679c63
...
@@ -50,5 +50,6 @@ public interface IpResourceRepository extends MongoRepository<IpResource, String
...
@@ -50,5 +50,6 @@ public interface IpResourceRepository extends MongoRepository<IpResource, String
long
countAllByIsDeletedAndValidTimeGreaterThan
(
boolean
isDeleted
,
long
time
);
long
countAllByIsDeletedAndValidTimeGreaterThan
(
boolean
isDeleted
,
long
time
);
long
countAllByOwnerAndIsDeletedAndValidTimeGreaterThan
(
String
username
,
boolean
isDeleted
,
long
time
);
long
countAllByOwnerAndIsDeletedAndValidTimeGreaterThan
(
String
username
,
boolean
isDeleted
,
long
time
);
long
countAllByOwnerInAndIsDeletedAndValidTimeGreaterThan
(
List
<
String
>
username
,
boolean
isDeleted
,
long
time
);
long
countAllByOwner
(
String
username
);
long
countAllByOwner
(
String
username
);
}
}
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