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
59314805
Commit
59314805
authored
Mar 25, 2021
by
licc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增账户列表接口
parent
a91bd0a8
Show whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
906 additions
and
551 deletions
+906
-551
AccountMapper.java
...pper/src/main/java/cn/wisenergy/mapper/AccountMapper.java
+16
-0
MemberPercentMapper.java
...rc/main/java/cn/wisenergy/mapper/MemberPercentMapper.java
+16
-0
AccountInfoMapper.xml
...gy-mapper/src/main/resources/mapper/AccountInfoMapper.xml
+15
-0
MemberPercentMapper.xml
...-mapper/src/main/resources/mapper/MemberPercentMapper.xml
+15
-0
MemberPercent.java
...l/src/main/java/cn/wisenergy/model/app/MemberPercent.java
+3
-3
AccountInfoQuery.java
...rc/main/java/cn/wisenergy/model/dto/AccountInfoQuery.java
+29
-0
MemberPercentQuery.java
.../main/java/cn/wisenergy/model/dto/MemberPercentQuery.java
+29
-0
AccountService.java
...rc/main/java/cn/wisenergy/service/app/AccountService.java
+6
-27
DayTaskService.java
...rc/main/java/cn/wisenergy/service/app/DayTaskService.java
+41
-0
MemberPercentService.java
...n/java/cn/wisenergy/service/app/MemberPercentService.java
+19
-0
AccountServiceImpl.java
...ava/cn/wisenergy/service/app/impl/AccountServiceImpl.java
+41
-505
DayTaskServiceImpl.java
...ava/cn/wisenergy/service/app/impl/DayTaskServiceImpl.java
+549
-0
MemberPercentServiceImpl.java
.../wisenergy/service/app/impl/MemberPercentServiceImpl.java
+69
-0
MonthTaskServiceImpl.java
...a/cn/wisenergy/service/app/impl/MonthTaskServiceImpl.java
+3
-2
AccountController.java
...wisenergy/web/admin/controller/app/AccountController.java
+17
-11
MemberController.java
.../wisenergy/web/admin/controller/app/MemberController.java
+38
-0
SysUserController.java
...wisenergy/web/admin/controller/app/SysUserController.java
+0
-3
No files found.
wisenergy-mapper/src/main/java/cn/wisenergy/mapper/AccountMapper.java
View file @
59314805
...
@@ -5,6 +5,9 @@ import cn.wisenergy.model.app.AccountInfo;
...
@@ -5,6 +5,9 @@ import cn.wisenergy.model.app.AccountInfo;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
import
java.util.Map
;
/**
/**
* @author 86187
* @author 86187
*/
*/
...
@@ -57,4 +60,17 @@ public interface AccountMapper extends BaseMapper<AccountInfo> {
...
@@ -57,4 +60,17 @@ public interface AccountMapper extends BaseMapper<AccountInfo> {
* @return
* @return
*/
*/
int
updateEarningsMonthAndEarningsTotalByid
(
AccountInfo
accountInfo
);
int
updateEarningsMonthAndEarningsTotalByid
(
AccountInfo
accountInfo
);
/**
* 统计
* @return 数量
*/
int
count
();
/**
* 获取账户列表
* @param map 条件
* @return 账户列表
*/
List
<
AccountInfo
>
getList
(
Map
<
String
,
Object
>
map
);
}
}
wisenergy-mapper/src/main/java/cn/wisenergy/mapper/MemberPercentMapper.java
View file @
59314805
...
@@ -4,6 +4,9 @@ import cn.wisenergy.model.app.MemberPercent;
...
@@ -4,6 +4,9 @@ import cn.wisenergy.model.app.MemberPercent;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
import
java.util.Map
;
/**
/**
* @author 86187
* @author 86187
*/
*/
...
@@ -39,4 +42,17 @@ public interface MemberPercentMapper extends BaseMapper<MemberPercent> {
...
@@ -39,4 +42,17 @@ public interface MemberPercentMapper extends BaseMapper<MemberPercent> {
*/
*/
MemberPercent
getByLevelAndType
(
@Param
(
"userLevel"
)
Integer
userLevel
,
@Param
(
"type"
)
Integer
type
);
MemberPercent
getByLevelAndType
(
@Param
(
"userLevel"
)
Integer
userLevel
,
@Param
(
"type"
)
Integer
type
);
/**
* 统计条数
* @return 条数
*/
int
count
();
/**
* 获取会员优惠比列
* @param map 参数条件
* @return 列表
*/
List
<
MemberPercent
>
getList
(
Map
<
String
,
Object
>
map
);
}
}
wisenergy-mapper/src/main/resources/mapper/AccountInfoMapper.xml
View file @
59314805
...
@@ -108,6 +108,21 @@
...
@@ -108,6 +108,21 @@
</where>
</where>
</select>
</select>
<select
id=
"count"
resultType=
"java.lang.Integer"
>
select count(1)
from
<include
refid=
"table"
/>
</select>
<select
id=
"getList"
resultType=
"cn.wisenergy.model.app.AccountInfo"
>
select
<include
refid=
"cols_all"
/>
from
<include
refid=
"table"
/>
order by create_time desc
limit #{startNum},#{endNum}
</select>
<update
id=
"updateEarningsMonthAndEarningsTotalByid"
parameterType=
"cn.wisenergy.model.app.AccountInfo"
>
<update
id=
"updateEarningsMonthAndEarningsTotalByid"
parameterType=
"cn.wisenergy.model.app.AccountInfo"
>
UPDATE
UPDATE
<include
refid=
"table"
/>
<include
refid=
"table"
/>
...
...
wisenergy-mapper/src/main/resources/mapper/MemberPercentMapper.xml
View file @
59314805
...
@@ -83,4 +83,19 @@
...
@@ -83,4 +83,19 @@
</where>
</where>
</select>
</select>
<select
id=
"count"
resultType=
"java.lang.Integer"
>
select count(1)
from
<include
refid=
"table"
/>
</select>
<select
id=
"getList"
resultType=
"cn.wisenergy.model.app.MemberPercent"
>
select
<include
refid=
"cols_all"
/>
from
<include
refid=
"table"
/>
order by create_time desc
limit #{startNum},#{endNum}
</select>
</mapper>
</mapper>
wisenergy-model/src/main/java/cn/wisenergy/model/app/MemberPercent.java
View file @
59314805
...
@@ -38,18 +38,18 @@ public class MemberPercent implements Serializable {
...
@@ -38,18 +38,18 @@ public class MemberPercent implements Serializable {
/**
/**
* 等级对应的返佣比例
* 等级对应的返佣比例
*/
*/
@ApiModelProperty
(
name
=
"
"
,
value
=
"
"
)
@ApiModelProperty
(
name
=
"
percent"
,
value
=
"等级对应的返佣比例
"
)
private
BigDecimal
percent
;
private
BigDecimal
percent
;
/**
/**
* 创建时间
* 创建时间
*/
*/
@ApiModelProperty
(
name
=
"
"
,
value
=
"
"
)
@ApiModelProperty
(
name
=
"
createTime"
,
value
=
"创建时间
"
)
private
Date
createTime
;
private
Date
createTime
;
/**
/**
* 更新时间
* 更新时间
*/
*/
@ApiModelProperty
(
name
=
"
"
,
value
=
"
"
)
@ApiModelProperty
(
name
=
"
updateTime"
,
value
=
"更新时间
"
)
private
Date
updateTime
;
private
Date
updateTime
;
}
}
wisenergy-model/src/main/java/cn/wisenergy/model/dto/AccountInfoQuery.java
0 → 100644
View file @
59314805
package
cn
.
wisenergy
.
model
.
dto
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
/**
* @author 86187
*/
@Data
@ApiModel
(
"AccountInfoQuery"
)
public
class
AccountInfoQuery
{
/**
* 页码
*/
@ApiModelProperty
(
value
=
"页码"
,
name
=
"pageNo"
)
private
Integer
pageNo
;
/**
* 页条数
*/
@ApiModelProperty
(
value
=
"页条数"
,
name
=
"pageSize"
)
private
Integer
pageSize
;
private
Integer
startNum
;
private
Integer
endNum
;
}
wisenergy-model/src/main/java/cn/wisenergy/model/dto/MemberPercentQuery.java
0 → 100644
View file @
59314805
package
cn
.
wisenergy
.
model
.
dto
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
/**
* @author 86187
*/
@Data
@ApiModel
(
"MemberPercentQuery"
)
public
class
MemberPercentQuery
{
/**
* 页码
*/
@ApiModelProperty
(
value
=
"页码"
,
name
=
"pageNo"
)
private
Integer
pageNo
;
/**
* 页条数
*/
@ApiModelProperty
(
value
=
"页条数"
,
name
=
"pageSize"
)
private
Integer
pageSize
;
private
Integer
startNum
;
private
Integer
endNum
;
}
wisenergy-service/src/main/java/cn/wisenergy/service/app/AccountService.java
View file @
59314805
...
@@ -3,21 +3,15 @@ package cn.wisenergy.service.app;
...
@@ -3,21 +3,15 @@ package cn.wisenergy.service.app;
import
cn.wisenergy.common.utils.R
;
import
cn.wisenergy.common.utils.R
;
import
cn.wisenergy.model.app.AccountInfo
;
import
cn.wisenergy.model.app.AccountInfo
;
import
cn.wisenergy.model.app.User
;
import
cn.wisenergy.model.dto.AccountInfoQuery
;
import
com.github.pagehelper.PageInfo
;
import
java.util.List
;
/**
/**
* @author 86187
* @author 86187
*/
*/
public
interface
AccountService
{
public
interface
AccountService
{
/**
* 订单返佣-日任务
* @return true or false
*/
R
<
Boolean
>
orderRebate
();
/**
/**
* 获取账户信息
* 获取账户信息
*
*
...
@@ -27,24 +21,9 @@ public interface AccountService {
...
@@ -27,24 +21,9 @@ public interface AccountService {
R
<
AccountInfo
>
getByUserId
(
String
userId
);
R
<
AccountInfo
>
getByUserId
(
String
userId
);
/**
/**
* 收益和业绩统计(月度肥料 -日)
* 获取账户列表
* @return true or false
* @param query 查询条件
*/
* @return 账户列表
R
<
Boolean
>
performanceCount
();
/**
* 获取用户的商机信息
*
* @param userId 用户id
* @return 用户商机列表
*/
List
<
User
>
getByList
(
String
userId
);
/**
* 进步奖收益统计(最大进步奖) -日任务
*
* @return true or false
*/
*/
R
<
Boolean
>
progressPrizeCount
(
);
R
<
PageInfo
<
AccountInfo
>>
getList
(
AccountInfoQuery
query
);
}
}
wisenergy-service/src/main/java/cn/wisenergy/service/app/DayTaskService.java
0 → 100644
View file @
59314805
package
cn
.
wisenergy
.
service
.
app
;
import
cn.wisenergy.common.utils.R
;
import
cn.wisenergy.model.app.User
;
import
java.util.List
;
/**
*@ Description: 日定时任务
*@ Author : 86187
*@ Date : 2021/3/25 15:09
* @author 86187
*/
public
interface
DayTaskService
{
/**
* 订单返佣-日任务
* @return true or false
*/
R
<
Boolean
>
orderRebate
();
/**
* 收益和业绩统计(月度肥料 -日)
* @return true or false
*/
R
<
Boolean
>
performanceCount
();
/**
* 获取用户的商机信息
*
* @param userId 用户id
* @return 用户商机列表
*/
List
<
User
>
getByList
(
String
userId
);
/**
* 进步奖收益统计(最大进步奖) -日任务
*
* @return true or false
*/
R
<
Boolean
>
progressPrizeCount
();
}
wisenergy-service/src/main/java/cn/wisenergy/service/app/MemberPercentService.java
0 → 100644
View file @
59314805
package
cn
.
wisenergy
.
service
.
app
;
import
cn.wisenergy.common.utils.R
;
import
cn.wisenergy.model.app.MemberPercent
;
import
cn.wisenergy.model.dto.MemberPercentQuery
;
import
com.github.pagehelper.PageInfo
;
/**
* @author 86187
*/
public
interface
MemberPercentService
{
/**
* 获取会员等级优惠比列列表
* @param query 条件
* @return 优惠比列列表
*/
R
<
PageInfo
<
MemberPercent
>>
getList
(
MemberPercentQuery
query
);
}
wisenergy-service/src/main/java/cn/wisenergy/service/app/impl/AccountServiceImpl.java
View file @
59314805
package
cn
.
wisenergy
.
service
.
app
.
impl
;
package
cn
.
wisenergy
.
service
.
app
.
impl
;
import
cn.wisenergy.common.constant.CommonAttributes
;
import
cn.wisenergy.common.utils.DateUtil
;
import
cn.wisenergy.common.utils.DateUtil
;
import
cn.wisenergy.common.utils.R
;
import
cn.wisenergy.common.utils.R
;
import
cn.wisenergy.mapper.*
;
import
cn.wisenergy.mapper.*
;
import
cn.wisenergy.model.app.*
;
import
cn.wisenergy.model.app.*
;
import
cn.wisenergy.model.dto.AccountInfoQuery
;
import
cn.wisenergy.model.dto.MemberPercentQuery
;
import
cn.wisenergy.model.enums.*
;
import
cn.wisenergy.model.enums.*
;
import
cn.wisenergy.model.vo.TeamPerformanceSortVo
;
import
cn.wisenergy.model.vo.TeamPerformanceSortVo
;
import
cn.wisenergy.service.Manager.PublicManager
;
import
cn.wisenergy.service.Manager.PublicManager
;
import
cn.wisenergy.service.app.AccountService
;
import
cn.wisenergy.service.app.AccountService
;
import
cn.wisenergy.service.Manager.AccountManager
;
import
cn.wisenergy.service.Manager.AccountManager
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.github.pagehelper.PageInfo
;
import
com.xxl.job.core.handler.annotation.XxlJob
;
import
com.xxl.job.core.handler.annotation.XxlJob
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
...
@@ -32,526 +36,58 @@ import java.util.*;
...
@@ -32,526 +36,58 @@ import java.util.*;
@Service
@Service
public
class
AccountServiceImpl
extends
ServiceImpl
<
AccountMapper
,
AccountInfo
>
implements
AccountService
{
public
class
AccountServiceImpl
extends
ServiceImpl
<
AccountMapper
,
AccountInfo
>
implements
AccountService
{
@Autowired
private
UsersMapper
usersMapper
;
@Autowired
@Autowired
private
AccountMapper
accountMapper
;
private
AccountMapper
accountMapper
;
@Autowired
private
MemberPercentMapper
memberPercentMapper
;
@Autowired
private
AccountManager
accountManager
;
@Autowired
private
PublicManager
publicManager
;
@Autowired
private
TradeRecordMapper
tradeRecordMapper
;
@Autowired
private
TeamPerformanceMapper
teamPerformanceMapper
;
@Autowired
private
ProgressPrizeMapper
progressPrizeMapper
;
@Autowired
private
OrderMapper
orderMapper
;
@Autowired
private
MonthManureMapper
monthManureMapper
;
@Autowired
private
LastAccountMapper
lastAccountMapper
;
private
static
final
String
PATTERN
=
"yyyy-MM"
;
private
static
final
Integer
TWENTY
=
20
;
@XxlJob
(
value
=
"orderRebateDayTask"
)
@Override
public
R
<
Boolean
>
orderRebate
()
{
log
.
info
(
"订单返佣接口定时-日任务"
);
// //获取返佣订单
List
<
OrderInfo
>
list
=
orderMapper
.
getListBySuccessTime
(
new
Date
());
log
.
info
(
"shop-mall[]AccountServiceImpl[]orderRebate[]input.param.list:{}"
,
list
.
size
());
if
(
CollectionUtils
.
isEmpty
(
list
))
{
return
R
.
ok
(
0
,
true
);
}
//1、遍历订单,订单状态是未返佣,完成时间小于当前时间 --返佣
for
(
OrderInfo
orderInfo
:
list
)
{
long
successTime
=
orderInfo
.
getSuccessTime
().
getTime
();
long
time
=
System
.
currentTimeMillis
();
if
(
RebateStatusEnum
.
NO_REBATE
.
getCode
().
equals
(
orderInfo
.
getRebateStatus
())
&&
successTime
<=
time
)
{
//获取用户信息
User
user
=
usersMapper
.
getByUserId
(
orderInfo
.
getUserId
());
if
(
null
==
user
||
user
.
getUserLevel
()
==
0
)
{
continue
;
}
//获取账户信息
AccountInfo
accountInfo
=
accountMapper
.
getByUserId
(
user
.
getUserId
());
if
(
null
==
accountInfo
)
{
continue
;
}
//获取返佣比例
MemberPercent
memberpercent
=
memberPercentMapper
.
getByLevelAndType
(
user
.
getUserLevel
(),
MemberPercentEnum
.
REBATE
.
getCode
());
if
(
null
==
memberpercent
)
{
continue
;
}
//修改订单状态为已返佣,账户可用金额增加
accountManager
.
updateOrderAddMoney
(
orderInfo
,
accountInfo
,
memberpercent
);
}
}
return
R
.
ok
(
0
,
true
);
}
@Override
@Override
public
R
<
AccountInfo
>
getByUserId
(
String
userId
)
{
public
R
<
AccountInfo
>
getByUserId
(
String
userId
)
{
AccountInfo
accountInfo
=
accountMapper
.
getByUserId
(
userId
);
AccountInfo
accountInfo
=
accountMapper
.
getByUserId
(
userId
);
return
R
.
ok
(
accountInfo
);
return
R
.
ok
(
accountInfo
);
}
}
@XxlJob
(
value
=
"monthManureDayTask"
)
@Override
@Override
public
R
<
Boolean
>
performanceCount
()
{
public
R
<
PageInfo
<
AccountInfo
>>
getList
(
AccountInfoQuery
query
)
{
//获取本月订单
log
.
info
(
"shop-mall[]AccountServiceImpl[]getList[]input.param.query:"
+
query
);
log
.
info
(
"月度肥料定时-日任务开启"
);
if
(
null
==
query
)
{
List
<
OrderInfo
>
list
=
orderMapper
.
getByCreateTime
(
new
Date
());
return
R
.
error
(
"入参不能为空!"
);
log
.
info
(
"shop-mall[]AccountServiceImpl[]performanceCount[]input.param.list:{}"
,
list
.
size
());
if
(
CollectionUtils
.
isEmpty
(
list
))
{
return
R
.
ok
(
0
,
true
);
}
}
Date
date
=
new
Date
();
pageHandle
(
query
);
String
yearMonth
=
DateUtil
.
convertDateToStr
(
date
,
PATTERN
);
//计算当月所有订单成交额
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
BigDecimal
totalMoney
=
new
BigDecimal
(
0
);
int
total
=
accountMapper
.
count
(
);
//统计出出每个用户当月订单成交额 key:userId value:用户当月订单成交额
map
.
put
(
"startNum"
,
query
.
getStartNum
());
Map
<
String
,
Double
>
map
=
new
HashMap
<>();
map
.
put
(
"endNum"
,
query
.
getEndNum
());
for
(
OrderInfo
orderInfo
:
list
)
{
List
<
AccountInfo
>
list
=
accountMapper
.
getList
(
map
);
String
userId
=
orderInfo
.
getUserId
();
PageInfo
<
AccountInfo
>
info
=
new
PageInfo
<>();
double
payMoney
=
orderInfo
.
getPayment
().
doubleValue
();
info
.
setPageSize
(
query
.
getPageSize
());
info
.
setPageNum
(
query
.
getPageNo
());
//key 存在 累加订单金额 到 value
info
.
setTotal
(
total
);
if
(
map
.
containsKey
(
userId
))
{
info
.
setList
(
list
);
double
money
=
payMoney
+
map
.
get
(
orderInfo
.
getUserId
());
return
R
.
ok
(
info
);
map
.
put
(
orderInfo
.
getUserId
(),
money
);
}
else
{
//key 不存在,加入集合
map
.
put
(
userId
,
payMoney
);
}
totalMoney
=
totalMoney
.
add
(
orderInfo
.
getPayment
());
}
//累计用户和上级用户-团队业绩
Map
<
String
,
Double
>
tempMap
=
new
HashMap
<>();
for
(
Map
.
Entry
<
String
,
Double
>
entity
:
map
.
entrySet
())
{
String
userId
=
entity
.
getKey
();
//1)、统计当前用户月度业绩
double
userCount
=
entity
.
getValue
();
if
(
tempMap
.
containsKey
(
entity
.
getKey
()))
{
double
teamMoney
=
userCount
+
tempMap
.
get
(
entity
.
getKey
());
tempMap
.
put
(
entity
.
getKey
(),
teamMoney
);
}
else
{
//key 不存在,加入集合 当前用户团队绩效
tempMap
.
put
(
entity
.
getKey
(),
userCount
);
}
//2)、获取当前用户的上级用户列表
List
<
User
>
userList
=
getByList
(
userId
);
if
(
CollectionUtils
.
isEmpty
(
userList
))
{
continue
;
}
for
(
User
userInfo
:
userList
)
{
//3)、统计当前用户的上级用户团队绩效
//key 存在 当前用户团队绩效 + 上级用户团队绩效
if
(
tempMap
.
containsKey
(
userInfo
.
getUserId
()))
{
double
teamMoney
=
userCount
+
tempMap
.
get
(
userInfo
.
getUserId
());
tempMap
.
put
(
userInfo
.
getUserId
(),
teamMoney
);
}
else
{
//key 不存在,加入集合 当前用户团队绩效
tempMap
.
put
(
userInfo
.
getUserId
(),
userCount
);
}
}
}
//3、获取用户当月绩效信息 新增 or 更新
List
<
TeamPerformance
>
addList
=
new
ArrayList
<>();
List
<
TeamPerformance
>
updateList
=
new
ArrayList
<>();
for
(
Map
.
Entry
<
String
,
Double
>
entity
:
tempMap
.
entrySet
())
{
//获取团队业绩信息
TeamPerformance
teamPerformance
=
teamPerformanceMapper
.
getByUserIdAndTime
(
entity
.
getKey
(),
yearMonth
);
if
(
null
==
teamPerformance
)
{
//获取用户信息
User
user
=
usersMapper
.
getByUserId
(
entity
.
getKey
());
//添加用户团队业绩信息
TeamPerformance
performance
=
new
TeamPerformance
();
performance
.
setUserId
(
user
.
getUserId
());
performance
.
setMonthTeamPerformance
(
BigDecimal
.
valueOf
(
entity
.
getValue
()));
performance
.
setUserLevel
(
user
.
getUserLevel
());
performance
.
setYearMonth
(
yearMonth
);
addList
.
add
(
performance
);
}
else
{
teamPerformance
.
setMonthTeamPerformance
(
BigDecimal
.
valueOf
(
entity
.
getValue
()));
updateList
.
add
(
teamPerformance
);
}
}
//4、更新账户月度绩效
boolean
updateBool
=
accountManager
.
updateAccountPerformanceMonth
(
addList
,
updateList
);
if
(!
updateBool
)
{
return
R
.
ok
(
1
,
false
);
}
//5、获取所有用户,如果会员等级是黄金以上,计算月度收益
List
<
User
>
userList
=
usersMapper
.
getAllGoldUser
();
if
(
CollectionUtils
.
isEmpty
(
userList
))
{
return
R
.
ok
(
0
,
true
);
}
boolean
bool
=
monthlyIncome
(
totalMoney
,
userList
);
if
(!
bool
)
{
return
R
.
ok
(
1
,
false
);
}
log
.
info
(
"月度肥料定时-日任务执行成功"
);
return
R
.
ok
(
0
,
true
);
}
}
/**
/**
*
获取用户的上级列表
*
分页处理方法
*
*
* @param userId 用户id
* @param schemeVo 参数
* @return 用户的上级列表
*/
*/
@Override
private
void
pageHandle
(
AccountInfoQuery
schemeVo
)
{
public
List
<
User
>
getByList
(
String
userId
)
{
Integer
pageNum
=
schemeVo
.
getPageNo
();
List
<
User
>
list
=
new
ArrayList
<>();
Integer
pageSize
=
schemeVo
.
getPageSize
();
User
user
=
usersMapper
.
getByUserId
(
userId
);
if
(
null
==
pageSize
||
pageSize
==
0
)
{
getUser
(
list
,
userId
);
pageSize
=
10
;
//去除本身
}
list
.
remove
(
user
);
if
(
null
==
pageNum
||
pageNum
==
0
)
{
return
list
;
pageNum
=
1
;
}
}
Integer
endNum
=
pageSize
;
@XxlJob
(
value
=
"growthAwardDayTask"
)
Integer
startNum
=
(
pageNum
-
CommonAttributes
.
NUM_ONE
)
*
pageSize
;
@Override
schemeVo
.
setEndNum
(
endNum
);
public
R
<
Boolean
>
progressPrizeCount
()
{
schemeVo
.
setStartNum
(
startNum
);
log
.
info
(
"shop-mall[]AccountServiceImpl[]performanceCount[]input.method"
);
schemeVo
.
setPageNo
(
pageNum
);
log
.
info
(
"本月最大进步奖日定时任务开启"
);
schemeVo
.
setPageSize
(
pageSize
);
Date
date
=
new
Date
();
String
yearMonth
=
DateUtil
.
convertDateToStr
(
date
,
PATTERN
);
//1、判断当前月是否是业绩开始的第一个月
List
<
TeamPerformance
>
teamPerformances
=
teamPerformanceMapper
.
getByBeforeTime
(
yearMonth
);
//获取当月所有人业绩总额
Double
totalMoney
=
teamPerformanceMapper
.
countByTime
(
yearMonth
);
double
number
=
Math
.
floor
(
totalMoney
/
3980
/
12
);
//2、集合为空 是业绩开始的第一个月
if
(
CollectionUtils
.
isEmpty
(
teamPerformances
))
{
if
(
number
!=
0
)
{
//获取月业绩前20用户
List
<
TeamPerformance
>
list
=
teamPerformanceMapper
.
userTwenty
(
yearMonth
);
if
(
CollectionUtils
.
isEmpty
(
list
))
{
return
R
.
ok
(
0
,
true
);
}
//获取20名进步最大的月业绩和
Double
twentyTotal
=
teamPerformanceMapper
.
countTwenty
(
yearMonth
);
List
<
AccountInfo
>
accountInfoList
=
new
ArrayList
<>();
List
<
TradeRecord
>
tradeRecordList
=
new
ArrayList
<>();
List
<
ProgressPrize
>
addPrizeList
=
new
ArrayList
<>();
List
<
ProgressPrize
>
updatePrizeList
=
new
ArrayList
<>();
for
(
TeamPerformance
user
:
list
)
{
//获取最大进步奖 百分比
MemberPercent
memberPercent
=
memberPercentMapper
.
getByLevelAndType
(
user
.
getUserLevel
(),
MemberPercentEnum
.
MONTH_BEST_AWARD
.
getCode
());
//计算收益
double
userTeamPerformance
=
user
.
getMonthTeamPerformance
().
doubleValue
();
double
percent
=
memberPercent
.
getPercent
().
doubleValue
();
double
income
=
Math
.
floor
(
number
*
3980
*
percent
*
userTeamPerformance
/
twentyTotal
);
//获取账户信息
AccountInfo
accountInfo
=
accountMapper
.
getByUserId
(
user
.
getUserId
());
//用户月收益 =其他收益+最大进步奖收益
BigDecimal
earningsMonth
=
accountInfo
.
getEarningsMonth
().
add
(
BigDecimal
.
valueOf
(
income
));
accountInfo
.
setEarningsMonth
(
earningsMonth
);
//用户总收益 =其他总收益 + 最大进步奖收益
BigDecimal
earningsTotal
=
accountInfo
.
getEarningsTotal
().
add
(
BigDecimal
.
valueOf
(
income
));
accountInfo
.
setEarningsTotal
(
earningsTotal
);
accountInfoList
.
add
(
accountInfo
);
//添加最大进步奖信息 不存在:新增 存在,修改
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
.
setUserId
(
user
.
getUserId
());
prize
.
setGrowthRate
(
0.0
);
prize
.
setYearMonth
(
yearMonth
);
addPrizeList
.
add
(
prize
);
}
else
{
progressPrize
.
setYearMonth
(
yearMonth
);
progressPrize
.
setAwardMoney
(
awardMoney
.
doubleValue
());
updatePrizeList
.
add
(
progressPrize
);
}
//添加交易流水记录
TradeRecord
tradeRecord
=
new
TradeRecord
();
tradeRecord
.
setUserId
(
user
.
getUserId
());
tradeRecord
.
setTradeType
(
TradeRecordEnum
.
PROGRESS_PRIZE
.
getCode
());
tradeRecord
.
setTradeNo
(
null
);
tradeRecord
.
setStatus
(
TradeStatusEnum
.
NO_SETTLE_ACCOUNTS
.
getCode
());
tradeRecord
.
setMoney
(
BigDecimal
.
valueOf
(
income
));
tradeRecordList
.
add
(
tradeRecord
);
}
//更新账户信息,添加交易流水记录
boolean
bool
=
accountManager
.
updateAccountAddRecordAddPrize
(
accountInfoList
,
tradeRecordList
,
addPrizeList
,
updatePrizeList
);
if
(!
bool
)
{
return
R
.
ok
(
1
,
false
);
}
}
log
.
info
(
"本月最大进步奖日定时任务执行成功"
);
return
R
.
ok
(
0
,
true
);
}
//3、集合不为空 不是业绩开始的第一个月
//获取用户列表
List
<
User
>
userList
=
usersMapper
.
findAllNotZeroUser
();
if
(
CollectionUtils
.
isEmpty
(
userList
))
{
return
R
.
ok
(
0
,
true
);
}
//4计算每个用户本月的业绩增长率 如果集合大于20 ,取前二十名,小于,取全部
List
<
TeamPerformanceSortVo
>
listVo
=
progressPrizeStatistics
(
userList
);
if
(
listVo
.
size
()
>=
TWENTY
)
{
listVo
.
subList
(
0
,
TWENTY
);
}
//5、计算前20的总业绩
double
total
=
listVo
.
stream
().
mapToDouble
(
TeamPerformanceSortVo:
:
getMonthPerformance
).
sum
();
boolean
bool
=
totalPerformanceIncome
(
listVo
,
number
,
total
);
if
(!
bool
)
{
return
R
.
ok
(
1
,
false
);
}
log
.
info
(
"本月最大进步奖日定时任务执行成功"
);
return
R
.
ok
(
0
,
true
);
}
public
void
getUser
(
List
<
User
>
list
,
String
userId
)
{
User
user
=
usersMapper
.
getByUserId
(
userId
);
list
.
add
(
user
);
if
(
null
!=
user
&&
!
StringUtils
.
isBlank
(
user
.
getBeInvitedCode
()))
{
User
userInfo
=
usersMapper
.
getByBeInvitedCode
(
user
.
getBeInvitedCode
());
if
(
null
!=
userInfo
)
{
if
(
userInfo
.
getBeInvitedCode
().
equals
(
userInfo
.
getInviteCode
()))
{
return
;
}
getUser
(
list
,
userInfo
.
getUserId
());
}
}
}
/**
* 如果会员等级是黄金以上,计算月度收益
*
* @param totalMoney 月金额总额
* @param userList 用户列表
* @return true or false
*/
private
boolean
monthlyIncome
(
BigDecimal
totalMoney
,
List
<
User
>
userList
)
{
double
total
=
totalMoney
.
doubleValue
();
Date
date
=
new
Date
();
String
yearMonth
=
DateUtil
.
convertDateToStr
(
date
,
PATTERN
);
//当月所有人订单成交总金额/3980/12 向下整
double
moneyMonth
=
Math
.
floor
(
total
/
3980
/
12
);
List
<
AccountInfo
>
accountInfoList
=
new
ArrayList
<>();
List
<
TradeRecord
>
tradeRecordList
=
new
ArrayList
<>();
//获取上月未分配完的奖金
double
lastMonthAward
;
Date
last
=
DateUtil
.
getLastMonth
(
new
Date
());
String
yearMonthTime
=
DateUtil
.
convertDateToStr
(
last
,
PATTERN
);
MonthManure
monthManure
=
monthManureMapper
.
queryByTime
(
yearMonthTime
);
if
(
null
==
monthManure
)
{
lastMonthAward
=
0.00
;
}
else
{
lastMonthAward
=
monthManure
.
getManureAward
();
}
for
(
User
user
:
userList
)
{
if
(
moneyMonth
!=
0
)
{
//获取等级优惠百分比
MemberPercent
memberPercent
=
memberPercentMapper
.
getByLevelAndType
(
user
.
getUserLevel
(),
2
);
if
(
null
!=
memberPercent
)
{
//获取本月团队总金额
TeamPerformance
teamPerformance
=
teamPerformanceMapper
.
getByUserIdAndTime
(
user
.
getUserId
(),
yearMonth
);
//获取该等级团队总金额
Double
teamTotal
=
teamPerformanceMapper
.
countTeamMoney
(
user
.
getUserLevel
(),
yearMonth
);
if
(
null
!=
teamPerformance
&&
null
!=
teamTotal
)
{
double
month
=
teamPerformance
.
getMonthTeamPerformance
().
doubleValue
();
double
percent
=
memberPercent
.
getPercent
().
doubleValue
();
//计算收益
double
teamMoney
=
(
moneyMonth
+
lastMonthAward
)
*
3980
*
percent
*
month
;
DecimalFormat
df
=
new
DecimalFormat
(
"######0.00"
);
double
income
=
Double
.
parseDouble
(
df
.
format
(
teamMoney
/
teamTotal
));
//获取账户信息
AccountInfo
accountInfo
=
accountMapper
.
getByUserId
(
user
.
getUserId
());
BigDecimal
bigDecimal
=
new
BigDecimal
(
income
).
setScale
(
2
,
RoundingMode
.
HALF_UP
);
//获取用户本月收益=可提现金额+ 本月肥料收益
BigDecimal
performanceMonth
=
accountInfo
.
getExtractMoney
().
add
(
bigDecimal
);
accountInfo
.
setEarningsMonth
(
performanceMonth
);
//获取用户上月总收益
LastMonthAccount
lastMonthAccount
=
lastAccountMapper
.
getByUserIdAndTime
(
user
.
getUserId
(),
yearMonthTime
);
BigDecimal
lastTotalMonth
;
if
(
null
==
lastMonthAccount
||
null
==
lastMonthAccount
.
getEarningsTotal
())
{
lastTotalMonth
=
new
BigDecimal
(
"0.00"
);
}
else
{
lastTotalMonth
=
lastMonthAccount
.
getEarningsTotal
();
}
//用户总收益=上月总收益+本月收益
BigDecimal
performanceTotal
=
lastTotalMonth
.
add
(
performanceMonth
);
accountInfo
.
setEarningsTotal
(
performanceTotal
);
accountInfoList
.
add
(
accountInfo
);
//5、添加交易流水记录
TradeRecord
tradeRecord
=
new
TradeRecord
();
tradeRecord
.
setUserId
(
user
.
getUserId
());
tradeRecord
.
setTradeType
(
TradeRecordEnum
.
MONTHLY_FERTILIZER
.
getCode
());
tradeRecord
.
setTradeNo
(
null
);
tradeRecord
.
setStatus
(
TradeStatusEnum
.
NO_SETTLE_ACCOUNTS
.
getCode
());
tradeRecordList
.
add
(
tradeRecord
);
}
}
}
}
//更新账户信息,新增交易流水记录
return
accountManager
.
updateAccountAddRecord
(
accountInfoList
,
tradeRecordList
);
}
/**
* 统计每个用户本月业绩增长率
*
* @param userList 用户列表
* @return 每个用户本月业绩增长率
*/
private
List
<
TeamPerformanceSortVo
>
progressPrizeStatistics
(
List
<
User
>
userList
)
{
Date
date
=
new
Date
();
String
yearMonth
=
DateUtil
.
convertDateToStr
(
date
,
PATTERN
);
//遍历 计算业绩增长率
List
<
TeamPerformanceSortVo
>
listVo
=
new
ArrayList
<>();
for
(
User
user
:
userList
)
{
TeamPerformanceSortVo
teamVo
=
new
TeamPerformanceSortVo
();
double
growthRate
;
//获取当月业绩
TeamPerformance
teamPerformance
=
teamPerformanceMapper
.
getByUserIdAndTime
(
user
.
getUserId
(),
yearMonth
);
//获取上月业绩
Calendar
cal
=
Calendar
.
getInstance
();
cal
.
setTime
(
new
Date
());
cal
.
add
(
Calendar
.
MONTH
,
-
1
);
Date
lastDate
=
cal
.
getTime
();
String
lastMonthTime
=
DateUtil
.
convertDateToStr
(
lastDate
,
PATTERN
);
TeamPerformance
lastMonth
=
teamPerformanceMapper
.
getByUserIdAndTime
(
user
.
getUserId
(),
lastMonthTime
);
if
(
null
==
teamPerformance
||
null
==
lastMonth
)
{
growthRate
=
0.00
;
}
else
{
double
month
=
teamPerformance
.
getMonthTeamPerformance
().
doubleValue
();
double
last
=
lastMonth
.
getMonthTeamPerformance
().
doubleValue
();
if
(
last
>=
month
)
{
growthRate
=
0.00
;
}
else
{
growthRate
=
(
month
-
last
)
/
month
;
}
}
teamVo
.
setGrowthRate
(
growthRate
);
double
monthPerformance
;
assert
teamPerformance
!=
null
;
if
(
null
==
teamPerformance
.
getMonthTeamPerformance
())
{
monthPerformance
=
0.00
;
}
else
{
monthPerformance
=
teamPerformance
.
getMonthTeamPerformance
().
doubleValue
();
}
teamVo
.
setMonthPerformance
(
monthPerformance
);
teamVo
.
setUserId
(
user
.
getUserId
());
teamVo
.
setTeamPerformance
(
teamPerformance
);
listVo
.
add
(
teamVo
);
}
//对集合进行排序
listVo
.
sort
(
Comparator
.
comparing
(
TeamPerformanceSortVo:
:
getGrowthRate
).
reversed
());
return
listVo
;
}
/**
* 统计用户最大进步奖收益
*
* @param listVo 用户增长率列表
* @param number 个人业绩
* @param total 总业绩
*/
private
boolean
totalPerformanceIncome
(
List
<
TeamPerformanceSortVo
>
listVo
,
double
number
,
double
total
)
{
//要更新的账户列表
List
<
AccountInfo
>
updateAccountList
=
new
ArrayList
<>();
BigDecimal
sum
=
new
BigDecimal
(
0
);
for
(
int
i
=
0
;
i
<
listVo
.
size
();
i
++)
{
String
userId
=
listVo
.
get
(
i
).
getTeamPerformance
().
getUserId
();
Integer
userLevel
=
listVo
.
get
(
i
).
getTeamPerformance
().
getUserLevel
();
//获取最大进步奖 百分比
MemberPercent
memberPercent
=
memberPercentMapper
.
getByLevelAndType
(
userLevel
,
3
);
//计算收益
double
userTeamPerformance
=
listVo
.
get
(
i
).
getTeamPerformance
().
getMonthTeamPerformance
().
doubleValue
();
double
percent
=
memberPercent
.
getPercent
().
doubleValue
();
double
income
=
number
*
3980
*
percent
*
userTeamPerformance
/
total
;
//获取账户信息
AccountInfo
accountInfo
=
accountMapper
.
getByUserId
(
userId
);
BigDecimal
bigDecimal
;
if
(
i
==
listVo
.
size
()
-
1
)
{
bigDecimal
=
new
BigDecimal
(
total
).
subtract
(
sum
);
}
else
{
bigDecimal
=
accountInfo
.
getEarningsMonth
().
add
(
new
BigDecimal
(
income
));
sum
=
sum
.
add
(
new
BigDecimal
(
income
));
}
accountInfo
.
setEarningsMonth
(
bigDecimal
);
updateAccountList
.
add
(
accountInfo
);
}
//判断本月是否有最大进步奖数据 无,新增 有,修改或删除
Date
date
=
new
Date
();
String
yearMonth
=
DateUtil
.
convertDateToStr
(
date
,
PATTERN
);
List
<
ProgressPrize
>
prizes
=
progressPrizeMapper
.
getByYearMonth
(
yearMonth
);
//修改或保存最大进步奖信息
// flag 1: 日定时任务 2:月定时任务
int
flag
=
1
;
return
accountManager
.
updateOrSavePrize
(
listVo
,
updateAccountList
,
prizes
,
flag
);
}
}
}
}
wisenergy-service/src/main/java/cn/wisenergy/service/app/impl/DayTaskServiceImpl.java
0 → 100644
View file @
59314805
package
cn
.
wisenergy
.
service
.
app
.
impl
;
import
cn.wisenergy.common.utils.DateUtil
;
import
cn.wisenergy.common.utils.R
;
import
cn.wisenergy.mapper.*
;
import
cn.wisenergy.model.app.*
;
import
cn.wisenergy.model.enums.MemberPercentEnum
;
import
cn.wisenergy.model.enums.RebateStatusEnum
;
import
cn.wisenergy.model.enums.TradeRecordEnum
;
import
cn.wisenergy.model.enums.TradeStatusEnum
;
import
cn.wisenergy.model.vo.TeamPerformanceSortVo
;
import
cn.wisenergy.service.Manager.AccountManager
;
import
cn.wisenergy.service.Manager.PublicManager
;
import
cn.wisenergy.service.app.DayTaskService
;
import
com.xxl.job.core.handler.annotation.XxlJob
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.CollectionUtils
;
import
java.math.BigDecimal
;
import
java.math.RoundingMode
;
import
java.text.DecimalFormat
;
import
java.util.*
;
/**
* @author 86187
*/
@Service
@Slf4j
public
class
DayTaskServiceImpl
implements
DayTaskService
{
@Autowired
private
UsersMapper
usersMapper
;
@Autowired
private
AccountMapper
accountMapper
;
@Autowired
private
MemberPercentMapper
memberPercentMapper
;
@Autowired
private
AccountManager
accountManager
;
@Autowired
private
PublicManager
publicManager
;
@Autowired
private
TradeRecordMapper
tradeRecordMapper
;
@Autowired
private
TeamPerformanceMapper
teamPerformanceMapper
;
@Autowired
private
ProgressPrizeMapper
progressPrizeMapper
;
@Autowired
private
OrderMapper
orderMapper
;
@Autowired
private
MonthManureMapper
monthManureMapper
;
@Autowired
private
LastAccountMapper
lastAccountMapper
;
private
static
final
String
PATTERN
=
"yyyy-MM"
;
private
static
final
Integer
TWENTY
=
20
;
@XxlJob
(
value
=
"orderRebateDayTask"
)
@Override
public
R
<
Boolean
>
orderRebate
()
{
log
.
info
(
"订单返佣接口定时-日任务"
);
// //获取返佣订单
List
<
OrderInfo
>
list
=
orderMapper
.
getListBySuccessTime
(
new
Date
());
log
.
info
(
"shop-mall[]AccountServiceImpl[]orderRebate[]input.param.list:{}"
,
list
.
size
());
if
(
CollectionUtils
.
isEmpty
(
list
))
{
return
R
.
ok
(
0
,
true
);
}
//1、遍历订单,订单状态是未返佣,完成时间小于当前时间 --返佣
for
(
OrderInfo
orderInfo
:
list
)
{
long
successTime
=
orderInfo
.
getSuccessTime
().
getTime
();
long
time
=
System
.
currentTimeMillis
();
if
(
RebateStatusEnum
.
NO_REBATE
.
getCode
().
equals
(
orderInfo
.
getRebateStatus
())
&&
successTime
<=
time
)
{
//获取用户信息
User
user
=
usersMapper
.
getByUserId
(
orderInfo
.
getUserId
());
if
(
null
==
user
||
user
.
getUserLevel
()
==
0
)
{
continue
;
}
//获取账户信息
AccountInfo
accountInfo
=
accountMapper
.
getByUserId
(
user
.
getUserId
());
if
(
null
==
accountInfo
)
{
continue
;
}
//获取返佣比例
MemberPercent
memberpercent
=
memberPercentMapper
.
getByLevelAndType
(
user
.
getUserLevel
(),
MemberPercentEnum
.
REBATE
.
getCode
());
if
(
null
==
memberpercent
)
{
continue
;
}
//修改订单状态为已返佣,账户可用金额增加
accountManager
.
updateOrderAddMoney
(
orderInfo
,
accountInfo
,
memberpercent
);
}
}
return
R
.
ok
(
0
,
true
);
}
@XxlJob
(
value
=
"monthManureDayTask"
)
@Override
public
R
<
Boolean
>
performanceCount
()
{
//获取本月订单
log
.
info
(
"月度肥料定时-日任务开启"
);
List
<
OrderInfo
>
list
=
orderMapper
.
getByCreateTime
(
new
Date
());
log
.
info
(
"shop-mall[]AccountServiceImpl[]performanceCount[]input.param.list:{}"
,
list
.
size
());
if
(
CollectionUtils
.
isEmpty
(
list
))
{
return
R
.
ok
(
0
,
true
);
}
Date
date
=
new
Date
();
String
yearMonth
=
DateUtil
.
convertDateToStr
(
date
,
PATTERN
);
//计算当月所有订单成交额
BigDecimal
totalMoney
=
new
BigDecimal
(
0
);
//统计出出每个用户当月订单成交额 key:userId value:用户当月订单成交额
Map
<
String
,
Double
>
map
=
new
HashMap
<>();
for
(
OrderInfo
orderInfo
:
list
)
{
String
userId
=
orderInfo
.
getUserId
();
double
payMoney
=
orderInfo
.
getPayment
().
doubleValue
();
//key 存在 累加订单金额 到 value
if
(
map
.
containsKey
(
userId
))
{
double
money
=
payMoney
+
map
.
get
(
orderInfo
.
getUserId
());
map
.
put
(
orderInfo
.
getUserId
(),
money
);
}
else
{
//key 不存在,加入集合
map
.
put
(
userId
,
payMoney
);
}
totalMoney
=
totalMoney
.
add
(
orderInfo
.
getPayment
());
}
//累计用户和上级用户-团队业绩
Map
<
String
,
Double
>
tempMap
=
new
HashMap
<>();
for
(
Map
.
Entry
<
String
,
Double
>
entity
:
map
.
entrySet
())
{
String
userId
=
entity
.
getKey
();
//1)、统计当前用户月度业绩
double
userCount
=
entity
.
getValue
();
if
(
tempMap
.
containsKey
(
entity
.
getKey
()))
{
double
teamMoney
=
userCount
+
tempMap
.
get
(
entity
.
getKey
());
tempMap
.
put
(
entity
.
getKey
(),
teamMoney
);
}
else
{
//key 不存在,加入集合 当前用户团队绩效
tempMap
.
put
(
entity
.
getKey
(),
userCount
);
}
//2)、获取当前用户的上级用户列表
List
<
User
>
userList
=
getByList
(
userId
);
if
(
CollectionUtils
.
isEmpty
(
userList
))
{
continue
;
}
for
(
User
userInfo
:
userList
)
{
//3)、统计当前用户的上级用户团队绩效
//key 存在 当前用户团队绩效 + 上级用户团队绩效
if
(
tempMap
.
containsKey
(
userInfo
.
getUserId
()))
{
double
teamMoney
=
userCount
+
tempMap
.
get
(
userInfo
.
getUserId
());
tempMap
.
put
(
userInfo
.
getUserId
(),
teamMoney
);
}
else
{
//key 不存在,加入集合 当前用户团队绩效
tempMap
.
put
(
userInfo
.
getUserId
(),
userCount
);
}
}
}
//3、获取用户当月绩效信息 新增 or 更新
List
<
TeamPerformance
>
addList
=
new
ArrayList
<>();
List
<
TeamPerformance
>
updateList
=
new
ArrayList
<>();
for
(
Map
.
Entry
<
String
,
Double
>
entity
:
tempMap
.
entrySet
())
{
//获取团队业绩信息
TeamPerformance
teamPerformance
=
teamPerformanceMapper
.
getByUserIdAndTime
(
entity
.
getKey
(),
yearMonth
);
if
(
null
==
teamPerformance
)
{
//获取用户信息
User
user
=
usersMapper
.
getByUserId
(
entity
.
getKey
());
//添加用户团队业绩信息
TeamPerformance
performance
=
new
TeamPerformance
();
performance
.
setUserId
(
user
.
getUserId
());
performance
.
setMonthTeamPerformance
(
BigDecimal
.
valueOf
(
entity
.
getValue
()));
performance
.
setUserLevel
(
user
.
getUserLevel
());
performance
.
setYearMonth
(
yearMonth
);
addList
.
add
(
performance
);
}
else
{
teamPerformance
.
setMonthTeamPerformance
(
BigDecimal
.
valueOf
(
entity
.
getValue
()));
updateList
.
add
(
teamPerformance
);
}
}
//4、更新账户月度绩效
boolean
updateBool
=
accountManager
.
updateAccountPerformanceMonth
(
addList
,
updateList
);
if
(!
updateBool
)
{
return
R
.
ok
(
1
,
false
);
}
//5、获取所有用户,如果会员等级是黄金以上,计算月度收益
List
<
User
>
userList
=
usersMapper
.
getAllGoldUser
();
if
(
CollectionUtils
.
isEmpty
(
userList
))
{
return
R
.
ok
(
0
,
true
);
}
boolean
bool
=
monthlyIncome
(
totalMoney
,
userList
);
if
(!
bool
)
{
return
R
.
ok
(
1
,
false
);
}
log
.
info
(
"月度肥料定时-日任务执行成功"
);
return
R
.
ok
(
0
,
true
);
}
@XxlJob
(
value
=
"growthAwardDayTask"
)
@Override
public
R
<
Boolean
>
progressPrizeCount
()
{
log
.
info
(
"shop-mall[]AccountServiceImpl[]performanceCount[]input.method"
);
log
.
info
(
"本月最大进步奖日定时任务开启"
);
Date
date
=
new
Date
();
String
yearMonth
=
DateUtil
.
convertDateToStr
(
date
,
PATTERN
);
//1、判断当前月是否是业绩开始的第一个月
List
<
TeamPerformance
>
teamPerformances
=
teamPerformanceMapper
.
getByBeforeTime
(
yearMonth
);
//获取当月所有人业绩总额
Double
totalMoney
=
teamPerformanceMapper
.
countByTime
(
yearMonth
);
double
number
=
Math
.
floor
(
totalMoney
/
3980
/
12
);
//2、集合为空 是业绩开始的第一个月
if
(
CollectionUtils
.
isEmpty
(
teamPerformances
))
{
if
(
number
!=
0
)
{
//获取月业绩前20用户
List
<
TeamPerformance
>
list
=
teamPerformanceMapper
.
userTwenty
(
yearMonth
);
if
(
CollectionUtils
.
isEmpty
(
list
))
{
return
R
.
ok
(
0
,
true
);
}
//获取20名进步最大的月业绩和
Double
twentyTotal
=
teamPerformanceMapper
.
countTwenty
(
yearMonth
);
List
<
AccountInfo
>
accountInfoList
=
new
ArrayList
<>();
List
<
TradeRecord
>
tradeRecordList
=
new
ArrayList
<>();
List
<
ProgressPrize
>
addPrizeList
=
new
ArrayList
<>();
List
<
ProgressPrize
>
updatePrizeList
=
new
ArrayList
<>();
for
(
TeamPerformance
user
:
list
)
{
//获取最大进步奖 百分比
MemberPercent
memberPercent
=
memberPercentMapper
.
getByLevelAndType
(
user
.
getUserLevel
(),
MemberPercentEnum
.
MONTH_BEST_AWARD
.
getCode
());
//计算收益
double
userTeamPerformance
=
user
.
getMonthTeamPerformance
().
doubleValue
();
double
percent
=
memberPercent
.
getPercent
().
doubleValue
();
double
income
=
Math
.
floor
(
number
*
3980
*
percent
*
userTeamPerformance
/
twentyTotal
);
//获取账户信息
AccountInfo
accountInfo
=
accountMapper
.
getByUserId
(
user
.
getUserId
());
//用户月收益 =其他收益+最大进步奖收益
BigDecimal
earningsMonth
=
accountInfo
.
getEarningsMonth
().
add
(
BigDecimal
.
valueOf
(
income
));
accountInfo
.
setEarningsMonth
(
earningsMonth
);
//用户总收益 =其他总收益 + 最大进步奖收益
BigDecimal
earningsTotal
=
accountInfo
.
getEarningsTotal
().
add
(
BigDecimal
.
valueOf
(
income
));
accountInfo
.
setEarningsTotal
(
earningsTotal
);
accountInfoList
.
add
(
accountInfo
);
//添加最大进步奖信息 不存在:新增 存在,修改
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
.
setUserId
(
user
.
getUserId
());
prize
.
setGrowthRate
(
0.0
);
prize
.
setYearMonth
(
yearMonth
);
addPrizeList
.
add
(
prize
);
}
else
{
progressPrize
.
setYearMonth
(
yearMonth
);
progressPrize
.
setAwardMoney
(
awardMoney
.
doubleValue
());
updatePrizeList
.
add
(
progressPrize
);
}
//添加交易流水记录
TradeRecord
tradeRecord
=
new
TradeRecord
();
tradeRecord
.
setUserId
(
user
.
getUserId
());
tradeRecord
.
setTradeType
(
TradeRecordEnum
.
PROGRESS_PRIZE
.
getCode
());
tradeRecord
.
setTradeNo
(
null
);
tradeRecord
.
setStatus
(
TradeStatusEnum
.
NO_SETTLE_ACCOUNTS
.
getCode
());
tradeRecord
.
setMoney
(
BigDecimal
.
valueOf
(
income
));
tradeRecordList
.
add
(
tradeRecord
);
}
//更新账户信息,添加交易流水记录
boolean
bool
=
accountManager
.
updateAccountAddRecordAddPrize
(
accountInfoList
,
tradeRecordList
,
addPrizeList
,
updatePrizeList
);
if
(!
bool
)
{
return
R
.
ok
(
1
,
false
);
}
}
log
.
info
(
"本月最大进步奖日定时任务执行成功"
);
return
R
.
ok
(
0
,
true
);
}
//3、集合不为空 不是业绩开始的第一个月
//获取用户列表
List
<
User
>
userList
=
usersMapper
.
findAllNotZeroUser
();
if
(
CollectionUtils
.
isEmpty
(
userList
))
{
return
R
.
ok
(
0
,
true
);
}
//4计算每个用户本月的业绩增长率 如果集合大于20 ,取前二十名,小于,取全部
List
<
TeamPerformanceSortVo
>
listVo
=
progressPrizeStatistics
(
userList
);
if
(
listVo
.
size
()
>=
TWENTY
)
{
listVo
.
subList
(
0
,
TWENTY
);
}
//5、计算前20的总业绩
double
total
=
listVo
.
stream
().
mapToDouble
(
TeamPerformanceSortVo:
:
getMonthPerformance
).
sum
();
boolean
bool
=
totalPerformanceIncome
(
listVo
,
number
,
total
);
if
(!
bool
)
{
return
R
.
ok
(
1
,
false
);
}
log
.
info
(
"本月最大进步奖日定时任务执行成功"
);
return
R
.
ok
(
0
,
true
);
}
/**
* 获取用户的上级列表
*
* @param userId 用户id
* @return 用户的上级列表
*/
@Override
public
List
<
User
>
getByList
(
String
userId
)
{
List
<
User
>
list
=
new
ArrayList
<>();
User
user
=
usersMapper
.
getByUserId
(
userId
);
getUser
(
list
,
userId
);
//去除本身
list
.
remove
(
user
);
return
list
;
}
public
void
getUser
(
List
<
User
>
list
,
String
userId
)
{
User
user
=
usersMapper
.
getByUserId
(
userId
);
list
.
add
(
user
);
if
(
null
!=
user
&&
!
StringUtils
.
isBlank
(
user
.
getBeInvitedCode
()))
{
User
userInfo
=
usersMapper
.
getByBeInvitedCode
(
user
.
getBeInvitedCode
());
if
(
null
!=
userInfo
)
{
if
(
userInfo
.
getBeInvitedCode
().
equals
(
userInfo
.
getInviteCode
()))
{
return
;
}
getUser
(
list
,
userInfo
.
getUserId
());
}
}
}
/**
* 统计每个用户本月业绩增长率
*
* @param userList 用户列表
* @return 每个用户本月业绩增长率
*/
private
List
<
TeamPerformanceSortVo
>
progressPrizeStatistics
(
List
<
User
>
userList
)
{
Date
date
=
new
Date
();
String
yearMonth
=
DateUtil
.
convertDateToStr
(
date
,
PATTERN
);
//遍历 计算业绩增长率
List
<
TeamPerformanceSortVo
>
listVo
=
new
ArrayList
<>();
for
(
User
user
:
userList
)
{
TeamPerformanceSortVo
teamVo
=
new
TeamPerformanceSortVo
();
double
growthRate
;
//获取当月业绩
TeamPerformance
teamPerformance
=
teamPerformanceMapper
.
getByUserIdAndTime
(
user
.
getUserId
(),
yearMonth
);
//获取上月业绩
Calendar
cal
=
Calendar
.
getInstance
();
cal
.
setTime
(
new
Date
());
cal
.
add
(
Calendar
.
MONTH
,
-
1
);
Date
lastDate
=
cal
.
getTime
();
String
lastMonthTime
=
DateUtil
.
convertDateToStr
(
lastDate
,
PATTERN
);
TeamPerformance
lastMonth
=
teamPerformanceMapper
.
getByUserIdAndTime
(
user
.
getUserId
(),
lastMonthTime
);
if
(
null
==
teamPerformance
||
null
==
lastMonth
)
{
growthRate
=
0.00
;
}
else
{
double
month
=
teamPerformance
.
getMonthTeamPerformance
().
doubleValue
();
double
last
=
lastMonth
.
getMonthTeamPerformance
().
doubleValue
();
if
(
last
>=
month
)
{
growthRate
=
0.00
;
}
else
{
growthRate
=
(
month
-
last
)
/
month
;
}
}
teamVo
.
setGrowthRate
(
growthRate
);
double
monthPerformance
;
assert
teamPerformance
!=
null
;
if
(
null
==
teamPerformance
.
getMonthTeamPerformance
())
{
monthPerformance
=
0.00
;
}
else
{
monthPerformance
=
teamPerformance
.
getMonthTeamPerformance
().
doubleValue
();
}
teamVo
.
setMonthPerformance
(
monthPerformance
);
teamVo
.
setUserId
(
user
.
getUserId
());
teamVo
.
setTeamPerformance
(
teamPerformance
);
listVo
.
add
(
teamVo
);
}
//对集合进行排序
listVo
.
sort
(
Comparator
.
comparing
(
TeamPerformanceSortVo:
:
getGrowthRate
).
reversed
());
return
listVo
;
}
/**
* 如果会员等级是黄金以上,计算月度收益
*
* @param totalMoney 月金额总额
* @param userList 用户列表
* @return true or false
*/
private
boolean
monthlyIncome
(
BigDecimal
totalMoney
,
List
<
User
>
userList
)
{
double
total
=
totalMoney
.
doubleValue
();
Date
date
=
new
Date
();
String
yearMonth
=
DateUtil
.
convertDateToStr
(
date
,
PATTERN
);
//当月所有人订单成交总金额/3980/12 向下整
double
moneyMonth
=
Math
.
floor
(
total
/
3980
/
12
);
List
<
AccountInfo
>
accountInfoList
=
new
ArrayList
<>();
List
<
TradeRecord
>
tradeRecordList
=
new
ArrayList
<>();
//获取上月未分配完的奖金
double
lastMonthAward
;
Date
last
=
DateUtil
.
getLastMonth
(
new
Date
());
String
yearMonthTime
=
DateUtil
.
convertDateToStr
(
last
,
PATTERN
);
MonthManure
monthManure
=
monthManureMapper
.
queryByTime
(
yearMonthTime
);
if
(
null
==
monthManure
)
{
lastMonthAward
=
0.00
;
}
else
{
lastMonthAward
=
monthManure
.
getManureAward
();
}
for
(
User
user
:
userList
)
{
if
(
moneyMonth
!=
0
)
{
//获取等级优惠百分比
MemberPercent
memberPercent
=
memberPercentMapper
.
getByLevelAndType
(
user
.
getUserLevel
(),
2
);
if
(
null
!=
memberPercent
)
{
//获取本月团队总金额
TeamPerformance
teamPerformance
=
teamPerformanceMapper
.
getByUserIdAndTime
(
user
.
getUserId
(),
yearMonth
);
//获取该等级团队总金额
Double
teamTotal
=
teamPerformanceMapper
.
countTeamMoney
(
user
.
getUserLevel
(),
yearMonth
);
if
(
null
!=
teamPerformance
&&
null
!=
teamTotal
)
{
double
month
=
teamPerformance
.
getMonthTeamPerformance
().
doubleValue
();
double
percent
=
memberPercent
.
getPercent
().
doubleValue
();
//计算收益
double
teamMoney
=
(
moneyMonth
+
lastMonthAward
)
*
3980
*
percent
*
month
;
DecimalFormat
df
=
new
DecimalFormat
(
"######0.00"
);
double
income
=
Double
.
parseDouble
(
df
.
format
(
teamMoney
/
teamTotal
));
//获取账户信息
AccountInfo
accountInfo
=
accountMapper
.
getByUserId
(
user
.
getUserId
());
BigDecimal
bigDecimal
=
new
BigDecimal
(
income
).
setScale
(
2
,
RoundingMode
.
HALF_UP
);
//获取用户本月收益=可提现金额+ 本月肥料收益
BigDecimal
performanceMonth
=
accountInfo
.
getExtractMoney
().
add
(
bigDecimal
);
accountInfo
.
setEarningsMonth
(
performanceMonth
);
//获取用户上月总收益
LastMonthAccount
lastMonthAccount
=
lastAccountMapper
.
getByUserIdAndTime
(
user
.
getUserId
(),
yearMonthTime
);
BigDecimal
lastTotalMonth
;
if
(
null
==
lastMonthAccount
||
null
==
lastMonthAccount
.
getEarningsTotal
())
{
lastTotalMonth
=
new
BigDecimal
(
"0.00"
);
}
else
{
lastTotalMonth
=
lastMonthAccount
.
getEarningsTotal
();
}
//用户总收益=上月总收益+本月收益
BigDecimal
performanceTotal
=
lastTotalMonth
.
add
(
performanceMonth
);
accountInfo
.
setEarningsTotal
(
performanceTotal
);
accountInfoList
.
add
(
accountInfo
);
//5、添加交易流水记录
TradeRecord
tradeRecord
=
new
TradeRecord
();
tradeRecord
.
setUserId
(
user
.
getUserId
());
tradeRecord
.
setTradeType
(
TradeRecordEnum
.
MONTHLY_FERTILIZER
.
getCode
());
tradeRecord
.
setTradeNo
(
null
);
tradeRecord
.
setStatus
(
TradeStatusEnum
.
NO_SETTLE_ACCOUNTS
.
getCode
());
tradeRecordList
.
add
(
tradeRecord
);
}
}
}
}
//更新账户信息,新增交易流水记录
return
accountManager
.
updateAccountAddRecord
(
accountInfoList
,
tradeRecordList
);
}
/**
* 统计用户最大进步奖收益
*
* @param listVo 用户增长率列表
* @param number 个人业绩
* @param total 总业绩
*/
private
boolean
totalPerformanceIncome
(
List
<
TeamPerformanceSortVo
>
listVo
,
double
number
,
double
total
)
{
//要更新的账户列表
List
<
AccountInfo
>
updateAccountList
=
new
ArrayList
<>();
BigDecimal
sum
=
new
BigDecimal
(
0
);
for
(
int
i
=
0
;
i
<
listVo
.
size
();
i
++)
{
String
userId
=
listVo
.
get
(
i
).
getTeamPerformance
().
getUserId
();
Integer
userLevel
=
listVo
.
get
(
i
).
getTeamPerformance
().
getUserLevel
();
//获取最大进步奖 百分比
MemberPercent
memberPercent
=
memberPercentMapper
.
getByLevelAndType
(
userLevel
,
3
);
//计算收益
double
userTeamPerformance
=
listVo
.
get
(
i
).
getTeamPerformance
().
getMonthTeamPerformance
().
doubleValue
();
double
percent
=
memberPercent
.
getPercent
().
doubleValue
();
double
income
=
number
*
3980
*
percent
*
userTeamPerformance
/
total
;
//获取账户信息
AccountInfo
accountInfo
=
accountMapper
.
getByUserId
(
userId
);
BigDecimal
bigDecimal
;
if
(
i
==
listVo
.
size
()
-
1
)
{
bigDecimal
=
new
BigDecimal
(
total
).
subtract
(
sum
);
}
else
{
bigDecimal
=
accountInfo
.
getEarningsMonth
().
add
(
new
BigDecimal
(
income
));
sum
=
sum
.
add
(
new
BigDecimal
(
income
));
}
accountInfo
.
setEarningsMonth
(
bigDecimal
);
updateAccountList
.
add
(
accountInfo
);
}
//判断本月是否有最大进步奖数据 无,新增 有,修改或删除
Date
date
=
new
Date
();
String
yearMonth
=
DateUtil
.
convertDateToStr
(
date
,
PATTERN
);
List
<
ProgressPrize
>
prizes
=
progressPrizeMapper
.
getByYearMonth
(
yearMonth
);
//修改或保存最大进步奖信息
// flag 1: 日定时任务 2:月定时任务
int
flag
=
1
;
return
accountManager
.
updateOrSavePrize
(
listVo
,
updateAccountList
,
prizes
,
flag
);
}
}
wisenergy-service/src/main/java/cn/wisenergy/service/app/impl/MemberPercentServiceImpl.java
0 → 100644
View file @
59314805
package
cn
.
wisenergy
.
service
.
app
.
impl
;
import
cn.wisenergy.common.constant.CommonAttributes
;
import
cn.wisenergy.common.utils.R
;
import
cn.wisenergy.mapper.MemberPercentMapper
;
import
cn.wisenergy.model.app.MemberPercent
;
import
cn.wisenergy.model.app.TradeRecord
;
import
cn.wisenergy.model.dto.MemberPercentQuery
;
import
cn.wisenergy.model.dto.TradeRecordQuery
;
import
cn.wisenergy.service.app.MemberPercentService
;
import
com.github.pagehelper.PageInfo
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
* @author 86187
*/
@Service
@Slf4j
public
class
MemberPercentServiceImpl
implements
MemberPercentService
{
@Autowired
private
MemberPercentMapper
memberPercentMapper
;
@Override
public
R
<
PageInfo
<
MemberPercent
>>
getList
(
MemberPercentQuery
query
)
{
log
.
info
(
"sho[-mall[]MemberPercentServiceImpl[]getList[]input.method"
);
pageHandle
(
query
);
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
int
total
=
memberPercentMapper
.
count
();
map
.
put
(
"startNum"
,
query
.
getStartNum
());
map
.
put
(
"endNum"
,
query
.
getEndNum
());
List
<
MemberPercent
>
list
=
memberPercentMapper
.
getList
(
map
);
PageInfo
<
MemberPercent
>
info
=
new
PageInfo
<>();
info
.
setPageSize
(
query
.
getPageSize
());
info
.
setPageNum
(
query
.
getPageNo
());
info
.
setTotal
(
total
);
info
.
setList
(
list
);
return
R
.
ok
(
info
);
}
/**
* 分页处理方法
*
* @param schemeVo 参数
*/
private
void
pageHandle
(
MemberPercentQuery
schemeVo
)
{
Integer
pageNum
=
schemeVo
.
getPageNo
();
Integer
pageSize
=
schemeVo
.
getPageSize
();
if
(
null
==
pageSize
||
pageSize
==
0
)
{
pageSize
=
10
;
}
if
(
null
==
pageNum
||
pageNum
==
0
)
{
pageNum
=
1
;
}
Integer
endNum
=
pageSize
;
Integer
startNum
=
(
pageNum
-
CommonAttributes
.
NUM_ONE
)
*
pageSize
;
schemeVo
.
setEndNum
(
endNum
);
schemeVo
.
setStartNum
(
startNum
);
schemeVo
.
setPageNo
(
pageNum
);
schemeVo
.
setPageSize
(
pageSize
);
}
}
wisenergy-service/src/main/java/cn/wisenergy/service/app/impl/MonthTaskServiceImpl.java
View file @
59314805
...
@@ -12,6 +12,7 @@ import cn.wisenergy.model.vo.TeamPerformanceSortVo;
...
@@ -12,6 +12,7 @@ import cn.wisenergy.model.vo.TeamPerformanceSortVo;
import
cn.wisenergy.service.Manager.AccountManager
;
import
cn.wisenergy.service.Manager.AccountManager
;
import
cn.wisenergy.service.Manager.PublicManager
;
import
cn.wisenergy.service.Manager.PublicManager
;
import
cn.wisenergy.service.app.AccountService
;
import
cn.wisenergy.service.app.AccountService
;
import
cn.wisenergy.service.app.DayTaskService
;
import
cn.wisenergy.service.app.MonthTaskService
;
import
cn.wisenergy.service.app.MonthTaskService
;
import
com.xxl.job.core.handler.annotation.XxlJob
;
import
com.xxl.job.core.handler.annotation.XxlJob
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
...
@@ -58,7 +59,7 @@ public class MonthTaskServiceImpl implements MonthTaskService {
...
@@ -58,7 +59,7 @@ public class MonthTaskServiceImpl implements MonthTaskService {
private
ProgressPrizeMapper
progressPrizeMapper
;
private
ProgressPrizeMapper
progressPrizeMapper
;
@Autowired
@Autowired
private
AccountService
account
Service
;
private
DayTaskService
dayTask
Service
;
@Autowired
@Autowired
private
MonthManureMapper
monthManureMapper
;
private
MonthManureMapper
monthManureMapper
;
...
@@ -124,7 +125,7 @@ public class MonthTaskServiceImpl implements MonthTaskService {
...
@@ -124,7 +125,7 @@ public class MonthTaskServiceImpl implements MonthTaskService {
}
}
//2)、获取当前用户的上级用户列表
//2)、获取当前用户的上级用户列表
List
<
User
>
userList
=
account
Service
.
getByList
(
userId
);
List
<
User
>
userList
=
dayTask
Service
.
getByList
(
userId
);
if
(
CollectionUtils
.
isEmpty
(
userList
))
{
if
(
CollectionUtils
.
isEmpty
(
userList
))
{
continue
;
continue
;
}
}
...
...
wisenergy-web-admin/src/main/java/cn/wisenergy/web/admin/controller/app/AccountController.java
View file @
59314805
...
@@ -3,8 +3,11 @@ package cn.wisenergy.web.admin.controller.app;
...
@@ -3,8 +3,11 @@ package cn.wisenergy.web.admin.controller.app;
import
cn.wisenergy.common.utils.R
;
import
cn.wisenergy.common.utils.R
;
import
cn.wisenergy.model.app.AccountInfo
;
import
cn.wisenergy.model.app.AccountInfo
;
import
cn.wisenergy.model.app.User
;
import
cn.wisenergy.model.app.User
;
import
cn.wisenergy.model.dto.AccountInfoQuery
;
import
cn.wisenergy.service.app.AccountService
;
import
cn.wisenergy.service.app.AccountService
;
import
cn.wisenergy.service.app.DayTaskService
;
import
cn.wisenergy.web.common.BaseController
;
import
cn.wisenergy.web.common.BaseController
;
import
com.github.pagehelper.PageInfo
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
...
@@ -14,8 +17,6 @@ import org.springframework.web.bind.annotation.GetMapping;
...
@@ -14,8 +17,6 @@ import org.springframework.web.bind.annotation.GetMapping;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.List
;
/**
/**
* @author 86187
* @author 86187
*/
*/
...
@@ -27,6 +28,9 @@ public class AccountController extends BaseController {
...
@@ -27,6 +28,9 @@ public class AccountController extends BaseController {
@Autowired
@Autowired
private
AccountService
accountService
;
private
AccountService
accountService
;
@Autowired
private
DayTaskService
dayTaskService
;
@ApiOperation
(
value
=
"获取账户信息"
,
notes
=
"获取账户信息"
,
httpMethod
=
"GET"
)
@ApiOperation
(
value
=
"获取账户信息"
,
notes
=
"获取账户信息"
,
httpMethod
=
"GET"
)
@ApiImplicitParam
(
name
=
"userId"
,
value
=
"用户id"
,
dataType
=
"String"
)
@ApiImplicitParam
(
name
=
"userId"
,
value
=
"用户id"
,
dataType
=
"String"
)
@GetMapping
(
"/getByUserId"
)
@GetMapping
(
"/getByUserId"
)
...
@@ -34,30 +38,32 @@ public class AccountController extends BaseController {
...
@@ -34,30 +38,32 @@ public class AccountController extends BaseController {
return
accountService
.
getByUserId
(
userId
);
return
accountService
.
getByUserId
(
userId
);
}
}
@ApiOperation
(
value
=
"获取账户列表信息"
,
notes
=
"获取账户列表信息"
,
httpMethod
=
"GET"
)
@ApiImplicitParam
(
name
=
"userId"
,
value
=
"用户id"
,
dataType
=
"String"
)
@ApiOperation
(
value
=
"获取账户分页列表"
,
notes
=
"获取账户分页列表"
,
httpMethod
=
"GET"
)
@GetMapping
(
"/getByList"
)
@ApiImplicitParam
(
name
=
"query"
,
value
=
"查询条件"
,
dataType
=
"AccountInfoQuery"
)
public
List
<
User
>
getByList
(
String
userId
)
{
@GetMapping
(
"/getList"
)
return
accountService
.
getByList
(
userId
);
public
R
<
PageInfo
<
AccountInfo
>>
getList
(
AccountInfoQuery
query
)
{
return
accountService
.
getList
(
query
);
}
}
/***********************************************测试日定时任务***************************/
@ApiOperation
(
value
=
"订单佣金"
,
notes
=
"订单佣金"
,
httpMethod
=
"GET"
)
@ApiOperation
(
value
=
"订单佣金"
,
notes
=
"订单佣金"
,
httpMethod
=
"GET"
)
@GetMapping
(
"/orderRebate"
)
@GetMapping
(
"/orderRebate"
)
public
R
<
Boolean
>
orderRebate
()
{
public
R
<
Boolean
>
orderRebate
()
{
return
account
Service
.
orderRebate
();
return
dayTask
Service
.
orderRebate
();
}
}
@ApiOperation
(
value
=
"月度肥料"
,
notes
=
"月度肥料"
,
httpMethod
=
"GET"
)
@ApiOperation
(
value
=
"月度肥料"
,
notes
=
"月度肥料"
,
httpMethod
=
"GET"
)
@GetMapping
(
"/monthManure"
)
@GetMapping
(
"/monthManure"
)
public
R
<
Boolean
>
monthManure
()
{
public
R
<
Boolean
>
monthManure
()
{
return
account
Service
.
performanceCount
();
return
dayTask
Service
.
performanceCount
();
}
}
@ApiOperation
(
value
=
"最大进步奖"
,
notes
=
"最大进步奖"
,
httpMethod
=
"GET"
)
@ApiOperation
(
value
=
"最大进步奖"
,
notes
=
"最大进步奖"
,
httpMethod
=
"GET"
)
@GetMapping
(
"/growAward"
)
@GetMapping
(
"/growAward"
)
public
R
<
Boolean
>
growAward
()
{
public
R
<
Boolean
>
growAward
()
{
return
account
Service
.
progressPrizeCount
();
return
dayTask
Service
.
progressPrizeCount
();
}
}
}
}
wisenergy-web-admin/src/main/java/cn/wisenergy/web/admin/controller/app/MemberController.java
0 → 100644
View file @
59314805
package
cn
.
wisenergy
.
web
.
admin
.
controller
.
app
;
import
cn.wisenergy.common.utils.R
;
import
cn.wisenergy.model.app.MemberPercent
;
import
cn.wisenergy.model.dto.MemberPercentQuery
;
import
cn.wisenergy.service.app.MemberPercentService
;
import
com.github.pagehelper.PageInfo
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
/**
* @author 86187
*/
@Api
(
tags
=
"会员优惠比列-后台管理"
)
@RestController
@RequestMapping
(
"/member"
)
@Slf4j
public
class
MemberController
{
@Autowired
private
MemberPercentService
memberPercentService
;
@ApiOperation
(
value
=
"获取会员优惠比列列表"
,
notes
=
"获取会员优惠比列列表"
,
httpMethod
=
"GET"
)
@ApiImplicitParam
(
name
=
"query"
,
value
=
"查询参数"
,
dataType
=
"MemberPercentQuery"
)
@GetMapping
(
"/getList"
)
public
R
<
PageInfo
<
MemberPercent
>>
getList
(
MemberPercentQuery
query
)
{
log
.
info
(
"shop-mall[]MemberController[]getList[]input.param.query:"
+
query
);
if
(
null
==
query
)
{
return
R
.
error
(
"入参为空!"
);
}
return
memberPercentService
.
getList
(
query
);
}
}
wisenergy-web-admin/src/main/java/cn/wisenergy/web/admin/controller/app/SysUserController.java
View file @
59314805
...
@@ -2,11 +2,8 @@ package cn.wisenergy.web.admin.controller.app;
...
@@ -2,11 +2,8 @@ package cn.wisenergy.web.admin.controller.app;
import
cn.wisenergy.common.utils.R
;
import
cn.wisenergy.common.utils.R
;
import
cn.wisenergy.mapper.SysUserMapper
;
import
cn.wisenergy.mapper.SysUserMapper
;
import
cn.wisenergy.model.app.ProgressPrize
;
import
cn.wisenergy.model.app.SysUser
;
import
cn.wisenergy.model.app.SysUser
;
import
cn.wisenergy.model.dto.ProgressPrizeQuery
;
import
cn.wisenergy.model.dto.SysLoginDto
;
import
cn.wisenergy.model.dto.SysLoginDto
;
import
com.github.pagehelper.PageInfo
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
...
...
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