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
8d85fa25
Commit
8d85fa25
authored
Mar 01, 2021
by
licc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增枚举类
parent
f0958551
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
384 additions
and
49 deletions
+384
-49
ProgressPrizeMapper.java
...rc/main/java/cn/wisenergy/mapper/ProgressPrizeMapper.java
+17
-0
AccountInfoMapper.xml
...gy-mapper/src/main/resources/mapper/AccountInfoMapper.xml
+9
-8
ProgressPrizeMapper.xml
...-mapper/src/main/resources/mapper/ProgressPrizeMapper.xml
+75
-0
AccountInfo.java
...del/src/main/java/cn/wisenergy/model/app/AccountInfo.java
+6
-6
ProgressPrize.java
...l/src/main/java/cn/wisenergy/model/app/ProgressPrize.java
+62
-0
MonthOrderStatus.java
.../main/java/cn/wisenergy/model/enums/MonthOrderStatus.java
+39
-0
MonthlyTaskStatus.java
...main/java/cn/wisenergy/model/enums/MonthlyTaskStatus.java
+40
-0
RebateStatusEnum.java
.../main/java/cn/wisenergy/model/enums/RebateStatusEnum.java
+42
-0
UserLevelEnum.java
...src/main/java/cn/wisenergy/model/enums/UserLevelEnum.java
+54
-0
AccountManager.java
...ain/java/cn/wisenergy/service/Manager/AccountManager.java
+18
-21
AccountServiceImpl.java
...ava/cn/wisenergy/service/app/impl/AccountServiceImpl.java
+22
-14
No files found.
wisenergy-mapper/src/main/java/cn/wisenergy/mapper/ProgressPrizeMapper.java
0 → 100644
View file @
8d85fa25
package
cn
.
wisenergy
.
mapper
;
import
cn.wisenergy.model.app.ProgressPrize
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
org.apache.ibatis.annotations.Param
;
/**
* @author 86187
*/
public
interface
ProgressPrizeMapper
extends
BaseMapper
<
ProgressPrize
>
{
int
add
(
ProgressPrize
progressPrize
);
int
edit
(
ProgressPrize
progressPrize
);
int
delById
(
@Param
(
"id"
)
Integer
id
);
}
wisenergy-mapper/src/main/resources/mapper/AccountInfoMapper.xml
View file @
8d85fa25
...
@@ -6,10 +6,10 @@
...
@@ -6,10 +6,10 @@
<result
column=
"user_id"
property=
"userId"
/>
<result
column=
"user_id"
property=
"userId"
/>
<result
column=
"user_level"
property=
"userLevel"
/>
<result
column=
"user_level"
property=
"userLevel"
/>
<result
column=
"extract_money"
property=
"extractMoney"
/>
<result
column=
"extract_money"
property=
"extractMoney"
/>
<result
column=
"
performance_month"
property=
"performance
Month"
/>
<result
column=
"
earnings_month"
property=
"earnings
Month"
/>
<result
column=
"performance_team"
property=
"performanceTeam"
/>
<result
column=
"performance_team"
property=
"performanceTeam"
/>
<result
column=
"frozen_money"
property=
"frozenMoney"
/>
<result
column=
"frozen_money"
property=
"frozenMoney"
/>
<result
column=
"
performance_total"
property=
"performance
Total"
/>
<result
column=
"
earnings_total"
property=
"earnings
Total"
/>
<result
column=
"create_time"
property=
"createTime"
/>
<result
column=
"create_time"
property=
"createTime"
/>
<result
column=
"update_time"
property=
"updateTime"
/>
<result
column=
"update_time"
property=
"updateTime"
/>
</resultMap>
</resultMap>
...
@@ -24,21 +24,22 @@
...
@@ -24,21 +24,22 @@
</sql>
</sql>
<sql
id=
"cols_exclude_id"
>
<sql
id=
"cols_exclude_id"
>
user_id,user_level,extract_money,
performance_month,performance_team,frozen_money,performance
_total,create_time,update_time
user_id,user_level,extract_money,
earnings_month,performance_team,frozen_money,earnings
_total,create_time,update_time
</sql>
</sql>
<sql
id=
"vals"
>
<sql
id=
"vals"
>
#{userId},#{userLevel},#{extractMoney},#{performanceMonth},#{performanceTeam},#{frozenMoney}, #{performanceTotal},now(),now()
#{userId},#{userLevel},#{extractMoney},#{earningsMonth},#{performanceTeam},#{frozenMoney},
#{earningsTotal},now(),now()
</sql>
</sql>
<sql
id=
"updateCondition"
>
<sql
id=
"updateCondition"
>
<if
test=
"userId != null"
>
user_id = #{userId},
</if>
<if
test=
"userId != null"
>
user_id = #{userId},
</if>
<if
test=
"userLevel != null"
>
user_level = #{userLevel},
</if>
<if
test=
"userLevel != null"
>
user_level = #{userLevel},
</if>
<if
test=
"extractMoney != null"
>
extract_money =#{extractMoney},
</if>
<if
test=
"extractMoney != null"
>
extract_money =#{extractMoney},
</if>
<if
test=
"
performanceMonth != null"
>
performance_month =#{performance
Month},
</if>
<if
test=
"
earningsMonth != null"
>
earnings_month =#{earnings
Month},
</if>
<if
test=
"performanceTeam != null"
>
performance_team =#{performanceTeam},
</if>
<if
test=
"performanceTeam != null"
>
performance_team =#{performanceTeam},
</if>
<if
test=
"frozenMoney != null"
>
frozen_money =#{frozenMoney},
</if>
<if
test=
"frozenMoney != null"
>
frozen_money =#{frozenMoney},
</if>
<if
test=
"
performanceTotal != null"
>
performance_total =#{performance
Total},
</if>
<if
test=
"
earningsTotal != null"
>
earnings_total =#{earnings
Total},
</if>
update_time =now()
update_time =now()
</sql>
</sql>
...
@@ -47,10 +48,10 @@
...
@@ -47,10 +48,10 @@
<if
test=
"userId != null"
>
and user_id = #{userId}
</if>
<if
test=
"userId != null"
>
and user_id = #{userId}
</if>
<if
test=
"userLevel != null"
>
and user_level = #{userLevel}
</if>
<if
test=
"userLevel != null"
>
and user_level = #{userLevel}
</if>
<if
test=
"extractMoney != null"
>
and extract_money =#{extractMoney}
</if>
<if
test=
"extractMoney != null"
>
and extract_money =#{extractMoney}
</if>
<if
test=
"
performanceMonth != null"
>
and performance_month =#{performance
Month}
</if>
<if
test=
"
earningsMonth != null"
>
and earnings_month =#{earnings
Month}
</if>
<if
test=
"performanceTeam != null"
>
and performance_team =#{performanceTeam}
</if>
<if
test=
"performanceTeam != null"
>
and performance_team =#{performanceTeam}
</if>
<if
test=
"frozenMoney != null"
>
and frozen_money =#{frozenMoney}
</if>
<if
test=
"frozenMoney != null"
>
and frozen_money =#{frozenMoney}
</if>
<if
test=
"
performanceTotal != null"
>
performance_total =#{performance
Total}
</if>
<if
test=
"
earningsTotal != null"
>
and earnings_total =#{earnings
Total}
</if>
<if
test=
"createTime != null"
>
and create_time
>
= #{createTime}
</if>
<if
test=
"createTime != null"
>
and create_time
>
= #{createTime}
</if>
<if
test=
"updateTime != null"
>
and #{updateTime}
>
= update_time
</if>
<if
test=
"updateTime != null"
>
and #{updateTime}
>
= update_time
</if>
</sql>
</sql>
...
...
wisenergy-mapper/src/main/resources/mapper/ProgressPrizeMapper.xml
0 → 100644
View file @
8d85fa25
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"cn.wisenergy.mapper.ProgressPrizeMapper"
>
<resultMap
id=
"monthMap"
type=
"cn.wisenergy.model.app.ProgressPrize"
>
<id
column=
"id"
property=
"id"
/>
<result
column=
"user_id"
property=
"userId"
/>
<result
column=
"year_month"
property=
"yearMonth"
/>
<result
column=
"growth_rate"
property=
"growthRate"
/>
<result
column=
"award_money"
property=
"awardMoney"
/>
<result
column=
"create_time"
property=
"createTime"
/>
<result
column=
"update_time"
property=
"updateTime"
/>
</resultMap>
<sql
id=
"table"
>
month_award
</sql>
<sql
id=
"cols_all"
>
id,
<include
refid=
"cols_exclude_id"
/>
</sql>
<sql
id=
"cols_exclude_id"
>
user_id,year_month,growth_rate,award_money,create_time,update_time
</sql>
<sql
id=
"vals"
>
#{userId},#{yearMonth},#{growthRate},#{awardMoney},now(),now()
</sql>
<sql
id=
"updateCondition"
>
<if
test=
"userId != null"
>
user_id = #{userId},
</if>
<if
test=
"yearMonth != null"
>
year_month = #{yearMonth},
</if>
<if
test=
"growthRate != null"
>
growth_rate =#{growthRate},
</if>
<if
test=
"awardMoney != null"
>
award_money =#{awardMoney},
</if>
update_time =now()
</sql>
<sql
id=
"criteria"
>
<if
test=
"id != null"
>
id = #{id}
</if>
<if
test=
"userId != null"
>
and user_id = #{userId}
</if>
<if
test=
"yearMonth != null"
>
and year_month = #{yearMonth}
</if>
<if
test=
"growthRate != null"
>
and growth_rate =#{growthRate}
</if>
<if
test=
"awardMoney != null"
>
and award_money =#{awardMoney}
</if>
<if
test=
"createTime != null"
>
and create_time
>
= #{createTime}
</if>
<if
test=
"updateTime != null"
>
and #{updateTime}
>
= update_time
</if>
</sql>
<insert
id=
"add"
parameterType=
"cn.wisenergy.model.app.ProgressPrize"
keyProperty=
"id"
useGeneratedKeys=
"true"
>
insert into
<include
refid=
"table"
/>
(
<include
refid=
"cols_exclude_id"
/>
)
value(
<include
refid=
"vals"
/>
)
</insert>
<update
id=
"edit"
parameterType=
"cn.wisenergy.model.app.ProgressPrize"
>
UPDATE
<include
refid=
"table"
/>
<set>
<include
refid=
"updateCondition"
/>
</set>
<where>
id = #{id}
</where>
</update>
<delete
id=
"delById"
parameterType=
"java.lang.Integer"
>
delete from
<include
refid=
"table"
/>
where id = #{id}
</delete>
</mapper>
\ No newline at end of file
wisenergy-model/src/main/java/cn/wisenergy/model/app/AccountInfo.java
View file @
8d85fa25
...
@@ -44,10 +44,10 @@ public class AccountInfo implements Serializable {
...
@@ -44,10 +44,10 @@ public class AccountInfo implements Serializable {
private
BigDecimal
extractMoney
;
private
BigDecimal
extractMoney
;
/**
/**
* 本月
业绩
* 本月
收益
*/
*/
@ApiModelProperty
(
name
=
"
performanceMonth"
,
value
=
"本月业绩
"
)
@ApiModelProperty
(
name
=
"
earningsMonth"
,
value
=
"本月收益
"
)
private
BigDecimal
performance
Month
;
private
BigDecimal
earnings
Month
;
/**
/**
* 本月团队业绩
* 本月团队业绩
...
@@ -62,10 +62,10 @@ public class AccountInfo implements Serializable {
...
@@ -62,10 +62,10 @@ public class AccountInfo implements Serializable {
private
BigDecimal
frozenMoney
;
private
BigDecimal
frozenMoney
;
/**
/**
* 累计
业绩
* 累计
收益
*/
*/
@ApiModelProperty
(
name
=
"
performanceTotal"
,
value
=
"累计业绩
"
)
@ApiModelProperty
(
name
=
"
earningsTotal"
,
value
=
"累计收益
"
)
private
BigDecimal
performance
Total
;
private
BigDecimal
earnings
Total
;
/**
/**
* 创建时间
* 创建时间
*/
*/
...
...
wisenergy-model/src/main/java/cn/wisenergy/model/app/ProgressPrize.java
0 → 100644
View file @
8d85fa25
package
cn
.
wisenergy
.
model
.
app
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.math.BigDecimal
;
import
java.util.Date
;
/**
*@ Description: 每月进步奖实体类
*@ Author : 86187
*@ Date : 2021/3/1 9:31
* @author 86187
*/
@Data
public
class
ProgressPrize
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
1533799058729746392L
;
/**
* 主键id
*/
@ApiModelProperty
(
value
=
"主键id"
,
name
=
"id"
)
private
Integer
id
;
/**
* 用户id
*/
@ApiModelProperty
(
value
=
"用户id"
,
name
=
"userId"
)
private
String
userId
;
/**
* 年月
*/
@ApiModelProperty
(
value
=
"年月"
,
name
=
"yearMonth"
)
private
Date
yearMonth
;
/**
* 本月增长率
*/
@ApiModelProperty
(
value
=
"本月增长率"
,
name
=
"growthRate"
)
private
BigDecimal
growthRate
;
/**
* 进步奖奖金
*/
@ApiModelProperty
(
value
=
"进步奖奖金"
,
name
=
"awardMoney"
)
private
BigDecimal
awardMoney
;
/**
* 创建时间
*/
@ApiModelProperty
(
value
=
"创建时间"
,
name
=
"createTime"
)
private
Date
createTime
;
/**
* 更新时间
*/
@ApiModelProperty
(
value
=
"更新时间"
,
name
=
"updateTime"
)
private
Date
updateTime
;
}
wisenergy-model/src/main/java/cn/wisenergy/model/enums/MonthOrderStatus.java
0 → 100644
View file @
8d85fa25
package
cn
.
wisenergy
.
model
.
enums
;
/**
*@ Description: 月订单处理状态枚举
*@ Author : 86187
*@ Date : 2021/3/1 11:28
* @author 86187
*/
public
enum
MonthOrderStatus
{
/**
* 月订单处理状态
*/
NO_DEAL_WITH
(
0
,
"未处理"
),
ALREADY_DEAL_WITH
(
1
,
"已处理"
);
MonthOrderStatus
(
Integer
code
,
String
desc
)
{
this
.
code
=
code
;
this
.
desc
=
desc
;
}
private
Integer
code
;
private
String
desc
;
public
Integer
getCode
()
{
return
code
;
}
public
void
setCode
(
Integer
code
)
{
this
.
code
=
code
;
}
public
String
getDesc
()
{
return
desc
;
}
public
void
setDesc
(
String
desc
)
{
this
.
desc
=
desc
;
}
}
wisenergy-model/src/main/java/cn/wisenergy/model/enums/MonthlyTaskStatus.java
0 → 100644
View file @
8d85fa25
package
cn
.
wisenergy
.
model
.
enums
;
/**
* @author 86187
* @ Description: 月度任务状态枚举
* @ Author : 86187
* @ Date : 2021/3/1 11:38
*/
public
enum
MonthlyTaskStatus
{
/**
* 月度任务状态
*/
NO_DEAL_WITH
(
0
,
"未处理"
),
ALREADY_DEAL_WITH
(
1
,
"已处理"
);
MonthlyTaskStatus
(
Integer
code
,
String
desc
)
{
this
.
code
=
code
;
this
.
desc
=
desc
;
}
private
Integer
code
;
private
String
desc
;
public
Integer
getCode
()
{
return
code
;
}
public
void
setCode
(
Integer
code
)
{
this
.
code
=
code
;
}
public
String
getDesc
()
{
return
desc
;
}
public
void
setDesc
(
String
desc
)
{
this
.
desc
=
desc
;
}
}
wisenergy-model/src/main/java/cn/wisenergy/model/enums/RebateStatusEnum.java
0 → 100644
View file @
8d85fa25
package
cn
.
wisenergy
.
model
.
enums
;
/**
* @author 86187
* @ Description: 订单返佣状态枚举
* @ Author : 86187
* @ Date : 2021/3/1 10:42
*/
public
enum
RebateStatusEnum
{
/**
* 返佣状态
*/
NO_REBATE
(
0
,
"未返佣"
),
ALREADY_REBATE
(
1
,
"已返佣"
);
RebateStatusEnum
(
Integer
code
,
String
desc
)
{
this
.
code
=
code
;
this
.
desc
=
desc
;
}
private
Integer
code
;
private
String
desc
;
public
Integer
getCode
()
{
return
code
;
}
public
void
setCode
(
Integer
code
)
{
this
.
code
=
code
;
}
public
String
getDesc
()
{
return
desc
;
}
public
void
setDesc
(
String
desc
)
{
this
.
desc
=
desc
;
}
}
wisenergy-model/src/main/java/cn/wisenergy/model/enums/UserLevelEnum.java
0 → 100644
View file @
8d85fa25
package
cn
.
wisenergy
.
model
.
enums
;
/**
* @author 86187
* @ Description: 用户会员等级枚举类
* @ Author : 86187
* @ Date : 2021/3/1 11:14
*/
public
enum
UserLevelEnum
{
/**
* 会员等级
*/
NORMAL_USER
(
0
,
"普通用户"
),
SEEDLING
(
1
,
"幼苗"
),
BRONZE_TREE
(
2
,
"青铜树"
),
SILVER_TREE
(
3
,
"白银树"
),
GOLD_TREE
(
4
,
"黄金树"
),
FARMER
(
6
,
"农场主"
),
FOREST_START
(
7
,
"森林之星"
),
PARTNER
(
8
,
"西田森合伙人"
);
private
Integer
code
;
private
String
desc
;
UserLevelEnum
(
Integer
code
,
String
desc
)
{
this
.
code
=
code
;
this
.
desc
=
desc
;
}
public
Integer
getCode
()
{
return
code
;
}
public
void
setCode
(
Integer
code
)
{
this
.
code
=
code
;
}
public
String
getDesc
()
{
return
desc
;
}
public
void
setDesc
(
String
desc
)
{
this
.
desc
=
desc
;
}
}
wisenergy-service/src/main/java/cn/wisenergy/service/Manager/AccountManager.java
View file @
8d85fa25
...
@@ -5,6 +5,7 @@ import cn.wisenergy.mapper.OrderMapper;
...
@@ -5,6 +5,7 @@ import cn.wisenergy.mapper.OrderMapper;
import
cn.wisenergy.mapper.TeamPerformanceMapper
;
import
cn.wisenergy.mapper.TeamPerformanceMapper
;
import
cn.wisenergy.mapper.TradeRecordMapper
;
import
cn.wisenergy.mapper.TradeRecordMapper
;
import
cn.wisenergy.model.app.*
;
import
cn.wisenergy.model.app.*
;
import
cn.wisenergy.model.enums.RebateStatusEnum
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
...
@@ -35,43 +36,39 @@ public class AccountManager {
...
@@ -35,43 +36,39 @@ public class AccountManager {
@Autowired
@Autowired
private
TeamPerformanceMapper
teamPerformanceMapper
;
private
TeamPerformanceMapper
teamPerformanceMapper
;
/**
* 保存用户佣金
*
* @param orderInfo 订单信息
* @param accountInfo 账户信息
* @param memberPercent 会员等级百比分
*/
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
Boolean
updateOrderAddMoney
(
OrderInfo
orderInfo
,
AccountInfo
accountInfo
,
MemberPercent
memberp
ercent
)
{
public
void
updateOrderAddMoney
(
OrderInfo
orderInfo
,
AccountInfo
accountInfo
,
MemberPercent
memberP
ercent
)
{
//1、计算返佣金额
//1、计算返佣金额
BigDecimal
bigDecimal
=
orderInfo
.
getPayment
().
multiply
(
member
p
ercent
.
getPercent
());
BigDecimal
bigDecimal
=
orderInfo
.
getPayment
().
multiply
(
member
P
ercent
.
getPercent
());
BigDecimal
extractMoney
=
accountInfo
.
getExtractMoney
().
add
(
bigDecimal
);
BigDecimal
extractMoney
=
accountInfo
.
getExtractMoney
().
add
(
bigDecimal
);
accountInfo
.
setExtractMoney
(
extractMoney
);
accountInfo
.
setExtractMoney
(
extractMoney
);
BigDecimal
performanceMonth
=
accountInfo
.
get
Performance
Month
().
add
(
bigDecimal
);
BigDecimal
performanceMonth
=
accountInfo
.
get
Earnings
Month
().
add
(
bigDecimal
);
accountInfo
.
set
Performance
Month
(
performanceMonth
);
accountInfo
.
set
Earnings
Month
(
performanceMonth
);
BigDecimal
performanceTotal
=
accountInfo
.
get
PerformanceTotal
().
add
(
bigDecimal
);
BigDecimal
performanceTotal
=
accountInfo
.
get
EarningsMonth
().
add
(
bigDecimal
);
accountInfo
.
set
Performance
Month
(
performanceTotal
);
accountInfo
.
set
Earnings
Month
(
performanceTotal
);
//2、修改订单返佣状态:已返佣 1
//2、修改订单返佣状态:已返佣 1
orderInfo
.
setRebateStatus
(
1
);
orderInfo
.
setRebateStatus
(
RebateStatusEnum
.
ALREADY_REBATE
.
getCode
()
);
int
count
=
orderMapper
.
updateById
(
orderInfo
);
orderMapper
.
updateById
(
orderInfo
);
if
(
count
==
0
)
{
return
false
;
}
//3、增加账户可用金额
//3、增加账户可用金额
int
sum
=
accountMapper
.
updateById
(
accountInfo
);
accountMapper
.
updateById
(
accountInfo
);
if
(
sum
==
0
){
return
false
;
}
//4、添加交易流水记录
//4、添加交易流水记录
TradeRecord
tradeRecord
=
new
TradeRecord
();
TradeRecord
tradeRecord
=
new
TradeRecord
();
tradeRecord
.
setUserId
(
orderInfo
.
getBuyerId
());
tradeRecord
.
setUserId
(
orderInfo
.
getBuyerId
());
tradeRecord
.
setTradeType
(
2
);
tradeRecord
.
setTradeType
(
2
);
tradeRecord
.
setTradeNo
(
orderInfo
.
getTid
());
tradeRecord
.
setTradeNo
(
orderInfo
.
getTid
());
int
number
=
recordMapper
.
add
(
tradeRecord
);
recordMapper
.
add
(
tradeRecord
);
if
(
number
==
0
)
{
return
false
;
}
return
true
;
}
}
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
...
...
wisenergy-service/src/main/java/cn/wisenergy/service/app/impl/AccountServiceImpl.java
View file @
8d85fa25
...
@@ -6,6 +6,8 @@ import cn.wisenergy.mapper.MemberPercentMapper;
...
@@ -6,6 +6,8 @@ import cn.wisenergy.mapper.MemberPercentMapper;
import
cn.wisenergy.mapper.TeamPerformanceMapper
;
import
cn.wisenergy.mapper.TeamPerformanceMapper
;
import
cn.wisenergy.mapper.UsersMapper
;
import
cn.wisenergy.mapper.UsersMapper
;
import
cn.wisenergy.model.app.*
;
import
cn.wisenergy.model.app.*
;
import
cn.wisenergy.model.enums.MonthlyTaskStatus
;
import
cn.wisenergy.model.enums.RebateStatusEnum
;
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
;
...
@@ -56,12 +58,11 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo>
...
@@ -56,12 +58,11 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo>
return
R
.
ok
(
0
,
true
);
return
R
.
ok
(
0
,
true
);
}
}
//
遍历订单,
返佣
//
1、遍历订单,订单状态是未返佣,完成时间小于当前时间 --
返佣
for
(
OrderInfo
orderInfo
:
list
)
{
for
(
OrderInfo
orderInfo
:
list
)
{
//订单状态是未返佣,完成时间小于当前时间
long
successTime
=
orderInfo
.
getSuccessTime
().
getTime
();
long
successTime
=
orderInfo
.
getSuccessTime
().
getTime
();
long
time
=
System
.
currentTimeMillis
();
long
time
=
System
.
currentTimeMillis
();
if
(
orderInfo
.
getRebateStatus
()
==
0
&&
successTime
<=
time
)
{
if
(
RebateStatusEnum
.
NO_REBATE
.
getCode
().
equals
(
orderInfo
.
getRebateStatus
())
&&
successTime
<=
time
)
{
//获取用户信息
//获取用户信息
User
user
=
usersMapper
.
selectById
(
orderInfo
.
getBuyerId
());
User
user
=
usersMapper
.
selectById
(
orderInfo
.
getBuyerId
());
if
(
null
==
user
)
{
if
(
null
==
user
)
{
...
@@ -103,18 +104,18 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo>
...
@@ -103,18 +104,18 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo>
//计算当月所有订单成交额
//计算当月所有订单成交额
BigDecimal
totalMoney
=
new
BigDecimal
(
0
);
BigDecimal
totalMoney
=
new
BigDecimal
(
0
);
for
(
OrderInfo
orderInfo
:
list
)
{
for
(
OrderInfo
orderInfo
:
list
)
{
//判断是否是本月
boolean
bool
=
publicManager
.
isThisMonth
(
orderInfo
.
getCreateTime
(),
PATTERN
);
boolean
bool
=
publicManager
.
isThisMonth
(
orderInfo
.
getCreateTime
(),
PATTERN
);
if
(
bool
&&
orderInfo
.
getMonthlyTaskStatus
()
==
0
)
{
if
(
bool
&&
orderInfo
.
getMonthlyTaskStatus
()
==
0
)
{
totalMoney
=
totalMoney
.
add
(
orderInfo
.
getPayment
());
totalMoney
=
totalMoney
.
add
(
orderInfo
.
getPayment
());
}
}
}
}
//遍历订单
//遍历订单
订单状态创建时间,小于当前时间 订单当月处理状态 :未处理
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
(
orderInfo
.
getMonthlyTaskStatus
()
==
0
&&
createTime
<=
time
)
{
if
(
MonthlyTaskStatus
.
NO_DEAL_WITH
.
getCode
().
equals
(
orderInfo
.
getMonthlyTaskStatus
())
&&
createTime
<=
time
)
{
//获取用户信息
//获取用户信息
User
user
=
usersMapper
.
selectById
(
orderInfo
.
getBuyerId
());
User
user
=
usersMapper
.
selectById
(
orderInfo
.
getBuyerId
());
if
(
null
==
user
)
{
if
(
null
==
user
)
{
...
@@ -142,7 +143,7 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo>
...
@@ -142,7 +143,7 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo>
for
(
User
userInfo
:
userList
)
{
for
(
User
userInfo
:
userList
)
{
//3、统计当前用户上级月度绩效
//3、统计当前用户上级月度绩效
TeamPerformance
team
=
teamPerformanceMapper
.
getByUserIdAndTime
(
user
.
getUserId
(),
new
Date
());
TeamPerformance
team
=
teamPerformanceMapper
.
getByUserIdAndTime
(
user
Info
.
getUserId
(),
new
Date
());
if
(
null
==
team
)
{
if
(
null
==
team
)
{
continue
;
continue
;
}
}
...
@@ -215,7 +216,7 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo>
...
@@ -215,7 +216,7 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo>
//获取账户信息
//获取账户信息
AccountInfo
accountInfo
=
accountMapper
.
getByUserId
(
user
.
getUserId
());
AccountInfo
accountInfo
=
accountMapper
.
getByUserId
(
user
.
getUserId
());
accountInfo
.
set
Performance
Month
(
new
BigDecimal
(
income
));
accountInfo
.
set
Earnings
Month
(
new
BigDecimal
(
income
));
//更新用户账户表
//更新用户账户表
accountMapper
.
updateById
(
accountInfo
);
accountMapper
.
updateById
(
accountInfo
);
...
@@ -292,7 +293,7 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo>
...
@@ -292,7 +293,7 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo>
//获取账户信息
//获取账户信息
AccountInfo
accountInfo
=
accountMapper
.
getByUserId
(
userId
);
AccountInfo
accountInfo
=
accountMapper
.
getByUserId
(
userId
);
accountInfo
.
set
Performance
Month
(
new
BigDecimal
(
income
));
accountInfo
.
set
Earnings
Month
(
new
BigDecimal
(
income
));
//更新用户账户表
//更新用户账户表
accountMapper
.
updateById
(
accountInfo
);
accountMapper
.
updateById
(
accountInfo
);
...
@@ -314,7 +315,7 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo>
...
@@ -314,7 +315,7 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo>
//获取账户信息
//获取账户信息
AccountInfo
accountInfo
=
accountMapper
.
getByUserId
(
userId
);
AccountInfo
accountInfo
=
accountMapper
.
getByUserId
(
userId
);
accountInfo
.
set
Performance
Month
(
new
BigDecimal
(
income
));
accountInfo
.
set
Earnings
Month
(
new
BigDecimal
(
income
));
//更新用户账户表
//更新用户账户表
accountMapper
.
updateById
(
accountInfo
);
accountMapper
.
updateById
(
accountInfo
);
...
@@ -332,6 +333,13 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo>
...
@@ -332,6 +333,13 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo>
}
}
}
}
/**
* 如果会员等级是黄金以上,计算月度收益
*
* @param totalMoney
* @param user
* @return
*/
private
boolean
monthlyIncome
(
BigDecimal
totalMoney
,
User
user
)
{
private
boolean
monthlyIncome
(
BigDecimal
totalMoney
,
User
user
)
{
double
total
=
totalMoney
.
doubleValue
();
double
total
=
totalMoney
.
doubleValue
();
BigDecimal
money
;
BigDecimal
money
;
...
@@ -355,11 +363,11 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo>
...
@@ -355,11 +363,11 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo>
//获取账户信息
//获取账户信息
AccountInfo
accountInfo
=
accountMapper
.
getByUserId
(
user
.
getUserId
());
AccountInfo
accountInfo
=
accountMapper
.
getByUserId
(
user
.
getUserId
());
BigDecimal
bigDecimal
=
new
BigDecimal
(
income
);
BigDecimal
bigDecimal
=
new
BigDecimal
(
income
);
BigDecimal
performanceMonth
=
accountInfo
.
get
Performance
Month
().
add
(
bigDecimal
);
BigDecimal
performanceMonth
=
accountInfo
.
get
Earnings
Month
().
add
(
bigDecimal
);
accountInfo
.
set
Performance
Month
(
performanceMonth
);
accountInfo
.
set
Earnings
Month
(
performanceMonth
);
BigDecimal
performanceTotal
=
accountInfo
.
get
PerformanceTotal
().
add
(
bigDecimal
);
BigDecimal
performanceTotal
=
accountInfo
.
get
EarningsMonth
().
add
(
bigDecimal
);
accountInfo
.
set
Performance
Month
(
performanceTotal
);
accountInfo
.
set
Earnings
Month
(
performanceTotal
);
//更新月收益
//更新月收益
int
count
=
accountMapper
.
updateById
(
accountInfo
);
int
count
=
accountMapper
.
updateById
(
accountInfo
);
...
...
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