Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
huhu-partner
Project
Overview
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
guanchen
huhu-partner
Commits
dfba251b
Commit
dfba251b
authored
Oct 17, 2019
by
guanchen
Browse files
Options
Browse Files
Download
Plain Diff
Merge commit '
a8770582
' into finance
# Conflicts: # pom.xml # src/main/resources/logback.xml
parents
505d9403
a8770582
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
67 additions
and
63 deletions
+67
-63
pom.xml
pom.xml
+1
-2
Constants.java
...ain/java/com/lanren/huhu/partner/constants/Constants.java
+14
-1
UserController.java
...va/com/lanren/huhu/partner/controller/UserController.java
+5
-2
AgentDailyExpandTask.java
...om/lanren/huhu/partner/schedule/AgentDailyExpandTask.java
+1
-2
AgentRewardQueueTask.java
...om/lanren/huhu/partner/schedule/AgentRewardQueueTask.java
+4
-2
RevokeAgentRewardTask.java
...m/lanren/huhu/partner/schedule/RevokeAgentRewardTask.java
+9
-12
UserServiceImpl.java
...com/lanren/huhu/partner/service/impl/UserServiceImpl.java
+21
-20
application.yml
src/main/resources/application.yml
+1
-1
logback.xml
src/main/resources/logback.xml
+11
-21
No files found.
pom.xml
View file @
dfba251b
...
@@ -192,8 +192,7 @@
...
@@ -192,8 +192,7 @@
<redis.host>
10.9.48.21
</redis.host>
<redis.host>
10.9.48.21
</redis.host>
<redis.password>
Ws_LrqD_20180319_REdis_MQLRd
</redis.password>
<redis.password>
Ws_LrqD_20180319_REdis_MQLRd
</redis.password>
<spring.profiles.active>
prod
</spring.profiles.active>
<spring.profiles.active>
prod
</spring.profiles.active>
<!--<logfile_path>/data/logs/huhu/lanren</logfile_path>-->
<logfile_path>
/data/logs2/huhu/lanren
</logfile_path>
<logfile_path>
/Users/chen/Develop/workspace/partner/data/release/dev/logs
</logfile_path>
<providers-path>
/data/java/service
</providers-path>
<providers-path>
/data/java/service
</providers-path>
</properties>
</properties>
...
...
src/main/java/com/lanren/huhu/partner/constants/Constants.java
View file @
dfba251b
...
@@ -33,6 +33,7 @@ public class Constants {
...
@@ -33,6 +33,7 @@ public class Constants {
public
static
final
int
AGENT_REWARD_TYPE_SHARE_ORDER
=
760
;
public
static
final
int
AGENT_REWARD_TYPE_SHARE_ORDER
=
760
;
public
static
final
String
AGENT_REWARD_TYPE_SHARE_ORDER_REMARK
=
"推荐奖励-分享赚"
;
public
static
final
String
AGENT_REWARD_TYPE_SHARE_ORDER_REMARK
=
"推荐奖励-分享赚"
;
public
static
final
int
JD_OFFSET
=
1000
;
//用于查找京东的平推奖励比例
public
static
final
int
JD_OFFSET
=
1000
;
//用于查找京东的平推奖励比例
public
static
final
int
MT_OFFSET
=
2000
;
//用于查找美团的平推奖励比例
public
static
Map
<
Integer
,
Map
<
Integer
,
BigDecimal
>>
AGENT_RATE_MAP
=
new
HashMap
<
Integer
,
Map
<
Integer
,
BigDecimal
>>();
public
static
Map
<
Integer
,
Map
<
Integer
,
BigDecimal
>>
AGENT_RATE_MAP
=
new
HashMap
<
Integer
,
Map
<
Integer
,
BigDecimal
>>();
public
static
Map
<
Integer
,
String
>
AGENT_REWARD_REMARK
=
new
HashMap
<
Integer
,
String
>();
public
static
Map
<
Integer
,
String
>
AGENT_REWARD_REMARK
=
new
HashMap
<
Integer
,
String
>();
public
static
final
int
AGENT_LEVEL_1
=
1
;
public
static
final
int
AGENT_LEVEL_1
=
1
;
...
@@ -43,6 +44,7 @@ public class Constants {
...
@@ -43,6 +44,7 @@ public class Constants {
public
static
final
String
PARENT_COLUMN_NAME_CENGJI
=
"parent_agent_id"
;
public
static
final
String
PARENT_COLUMN_NAME_CENGJI
=
"parent_agent_id"
;
public
static
final
String
PARENT_COLUMN_NAME_PINGTUI
=
"presenter_id"
;
public
static
final
String
PARENT_COLUMN_NAME_PINGTUI
=
"presenter_id"
;
public
static
final
String
ORDER_TYPE_JD
=
"jd"
;
public
static
final
String
ORDER_TYPE_JD
=
"jd"
;
public
static
final
String
ORDER_TYPE_MT
=
"mt"
;
/**
/**
* 回扣类型
* 回扣类型
*/
*/
...
@@ -149,6 +151,7 @@ public class Constants {
...
@@ -149,6 +151,7 @@ public class Constants {
AGENT_RATE_MAP
.
put
(
AGENT_REWARD_TYPE_SHARE_ORDER
,
new
HashMap
<
Integer
,
BigDecimal
>());
AGENT_RATE_MAP
.
put
(
AGENT_REWARD_TYPE_SHARE_ORDER
,
new
HashMap
<
Integer
,
BigDecimal
>());
AGENT_RATE_MAP
.
put
(
AGENT_REWARD_TYPE_SELF_ORDER
+
JD_OFFSET
,
new
HashMap
<
Integer
,
BigDecimal
>());
AGENT_RATE_MAP
.
put
(
AGENT_REWARD_TYPE_SELF_ORDER
+
JD_OFFSET
,
new
HashMap
<
Integer
,
BigDecimal
>());
AGENT_RATE_MAP
.
put
(
AGENT_REWARD_TYPE_SHARE_ORDER
+
JD_OFFSET
,
new
HashMap
<
Integer
,
BigDecimal
>());
AGENT_RATE_MAP
.
put
(
AGENT_REWARD_TYPE_SHARE_ORDER
+
JD_OFFSET
,
new
HashMap
<
Integer
,
BigDecimal
>());
AGENT_RATE_MAP
.
put
(
AGENT_REWARD_TYPE_SELF_ORDER
+
MT_OFFSET
,
new
HashMap
<
Integer
,
BigDecimal
>());
AGENT_RATE_MAP
.
get
(
AGENT_REWARD_TYPE_YEAR_VIP
).
put
(
0
,
new
BigDecimal
(
"0.02512563"
));
AGENT_RATE_MAP
.
get
(
AGENT_REWARD_TYPE_YEAR_VIP
).
put
(
0
,
new
BigDecimal
(
"0.02512563"
));
AGENT_RATE_MAP
.
get
(
AGENT_REWARD_TYPE_YEAR_VIP
).
put
(
1
,
new
BigDecimal
(
"0.01507538"
));
AGENT_RATE_MAP
.
get
(
AGENT_REWARD_TYPE_YEAR_VIP
).
put
(
1
,
new
BigDecimal
(
"0.01507538"
));
...
@@ -160,13 +163,23 @@ public class Constants {
...
@@ -160,13 +163,23 @@ public class Constants {
// AGENT_RATE_MAP.get(AGENT_REWARD_TYPE_SVIP).put(0, new BigDecimal("0.02500000"));
// AGENT_RATE_MAP.get(AGENT_REWARD_TYPE_SVIP).put(0, new BigDecimal("0.02500000"));
// AGENT_RATE_MAP.get(AGENT_REWARD_TYPE_SVIP).put(1, new BigDecimal("0.01111111"));
// AGENT_RATE_MAP.get(AGENT_REWARD_TYPE_SVIP).put(1, new BigDecimal("0.01111111"));
// AGENT_RATE_MAP.get(AGENT_REWARD_TYPE_SVIP).put(2, new BigDecimal("0.00555556"));
// AGENT_RATE_MAP.get(AGENT_REWARD_TYPE_SVIP).put(2, new BigDecimal("0.00555556"));
/**
* 红包
*/
AGENT_RATE_MAP
.
get
(
AGENT_REWARD_TYPE_REDPACK
).
put
(
0
,
new
BigDecimal
(
"0.03"
));
AGENT_RATE_MAP
.
get
(
AGENT_REWARD_TYPE_REDPACK
).
put
(
0
,
new
BigDecimal
(
"0.03"
));
AGENT_RATE_MAP
.
get
(
AGENT_REWARD_TYPE_REDPACK
).
put
(
1
,
new
BigDecimal
(
"0.02"
));
AGENT_RATE_MAP
.
get
(
AGENT_REWARD_TYPE_REDPACK
).
put
(
1
,
new
BigDecimal
(
"0.02"
));
/**
* 自购省
*/
AGENT_RATE_MAP
.
get
(
AGENT_REWARD_TYPE_SELF_ORDER
).
put
(
0
,
new
BigDecimal
(
"0.009"
));
AGENT_RATE_MAP
.
get
(
AGENT_REWARD_TYPE_SELF_ORDER
).
put
(
0
,
new
BigDecimal
(
"0.009"
));
AGENT_RATE_MAP
.
get
(
AGENT_REWARD_TYPE_SELF_ORDER
).
put
(
1
,
new
BigDecimal
(
"0.009"
));
AGENT_RATE_MAP
.
get
(
AGENT_REWARD_TYPE_SELF_ORDER
).
put
(
1
,
new
BigDecimal
(
"0.009"
));
AGENT_RATE_MAP
.
get
(
AGENT_REWARD_TYPE_SELF_ORDER
+
JD_OFFSET
).
put
(
0
,
new
BigDecimal
(
"0.0087"
));
AGENT_RATE_MAP
.
get
(
AGENT_REWARD_TYPE_SELF_ORDER
+
JD_OFFSET
).
put
(
0
,
new
BigDecimal
(
"0.0087"
));
AGENT_RATE_MAP
.
get
(
AGENT_REWARD_TYPE_SELF_ORDER
+
JD_OFFSET
).
put
(
1
,
new
BigDecimal
(
"0.0087"
));
AGENT_RATE_MAP
.
get
(
AGENT_REWARD_TYPE_SELF_ORDER
+
JD_OFFSET
).
put
(
1
,
new
BigDecimal
(
"0.0087"
));
AGENT_RATE_MAP
.
get
(
AGENT_REWARD_TYPE_SELF_ORDER
+
MT_OFFSET
).
put
(
0
,
new
BigDecimal
(
"0.01"
));
AGENT_RATE_MAP
.
get
(
AGENT_REWARD_TYPE_SELF_ORDER
+
MT_OFFSET
).
put
(
1
,
new
BigDecimal
(
"0.01"
));
/**
* 分享赚
*/
AGENT_RATE_MAP
.
get
(
AGENT_REWARD_TYPE_SHARE_ORDER
).
put
(
0
,
new
BigDecimal
(
"0.009"
));
AGENT_RATE_MAP
.
get
(
AGENT_REWARD_TYPE_SHARE_ORDER
).
put
(
0
,
new
BigDecimal
(
"0.009"
));
AGENT_RATE_MAP
.
get
(
AGENT_REWARD_TYPE_SHARE_ORDER
).
put
(
1
,
new
BigDecimal
(
"0.009"
));
AGENT_RATE_MAP
.
get
(
AGENT_REWARD_TYPE_SHARE_ORDER
).
put
(
1
,
new
BigDecimal
(
"0.009"
));
AGENT_RATE_MAP
.
get
(
AGENT_REWARD_TYPE_SHARE_ORDER
+
JD_OFFSET
).
put
(
0
,
new
BigDecimal
(
"0.0087"
));
AGENT_RATE_MAP
.
get
(
AGENT_REWARD_TYPE_SHARE_ORDER
+
JD_OFFSET
).
put
(
0
,
new
BigDecimal
(
"0.0087"
));
...
...
src/main/java/com/lanren/huhu/partner/controller/UserController.java
View file @
dfba251b
package
com
.
lanren
.
huhu
.
partner
.
controller
;
package
com
.
lanren
.
huhu
.
partner
.
controller
;
import
com.alibaba.fastjson.JSON
;
import
com.lanren.huhu.partner.manager.UserManager
;
import
com.lanren.huhu.partner.manager.UserManager
;
import
com.lanren.huhu.partner.model.User
;
import
com.lanren.huhu.partner.model.User
;
import
com.lanren.huhu.partner.result.Result
;
import
com.lanren.huhu.partner.result.Result
;
...
@@ -38,7 +39,9 @@ public class UserController {
...
@@ -38,7 +39,9 @@ public class UserController {
if
(
logger
.
isInfoEnabled
())
{
if
(
logger
.
isInfoEnabled
())
{
logger
.
info
(
"getRelationNocache userId:{},header:{},time:{}"
,
user
.
getUserId
(),
headers
.
keySet
().
toArray
(),
LocalDateTime
.
now
());
logger
.
info
(
"getRelationNocache userId:{},header:{},time:{}"
,
user
.
getUserId
(),
headers
.
keySet
().
toArray
(),
LocalDateTime
.
now
());
}
}
return
userManager
.
getRelationNoCache
(
user
.
getUserId
());
Result
<
User
>
result
=
userManager
.
getRelationNoCache
(
user
.
getUserId
());
logger
.
info
(
"uid:{} call /relation/nocache api, return: {}"
,
user
.
getUserId
(),
JSON
.
toJSONString
(
result
));
return
result
;
}
}
@RequestMapping
(
value
=
"/relation/delete"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"/relation/delete"
,
method
=
RequestMethod
.
POST
)
...
@@ -54,7 +57,7 @@ public class UserController {
...
@@ -54,7 +57,7 @@ public class UserController {
if
(
logger
.
isInfoEnabled
())
{
if
(
logger
.
isInfoEnabled
())
{
logger
.
info
(
"purgeRelation userId:{},header:{},time:{}"
,
user
.
getUserId
(),
headers
.
keySet
().
toArray
(),
LocalDateTime
.
now
());
logger
.
info
(
"purgeRelation userId:{},header:{},time:{}"
,
user
.
getUserId
(),
headers
.
keySet
().
toArray
(),
LocalDateTime
.
now
());
}
}
userManager
.
purgeRelation
(
user
.
getUserId
());
//
userManager.purgeRelation(user.getUserId());
logger
.
info
(
"============>"
+
Thread
.
currentThread
().
getName
());
logger
.
info
(
"============>"
+
Thread
.
currentThread
().
getName
());
Result
<
String
>
result
=
new
Result
<
String
>();
Result
<
String
>
result
=
new
Result
<
String
>();
result
.
setData
(
"异步,正在执行刷新......"
);
result
.
setData
(
"异步,正在执行刷新......"
);
...
...
src/main/java/com/lanren/huhu/partner/schedule/AgentDailyExpandTask.java
View file @
dfba251b
...
@@ -14,7 +14,6 @@ import org.slf4j.Logger;
...
@@ -14,7 +14,6 @@ import org.slf4j.Logger;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
java.util.Date
;
import
java.util.Date
;
...
@@ -45,7 +44,7 @@ public class AgentDailyExpandTask {
...
@@ -45,7 +44,7 @@ public class AgentDailyExpandTask {
@Autowired
@Autowired
AgentExpandDailyService
agentExpandDailyService
;
AgentExpandDailyService
agentExpandDailyService
;
@Scheduled
(
fixedDelay
=
DELAY
)
//
@Scheduled(fixedDelay = DELAY)
public
void
runScheduledTask
()
{
public
void
runScheduledTask
()
{
try
{
try
{
Date
dat
=
new
Date
(
System
.
currentTimeMillis
()
-
DELAY
);
Date
dat
=
new
Date
(
System
.
currentTimeMillis
()
-
DELAY
);
...
...
src/main/java/com/lanren/huhu/partner/schedule/AgentRewardQueueTask.java
View file @
dfba251b
...
@@ -22,7 +22,6 @@ import org.springframework.data.redis.core.RedisTemplate;
...
@@ -22,7 +22,6 @@ import org.springframework.data.redis.core.RedisTemplate;
import
org.springframework.data.redis.core.StringRedisTemplate
;
import
org.springframework.data.redis.core.StringRedisTemplate
;
import
org.springframework.jdbc.datasource.DataSourceTransactionManager
;
import
org.springframework.jdbc.datasource.DataSourceTransactionManager
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
org.springframework.transaction.TransactionDefinition
;
import
org.springframework.transaction.TransactionDefinition
;
import
org.springframework.transaction.TransactionStatus
;
import
org.springframework.transaction.TransactionStatus
;
...
@@ -64,7 +63,7 @@ public class AgentRewardQueueTask {
...
@@ -64,7 +63,7 @@ public class AgentRewardQueueTask {
@Autowired
@Autowired
TransactionDefinition
transactionDefinition
;
TransactionDefinition
transactionDefinition
;
@Scheduled
(
fixedDelay
=
5000L
)
//
@Scheduled(fixedDelay = 5000L)
public
void
runScheduledTask
()
{
public
void
runScheduledTask
()
{
logger
.
info
(
"run AgentRewardQueueTask"
);
logger
.
info
(
"run AgentRewardQueueTask"
);
runConsume
();
runConsume
();
...
@@ -111,6 +110,9 @@ public class AgentRewardQueueTask {
...
@@ -111,6 +110,9 @@ public class AgentRewardQueueTask {
if
((
rewardType
==
AGENT_REWARD_TYPE_SELF_ORDER
||
rewardType
==
AGENT_REWARD_TYPE_SHARE_ORDER
)
if
((
rewardType
==
AGENT_REWARD_TYPE_SELF_ORDER
||
rewardType
==
AGENT_REWARD_TYPE_SHARE_ORDER
)
&&
message
.
getOrderType
().
equals
(
ORDER_TYPE_JD
)
)
{
&&
message
.
getOrderType
().
equals
(
ORDER_TYPE_JD
)
)
{
rateMap
=
AGENT_RATE_MAP
.
get
(
rewardType
+
JD_OFFSET
);
rateMap
=
AGENT_RATE_MAP
.
get
(
rewardType
+
JD_OFFSET
);
}
else
if
(
rewardType
==
AGENT_REWARD_TYPE_SELF_ORDER
&&
message
.
getOrderType
().
equals
(
ORDER_TYPE_MT
)
)
{
rateMap
=
AGENT_RATE_MAP
.
get
(
rewardType
+
MT_OFFSET
);
}
else
{
}
else
{
rateMap
=
AGENT_RATE_MAP
.
get
(
rewardType
);
rateMap
=
AGENT_RATE_MAP
.
get
(
rewardType
);
}
}
...
...
src/main/java/com/lanren/huhu/partner/schedule/RevokeAgentRewardTask.java
View file @
dfba251b
...
@@ -9,7 +9,6 @@ import org.slf4j.LoggerFactory;
...
@@ -9,7 +9,6 @@ import org.slf4j.LoggerFactory;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.jdbc.datasource.DataSourceTransactionManager
;
import
org.springframework.jdbc.datasource.DataSourceTransactionManager
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
org.springframework.transaction.TransactionDefinition
;
import
org.springframework.transaction.TransactionDefinition
;
import
org.springframework.transaction.TransactionStatus
;
import
org.springframework.transaction.TransactionStatus
;
...
@@ -41,7 +40,7 @@ public class RevokeAgentRewardTask {
...
@@ -41,7 +40,7 @@ public class RevokeAgentRewardTask {
@Autowired
@Autowired
TransactionDefinition
transactionDefinition
;
TransactionDefinition
transactionDefinition
;
@Scheduled
(
fixedDelay
=
5000L
)
//
@Scheduled(fixedDelay = 5000L)
public
void
runScheduledTask
()
{
public
void
runScheduledTask
()
{
logger
.
info
(
"run RevokeAgentRewardTask"
);
logger
.
info
(
"run RevokeAgentRewardTask"
);
runConsume
();
runConsume
();
...
@@ -49,17 +48,15 @@ public class RevokeAgentRewardTask {
...
@@ -49,17 +48,15 @@ public class RevokeAgentRewardTask {
private
void
runConsume
()
{
private
void
runConsume
()
{
List
<
AgentRevokeRecords
>
revokeRecordList
=
null
;
List
<
AgentRevokeRecords
>
revokeRecordList
=
null
;
while
(
true
)
{
try
{
try
{
revokeRecordList
=
agentRevokeRecordsService
.
getAllPending
();
revokeRecordList
=
agentRevokeRecordsService
.
getAllPending
();
if
(
null
==
revokeRecordList
||
revokeRecordList
.
size
()
==
0
)
{
if
(
null
==
revokeRecordList
||
revokeRecordList
.
size
()
==
0
)
{
return
;
break
;
}
process
(
revokeRecordList
);
}
catch
(
Exception
e
)
{
logger
.
error
(
"process revoke failed. {}"
,
revokeRecordList
);
logger
.
error
(
e
.
getMessage
(),
e
);
}
}
process
(
revokeRecordList
);
}
catch
(
Exception
e
)
{
logger
.
error
(
"process revoke failed. {}"
,
revokeRecordList
);
logger
.
error
(
e
.
getMessage
(),
e
);
}
}
}
}
...
...
src/main/java/com/lanren/huhu/partner/service/impl/UserServiceImpl.java
View file @
dfba251b
...
@@ -147,12 +147,12 @@ public class UserServiceImpl implements UserService {
...
@@ -147,12 +147,12 @@ public class UserServiceImpl implements UserService {
}
}
partnerList
.
add
(
parentPartner
);
partnerList
.
add
(
parentPartner
);
loopUserId
=
parentPartner
.
getUserId
();
loopUserId
=
parentPartner
.
getUserId
();
loopTimes
++;
}
if
(
loopTimes
>
500
)
{
loopTimes
++;
partnerList
.
clear
();
if
(
loopTimes
>
500
)
{
logger
.
error
(
"用户:{} 邀请关系异常, 已超500层"
,
userId
);
partnerList
.
clear
(
);
break
;
logger
.
error
(
"用户:{} 邀请关系异常, 已超500层"
,
userId
)
;
}
break
;
}
}
}
}
if
(
logger
.
isInfoEnabled
())
{
if
(
logger
.
isInfoEnabled
())
{
...
@@ -249,7 +249,7 @@ public class UserServiceImpl implements UserService {
...
@@ -249,7 +249,7 @@ public class UserServiceImpl implements UserService {
@Override
@Override
public
List
<
ParentAgent
>
getAgentListByUserId
(
Integer
userId
,
String
parentColumnName
)
{
public
List
<
ParentAgent
>
getAgentListByUserId
(
Integer
userId
,
String
parentColumnName
)
{
if
(
logger
.
isInfoEnabled
())
{
if
(
logger
.
isInfoEnabled
())
{
logger
.
info
(
"getAgentListByUserId
for user: {} ......"
,
userId
);
logger
.
info
(
"getAgentListByUserId
{} for user: {} ......"
,
parentColumnName
,
userId
);
}
}
ArrayList
<
ParentAgent
>
agentList
=
new
ArrayList
<
ParentAgent
>();
ArrayList
<
ParentAgent
>
agentList
=
new
ArrayList
<
ParentAgent
>();
HashSet
<
Integer
>
existingUserIdSet
=
new
HashSet
<
Integer
>();
HashSet
<
Integer
>
existingUserIdSet
=
new
HashSet
<
Integer
>();
...
@@ -298,12 +298,6 @@ public class UserServiceImpl implements UserService {
...
@@ -298,12 +298,6 @@ public class UserServiceImpl implements UserService {
* 这个人不是代理商 继续往上找
* 这个人不是代理商 继续往上找
*/
*/
loopUserId
=
parentPartner
.
getUserId
();
loopUserId
=
parentPartner
.
getUserId
();
loopTimes
++;
if
(
loopTimes
>
500
)
{
agentList
.
clear
();
logger
.
error
(
"用户ID:{} 合伙人关系异常, 已超500层"
,
userId
);
break
;
}
if
(
existingUserIdSet
.
contains
(
loopUserId
))
{
if
(
existingUserIdSet
.
contains
(
loopUserId
))
{
logger
.
info
(
"发现互为上级的用户邀请关系 用户ID({})"
,
loopUserId
);
logger
.
info
(
"发现互为上级的用户邀请关系 用户ID({})"
,
loopUserId
);
logger
.
info
(
"退出循环, 不再继续查找"
);
logger
.
info
(
"退出循环, 不再继续查找"
);
...
@@ -319,6 +313,12 @@ public class UserServiceImpl implements UserService {
...
@@ -319,6 +313,12 @@ public class UserServiceImpl implements UserService {
}
}
break
;
break
;
}
}
loopTimes
++;
if
(
loopTimes
>
500
)
{
agentList
.
clear
();
logger
.
error
(
"用户ID:{} 合伙人关系异常, 已超500层"
,
userId
);
break
;
}
}
}
}
else
{
}
else
{
firstAgent
=
selfAgent
;
firstAgent
=
selfAgent
;
...
@@ -344,6 +344,7 @@ public class UserServiceImpl implements UserService {
...
@@ -344,6 +344,7 @@ public class UserServiceImpl implements UserService {
logger
.
info
(
"loop find parent agent start ......"
);
logger
.
info
(
"loop find parent agent start ......"
);
}
}
int
loogAgentId
=
firstAgent
.
getAgentId
();
int
loogAgentId
=
firstAgent
.
getAgentId
();
loopTimes
=
0
;
while
(
true
)
{
while
(
true
)
{
ParentAgent
loopUserAgent
=
getParentAgent
(
loogAgentId
,
parentColumnName
);
ParentAgent
loopUserAgent
=
getParentAgent
(
loogAgentId
,
parentColumnName
);
if
(
null
==
loopUserAgent
)
{
if
(
null
==
loopUserAgent
)
{
...
@@ -365,12 +366,12 @@ public class UserServiceImpl implements UserService {
...
@@ -365,12 +366,12 @@ public class UserServiceImpl implements UserService {
break
;
break
;
}
}
loogAgentId
=
loopUserAgent
.
getAgentId
();
loogAgentId
=
loopUserAgent
.
getAgentId
();
loopTimes
++;
}
if
(
loopTimes
>
500
)
{
loopTimes
++;
agentList
.
clear
();
if
(
loopTimes
>
500
)
{
logger
.
error
(
"用户ID:{} 代理商关系异常, 已超500层"
,
userId
);
agentList
.
clear
(
);
break
;
logger
.
error
(
"用户ID:{} 合伙人关系异常, 已超500层"
,
userId
)
;
}
break
;
}
}
}
}
/**
/**
...
@@ -395,7 +396,7 @@ public class UserServiceImpl implements UserService {
...
@@ -395,7 +396,7 @@ public class UserServiceImpl implements UserService {
}
}
if
(
logger
.
isInfoEnabled
())
{
if
(
logger
.
isInfoEnabled
())
{
logger
.
info
(
"setAgentList
for user: {} end"
,
userId
);
logger
.
info
(
"setAgentList
{} for user: {} end"
,
parentColumnName
,
userId
);
}
}
return
agentList
;
return
agentList
;
}
}
...
...
src/main/resources/application.yml
View file @
dfba251b
...
@@ -103,7 +103,7 @@ mybatis-plus:
...
@@ -103,7 +103,7 @@ mybatis-plus:
logging
:
logging
:
level
:
level
:
#打印SQL信息
#打印SQL信息
com.lanren.huhu.partner.dao
:
debug
com.lanren.huhu.partner.dao
:
info
...
...
src/main/resources/logback.xml
View file @
dfba251b
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<configuration>
<property
name=
"pattern"
value=
"[%level] %d{yy-MM-dd HH:mm:ss.SSS} [%thread] %logger{50}:%line - %msg%n"
/>
<property
name=
"log_file"
value=
"@logfile_path@/@profiles.active@/@artifactId@-@profiles.active@"
/>
<property
name=
"log_file"
value=
"@logfile_path@/@profiles.active@/@artifactId@-@profiles.active@"
/>
<property
name=
"MaxHistory"
value=
"90"
/>
<!--日志保留天数-->
<property
name=
"MaxFileSize"
value=
"256MB"
/>
<!--单个文件大小-->
<property
name=
"totalSizeCap"
value=
"256MB"
/>
<!--单个文件大小-->
<appender
name=
"stdout"
class=
"ch.qos.logback.core.ConsoleAppender"
>
<appender
name=
"stdout"
class=
"ch.qos.logback.core.ConsoleAppender"
>
<encoder
class=
"ch.qos.logback.classic.encoder.PatternLayoutEncoder"
>
<encoder
class=
"ch.qos.logback.classic.encoder.PatternLayoutEncoder"
>
<pattern>
${pattern}
</pattern>
<pattern>
%date [%thread] [%level] %logger - %msg %n
</pattern>
</encoder>
</encoder>
</appender>
</appender>
<appender
name=
"info"
class=
"ch.qos.logback.core.rolling.RollingFileAppender"
>
<appender
name=
"info"
class=
"ch.qos.logback.core.rolling.RollingFileAppender"
>
<File>
${log_file}-info.log
</File>
<rollingPolicy
class=
"ch.qos.logback.core.rolling.TimeBasedRollingPolicy"
>
<rollingPolicy
class=
"ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"
>
<FileNamePattern>
${log_file}-info.%d{yyyy-MM-dd}.log
</FileNamePattern>
<FileNamePattern>
${log_file}-info.%d{yyyy-MM-dd}.%i.log
</FileNamePattern>
<MaxHistory>
90
</MaxHistory>
<MaxHistory>
${MaxHistory}
</MaxHistory>
<MaxFileSize>
${MaxFileSize}
</MaxFileSize>
<totalSizeCap>
${totalSizeCap}
</totalSizeCap>
</rollingPolicy>
</rollingPolicy>
<encoder
class=
"ch.qos.logback.classic.encoder.PatternLayoutEncoder"
>
<encoder>
<pattern>
${pattern}
</pattern>
<pattern>
%date [%thread] [%level] %logger - %msg %n
</pattern>
</encoder>
</encoder>
<filter
class=
"ch.qos.logback.classic.filter.ThresholdFilter"
>
<filter
class=
"ch.qos.logback.classic.filter.ThresholdFilter"
>
<level>
DEBUG
</level>
<level>
DEBUG
</level>
...
@@ -29,15 +22,12 @@
...
@@ -29,15 +22,12 @@
</appender>
</appender>
<appender
name=
"error"
class=
"ch.qos.logback.core.rolling.RollingFileAppender"
>
<appender
name=
"error"
class=
"ch.qos.logback.core.rolling.RollingFileAppender"
>
<File>
${log_file}-error.log
</File>
<rollingPolicy
class=
"ch.qos.logback.core.rolling.TimeBasedRollingPolicy"
>
<rollingPolicy
class=
"ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"
>
<FileNamePattern>
${log_file}-error.%d{yyyy-MM-dd}.log
</FileNamePattern>
<FileNamePattern>
${log_file}-error.%d{yyyy-MM-dd}.%i.log
</FileNamePattern>
<MaxHistory>
90
</MaxHistory>
<MaxHistory>
${MaxHistory}
</MaxHistory>
<MaxFileSize>
${MaxFileSize}
</MaxFileSize>
<totalSizeCap>
${totalSizeCap}
</totalSizeCap>
</rollingPolicy>
</rollingPolicy>
<encoder
class=
"ch.qos.logback.classic.encoder.PatternLayoutEncoder"
>
<encoder>
<pattern>
${pattern}
</pattern>
<pattern>
%date [%thread] [%level] %logger - %msg %n
</pattern>
</encoder>
</encoder>
<filter
class=
"ch.qos.logback.classic.filter.LevelFilter"
>
<filter
class=
"ch.qos.logback.classic.filter.LevelFilter"
>
<level>
ERROR
</level>
<level>
ERROR
</level>
...
...
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