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
09f5eafe
Commit
09f5eafe
authored
Mar 01, 2021
by
licc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
代码优化
parent
5ea1c059
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
89 additions
and
20 deletions
+89
-20
MonthAwardMapper.xml
...rgy-mapper/src/main/resources/mapper/MonthAwardMapper.xml
+5
-2
MonthAward.java
...odel/src/main/java/cn/wisenergy/model/app/MonthAward.java
+6
-0
TradeRecord.java
...del/src/main/java/cn/wisenergy/model/app/TradeRecord.java
+1
-1
TradeRecordEnum.java
...c/main/java/cn/wisenergy/model/enums/TradeRecordEnum.java
+49
-0
UserLevelEnum.java
...src/main/java/cn/wisenergy/model/enums/UserLevelEnum.java
+3
-3
AccountManager.java
...ain/java/cn/wisenergy/service/Manager/AccountManager.java
+2
-1
AccountServiceImpl.java
...ava/cn/wisenergy/service/app/impl/AccountServiceImpl.java
+23
-13
No files found.
wisenergy-mapper/src/main/resources/mapper/MonthAwardMapper.xml
View file @
09f5eafe
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
<mapper
namespace=
"cn.wisenergy.mapper.MonthAwardMapper"
>
<mapper
namespace=
"cn.wisenergy.mapper.MonthAwardMapper"
>
<resultMap
id=
"monthMap"
type=
"cn.wisenergy.model.app.MonthAward"
>
<resultMap
id=
"monthMap"
type=
"cn.wisenergy.model.app.MonthAward"
>
<id
column=
"id"
property=
"id"
/>
<id
column=
"id"
property=
"id"
/>
<result
column=
"year_month"
property=
"yearMonth"
/>
<result
column=
"month_manure_total"
property=
"monthManureTotal"
/>
<result
column=
"month_manure_total"
property=
"monthManureTotal"
/>
<result
column=
"month_award_pool"
property=
"monthAwardPool"
/>
<result
column=
"month_award_pool"
property=
"monthAwardPool"
/>
<result
column=
"month_manure_award"
property=
"monthManureAward"
/>
<result
column=
"month_manure_award"
property=
"monthManureAward"
/>
...
@@ -24,16 +25,17 @@
...
@@ -24,16 +25,17 @@
</sql>
</sql>
<sql
id=
"cols_exclude_id"
>
<sql
id=
"cols_exclude_id"
>
month_manure_total,month_award_pool,month_manure_award,month_gold_award,month_farmer_award,
year_month,
month_manure_total,month_award_pool,month_manure_award,month_gold_award,month_farmer_award,
month_forest_start_award,month_partner_award,create_time,update_time
month_forest_start_award,month_partner_award,create_time,update_time
</sql>
</sql>
<sql
id=
"vals"
>
<sql
id=
"vals"
>
#{monthManureTotal},#{monthAwardPool},#{monthManureAward},#{monthGoldAward},#{monthFarmerAward},
#{
yearMonth},#{
monthManureTotal},#{monthAwardPool},#{monthManureAward},#{monthGoldAward},#{monthFarmerAward},
#{monthForestStartAward}, #{monthPartnerAward},now(),now()
#{monthForestStartAward}, #{monthPartnerAward},now(),now()
</sql>
</sql>
<sql
id=
"updateCondition"
>
<sql
id=
"updateCondition"
>
<if
test=
"yearMonth != null"
>
year_month =#{yearMonth},
</if>
<if
test=
"monthManureTotal != null"
>
month_manure_total = #{monthManureTotal},
</if>
<if
test=
"monthManureTotal != null"
>
month_manure_total = #{monthManureTotal},
</if>
<if
test=
"monthAwardPool != null"
>
month_award_pool = #{monthAwardPool},
</if>
<if
test=
"monthAwardPool != null"
>
month_award_pool = #{monthAwardPool},
</if>
<if
test=
"monthManureAward != null"
>
month_manure_award =#{monthManureAward},
</if>
<if
test=
"monthManureAward != null"
>
month_manure_award =#{monthManureAward},
</if>
...
@@ -46,6 +48,7 @@
...
@@ -46,6 +48,7 @@
<sql
id=
"criteria"
>
<sql
id=
"criteria"
>
<if
test=
"id != null"
>
id = #{id}
</if>
<if
test=
"id != null"
>
id = #{id}
</if>
<if
test=
"yearMonth != null"
>
and year_month =#{yearMonth}
</if>
<if
test=
"monthManureTotal != null"
>
and month_manure_total = #{monthManureTotal}
</if>
<if
test=
"monthManureTotal != null"
>
and month_manure_total = #{monthManureTotal}
</if>
<if
test=
"monthAwardPool != null"
>
and month_award_pool = #{monthAwardPool}
</if>
<if
test=
"monthAwardPool != null"
>
and month_award_pool = #{monthAwardPool}
</if>
<if
test=
"monthManureAward != null"
>
and month_manure_award =#{monthManureAward}
</if>
<if
test=
"monthManureAward != null"
>
and month_manure_award =#{monthManureAward}
</if>
...
...
wisenergy-model/src/main/java/cn/wisenergy/model/app/MonthAward.java
View file @
09f5eafe
...
@@ -25,6 +25,12 @@ public class MonthAward implements Serializable {
...
@@ -25,6 +25,12 @@ public class MonthAward implements Serializable {
@ApiModelProperty
(
value
=
"主键id"
,
name
=
"id"
)
@ApiModelProperty
(
value
=
"主键id"
,
name
=
"id"
)
private
Integer
id
;
private
Integer
id
;
/**
* 年月
*/
@ApiModelProperty
(
name
=
"yearMonth"
,
value
=
"年月"
)
private
Date
yearMonth
;
/**
/**
* 本月月度肥料总额
* 本月月度肥料总额
*/
*/
...
...
wisenergy-model/src/main/java/cn/wisenergy/model/app/TradeRecord.java
View file @
09f5eafe
...
@@ -31,7 +31,7 @@ public class TradeRecord implements Serializable {
...
@@ -31,7 +31,7 @@ public class TradeRecord implements Serializable {
private
String
userId
;
private
String
userId
;
/**
/**
* 交易
类型 1:提现 2:订单返佣 3:订单下单 4:月度肥料 5:培育奖 6:工资
* 交易
记录类型 1:提现 2:订单返佣 3:订单下单 4:月度肥料 5:培育奖 6:工资奖励
*/
*/
@ApiModelProperty
(
name
=
"tradeType"
,
value
=
"交易类型 1:提现 2:订单返佣 3:订单下单 4:月度肥料 5:培育奖 6:工资"
)
@ApiModelProperty
(
name
=
"tradeType"
,
value
=
"交易类型 1:提现 2:订单返佣 3:订单下单 4:月度肥料 5:培育奖 6:工资"
)
private
Integer
tradeType
;
private
Integer
tradeType
;
...
...
wisenergy-model/src/main/java/cn/wisenergy/model/enums/TradeRecordEnum.java
0 → 100644
View file @
09f5eafe
package
cn
.
wisenergy
.
model
.
enums
;
/**
* @author 86187
* @ Description: 交易记录类型枚举
* @ Author : 86187
* @ Date : 2021/3/1 14:27
*/
public
enum
TradeRecordEnum
{
/**
* 交易记录类型
*/
WITHDRAW_DEPOSIT
(
1
,
"提现"
),
ORDER_REBATE
(
2
,
"订单返佣"
),
PLACE_ORDER
(
3
,
"订单下单"
),
MONTHLY_FERTILIZER
(
4
,
"月度肥料"
),
CULTIVATING_PRIZE
(
5
,
"培育奖"
),
SALARY_REWARD
(
6
,
"工资奖励"
);
private
Integer
code
;
private
String
desc
;
TradeRecordEnum
(
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-model/src/main/java/cn/wisenergy/model/enums/UserLevelEnum.java
View file @
09f5eafe
...
@@ -21,11 +21,11 @@ public enum UserLevelEnum {
...
@@ -21,11 +21,11 @@ public enum UserLevelEnum {
GOLD_TREE
(
4
,
"黄金树"
),
GOLD_TREE
(
4
,
"黄金树"
),
FARMER
(
6
,
"农场主"
),
FARMER
(
5
,
"农场主"
),
FOREST_START
(
7
,
"森林之星"
),
FOREST_START
(
6
,
"森林之星"
),
PARTNER
(
8
,
"西田森合伙人"
);
PARTNER
(
7
,
"西田森合伙人"
);
private
Integer
code
;
private
Integer
code
;
private
String
desc
;
private
String
desc
;
...
...
wisenergy-service/src/main/java/cn/wisenergy/service/Manager/AccountManager.java
View file @
09f5eafe
...
@@ -6,6 +6,7 @@ import cn.wisenergy.mapper.TeamPerformanceMapper;
...
@@ -6,6 +6,7 @@ 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
cn.wisenergy.model.enums.RebateStatusEnum
;
import
cn.wisenergy.model.enums.TradeRecordEnum
;
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
;
...
@@ -66,7 +67,7 @@ public class AccountManager {
...
@@ -66,7 +67,7 @@ public class AccountManager {
//4、添加交易流水记录
//4、添加交易流水记录
TradeRecord
tradeRecord
=
new
TradeRecord
();
TradeRecord
tradeRecord
=
new
TradeRecord
();
tradeRecord
.
setUserId
(
orderInfo
.
getBuyerId
());
tradeRecord
.
setUserId
(
orderInfo
.
getBuyerId
());
tradeRecord
.
setTradeType
(
2
);
tradeRecord
.
setTradeType
(
TradeRecordEnum
.
ORDER_REBATE
.
getCode
()
);
tradeRecord
.
setTradeNo
(
orderInfo
.
getTid
());
tradeRecord
.
setTradeNo
(
orderInfo
.
getTid
());
recordMapper
.
add
(
tradeRecord
);
recordMapper
.
add
(
tradeRecord
);
}
}
...
...
wisenergy-service/src/main/java/cn/wisenergy/service/app/impl/AccountServiceImpl.java
View file @
09f5eafe
package
cn
.
wisenergy
.
service
.
app
.
impl
;
package
cn
.
wisenergy
.
service
.
app
.
impl
;
import
cn.wisenergy.common.utils.R
;
import
cn.wisenergy.common.utils.R
;
import
cn.wisenergy.mapper.AccountMapper
;
import
cn.wisenergy.mapper.*
;
import
cn.wisenergy.mapper.MemberPercentMapper
;
import
cn.wisenergy.mapper.TeamPerformanceMapper
;
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.MonthlyTaskStatus
;
import
cn.wisenergy.model.enums.RebateStatusEnum
;
import
cn.wisenergy.model.enums.RebateStatusEnum
;
import
cn.wisenergy.model.enums.TradeRecordEnum
;
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
;
...
@@ -46,6 +44,9 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo>
...
@@ -46,6 +44,9 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo>
@Autowired
@Autowired
private
PublicManager
publicManager
;
private
PublicManager
publicManager
;
@Autowired
private
TradeRecordMapper
tradeRecordMapper
;
@Autowired
@Autowired
private
TeamPerformanceMapper
teamPerformanceMapper
;
private
TeamPerformanceMapper
teamPerformanceMapper
;
...
@@ -156,7 +157,7 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo>
...
@@ -156,7 +157,7 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo>
//4、更新账户月度绩效
//4、更新账户月度绩效
accountManager
.
updateAccountPerformanceMonth
(
teamPerformances
);
accountManager
.
updateAccountPerformanceMonth
(
teamPerformances
);
}
}
}
//5、获取所有用户,如果会员等级是黄金以上,计算月度收益
//5、获取所有用户,如果会员等级是黄金以上,计算月度收益
List
<
User
>
userList
=
usersMapper
.
getAllGoldUser
();
List
<
User
>
userList
=
usersMapper
.
getAllGoldUser
();
if
(
CollectionUtils
.
isEmpty
(
userList
))
{
if
(
CollectionUtils
.
isEmpty
(
userList
))
{
...
@@ -165,7 +166,6 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo>
...
@@ -165,7 +166,6 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo>
for
(
User
user
:
userList
)
{
for
(
User
user
:
userList
)
{
monthlyIncome
(
totalMoney
,
user
);
monthlyIncome
(
totalMoney
,
user
);
}
}
}
return
R
.
ok
(
0
,
true
);
return
R
.
ok
(
0
,
true
);
}
}
...
@@ -375,6 +375,16 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo>
...
@@ -375,6 +375,16 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo>
if
(
count
!=
0
)
{
if
(
count
!=
0
)
{
return
true
;
return
true
;
}
}
//5、添加交易流水记录
TradeRecord
tradeRecord
=
new
TradeRecord
();
tradeRecord
.
setUserId
(
user
.
getUserId
());
tradeRecord
.
setTradeType
(
TradeRecordEnum
.
ORDER_REBATE
.
getCode
());
tradeRecord
.
setTradeNo
(
null
);
int
number
=
tradeRecordMapper
.
add
(
tradeRecord
);
if
(
number
==
0
)
{
return
false
;
}
}
}
}
}
...
...
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