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
53caafc8
Commit
53caafc8
authored
Mar 11, 2021
by
licc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化月度任务接口2
parent
44413526
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
62 additions
and
42 deletions
+62
-42
OrderMapper.java
...mapper/src/main/java/cn/wisenergy/mapper/OrderMapper.java
+7
-0
OrderMapper.xml
wisenergy-mapper/src/main/resources/mapper/OrderMapper.xml
+13
-0
AccountService.java
...rc/main/java/cn/wisenergy/service/app/AccountService.java
+1
-3
MonthTaskService.java
.../main/java/cn/wisenergy/service/app/MonthTaskService.java
+1
-3
AccountServiceImpl.java
...ava/cn/wisenergy/service/app/impl/AccountServiceImpl.java
+3
-1
MonthTaskServiceImpl.java
...a/cn/wisenergy/service/app/impl/MonthTaskServiceImpl.java
+37
-35
No files found.
wisenergy-mapper/src/main/java/cn/wisenergy/mapper/OrderMapper.java
View file @
53caafc8
...
@@ -49,4 +49,11 @@ public interface OrderMapper extends BaseMapper<OrderInfo> {
...
@@ -49,4 +49,11 @@ public interface OrderMapper extends BaseMapper<OrderInfo> {
* @return 订单列表
* @return 订单列表
*/
*/
List
<
OrderInfo
>
getListBySuccessTime
(
@Param
(
"successTime"
)
Date
successTime
);
List
<
OrderInfo
>
getListBySuccessTime
(
@Param
(
"successTime"
)
Date
successTime
);
/**
* 更据创建订单时间获取订单列表
* @param createTime 创建订单时间
* @return 订单列表
*/
List
<
OrderInfo
>
getByCreateTime
(
@Param
(
"createTime"
)
Date
createTime
);
}
}
wisenergy-mapper/src/main/resources/mapper/OrderMapper.xml
View file @
53caafc8
...
@@ -140,4 +140,17 @@
...
@@ -140,4 +140,17 @@
</where>
</where>
</select>
</select>
<select
id=
"getByCreateTime"
resultType=
"cn.wisenergy.model.app.OrderInfo"
>
SELECT
<include
refid=
"cols_all"
/>
from
<include
refid=
"table"
/>
<where>
<if
test=
"successTime != null "
>
YEAR(create_time) = YEAR(#{successTime})
AND MONTH(create_time) = MONTH(#{successTime})
</if>
</where>
</select>
</mapper>
</mapper>
\ No newline at end of file
wisenergy-service/src/main/java/cn/wisenergy/service/app/AccountService.java
View file @
53caafc8
...
@@ -29,11 +29,9 @@ public interface AccountService {
...
@@ -29,11 +29,9 @@ public interface AccountService {
/**
/**
* 收益和业绩统计(月度肥料 -日)
* 收益和业绩统计(月度肥料 -日)
*
* @param list 订单信息
* @return true or false
* @return true or false
*/
*/
R
<
Boolean
>
performanceCount
(
List
<
OrderInfo
>
list
);
R
<
Boolean
>
performanceCount
();
/**
/**
* 获取用户的商机信息
* 获取用户的商机信息
...
...
wisenergy-service/src/main/java/cn/wisenergy/service/app/MonthTaskService.java
View file @
53caafc8
...
@@ -21,11 +21,9 @@ public interface MonthTaskService {
...
@@ -21,11 +21,9 @@ public interface MonthTaskService {
/**
/**
* 收益和业绩统计(月度肥料)-月任务
* 收益和业绩统计(月度肥料)-月任务
*
* @param list 订单信息
* @return true or false
* @return true or false
*/
*/
R
<
Boolean
>
performanceCount
(
List
<
OrderInfo
>
list
);
R
<
Boolean
>
performanceCount
();
/**
/**
* 进步奖收益统计(最大进步奖) -月任务
* 进步奖收益统计(最大进步奖) -月任务
...
...
wisenergy-service/src/main/java/cn/wisenergy/service/app/impl/AccountServiceImpl.java
View file @
53caafc8
...
@@ -113,7 +113,9 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo>
...
@@ -113,7 +113,9 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo>
}
}
@Override
@Override
public
R
<
Boolean
>
performanceCount
(
List
<
OrderInfo
>
list
)
{
public
R
<
Boolean
>
performanceCount
()
{
//获取本月订单
List
<
OrderInfo
>
list
=
orderMapper
.
getByCreateTime
(
new
Date
());
log
.
info
(
"shop-mall[]AccountServiceImpl[]performanceCount[]input.param.list:{}"
,
list
.
size
());
log
.
info
(
"shop-mall[]AccountServiceImpl[]performanceCount[]input.param.list:{}"
,
list
.
size
());
if
(
CollectionUtils
.
isEmpty
(
list
))
{
if
(
CollectionUtils
.
isEmpty
(
list
))
{
return
R
.
ok
(
0
,
true
);
return
R
.
ok
(
0
,
true
);
...
...
wisenergy-service/src/main/java/cn/wisenergy/service/app/impl/MonthTaskServiceImpl.java
View file @
53caafc8
...
@@ -76,7 +76,10 @@ public class MonthTaskServiceImpl implements MonthTaskService {
...
@@ -76,7 +76,10 @@ public class MonthTaskServiceImpl implements MonthTaskService {
}
}
@Override
@Override
public
R
<
Boolean
>
performanceCount
(
List
<
OrderInfo
>
list
)
{
public
R
<
Boolean
>
performanceCount
()
{
//获取上月订单
Date
lastMonth
=
DateUtil
.
getLastMonth
(
new
Date
());
List
<
OrderInfo
>
list
=
orderMapper
.
getByCreateTime
(
lastMonth
);
log
.
info
(
"shop-mall[]AccountServiceImpl[]performanceCount[]input.param.list:{}"
,
list
.
size
());
log
.
info
(
"shop-mall[]AccountServiceImpl[]performanceCount[]input.param.list:{}"
,
list
.
size
());
if
(
CollectionUtils
.
isEmpty
(
list
))
{
if
(
CollectionUtils
.
isEmpty
(
list
))
{
return
R
.
ok
(
0
,
true
);
return
R
.
ok
(
0
,
true
);
...
@@ -99,47 +102,46 @@ public class MonthTaskServiceImpl implements MonthTaskService {
...
@@ -99,47 +102,46 @@ public class MonthTaskServiceImpl implements MonthTaskService {
for
(
OrderInfo
orderInfo
:
list
)
{
for
(
OrderInfo
orderInfo
:
list
)
{
long
createTime
=
orderInfo
.
getCreated
().
getTime
();
long
createTime
=
orderInfo
.
getCreated
().
getTime
();
long
time
=
System
.
currentTimeMillis
();
long
time
=
System
.
currentTimeMillis
();
if
(
createTime
<=
time
)
{
//获取用户信息
User
user
=
usersMapper
.
selectById
(
orderInfo
.
getBuyerId
());
if
(
null
==
user
)
{
continue
;
}
List
<
TeamPerformance
>
teamPerformances
=
new
ArrayList
<>();
//获取用户信息
User
user
=
usersMapper
.
selectById
(
orderInfo
.
getBuyerId
());
if
(
null
==
user
)
{
continue
;
}
//获取团队业绩信息
List
<
TeamPerformance
>
teamPerformances
=
new
ArrayList
<>();
TeamPerformance
teamPerformance
=
teamPerformanceMapper
.
getByUserIdAndTime
(
user
.
getUserId
(),
yearMonth
);
if
(
null
==
teamPerformance
)
{
continue
;
}
//1、统计当前用户月度业绩
//获取团队业绩信息
BigDecimal
userCount
=
teamPerformance
.
getMonthTeamPerformance
().
add
(
orderInfo
.
getPayment
());
TeamPerformance
teamPerformance
=
teamPerformanceMapper
.
getByUserIdAndTime
(
user
.
getUserId
(),
yearMonth
);
teamPerformance
.
setMonthTeamPerformance
(
userCount
);
if
(
null
==
teamPerformance
)
{
teamPerformances
.
add
(
teamPerformance
);
continue
;
}
//2、获取当前用户的上级用户列表 todo 邀请码等于一个固定值,停止 等于两个值 七位XXXXXXX 和 7777777
//1、统计当前用户月度业绩
List
<
User
>
userList
=
accountService
.
getByList
(
user
.
getUserId
());
BigDecimal
userCount
=
teamPerformance
.
getMonthTeamPerformance
().
add
(
orderInfo
.
getPayment
());
if
(
CollectionUtils
.
isEmpty
(
userList
))
{
teamPerformance
.
setMonthTeamPerformance
(
userCount
);
continue
;
teamPerformances
.
add
(
teamPerformance
);
}
//3、统计当前用户上级月度绩效
//2、获取当前用户的上级用户列表 todo 邀请码等于一个固定值,停止 等于两个值 七位XXXXXXX 和 7777777
for
(
User
userInfo
:
userList
)
{
List
<
User
>
userList
=
accountService
.
getByList
(
user
.
getUserId
());
TeamPerformance
team
=
teamPerformanceMapper
.
getByUserIdAndTime
(
userInfo
.
getUserId
(),
yearMonth
);
if
(
CollectionUtils
.
isEmpty
(
userList
))
{
if
(
null
==
team
)
{
continue
;
continue
;
}
}
//1)、统计当前用户月度绩效
BigDecimal
monthCount
=
team
.
getMonthTeamPerformance
().
add
(
orderInfo
.
getPayment
());
team
.
setMonthTeamPerformance
(
monthCount
);
teamPerformances
.
add
(
team
);
}
//4、更新账户月度绩效
//3、统计当前用户上级月度绩效
accountManager
.
updateAccountPerformanceMonth
(
teamPerformances
);
for
(
User
userInfo
:
userList
)
{
TeamPerformance
team
=
teamPerformanceMapper
.
getByUserIdAndTime
(
userInfo
.
getUserId
(),
yearMonth
);
if
(
null
==
team
)
{
continue
;
}
//1)、统计当前用户月度绩效
BigDecimal
monthCount
=
team
.
getMonthTeamPerformance
().
add
(
orderInfo
.
getPayment
());
team
.
setMonthTeamPerformance
(
monthCount
);
teamPerformances
.
add
(
team
);
}
}
//4、更新账户月度绩效
accountManager
.
updateAccountPerformanceMonth
(
teamPerformances
);
}
}
//5、获取所有用户,如果会员等级是黄金以上,计算月度收益
//5、获取所有用户,如果会员等级是黄金以上,计算月度收益
List
<
User
>
userList
=
usersMapper
.
getAllGoldUser
();
List
<
User
>
userList
=
usersMapper
.
getAllGoldUser
();
...
...
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