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
e7627f40
Commit
e7627f40
authored
Aug 27, 2020
by
xuxin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改管理员界面 推荐码下线查询功能
parent
ea975173
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
10 deletions
+31
-10
AccountRepository.java
.../browserbackend/account/repository/AccountRepository.java
+3
-0
AdministratorServiceImpl.java
...ackend/account/service/impl/AdministratorServiceImpl.java
+28
-10
No files found.
src/main/java/com/edgec/browserbackend/account/repository/AccountRepository.java
View file @
e7627f40
...
@@ -31,6 +31,8 @@ public interface AccountRepository extends MongoRepository<Account, String>, Acc
...
@@ -31,6 +31,8 @@ public interface AccountRepository extends MongoRepository<Account, String>, Acc
List
<
Account
>
findAllBySignupDateBetweenAndPromotionCodeAndParentIsNull
(
Date
startDate
,
Date
endDate
,
String
promotionCode
);
List
<
Account
>
findAllBySignupDateBetweenAndPromotionCodeAndParentIsNull
(
Date
startDate
,
Date
endDate
,
String
promotionCode
);
List
<
Account
>
findAllByPromotionCodeAndParentIsNull
(
String
code
);
Page
<
Account
>
findAllBySignupDateBetweenAndPromotionCodeAndParentIsNull
(
Pageable
pageable
,
Date
startDate
,
Date
endDate
,
String
promotionCode
);
Page
<
Account
>
findAllBySignupDateBetweenAndPromotionCodeAndParentIsNull
(
Pageable
pageable
,
Date
startDate
,
Date
endDate
,
String
promotionCode
);
Page
<
Account
>
findAllBySignupDateBetweenAndParentIsNull
(
Pageable
pageable
,
Date
startDate
,
Date
endDate
);
Page
<
Account
>
findAllBySignupDateBetweenAndParentIsNull
(
Pageable
pageable
,
Date
startDate
,
Date
endDate
);
...
@@ -45,4 +47,5 @@ public interface AccountRepository extends MongoRepository<Account, String>, Acc
...
@@ -45,4 +47,5 @@ public interface AccountRepository extends MongoRepository<Account, String>, Acc
List
<
Account
>
findByPromotionCodeAndParentIsNull
(
String
code
);
List
<
Account
>
findByPromotionCodeAndParentIsNull
(
String
code
);
int
countByPromotionCodeAndParentIsNull
(
String
promotionCode
);
int
countByPromotionCodeAndParentIsNull
(
String
promotionCode
);
}
}
src/main/java/com/edgec/browserbackend/account/service/impl/AdministratorServiceImpl.java
View file @
e7627f40
...
@@ -407,16 +407,24 @@ public class AdministratorServiceImpl implements AdministratorService {
...
@@ -407,16 +407,24 @@ public class AdministratorServiceImpl implements AdministratorService {
@Override
@Override
public
PromotionQueryResultDto
queryPromotion
(
Pageable
pageable
,
String
username
,
String
promotionCode
,
String
strDate1
,
String
strDate2
)
{
public
PromotionQueryResultDto
queryPromotion
(
Pageable
pageable
,
String
username
,
String
promotionCode
,
String
strDate1
,
String
strDate2
)
{
if
(
StringUtils
.
isBlank
(
username
)
&&
StringUtils
.
isBlank
(
promotionCode
))
if
(
StringUtils
.
isBlank
(
username
)
&&
StringUtils
.
isBlank
(
promotionCode
))
{
throw
new
ClientRequestException
(
BrowserErrorCode
.
INFORMATIONNOTCOMPELETE
);
throw
new
ClientRequestException
(
BrowserErrorCode
.
INFORMATIONNOTCOMPELETE
);
}
Account
account
=
null
;
Account
account
=
null
;
if
(!
StringUtils
.
isBlank
(
username
))
if
(!
StringUtils
.
isBlank
(
username
))
{
account
=
accountRepository
.
findByName
(
username
).
orElseThrow
(()
->
new
ClientRequestException
(
AccountErrorCode
.
NAMENOTEXIST
));
account
=
accountRepository
.
findByName
(
username
).
orElseThrow
(()
->
new
ClientRequestException
(
AccountErrorCode
.
NAMENOTEXIST
));
else
account
=
accountRepository
.
findByPromotion
(
promotionCode
);
}
else
{
if
(
account
==
null
)
account
=
accountRepository
.
findByPromotion
(
promotionCode
);
}
if
(
account
==
null
)
{
throw
new
ClientRequestException
(
AccountErrorCode
.
NAMENOTEXIST
);
throw
new
ClientRequestException
(
AccountErrorCode
.
NAMENOTEXIST
);
if
(
account
.
getParent
()
!=
null
)
}
if
(
account
.
getParent
()
!=
null
)
{
throw
new
ClientRequestException
(
AccountErrorCode
.
NOPERMISSION
);
throw
new
ClientRequestException
(
AccountErrorCode
.
NOPERMISSION
);
}
SimpleDateFormat
formatter
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
SimpleDateFormat
formatter
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
PromotionQueryResultDto
promotionQueryResultDto
=
new
PromotionQueryResultDto
(
account
);
PromotionQueryResultDto
promotionQueryResultDto
=
new
PromotionQueryResultDto
(
account
);
promotionQueryResultDto
.
setUsername
(
username
);
promotionQueryResultDto
.
setUsername
(
username
);
...
@@ -434,25 +442,34 @@ public class AdministratorServiceImpl implements AdministratorService {
...
@@ -434,25 +442,34 @@ public class AdministratorServiceImpl implements AdministratorService {
Page
<
AccountPromotionDto
>
accountPromotionDtoPage
=
new
PageImpl
<
AccountPromotionDto
>(
accountPromotionDtos
);
Page
<
AccountPromotionDto
>
accountPromotionDtoPage
=
new
PageImpl
<
AccountPromotionDto
>(
accountPromotionDtos
);
promotionQueryResultDto
.
setUsers
(
accountPromotionDtoPage
);
promotionQueryResultDto
.
setUsers
(
accountPromotionDtoPage
);
List
<
Account
>
accounts
=
accountRepository
.
findAllBySignupDateBetweenAndPromotionCodeAndParentIsNull
(
dateTime1
,
dateTime2
,
account
.
getPromotion
().
getCode
());
// 查询在指定的日期通过邀请码注册的账户
// List<Account> accounts = accountRepository.findAllBySignupDateBetweenAndPromotionCodeAndParentIsNull(dateTime1, dateTime2, account.getPromotion().getCode());
// 从上面的 改为查询 某用户邀请的所有账户
List
<
Account
>
accounts
=
accountRepository
.
findAllByPromotionCodeAndParentIsNull
(
account
.
getPromotion
().
getCode
());
Promotion
promotion
=
new
Promotion
();
Promotion
promotion
=
new
Promotion
();
Account
finalAccount
=
account
;
Account
finalAccount
=
account
;
AtomicLong
ipCount
=
new
AtomicLong
();
AtomicLong
ipCount
=
new
AtomicLong
();
if
(
accounts
!=
null
&&
accounts
.
size
()
>
0
)
{
if
(
accounts
!=
null
&&
accounts
.
size
()
>
0
)
{
accounts
.
forEach
(
x
->
{
accounts
.
forEach
(
x
->
{
promotion
.
setInvitedUsers
(
promotion
.
getInvitedUsers
()
+
1
);
promotion
.
setInvitedUsers
(
promotion
.
getInvitedUsers
()
+
1
);
// 查询账户在指定日期充值记录
List
<
UserPrePaidBilling
>
userPrePaidBillings
=
userPrePaidBillingRepository
.
findByAdministratorAndPayMethodInAndTimestampBetween
(
x
.
getName
(),
Arrays
.
asList
(
1
,
2
,
3
),
dateTime1
.
getTime
(),
dateTime2
.
getTime
());
List
<
UserPrePaidBilling
>
userPrePaidBillings
=
userPrePaidBillingRepository
.
findByAdministratorAndPayMethodInAndTimestampBetween
(
x
.
getName
(),
Arrays
.
asList
(
1
,
2
,
3
),
dateTime1
.
getTime
(),
dateTime2
.
getTime
());
double
totalCommission
=
0
;
double
totalCommission
=
0
;
if
(
userPrePaidBillings
!=
null
&&
userPrePaidBillings
.
size
()
>
0
)
if
(
userPrePaidBillings
!=
null
&&
userPrePaidBillings
.
size
()
>
0
)
{
totalCommission
=
userPrePaidBillings
.
stream
().
mapToDouble
(
UserPrePaidBilling:
:
getTotal
).
sum
();
totalCommission
=
userPrePaidBillings
.
stream
().
mapToDouble
(
UserPrePaidBilling:
:
getTotal
).
sum
();
}
promotion
.
setTotalCommission
(
promotion
.
getTotalCommission
()
+
(
int
)
totalCommission
);
promotion
.
setTotalCommission
(
promotion
.
getTotalCommission
()
+
(
int
)
totalCommission
);
promotion
.
setCommission
(
promotion
.
getCommission
()
+
x
.
getPromotion
().
getCommission
());
promotion
.
setCommission
(
promotion
.
getCommission
()
+
x
.
getPromotion
().
getCommission
());
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
());
List
<
Account
>
children
=
accountRepository
.
findByParent
(
x
.
getName
());
if
(
children
!=
null
&&
children
.
size
()
>
0
)
{
if
(
children
!=
null
&&
children
.
size
()
>
0
)
{
ipCount
.
addAndGet
(
ipResourceRepository
.
countAllByOwnerInAndIsDeletedAndValidTimeGreaterThan
(
children
.
stream
().
map
(
Account:
:
getName
).
collect
(
Collectors
.
toList
()),
false
,
Instant
.
now
().
toEpochMilli
()));
ipCount
.
addAndGet
(
ipResourceRepository
.
countAllByOwnerInAndIsDeletedAndValidTimeGreaterThan
(
children
.
stream
().
map
(
Account:
:
getName
).
collect
(
Collectors
.
toList
()),
false
,
Instant
.
now
().
toEpochMilli
()));
}
}
double
secondCommission
=
0
;
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
)
{
...
@@ -470,10 +487,11 @@ public class AdministratorServiceImpl implements AdministratorService {
...
@@ -470,10 +487,11 @@ public class AdministratorServiceImpl implements AdministratorService {
}
}
}
}
}
}
if
(
finalAccount
.
getPromotion
().
isSale
())
if
(
finalAccount
.
getPromotion
().
isSale
())
{
promotion
.
setAllGift
(
promotion
.
getAllGift
()
+
totalCommission
*
0.1
+
secondCommission
*
0.02
);
promotion
.
setAllGift
(
promotion
.
getAllGift
()
+
totalCommission
*
0.1
+
secondCommission
*
0.02
);
else
}
else
{
promotion
.
setAllGift
(
promotion
.
getAllGift
()
+
totalCommission
*
0.08
);
promotion
.
setAllGift
(
promotion
.
getAllGift
()
+
totalCommission
*
0.08
);
}
promotion
.
setWithdrawn
(
promotion
.
getWithdrawn
()
+
secondCommission
);
promotion
.
setWithdrawn
(
promotion
.
getWithdrawn
()
+
secondCommission
);
promotion
.
setGift
(
promotion
.
getGift
()
+
x
.
getPromotion
().
getGift
());
promotion
.
setGift
(
promotion
.
getGift
()
+
x
.
getPromotion
().
getGift
());
promotion
.
setCommissionLastMonth
(
promotion
.
getCommissionLastMonth
()
+
x
.
getPromotion
().
getCommissionLastMonth
());
promotion
.
setCommissionLastMonth
(
promotion
.
getCommissionLastMonth
()
+
x
.
getPromotion
().
getCommissionLastMonth
());
...
...
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