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
4555b949
Commit
4555b949
authored
Apr 08, 2020
by
renjie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
推广礼金
parent
403e8582
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
34 additions
and
12 deletions
+34
-12
Promotion.java
...va/com/edgec/browserbackend/account/domain/Promotion.java
+12
-11
AccountRepository.java
.../browserbackend/account/repository/AccountRepository.java
+1
-0
AccountServiceImpl.java
...owserbackend/account/service/impl/AccountServiceImpl.java
+19
-0
PromotionTask.java
.../com/edgec/browserbackend/browser/task/PromotionTask.java
+2
-1
No files found.
src/main/java/com/edgec/browserbackend/account/domain/Promotion.java
View file @
4555b949
...
@@ -13,11 +13,12 @@ public class Promotion {
...
@@ -13,11 +13,12 @@ public class Promotion {
private
int
invitedUsers
;
private
int
invitedUsers
;
//好友当月消费
//好友当月消费
private
int
commission
;
private
int
commission
;
//好友
以前
消费
//好友
上月总
消费
private
int
commissionL
eft
;
private
int
commissionL
astMonth
;
private
boolean
isSale
;
private
boolean
isSale
;
private
double
gift
;
private
double
gift
;
private
double
giftLeft
;
//所有未提现金额
private
double
allGift
;
public
int
getCommission
()
{
public
int
getCommission
()
{
return
commission
;
return
commission
;
...
@@ -59,19 +60,19 @@ public class Promotion {
...
@@ -59,19 +60,19 @@ public class Promotion {
this
.
gift
=
gift
;
this
.
gift
=
gift
;
}
}
public
double
getGiftLeft
()
{
public
int
getCommissionLastMonth
()
{
return
giftLeft
;
return
commissionLastMonth
;
}
}
public
void
setCommissionL
eft
(
int
commissionLeft
)
{
public
void
setCommissionL
astMonth
(
int
commissionLastMonth
)
{
this
.
commissionL
eft
=
commissionLeft
;
this
.
commissionL
astMonth
=
commissionLastMonth
;
}
}
public
int
getCommissionLe
ft
()
{
public
double
getAllGi
ft
()
{
return
commissionLe
ft
;
return
allGi
ft
;
}
}
public
void
set
GiftLeft
(
double
giftLe
ft
)
{
public
void
set
AllGift
(
double
allGi
ft
)
{
this
.
giftLeft
=
giftLe
ft
;
this
.
allGift
=
allGi
ft
;
}
}
}
}
src/main/java/com/edgec/browserbackend/account/repository/AccountRepository.java
View file @
4555b949
...
@@ -37,4 +37,5 @@ public interface AccountRepository extends MongoRepository<Account, String>, Acc
...
@@ -37,4 +37,5 @@ public interface AccountRepository extends MongoRepository<Account, String>, Acc
List
<
Account
>
findByPromotionCode
(
String
code
);
List
<
Account
>
findByPromotionCode
(
String
code
);
int
countByPromotionCodeAndParentIsNull
(
String
promotionCode
);
}
}
src/main/java/com/edgec/browserbackend/account/service/impl/AccountServiceImpl.java
View file @
4555b949
...
@@ -392,6 +392,25 @@ public class AccountServiceImpl implements AccountService {
...
@@ -392,6 +392,25 @@ public class AccountServiceImpl implements AccountService {
current
.
setQueryIpUrlList
(
queryIpUrlList
);
current
.
setQueryIpUrlList
(
queryIpUrlList
);
current
.
setWhiteList
(
whiteList
);
current
.
setWhiteList
(
whiteList
);
int
invitedUsers
=
repository
.
countByPromotionCodeAndParentIsNull
(
account
.
getPromotion
().
getCode
());
String
code
=
account
.
getPromotion
().
getCode
();
List
<
Account
>
promotes
=
repository
.
findByPromotionCode
(
code
);
double
totalCommission
=
0
;
totalCommission
=
0
;
for
(
Account
promote
:
promotes
)
{
List
<
UserPrePaidBilling
>
userPrePaidBillings
=
prePaidBillingRepository
.
findByUsernameAndYearAndMonthAndPayMethodIsNot
(
promote
.
getName
(),
YearMonth
.
now
().
getYear
(),
YearMonth
.
now
().
getMonthValue
(),
0
);
totalCommission
+=
userPrePaidBillings
.
stream
().
mapToDouble
(
UserPrePaidBilling:
:
getTotal
).
sum
();
}
account
.
getPromotion
().
setCommission
((
int
)
totalCommission
);
account
.
getPromotion
().
setInvitedUsers
(
invitedUsers
);
repository
.
save
(
account
);
resultDto
.
setStatus
(
0
);
resultDto
.
setStatus
(
0
);
resultDto
.
setData
(
current
);
resultDto
.
setData
(
current
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
...
...
src/main/java/com/edgec/browserbackend/browser/task/PromotionTask.java
View file @
4555b949
...
@@ -43,8 +43,9 @@ public class PromotionTask {
...
@@ -43,8 +43,9 @@ public class PromotionTask {
totalCommission
+=
userPrePaidBillings
.
stream
().
mapToDouble
(
UserPrePaidBilling:
:
getTotal
).
sum
();
totalCommission
+=
userPrePaidBillings
.
stream
().
mapToDouble
(
UserPrePaidBilling:
:
getTotal
).
sum
();
}
}
Promotion
promotion
=
account
.
getPromotion
();
Promotion
promotion
=
account
.
getPromotion
();
promotion
.
setCommission
((
int
)
totalCommission
);
promotion
.
setCommission
LastMonth
((
int
)
totalCommission
);
promotion
.
setGift
(
totalCommission
*
8
/
100
);
promotion
.
setGift
(
totalCommission
*
8
/
100
);
promotion
.
setAllGift
(
promotion
.
getAllGift
()
+
promotion
.
getGift
());
accountRepository
.
save
(
account
);
accountRepository
.
save
(
account
);
}
}
}
}
...
...
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