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
393f95f5
Commit
393f95f5
authored
Mar 16, 2021
by
m1991
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
09098a4e
69fc9a94
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
16 deletions
+35
-16
AccountManager.java
...ain/java/cn/wisenergy/service/Manager/AccountManager.java
+14
-5
MonthTaskServiceImpl.java
...a/cn/wisenergy/service/app/impl/MonthTaskServiceImpl.java
+21
-11
No files found.
wisenergy-service/src/main/java/cn/wisenergy/service/Manager/AccountManager.java
View file @
393f95f5
...
...
@@ -260,12 +260,12 @@ public class AccountManager {
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
Boolean
updateAccountAddRecordAndManure
(
List
<
AccountInfo
>
accountInfoList
,
List
<
TradeRecord
>
recordList
,
MonthManure
manure
)
{
MonthManure
manure
,
MonthManure
monthManure
)
{
//更新月收益
if
(!
CollectionUtils
.
isEmpty
(
accountInfoList
))
{
for
(
AccountInfo
accountInfo
:
accountInfoList
)
{
int
count
=
accountMapper
.
updateById
(
accountInfo
);
int
count
=
accountMapper
.
edit
(
accountInfo
);
if
(
count
==
0
)
{
return
false
;
}
...
...
@@ -282,8 +282,17 @@ public class AccountManager {
}
}
//新增上月剩余月度肥料奖金
int
count
=
monthManureMapper
.
add
(
manure
);
return
count
!=
0
;
//判断是否存在月度肥料奖金信息
if
(
null
==
monthManure
)
{
//新增上月剩余月度肥料奖金
int
count
=
monthManureMapper
.
add
(
manure
);
return
count
!=
0
;
}
else
{
//编辑
monthManure
.
setManureAward
(
manure
.
getManureAward
());
monthManure
.
setYearMonth
(
manure
.
getYearMonth
());
int
count
=
monthManureMapper
.
edit
(
monthManure
);
return
count
!=
0
;
}
}
}
wisenergy-service/src/main/java/cn/wisenergy/service/app/impl/MonthTaskServiceImpl.java
View file @
393f95f5
...
...
@@ -20,6 +20,7 @@ import org.springframework.stereotype.Service;
import
org.springframework.util.CollectionUtils
;
import
java.math.BigDecimal
;
import
java.math.RoundingMode
;
import
java.util.*
;
/**
...
...
@@ -325,19 +326,22 @@ public class MonthTaskServiceImpl implements MonthTaskService {
* @return
*/
private
boolean
monthlyIncome
(
BigDecimal
totalMoney
,
List
<
User
>
userList
)
{
double
total
=
totalMoney
.
doubleValue
();
Date
date
=
new
Date
(
);
//上月
Date
date
=
DateUtil
.
getLastMonth
(
new
Date
()
);
String
lastMonth
=
DateUtil
.
convertDateToStr
(
date
,
PATTERN
);
//上上月
String
time
=
DateUtil
.
convertDateToStr
(
date
,
"yyyy-MM-dd"
);
Date
timeString
=
DateUtil
.
convertStrToDate
(
time
,
"yyyy-MM-dd"
);
Date
lastAndLast
=
DateUtil
.
getLastMonth
(
timeString
);
String
yearMonthTime
=
DateUtil
.
convertDateToStr
(
lastAndLast
,
PATTERN
);
//当月所有人订单成交总金额/3980/12 向下取整
double
total
=
totalMoney
.
doubleValue
();
double
moneyMonth
=
Math
.
floor
(
total
/
3980
/
12
);
List
<
AccountInfo
>
accountInfoList
=
new
ArrayList
<>();
List
<
TradeRecord
>
tradeRecordList
=
new
ArrayList
<>();
//获取上上月未分配完的奖金
double
lastMonthAward
;
Date
lastAndLast
=
DateUtil
.
convertStrToDate
(
lastMonth
,
"yyyy-MM-dd"
);
String
yearMonthTime
=
DateUtil
.
convertDateToStr
(
lastAndLast
,
PATTERN
);
MonthManure
monthManure
=
monthManureMapper
.
queryByTime
(
yearMonthTime
);
if
(
null
==
monthManure
)
{
lastMonthAward
=
0.00
;
...
...
@@ -346,9 +350,13 @@ public class MonthTaskServiceImpl implements MonthTaskService {
}
moneyMonth
=
moneyMonth
+
lastMonthAward
;
//判断每个等级是否都有用户,没有用户的,记录下剩余奖金
//
1、
判断每个等级是否都有用户,没有用户的,记录下剩余奖金
MonthManure
manure
=
checkUserLevel
(
moneyMonth
);
//获取上月是否有月度剩余奖金信息
MonthManure
lastMonthManure
=
monthManureMapper
.
queryByTime
(
lastMonth
);
List
<
AccountInfo
>
accountInfoList
=
new
ArrayList
<>();
List
<
TradeRecord
>
tradeRecordList
=
new
ArrayList
<>();
for
(
User
user
:
userList
)
{
if
(
moneyMonth
!=
0
)
{
//获取等级优惠百分比
...
...
@@ -370,10 +378,10 @@ public class MonthTaskServiceImpl implements MonthTaskService {
AccountInfo
accountInfo
=
accountMapper
.
getByUserId
(
user
.
getUserId
());
BigDecimal
bigDecimal
=
new
BigDecimal
(
income
);
BigDecimal
performanceMonth
=
accountInfo
.
getEarningsMonth
().
add
(
bigDecimal
);
accountInfo
.
setEarningsMonth
(
performanceMonth
);
accountInfo
.
setEarningsMonth
(
performanceMonth
.
setScale
(
2
,
RoundingMode
.
HALF_UP
)
);
BigDecimal
performanceTotal
=
accountInfo
.
getEarningsMonth
().
add
(
bigDecimal
);
accountInfo
.
setEarningsMonth
(
performanceTotal
);
accountInfo
.
setEarningsMonth
(
performanceTotal
.
setScale
(
2
,
RoundingMode
.
HALF_UP
)
);
accountInfoList
.
add
(
accountInfo
);
...
...
@@ -382,6 +390,8 @@ public class MonthTaskServiceImpl implements MonthTaskService {
tradeRecord
.
setUserId
(
user
.
getUserId
());
tradeRecord
.
setTradeType
(
TradeRecordEnum
.
MONTHLY_FERTILIZER
.
getCode
());
tradeRecord
.
setTradeNo
(
null
);
BigDecimal
big
=
new
BigDecimal
(
income
);
tradeRecord
.
setMoney
(
big
.
setScale
(
2
,
RoundingMode
.
HALF_UP
));
tradeRecord
.
setStatus
(
TradeStatusEnum
.
ALREADY_SETTLE_ACCOUNTS
.
getCode
());
tradeRecordList
.
add
(
tradeRecord
);
}
...
...
@@ -389,7 +399,7 @@ public class MonthTaskServiceImpl implements MonthTaskService {
}
}
//更新账户信息,新增交易流水记录
return
accountManager
.
updateAccountAddRecordAndManure
(
accountInfoList
,
tradeRecordList
,
manure
);
return
accountManager
.
updateAccountAddRecordAndManure
(
accountInfoList
,
tradeRecordList
,
manure
,
lastMonthManure
);
}
/**
...
...
@@ -435,7 +445,7 @@ public class MonthTaskServiceImpl implements MonthTaskService {
//3、判断是否有森林之星等级的用户
List
<
User
>
startList
=
usersMapper
.
getByLevel
(
UserLevelEnum
.
FOREST_START
.
getCode
());
if
(
CollectionUtils
.
isEmpty
(
startList
))
{
if
(
!
CollectionUtils
.
isEmpty
(
startList
))
{
//获取等级优惠百分比
MemberPercent
memberPercent
=
memberPercentMapper
.
getByLevelAndType
(
UserLevelEnum
.
FOREST_START
.
getCode
(),
MemberPercentEnum
.
MONTH_MANURE
.
getCode
());
...
...
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