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
1c3070c3
Commit
1c3070c3
authored
Mar 19, 2021
by
licc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化月度任务
parent
1504d2d1
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
76 additions
and
26 deletions
+76
-26
ProgressPrizeMapper.java
...rc/main/java/cn/wisenergy/mapper/ProgressPrizeMapper.java
+9
-0
ProgressPrizeMapper.xml
...-mapper/src/main/resources/mapper/ProgressPrizeMapper.xml
+16
-3
AccountManager.java
...ain/java/cn/wisenergy/service/Manager/AccountManager.java
+13
-3
AccountServiceImpl.java
...ava/cn/wisenergy/service/app/impl/AccountServiceImpl.java
+20
-11
MonthTaskServiceImpl.java
...a/cn/wisenergy/service/app/impl/MonthTaskServiceImpl.java
+18
-9
No files found.
wisenergy-mapper/src/main/java/cn/wisenergy/mapper/ProgressPrizeMapper.java
View file @
1c3070c3
...
@@ -35,4 +35,13 @@ public interface ProgressPrizeMapper extends BaseMapper<ProgressPrize> {
...
@@ -35,4 +35,13 @@ public interface ProgressPrizeMapper extends BaseMapper<ProgressPrize> {
* @return 最大进步奖用户列表
* @return 最大进步奖用户列表
*/
*/
List
<
ProgressPrizeVo
>
getByTime
(
@Param
(
"yearMonth"
)
String
yearMonth
);
List
<
ProgressPrizeVo
>
getByTime
(
@Param
(
"yearMonth"
)
String
yearMonth
);
/**
* 根据 userId 年月 获取月的最大进步奖用户
*
* @param yearMonth 年月
* @return 最大进步奖用户列表
*/
ProgressPrize
getByUserIdYearMonth
(
@Param
(
"userId"
)
String
userId
,
@Param
(
"yearMonth"
)
String
yearMonth
);
}
}
wisenergy-mapper/src/main/resources/mapper/ProgressPrizeMapper.xml
View file @
1c3070c3
...
@@ -79,9 +79,7 @@
...
@@ -79,9 +79,7 @@
<include
refid=
"table"
/>
<include
refid=
"table"
/>
<where>
<where>
<if
test=
"yearMonth != null"
>
<if
test=
"yearMonth != null"
>
AND(
`year_month` = #{yearMonth}
YEAR(`year_month`) = YEAR(#{yearMonth})
AND MONTH(`year_month`) = MONTH(#{yearMonth}))
</if>
</if>
</where>
</where>
</select>
</select>
...
@@ -96,4 +94,19 @@
...
@@ -96,4 +94,19 @@
order by p.`growth_rate` desc,p.award_money desc,u.create_time desc
order by p.`growth_rate` desc,p.award_money desc,u.create_time desc
</select>
</select>
<select
id=
"getByUserIdYearMonth"
resultType=
"cn.wisenergy.model.app.ProgressPrize"
>
select
<include
refid=
"cols_all"
/>
from
<include
refid=
"table"
/>
<where>
<if
test=
"userId != null and userId != ''"
>
user_id=#{userId}
</if>
<if
test=
"yearMonth != null"
>
and `year_month`= #{yearMonth}
</if>
</where>
</select>
</mapper>
</mapper>
\ No newline at end of file
wisenergy-service/src/main/java/cn/wisenergy/service/Manager/AccountManager.java
View file @
1c3070c3
...
@@ -263,7 +263,7 @@ public class AccountManager {
...
@@ -263,7 +263,7 @@ public class AccountManager {
*/
*/
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
Boolean
updateAccountAddRecordAddPrize
(
List
<
AccountInfo
>
accountInfoList
,
List
<
TradeRecord
>
recordList
,
public
Boolean
updateAccountAddRecordAddPrize
(
List
<
AccountInfo
>
accountInfoList
,
List
<
TradeRecord
>
recordList
,
List
<
ProgressPrize
>
p
rizeList
)
{
List
<
ProgressPrize
>
addPrizeList
,
List
<
ProgressPrize
>
updateP
rizeList
)
{
//更新月收益
//更新月收益
if
(!
CollectionUtils
.
isEmpty
(
accountInfoList
))
{
if
(!
CollectionUtils
.
isEmpty
(
accountInfoList
))
{
...
@@ -286,14 +286,24 @@ public class AccountManager {
...
@@ -286,14 +286,24 @@ public class AccountManager {
}
}
//新增最大进步奖信息
//新增最大进步奖信息
if
(!
CollectionUtils
.
isEmpty
(
p
rizeList
))
{
if
(!
CollectionUtils
.
isEmpty
(
addP
rizeList
))
{
for
(
ProgressPrize
progressPrize
:
p
rizeList
)
{
for
(
ProgressPrize
progressPrize
:
addP
rizeList
)
{
int
count
=
progressPrizeMapper
.
add
(
progressPrize
);
int
count
=
progressPrizeMapper
.
add
(
progressPrize
);
if
(
count
==
0
)
{
if
(
count
==
0
)
{
return
false
;
return
false
;
}
}
}
}
}
}
//编辑最大进步奖信息
if
(!
CollectionUtils
.
isEmpty
(
updatePrizeList
))
{
for
(
ProgressPrize
progressPrize
:
updatePrizeList
)
{
int
count
=
progressPrizeMapper
.
edit
(
progressPrize
);
if
(
count
==
0
)
{
return
false
;
}
}
}
return
true
;
return
true
;
}
}
...
...
wisenergy-service/src/main/java/cn/wisenergy/service/app/impl/AccountServiceImpl.java
View file @
1c3070c3
...
@@ -267,7 +267,8 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo>
...
@@ -267,7 +267,8 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo>
Double
twentyTotal
=
teamPerformanceMapper
.
countTwenty
(
yearMonth
);
Double
twentyTotal
=
teamPerformanceMapper
.
countTwenty
(
yearMonth
);
List
<
AccountInfo
>
accountInfoList
=
new
ArrayList
<>();
List
<
AccountInfo
>
accountInfoList
=
new
ArrayList
<>();
List
<
TradeRecord
>
tradeRecordList
=
new
ArrayList
<>();
List
<
TradeRecord
>
tradeRecordList
=
new
ArrayList
<>();
List
<
ProgressPrize
>
prizeList
=
new
ArrayList
<>();
List
<
ProgressPrize
>
addPrizeList
=
new
ArrayList
<>();
List
<
ProgressPrize
>
updatePrizeList
=
new
ArrayList
<>();
for
(
TeamPerformance
user
:
list
)
{
for
(
TeamPerformance
user
:
list
)
{
//获取最大进步奖 百分比
//获取最大进步奖 百分比
MemberPercent
memberPercent
=
memberPercentMapper
.
getByLevelAndType
(
user
.
getUserLevel
(),
MemberPercent
memberPercent
=
memberPercentMapper
.
getByLevelAndType
(
user
.
getUserLevel
(),
...
@@ -290,14 +291,21 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo>
...
@@ -290,14 +291,21 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo>
accountInfo
.
setEarningsTotal
(
earningsTotal
);
accountInfo
.
setEarningsTotal
(
earningsTotal
);
accountInfoList
.
add
(
accountInfo
);
accountInfoList
.
add
(
accountInfo
);
//添加最大进步奖信息
//添加最大进步奖信息 不存在:新增 存在,修改
ProgressPrize
prize
=
new
ProgressPrize
();
BigDecimal
awardMoney
=
new
BigDecimal
(
income
).
setScale
(
2
,
RoundingMode
.
HALF_UP
);
BigDecimal
awardMoney
=
new
BigDecimal
(
income
).
setScale
(
2
,
RoundingMode
.
HALF_UP
);
ProgressPrize
progressPrize
=
progressPrizeMapper
.
getByUserIdYearMonth
(
user
.
getUserId
(),
yearMonth
);
if
(
null
==
progressPrize
)
{
ProgressPrize
prize
=
new
ProgressPrize
();
prize
.
setAwardMoney
(
awardMoney
.
doubleValue
());
prize
.
setAwardMoney
(
awardMoney
.
doubleValue
());
prize
.
setUserId
(
user
.
getUserId
());
prize
.
setUserId
(
user
.
getUserId
());
prize
.
setGrowthRate
(
0.0
);
prize
.
setGrowthRate
(
0.0
);
prize
.
setYearMonth
(
yearMonth
);
prize
.
setYearMonth
(
yearMonth
);
prizeList
.
add
(
prize
);
addPrizeList
.
add
(
prize
);
}
else
{
progressPrize
.
setYearMonth
(
yearMonth
);
progressPrize
.
setAwardMoney
(
awardMoney
.
doubleValue
());
updatePrizeList
.
add
(
progressPrize
);
}
//添加交易流水记录
//添加交易流水记录
TradeRecord
tradeRecord
=
new
TradeRecord
();
TradeRecord
tradeRecord
=
new
TradeRecord
();
...
@@ -310,7 +318,8 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo>
...
@@ -310,7 +318,8 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo>
}
}
//更新账户信息,添加交易流水记录
//更新账户信息,添加交易流水记录
boolean
bool
=
accountManager
.
updateAccountAddRecordAddPrize
(
accountInfoList
,
tradeRecordList
,
prizeList
);
boolean
bool
=
accountManager
.
updateAccountAddRecordAddPrize
(
accountInfoList
,
tradeRecordList
,
addPrizeList
,
updatePrizeList
);
if
(!
bool
)
{
if
(!
bool
)
{
return
R
.
ok
(
1
,
false
);
return
R
.
ok
(
1
,
false
);
}
}
...
@@ -400,7 +409,7 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo>
...
@@ -400,7 +409,7 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo>
//计算收益
//计算收益
double
teamMoney
=
(
moneyMonth
+
lastMonthAward
)
*
3980
*
percent
*
month
;
double
teamMoney
=
(
moneyMonth
+
lastMonthAward
)
*
3980
*
percent
*
month
;
DecimalFormat
df
=
new
DecimalFormat
(
"######0.00"
);
DecimalFormat
df
=
new
DecimalFormat
(
"######0.00"
);
double
income
=
Double
.
parseDouble
(
df
.
format
(
teamMoney
/
teamTotal
));
double
income
=
Double
.
parseDouble
(
df
.
format
(
teamMoney
/
teamTotal
));
//获取账户信息
//获取账户信息
AccountInfo
accountInfo
=
accountMapper
.
getByUserId
(
user
.
getUserId
());
AccountInfo
accountInfo
=
accountMapper
.
getByUserId
(
user
.
getUserId
());
...
...
wisenergy-service/src/main/java/cn/wisenergy/service/app/impl/MonthTaskServiceImpl.java
View file @
1c3070c3
...
@@ -219,7 +219,8 @@ public class MonthTaskServiceImpl implements MonthTaskService {
...
@@ -219,7 +219,8 @@ public class MonthTaskServiceImpl implements MonthTaskService {
Double
twentyTotal
=
teamPerformanceMapper
.
countTwenty
(
lastMonth
);
Double
twentyTotal
=
teamPerformanceMapper
.
countTwenty
(
lastMonth
);
List
<
AccountInfo
>
accountInfoList
=
new
ArrayList
<>();
List
<
AccountInfo
>
accountInfoList
=
new
ArrayList
<>();
List
<
TradeRecord
>
tradeRecordList
=
new
ArrayList
<>();
List
<
TradeRecord
>
tradeRecordList
=
new
ArrayList
<>();
List
<
ProgressPrize
>
prizeList
=
new
ArrayList
<>();
List
<
ProgressPrize
>
addPrizeList
=
new
ArrayList
<>();
List
<
ProgressPrize
>
updatePrizeList
=
new
ArrayList
<>();
for
(
TeamPerformance
user
:
list
)
{
for
(
TeamPerformance
user
:
list
)
{
//获取最大进步奖 百分比
//获取最大进步奖 百分比
MemberPercent
memberPercent
=
memberPercentMapper
.
getByLevelAndType
(
user
.
getUserLevel
(),
3
);
MemberPercent
memberPercent
=
memberPercentMapper
.
getByLevelAndType
(
user
.
getUserLevel
(),
3
);
...
@@ -239,14 +240,21 @@ public class MonthTaskServiceImpl implements MonthTaskService {
...
@@ -239,14 +240,21 @@ public class MonthTaskServiceImpl implements MonthTaskService {
accountInfo
.
setEarningsTotal
(
earningsTotal
.
setScale
(
2
,
RoundingMode
.
HALF_UP
));
accountInfo
.
setEarningsTotal
(
earningsTotal
.
setScale
(
2
,
RoundingMode
.
HALF_UP
));
accountInfoList
.
add
(
accountInfo
);
accountInfoList
.
add
(
accountInfo
);
//添加最大进步奖信息
//添加最大进步奖信息 不存在:新增 存在,修改
ProgressPrize
prize
=
new
ProgressPrize
();
BigDecimal
awardMoney
=
new
BigDecimal
(
income
).
setScale
(
2
,
RoundingMode
.
HALF_UP
);
BigDecimal
awardMoney
=
new
BigDecimal
(
income
).
setScale
(
2
,
RoundingMode
.
HALF_UP
);
ProgressPrize
progressPrize
=
progressPrizeMapper
.
getByUserIdYearMonth
(
user
.
getUserId
(),
lastMonth
);
if
(
null
==
progressPrize
)
{
ProgressPrize
prize
=
new
ProgressPrize
();
prize
.
setAwardMoney
(
awardMoney
.
doubleValue
());
prize
.
setAwardMoney
(
awardMoney
.
doubleValue
());
prize
.
setUserId
(
user
.
getUserId
());
prize
.
setUserId
(
user
.
getUserId
());
prize
.
setGrowthRate
(
0.0
);
prize
.
setGrowthRate
(
0.0
);
prize
.
setYearMonth
(
lastMonth
);
prize
.
setYearMonth
(
lastMonth
);
prizeList
.
add
(
prize
);
addPrizeList
.
add
(
prize
);
}
else
{
progressPrize
.
setYearMonth
(
lastMonth
);
progressPrize
.
setAwardMoney
(
awardMoney
.
doubleValue
());
updatePrizeList
.
add
(
progressPrize
);
}
//添加交易流水记录
//添加交易流水记录
TradeRecord
tradeRecord
=
new
TradeRecord
();
TradeRecord
tradeRecord
=
new
TradeRecord
();
...
@@ -259,7 +267,8 @@ public class MonthTaskServiceImpl implements MonthTaskService {
...
@@ -259,7 +267,8 @@ public class MonthTaskServiceImpl implements MonthTaskService {
}
}
//更新账户信息,添加交易流水记录
//更新账户信息,添加交易流水记录
boolean
bool
=
accountManager
.
updateAccountAddRecordAddPrize
(
accountInfoList
,
tradeRecordList
,
prizeList
);
boolean
bool
=
accountManager
.
updateAccountAddRecordAddPrize
(
accountInfoList
,
tradeRecordList
,
addPrizeList
,
updatePrizeList
);
if
(!
bool
)
{
if
(!
bool
)
{
return
R
.
ok
(
1
,
false
);
return
R
.
ok
(
1
,
false
);
}
}
...
...
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