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
b200d473
Commit
b200d473
authored
Mar 22, 2021
by
licc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增运营中心补贴月定时任务
parent
f7d325bc
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
96 additions
and
11 deletions
+96
-11
TeamPerformanceMapper.java
.../main/java/cn/wisenergy/mapper/TeamPerformanceMapper.java
+5
-0
TradeRecordEnum.java
...c/main/java/cn/wisenergy/model/enums/TradeRecordEnum.java
+3
-1
MonthTaskService.java
.../main/java/cn/wisenergy/service/app/MonthTaskService.java
+12
-4
BankServiceImpl.java
...n/java/cn/wisenergy/service/app/impl/BankServiceImpl.java
+0
-2
MonthTaskServiceImpl.java
...a/cn/wisenergy/service/app/impl/MonthTaskServiceImpl.java
+69
-3
MonthTaskController.java
...senergy/web/admin/controller/app/MonthTaskController.java
+7
-1
No files found.
wisenergy-mapper/src/main/java/cn/wisenergy/mapper/TeamPerformanceMapper.java
View file @
b200d473
...
...
@@ -21,6 +21,11 @@ public interface TeamPerformanceMapper extends BaseMapper<TeamPerformance> {
*/
int
edit
(
TeamPerformance
teamPerformance
);
/**
* 删除
* @param id 主键ID
* @return 1
*/
int
delById
(
@Param
(
"id"
)
Integer
id
);
/**
...
...
wisenergy-model/src/main/java/cn/wisenergy/model/enums/TradeRecordEnum.java
View file @
b200d473
...
...
@@ -22,7 +22,9 @@ public enum TradeRecordEnum {
SALARY_REWARD
(
6
,
"工资奖励"
),
PROGRESS_PRIZE
(
7
,
"最大进步奖"
);
PROGRESS_PRIZE
(
7
,
"最大进步奖"
),
RUN_CENTER_SUBSIDY
(
8
,
"运营中心补贴"
);
private
Integer
code
;
private
String
desc
;
...
...
wisenergy-service/src/main/java/cn/wisenergy/service/app/MonthTaskService.java
View file @
b200d473
...
...
@@ -3,16 +3,17 @@ package cn.wisenergy.service.app;
import
cn.wisenergy.common.utils.R
;
/**
*@ Description: 月定时任务接口定义
*@ Author : 86187
*@ Date : 2021/3/10 10:22
* @author 86187
* @ Description: 月定时任务接口定义
* @ Author : 86187
* @ Date : 2021/3/10 10:22
*/
public
interface
MonthTaskService
{
/**
* 收益和业绩统计(月度肥料)-月任务
*
* @return true or false
*/
R
<
Boolean
>
performanceCount
();
...
...
@@ -28,4 +29,11 @@ public interface MonthTaskService {
* 账户表镜像---每月更新一次,保存上一个的数据
*/
void
mirrorImage
();
/**
* 运营中心补贴
*
* @return true or false
*/
R
<
Boolean
>
runCenterSubsidy
();
}
wisenergy-service/src/main/java/cn/wisenergy/service/app/impl/BankServiceImpl.java
View file @
b200d473
...
...
@@ -11,8 +11,6 @@ import cn.wisenergy.service.app.BankService;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.Validate
;
import
org.apache.poi.ss.formula.functions.T
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
...
...
wisenergy-service/src/main/java/cn/wisenergy/service/app/impl/MonthTaskServiceImpl.java
View file @
b200d473
...
...
@@ -268,7 +268,7 @@ public class MonthTaskServiceImpl implements MonthTaskService {
//更新账户信息,添加交易流水记录
boolean
bool
=
accountManager
.
updateAccountAddRecordAddPrize
(
accountInfoList
,
tradeRecordList
,
addPrizeList
,
updatePrizeList
);
addPrizeList
,
updatePrizeList
);
if
(!
bool
)
{
return
R
.
ok
(
1
,
false
);
}
...
...
@@ -323,6 +323,72 @@ public class MonthTaskServiceImpl implements MonthTaskService {
lastAccountMapper
.
deleteTable
(
"month_account_image"
);
}
@Override
public
R
<
Boolean
>
runCenterSubsidy
()
{
log
.
info
(
"shop-mall[]MonthTaskServiceImpl[]runCenterSubsidy[]input.method"
);
//1、获取所有等级是西田森合伙人的用户
List
<
User
>
list
=
usersMapper
.
getByLevel
(
UserLevelEnum
.
PARTNER
.
getCode
());
if
(
CollectionUtils
.
isEmpty
(
list
))
{
return
R
.
ok
(
0
,
true
);
}
//2、获取每个用户上月的团队业绩
Date
date
=
DateUtil
.
getLastMonth
(
new
Date
());
String
yearMonth
=
DateUtil
.
convertDateToStr
(
date
,
"yyyy-MM"
);
//获取运营中心补贴比例
MemberPercent
memberPercent
=
memberPercentMapper
.
getByLevelAndType
(
UserLevelEnum
.
PARTNER
.
getCode
(),
MemberPercentEnum
.
RUN_CENTER_SUBSIDY
.
getCode
());
if
(
null
==
memberPercent
)
{
return
R
.
error
(
"无运营中心补贴比例,请联系管理员添加!"
);
}
List
<
AccountInfo
>
accountInfoList
=
new
ArrayList
<>();
List
<
TradeRecord
>
tradeRecordList
=
new
ArrayList
<>();
for
(
User
user
:
list
)
{
//获取团队业绩
TeamPerformance
teamPerformance
=
teamPerformanceMapper
.
getByUserIdAndTime
(
user
.
getUserId
(),
yearMonth
);
if
(
null
==
teamPerformance
)
{
continue
;
}
//获取账户信息
AccountInfo
accountInfo
=
accountMapper
.
getByUserId
(
user
.
getUserId
());
if
(
null
==
accountInfo
)
{
continue
;
}
//计算运营中心补贴
BigDecimal
money
=
teamPerformance
.
getMonthTeamPerformance
().
multiply
(
memberPercent
.
getPercent
());
BigDecimal
resultMoney
=
money
.
setScale
(
2
,
RoundingMode
.
HALF_UP
);
BigDecimal
extractMoney
=
accountInfo
.
getExtractMoney
().
add
(
resultMoney
);
accountInfo
.
setExtractMoney
(
extractMoney
);
BigDecimal
earningsMonth
=
accountInfo
.
getEarningsMonth
().
add
(
resultMoney
);
accountInfo
.
setExtractMoney
(
earningsMonth
);
BigDecimal
earningsTotal
=
accountInfo
.
getEarningsTotal
().
add
(
resultMoney
);
accountInfo
.
setEarningsTotal
(
earningsTotal
);
accountInfoList
.
add
(
accountInfo
);
//添加交易流水记录
TradeRecord
tradeRecord
=
new
TradeRecord
();
tradeRecord
.
setUserId
(
user
.
getUserId
());
tradeRecord
.
setTradeType
(
TradeRecordEnum
.
RUN_CENTER_SUBSIDY
.
getCode
());
tradeRecord
.
setTradeNo
(
null
);
tradeRecord
.
setStatus
(
TradeStatusEnum
.
ALREADY_SETTLE_ACCOUNTS
.
getCode
());
tradeRecordList
.
add
(
tradeRecord
);
}
//修改账户信息和保存交易记录
boolean
bool
=
accountManager
.
updateAccountAddRecord
(
accountInfoList
,
tradeRecordList
);
if
(!
bool
)
{
return
R
.
ok
(
1
,
false
);
}
return
R
.
ok
(
0
,
true
);
}
/**
* 如果会员等级是黄金以上,计算月度收益
...
...
@@ -382,7 +448,7 @@ public class MonthTaskServiceImpl implements MonthTaskService {
//获取账户信息
AccountInfo
accountInfo
=
accountMapper
.
getByUserId
(
user
.
getUserId
());
BigDecimal
bigDecimal
=
new
BigDecimal
(
income
).
setScale
(
2
,
RoundingMode
.
HALF_UP
);
BigDecimal
bigDecimal
=
new
BigDecimal
(
income
).
setScale
(
2
,
RoundingMode
.
HALF_UP
);
BigDecimal
performanceMonth
=
accountInfo
.
getEarningsMonth
().
add
(
bigDecimal
);
accountInfo
.
setEarningsMonth
(
performanceMonth
.
setScale
(
2
,
RoundingMode
.
HALF_UP
));
...
...
@@ -589,6 +655,6 @@ public class MonthTaskServiceImpl implements MonthTaskService {
//修改或保存最大进步奖信息
// flag 1: 日定时任务 2:月定时任务
int
flag
=
2
;
return
accountManager
.
updateOrSavePrize
(
listVo
,
updateAccountList
,
prizes
,
flag
);
return
accountManager
.
updateOrSavePrize
(
listVo
,
updateAccountList
,
prizes
,
flag
);
}
}
\ No newline at end of file
wisenergy-web-admin/src/main/java/cn/wisenergy/web/admin/controller/app/MonthTaskController.java
View file @
b200d473
...
...
@@ -33,7 +33,7 @@ public class MonthTaskController {
return
monthTaskService
.
progressPrizeCount
();
}
@ApiOperation
(
value
=
""
,
notes
=
"账户表镜像---每月更新一次,保存上一个的数据"
,
httpMethod
=
"GET"
)
@ApiOperation
(
value
=
"
账户表镜像
"
,
notes
=
"账户表镜像---每月更新一次,保存上一个的数据"
,
httpMethod
=
"GET"
)
@GetMapping
(
"/mirrorImage"
)
public
R
<
String
>
mirrorImage
()
{
monthTaskService
.
mirrorImage
();
...
...
@@ -41,4 +41,10 @@ public class MonthTaskController {
}
@ApiOperation
(
value
=
"运营中心补贴"
,
notes
=
"运营中心补贴"
,
httpMethod
=
"GET"
)
@GetMapping
(
"/runCenterSubsidy"
)
public
R
<
Boolean
>
runCenterSubsidy
()
{
return
monthTaskService
.
runCenterSubsidy
();
}
}
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