Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
S
shop-Mall
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
shop-Mall
Commits
198b1ce6
Commit
198b1ce6
authored
Mar 10, 2021
by
licc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化月度任务接口
parent
c3d4fb4a
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
484 additions
and
55 deletions
+484
-55
UsersMapper.java
...mapper/src/main/java/cn/wisenergy/mapper/UsersMapper.java
+35
-12
UsersMapper.xml
wisenergy-mapper/src/main/resources/mapper/UsersMapper.xml
+20
-9
OrderInfo.java
...model/src/main/java/cn/wisenergy/model/app/OrderInfo.java
+0
-1
AccountManager.java
...ain/java/cn/wisenergy/service/Manager/AccountManager.java
+39
-0
AccountService.java
...rc/main/java/cn/wisenergy/service/app/AccountService.java
+0
-5
MonthTaskService.java
.../main/java/cn/wisenergy/service/app/MonthTaskService.java
+32
-0
AccountServiceImpl.java
...ava/cn/wisenergy/service/app/impl/AccountServiceImpl.java
+16
-28
MonthTaskServiceImpl.java
...a/cn/wisenergy/service/app/impl/MonthTaskServiceImpl.java
+342
-0
No files found.
wisenergy-mapper/src/main/java/cn/wisenergy/mapper/UsersMapper.java
View file @
198b1ce6
...
...
@@ -44,12 +44,16 @@ public interface UsersMapper extends BaseMapper<User> {
List
<
User
>
getList
(
Map
<
String
,
Object
>
map
);
List
<
User
>
findAll
();
User
findByName
(
String
name
);
String
findPswByName
(
String
UserName
);
void
save
(
User
user
);
/**
* 获取用户信息
*
* @param userId 用户id
* @return 用户信息
*/
...
...
@@ -57,6 +61,7 @@ public interface UsersMapper extends BaseMapper<User> {
/**
* 获取用户信息
*
* @param userId 用户id
* @return 用户信息
*/
...
...
@@ -64,6 +69,7 @@ public interface UsersMapper extends BaseMapper<User> {
/**
* 获取用户信息
*
* @param
* @return 用户信息
*/
...
...
@@ -71,6 +77,7 @@ public interface UsersMapper extends BaseMapper<User> {
/**
* 获取用户信息
*
* @param beInvitedCode 用户被邀请码
* @return 用户信息
*/
...
...
@@ -78,39 +85,46 @@ public interface UsersMapper extends BaseMapper<User> {
/**
* 获取黄金树以上会员用户
*
* @return
*/
List
<
User
>
getAllGoldUser
();
/**
* 查询用户
*
* @param param
* @return
*/
public
List
<
User
>
getUsersListByMap
(
Map
<
String
,
Object
>
param
);
public
List
<
User
>
getUsersListByMap
(
Map
<
String
,
Object
>
param
);
//根据手机号查询用户Integer
User
queryUsersByPhone
(
@Param
(
"userId"
)
String
userId
);
User
queryUsersByPhone
(
@Param
(
"userId"
)
String
userId
);
//根据用户的推荐人邀请码比对推荐人的本人邀请码,查询推荐人的用户ID
Integer
inviteCodeBeInvitedCode
(
@Param
(
"beInvitedCode"
)
Integer
beInvitedCode
);
Integer
inviteCodeBeInvitedCode
(
@Param
(
"beInvitedCode"
)
Integer
beInvitedCode
);
/**
* 用户注册
*
* @param userId
* @param inviteCode
* @param beInvitedCode
* @param userLevel
*/
Integer
save
(
@Param
(
"userId"
)
String
userId
,
@Param
(
"inviteCode"
)
String
inviteCode
,
@Param
(
"beInvitedCode"
)
String
beInvitedCode
,
@Param
(
"userLevel"
)
Integer
userLevel
);
Integer
insertbyint
(
@Param
(
"userId"
)
String
userId
,
@Param
(
"beInvitedCode"
)
String
beInvitedCode
);
Integer
save
(
@Param
(
"userId"
)
String
userId
,
@Param
(
"inviteCode"
)
String
inviteCode
,
@Param
(
"beInvitedCode"
)
String
beInvitedCode
,
@Param
(
"userLevel"
)
Integer
userLevel
);
User
edit1
(
int
userLevel
,
String
intiveCode
,
String
userId
);
Integer
insertbyint
(
@Param
(
"userId"
)
String
userId
,
@Param
(
"beInvitedCode"
)
String
beInvitedCode
);
User
edit1
(
int
userLevel
,
String
intiveCode
,
String
userId
);
Integer
getuserIdById
(
@Param
(
"userId"
)
String
userId
);
Integer
BYQMById
(
@Param
(
"userId"
)
String
userId
);
Integer
getuserIdById
(
@Param
(
"userId"
)
String
userId
);
Integer
BYQMById
(
@Param
(
"userId"
)
String
userId
);
/**
* 根据userid获取获取所有的直接推荐人
*
* @param inviteCode 用户本人的邀请码
* @return 所有填写此人的邀请码的用户
*/
...
...
@@ -118,8 +132,17 @@ public interface UsersMapper extends BaseMapper<User> {
/**
* 通过邀请码,获取用户信息
*
* @param inviteCode 邀请码
* @return 用户信息
*/
User
queryByInviteCode
(
@Param
(
"inviteCode"
)
String
inviteCode
);
/**
* 通过用户等级,获取该等级用户列表
*
* @param userLevel 用户等级
* @return 等级用户列表
*/
List
<
User
>
getByLevel
(
@Param
(
"userLevel"
)
Integer
userLevel
);
}
wisenergy-mapper/src/main/resources/mapper/UsersMapper.xml
View file @
198b1ce6
...
...
@@ -165,7 +165,8 @@
<!--用户注册-->
<insert
id=
"save"
>
insert into user(user_id,invite_code,be_invited_code,user_level) value (#{userId},#{inviteCode},#{beInvitedCode},#{userLevel})
insert into user(user_id,invite_code,be_invited_code,user_level) value
(#{userId},#{inviteCode},#{beInvitedCode},#{userLevel})
</insert>
<insert
id=
"insertbyint"
>
insert into user_info(user_id,be_invited_code) value (#{userId},#{beInvitedCode})
...
...
@@ -219,7 +220,7 @@
user_id=#{userId}
</where>
</select>
<update
id=
"edit1"
>
<update
id=
"edit1"
>
update
user_info
<set>
...
...
@@ -289,7 +290,7 @@
</if>
</select>
<!-- 获取当前用户的所有直接推荐人-->
<!-- 获取当前用户的所有直接推荐人-->
<select
id=
"getByInviteCode"
resultType=
"cn.wisenergy.model.app.User"
parameterType=
"string"
>
select
<include
refid=
"cols_all"
/>
...
...
@@ -311,5 +312,15 @@
</where>
</select>
<select
id=
"getByLevel"
resultType=
"cn.wisenergy.model.app.User"
>
select
<include
refid=
"cols_all"
/>
from
<include
refid=
"table"
/>
<where>
user_level=#{userLevel}
</where>
</select>
</mapper>
wisenergy-model/src/main/java/cn/wisenergy/model/app/OrderInfo.java
View file @
198b1ce6
package
cn
.
wisenergy
.
model
.
app
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
...
...
wisenergy-service/src/main/java/cn/wisenergy/service/Manager/AccountManager.java
View file @
198b1ce6
...
...
@@ -46,6 +46,9 @@ public class AccountManager {
@Autowired
private
TradeRecordMapper
tradeRecordMapper
;
@Autowired
private
MonthManureMapper
monthManureMapper
;
private
static
final
String
PATTERN
=
"yyyy-MM"
;
...
...
@@ -229,4 +232,40 @@ public class AccountManager {
}
return
true
;
}
/**
* 更新账户信息和保存交易流水记录、保存上月剩余月度肥料奖金
*
* @param accountInfoList 账户列表
* @param recordList 交易流水信息
*/
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
Boolean
updateAccountAddRecordAndManure
(
List
<
AccountInfo
>
accountInfoList
,
List
<
TradeRecord
>
recordList
,
MonthManure
manure
)
{
//更新月收益
if
(!
CollectionUtils
.
isEmpty
(
accountInfoList
))
{
for
(
AccountInfo
accountInfo
:
accountInfoList
)
{
int
count
=
accountMapper
.
updateById
(
accountInfo
);
if
(
count
==
0
)
{
return
false
;
}
}
}
//新增交易流水记录
if
(!
CollectionUtils
.
isEmpty
(
recordList
))
{
for
(
TradeRecord
tradeRecord
:
recordList
)
{
int
count
=
tradeRecordMapper
.
add
(
tradeRecord
);
if
(
count
==
0
)
{
return
false
;
}
}
}
//新增上月剩余月度肥料奖金
int
count
=
monthManureMapper
.
add
(
manure
);
return
count
!=
0
;
}
}
wisenergy-service/src/main/java/cn/wisenergy/service/app/AccountService.java
View file @
198b1ce6
...
...
@@ -50,9 +50,4 @@ public interface AccountService {
* @return true or false
*/
R
<
Boolean
>
progressPrizeCount
();
/**
* 账户表镜像---每月更新一次,保存上一个的数据
*/
void
mirrorImage
();
}
wisenergy-service/src/main/java/cn/wisenergy/service/app/MonthTaskService.java
View file @
198b1ce6
package
cn
.
wisenergy
.
service
.
app
;
import
cn.wisenergy.common.utils.R
;
import
cn.wisenergy.model.app.OrderInfo
;
import
java.util.List
;
/**
*@ Description: 月定时任务接口定义
*@ Author : 86187
...
...
@@ -6,4 +12,30 @@ package cn.wisenergy.service.app;
* @author 86187
*/
public
interface
MonthTaskService
{
/**
* 订单返佣-月任务
* @return true or false
*/
R
<
Boolean
>
orderRebate
();
/**
* 收益和业绩统计(月度肥料)-月任务
*
* @param list 订单信息
* @return true or false
*/
R
<
Boolean
>
performanceCount
(
List
<
OrderInfo
>
list
);
/**
* 进步奖收益统计(最大进步奖) -月任务
*
* @return true or false
*/
R
<
Boolean
>
progressPrizeCount
();
/**
* 账户表镜像---每月更新一次,保存上一个的数据
*/
void
mirrorImage
();
}
wisenergy-service/src/main/java/cn/wisenergy/service/app/impl/AccountServiceImpl.java
View file @
198b1ce6
...
...
@@ -57,10 +57,10 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo>
private
ProgressPrizeMapper
progressPrizeMapper
;
@Autowired
private
LastAccountMapper
lastAccount
Mapper
;
private
OrderMapper
order
Mapper
;
@Autowired
private
OrderMapper
order
Mapper
;
private
MonthManureMapper
monthManure
Mapper
;
private
static
final
String
PATTERN
=
"yyyy-MM"
;
...
...
@@ -70,7 +70,7 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo>
public
R
<
Boolean
>
orderRebate
()
{
//获取返佣订单
List
<
OrderInfo
>
list
=
orderMapper
.
getListBySuccessTime
(
new
Date
());
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
);
...
...
@@ -292,29 +292,6 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo>
return
R
.
ok
(
0
,
true
);
}
@Override
public
void
mirrorImage
()
{
//1、把账户表account_info复制给表account_image CREATE TABLE table_2 SELECT * FROM table_1;
lastAccountMapper
.
copyTable
(
"account_info"
,
"account_image"
);
//删除上月备份
lastAccountMapper
.
deleteTable
(
"account_backup"
);
//备份
lastAccountMapper
.
copyTable
(
"account_info"
,
"account_backup"
);
//2、把上月账户表last_month_account 复制给month_account_image
lastAccountMapper
.
copyTable
(
"last_month_account"
,
"month_account_image"
);
//3、删除last_month_account
lastAccountMapper
.
deleteTable
(
"last_month_account"
);
//4、把account_image 更名为 last_month_account rename table table_2 to table_1;
lastAccountMapper
.
updateTableName
(
"account_image"
,
"last_month_account"
);
//5、删除month_account_image DROP table table_2;
lastAccountMapper
.
deleteTable
(
"month_account_image"
);
}
public
void
getUser
(
List
<
User
>
list
,
String
userId
)
{
User
user
=
usersMapper
.
getByUserId
(
userId
);
...
...
@@ -341,6 +318,17 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo>
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
)
{
//获取等级优惠百分比
...
...
@@ -355,7 +343,7 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo>
double
month
=
teamPerformance
.
getMonthTeamPerformance
().
doubleValue
();
double
percent
=
memberPercent
.
getPercent
().
doubleValue
();
//计算收益
double
income
=
moneyMonth
*
3980
*
percent
*
month
/
teamTotal
;
double
income
=
(
moneyMonth
+
lastMonthAward
)
*
3980
*
percent
*
month
/
teamTotal
;
//获取账户信息
AccountInfo
accountInfo
=
accountMapper
.
getByUserId
(
user
.
getUserId
());
...
...
@@ -371,7 +359,7 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo>
//5、添加交易流水记录
TradeRecord
tradeRecord
=
new
TradeRecord
();
tradeRecord
.
setUserId
(
user
.
getUserId
());
tradeRecord
.
setTradeType
(
TradeRecordEnum
.
ORDER_REBATE
.
getCode
());
tradeRecord
.
setTradeType
(
TradeRecordEnum
.
MONTHLY_FERTILIZER
.
getCode
());
tradeRecord
.
setTradeNo
(
null
);
tradeRecord
.
setStatus
(
TradeStatusEnum
.
NO_SETTLE_ACCOUNTS
.
getCode
());
tradeRecordList
.
add
(
tradeRecord
);
...
...
wisenergy-service/src/main/java/cn/wisenergy/service/app/impl/MonthTaskServiceImpl.java
View file @
198b1ce6
This diff is collapsed.
Click to expand it.
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