Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
cloud-platform
Project
Project
Details
Activity
Releases
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
youjj
cloud-platform
Commits
483c3376
Commit
483c3376
authored
Oct 31, 2020
by
hezhen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改后台录入会员
parent
024eb36f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
52 additions
and
6 deletions
+52
-6
AppUserRelationBiz.java
...github/wxiaoqi/security/admin/biz/AppUserRelationBiz.java
+52
-1
AdminUserRelationController.java
...ecurity/admin/rest/admin/AdminUserRelationController.java
+0
-5
No files found.
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/biz/AppUserRelationBiz.java
View file @
483c3376
...
@@ -178,6 +178,57 @@ public class AppUserRelationBiz extends BaseBiz<AppUserRelationMapper, AppUserRe
...
@@ -178,6 +178,57 @@ public class AppUserRelationBiz extends BaseBiz<AppUserRelationMapper, AppUserRe
}
}
public
void
bindRelationV2
(
Integer
userId
,
Integer
parentId
,
Integer
type
){
if
(
userId
.
equals
(
parentId
)){
log
.
info
(
"----userId==="
+
userId
+
"----parentId===="
+
parentId
+
"----自己不能成为自己的上线"
);
throw
new
BaseException
(
"自己不能成为自己的上线"
,
ResultCode
.
FAILED_CODE
);
}
AppUserVo
appUserVo
=
userDetailBiz
.
getUserInfoById
(
parentId
);
if
(
appUserVo
==
null
){
log
.
info
(
"----userId==="
+
userId
+
"----parentId===="
+
parentId
+
"----"
);
throw
new
BaseException
(
"该上线用户不存在"
,
ResultCode
.
FAILED_CODE
);
}
AppUserRelation
relation
=
getMyBiz
().
getRelationByUserId
(
parentId
);
Long
time
=
System
.
currentTimeMillis
();
if
(
relation
==
null
){
relation
=
new
AppUserRelation
();
relation
.
setUserId
(
parentId
);
relation
.
setBindType
(
type
);
insertSelective
(
relation
);
}
Long
bindTime
=
time
-
validTime
;
//判断用户是否有有效的下线
if
(
getCountByParentId
(
userId
,
bindTime
)==
0L
){
relation
=
getMyBiz
().
getRelationByUserId
(
userId
);
if
(
relation
==
null
){
relation
=
new
AppUserRelation
();
relation
.
setUserId
(
userId
);
relation
.
setParentId
(
parentId
);
relation
.
setBindType
(
type
);
relation
.
setBindTime
(
time
);
insertSelective
(
relation
);
}
else
{
//判断用户是否有有效的上线
log
.
info
(
"----userId==="
+
userId
+
"----bindTime===="
+
bindTime
+
"----relation.getBindTime()==="
+
relation
.
getBindTime
());
if
(
relation
.
getParentId
()==
null
||
relation
.
getParentId
()==
0
||(
relation
.
getIsForever
()!=
1
&&
validTime
>
0
&&
relation
.
getBindTime
()<
bindTime
)){
relation
.
setParentId
(
parentId
);
relation
.
setBindType
(
type
);
relation
.
setBindTime
(
time
);
getMyBiz
().
updRelation
(
relation
);
}
}
if
(
relation
!=
null
){
AppStaffUserDTO
staffUserDTO
=
new
AppStaffUserDTO
();
staffUserDTO
.
setSuId
(
relation
.
getParentId
());
staffUserDTO
.
setUid
(
relation
.
getUserId
());
staffUserBiz
.
addAppStaffUser
(
staffUserDTO
);
}
}
else
{
throw
new
BaseException
(
"该用户已有下线无法成为别人下线"
,
ResultCode
.
FAILED_CODE
);
}
}
//首页关系绑定
//首页关系绑定
public
ObjectRestResponse
appBindRelation
(
Integer
userId
,
String
code
)
{
public
ObjectRestResponse
appBindRelation
(
Integer
userId
,
String
code
)
{
Integer
parentId
=
0
;
Integer
parentId
=
0
;
...
@@ -207,7 +258,7 @@ public class AppUserRelationBiz extends BaseBiz<AppUserRelationMapper, AppUserRe
...
@@ -207,7 +258,7 @@ public class AppUserRelationBiz extends BaseBiz<AppUserRelationMapper, AppUserRe
return
ObjectRestResponse
.
createFailedResult
(
ResultCode
.
NULL_CODE
,
"该上级不存在"
);
return
ObjectRestResponse
.
createFailedResult
(
ResultCode
.
NULL_CODE
,
"该上级不存在"
);
}
}
Integer
parentId
=
userLogin
.
getId
();
Integer
parentId
=
userLogin
.
getId
();
getMyBiz
().
bindRelation
(
userId
,
parentId
,
1
);
bindRelationV2
(
userId
,
parentId
,
1
);
return
ObjectRestResponse
.
succ
();
return
ObjectRestResponse
.
succ
();
}
}
...
...
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/rest/admin/AdminUserRelationController.java
View file @
483c3376
...
@@ -17,12 +17,7 @@ public class AdminUserRelationController extends BaseController<AppUserRelationB
...
@@ -17,12 +17,7 @@ public class AdminUserRelationController extends BaseController<AppUserRelationB
@RequestMapping
(
value
=
"/bind"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"/bind"
,
method
=
RequestMethod
.
POST
)
@ApiModelProperty
(
"后台绑定"
)
@ApiModelProperty
(
"后台绑定"
)
public
ObjectRestResponse
bind
(
@RequestBody
UserRelationDTO
relationDTO
){
public
ObjectRestResponse
bind
(
@RequestBody
UserRelationDTO
relationDTO
){
try
{
return
baseBiz
.
adminBindRelation
(
relationDTO
);
return
baseBiz
.
adminBindRelation
(
relationDTO
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
throw
new
BaseException
(
e
);
}
}
}
...
...
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