Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
D
data-server
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
licc
data-server
Commits
345c553c
Commit
345c553c
authored
Feb 28, 2021
by
licc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
月度最大进步奖 实现2
parent
e5587b8f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
65 additions
and
10 deletions
+65
-10
TeamPerformanceSortVo.java
...ain/java/cn/wisenergy/model/vo/TeamPerformanceSortVo.java
+2
-0
AccountServiceImpl.java
...ava/cn/wisenergy/service/app/impl/AccountServiceImpl.java
+63
-10
No files found.
wisenergy-model/src/main/java/cn/wisenergy/model/vo/TeamPerformanceSortVo.java
View file @
345c553c
...
...
@@ -10,5 +10,7 @@ import lombok.Data;
public
class
TeamPerformanceSortVo
{
private
Double
growthRate
;
private
Double
monthPerformance
;
private
TeamPerformance
teamPerformance
;
}
wisenergy-service/src/main/java/cn/wisenergy/service/app/impl/AccountServiceImpl.java
View file @
345c553c
...
...
@@ -13,7 +13,6 @@ import cn.wisenergy.service.Manager.AccountManager;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections.map.HashedMap
;
import
org.apache.commons.lang.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
...
...
@@ -160,10 +159,7 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo>
//5、获取所有用户,如果会员等级是黄金以上,计算月度收益
List
<
User
>
userList
=
usersMapper
.
getAllGoldUser
();
for
(
User
user
:
userList
)
{
boolean
bool
=
monthlyIncome
(
totalMoney
,
user
);
if
(!
bool
)
{
continue
;
}
monthlyIncome
(
totalMoney
,
user
);
}
}
return
R
.
ok
(
0
,
true
);
...
...
@@ -192,10 +188,11 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo>
//1、判断当前月是否是业绩开始的第一个月
List
<
TeamPerformance
>
teamPerformances
=
teamPerformanceMapper
.
getByBeforeTime
(
new
Date
());
//获取当月所有人业绩总额
Double
totalMoney
=
teamPerformanceMapper
.
countByTime
(
new
Date
());
//2、集合为空 是业绩开始的第一个月
if
(
CollectionUtils
.
isEmpty
(
teamPerformances
))
{
//获取当月所有人业绩总额
Double
totalMoney
=
teamPerformanceMapper
.
countByTime
(
new
Date
());
double
number
=
Math
.
floor
(
totalMoney
/
3980
/
12
);
if
(
number
!=
0
)
{
//获取月业绩前20用户
...
...
@@ -261,6 +258,13 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo>
}
}
teamVo
.
setGrowthRate
(
growthRate
);
double
monthPerformance
;
if
(
null
==
teamPerformance
.
getMonthTeamPerformance
())
{
monthPerformance
=
0.00
;
}
else
{
monthPerformance
=
teamPerformance
.
getMonthTeamPerformance
().
doubleValue
();
}
teamVo
.
setMonthPerformance
(
monthPerformance
);
teamVo
.
setTeamPerformance
(
teamPerformance
);
listVo
.
add
(
teamVo
);
}
...
...
@@ -268,10 +272,59 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo>
//对集合进行排序
listVo
.
sort
(
Comparator
.
comparing
(
TeamPerformanceSortVo:
:
getGrowthRate
).
reversed
());
//取排名前20的
listVo
.
subList
(
0
,
20
);
return
R
.
ok
(
0
,
true
);
if
(
listVo
.
size
()
>=
20
)
{
//计算前20的总业绩
double
total
=
listVo
.
stream
().
mapToDouble
(
TeamPerformanceSortVo:
:
getMonthPerformance
).
sum
();
double
number
=
Math
.
floor
(
totalMoney
/
3980
/
12
);
//取排名前20的
listVo
.
subList
(
0
,
20
);
for
(
TeamPerformanceSortVo
sortVo
:
listVo
)
{
String
userId
=
sortVo
.
getTeamPerformance
().
getUserId
();
Integer
userLevel
=
sortVo
.
getTeamPerformance
().
getUserLevel
();
//获取最大进步奖 百分比
MemberPercent
memberPercent
=
memberPercentMapper
.
getByLevelAndType
(
userLevel
,
3
);
//计算收益
double
userTeamPerformance
=
sortVo
.
getTeamPerformance
().
getMonthTeamPerformance
().
doubleValue
();
double
percent
=
memberPercent
.
getPercent
().
doubleValue
();
double
income
=
number
*
3980
*
percent
*
userTeamPerformance
/
total
;
//获取账户信息
AccountInfo
accountInfo
=
accountMapper
.
getByUserId
(
userId
);
accountInfo
.
setPerformanceMonth
(
new
BigDecimal
(
income
));
//更新用户账户表
accountMapper
.
updateById
(
accountInfo
);
}
return
R
.
ok
(
0
,
true
);
}
else
{
//计算总业绩
double
total
=
listVo
.
stream
().
mapToDouble
(
TeamPerformanceSortVo:
:
getMonthPerformance
).
sum
();
double
number
=
Math
.
floor
(
totalMoney
/
3980
/
12
);
for
(
TeamPerformanceSortVo
sortVo
:
listVo
)
{
String
userId
=
sortVo
.
getTeamPerformance
().
getUserId
();
Integer
userLevel
=
sortVo
.
getTeamPerformance
().
getUserLevel
();
//获取最大进步奖 百分比
MemberPercent
memberPercent
=
memberPercentMapper
.
getByLevelAndType
(
userLevel
,
3
);
//计算收益
double
userTeamPerformance
=
sortVo
.
getTeamPerformance
().
getMonthTeamPerformance
().
doubleValue
();
double
percent
=
memberPercent
.
getPercent
().
doubleValue
();
double
income
=
number
*
3980
*
percent
*
userTeamPerformance
/
total
;
//获取账户信息
AccountInfo
accountInfo
=
accountMapper
.
getByUserId
(
userId
);
accountInfo
.
setPerformanceMonth
(
new
BigDecimal
(
income
));
//更新用户账户表
accountMapper
.
updateById
(
accountInfo
);
}
}
return
R
.
ok
(
0
,
true
);
}
public
void
getUser
(
List
<
User
>
list
,
String
userId
)
{
...
...
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