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
006f5a8c
Commit
006f5a8c
authored
Dec 13, 2019
by
hanfeng
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master-customer-management' into dev
parents
b295e777
140ccc90
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
9 deletions
+20
-9
AppStaffUserBiz.java
...om/github/wxiaoqi/security/admin/biz/AppStaffUserBiz.java
+6
-0
AppStaffUserController.java
...b/wxiaoqi/security/admin/rest/AppStaffUserController.java
+14
-9
No files found.
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/biz/AppStaffUserBiz.java
View file @
006f5a8c
...
...
@@ -83,4 +83,10 @@ public class AppStaffUserBiz extends BaseBiz<AppStaffUserMapper, AppStaffUser> {
List
<
AppStaffUser
>
appStaffUsers
=
mapper
.
selectByExample
(
example
);
return
CollectionUtil
.
isEmpty
(
appStaffUsers
)?
true
:
false
;
}
public
void
update
(
AppStaffUser
staffUser
,
Integer
userid
)
{
Example
example
=
new
Example
(
AppStaffUser
.
class
);
example
.
createCriteria
().
andEqualTo
(
"id"
,
staffUser
.
getId
()).
andEqualTo
(
"suId"
,
userid
);
mapper
.
updateByExampleSelective
(
staffUser
,
example
);
}
}
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/rest/AppStaffUserController.java
View file @
006f5a8c
...
...
@@ -4,6 +4,8 @@ import com.github.wxiaoqi.security.admin.biz.AppStaffUserBiz;
import
com.github.wxiaoqi.security.admin.entity.AppStaffUser
;
import
com.github.wxiaoqi.security.admin.feign.dto.AppUserDTO
;
import
com.github.wxiaoqi.security.auth.client.config.UserAuthConfig
;
import
com.github.wxiaoqi.security.auth.client.jwt.UserAuthUtil
;
import
com.github.wxiaoqi.security.auth.common.util.jwt.IJWTInfo
;
import
com.github.wxiaoqi.security.common.exception.BaseException
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.github.wxiaoqi.security.common.rest.BaseController
;
...
...
@@ -29,6 +31,7 @@ public class AppStaffUserController extends BaseController<AppStaffUserBiz, AppS
private
final
HttpServletRequest
request
;
private
final
PublicController
publicController
;
private
final
String
POSITION_NAME
=
"员工"
;
private
final
UserAuthUtil
userAuthUtil
;
/**
* 获取该用户所用的客户
...
...
@@ -39,7 +42,7 @@ public class AppStaffUserController extends BaseController<AppStaffUserBiz, AppS
public
ObjectRestResponse
<
List
<
AppStaffUser
>>
getAll
()
throws
Exception
{
AppUserDTO
userDTO
=
(
AppUserDTO
)
publicController
.
userDetailByToken
(
authConfig
.
getToken
(
request
)).
getData
();
if
(
POSITION_NAME
.
equals
(
userDTO
.
getPositionName
()))
{
return
ObjectRestResponse
.
succ
(
baseBiz
.
getAll
(
userDTO
.
getUserid
()))
;
return
ObjectRestResponse
.
succ
(
baseBiz
.
getAll
(
userDTO
.
getUserid
()))
;
}
return
ObjectRestResponse
.
succ
();
}
...
...
@@ -48,11 +51,11 @@ public class AppStaffUserController extends BaseController<AppStaffUserBiz, AppS
@ApiOperation
(
"添加"
)
@PostMapping
(
value
=
""
)
public
ObjectRestResponse
<
AppStaffUser
>
add
(
@RequestBody
AppStaffUser
appStaffUser
)
throws
Exception
{
AppUserDTO
userDTO
=
(
AppUserDTO
)
publicController
.
userDetailByToken
(
authConfig
.
getToken
(
request
)).
getData
(
);
if
(
appStaffUser
.
getPhone
().
equals
(
userDTO
.
getUsern
ame
()))
{
IJWTInfo
infoFromToken
=
userAuthUtil
.
getInfoFromToken
(
authConfig
.
getToken
(
request
)
);
if
(
appStaffUser
.
getPhone
().
equals
(
infoFromToken
.
getUniqueN
ame
()))
{
return
ObjectRestResponse
.
createFailedResult
(
ResultCode
.
FAILED_CODE
,
"不能绑定本人为客户"
);
}
appStaffUser
.
setSuId
(
userDTO
.
getUserid
(
));
appStaffUser
.
setSuId
(
Integer
.
valueOf
(
infoFromToken
.
getId
()
));
if
(
baseBiz
.
select
(
appStaffUser
))
{
baseBiz
.
insertSelective
(
appStaffUser
);
return
ObjectRestResponse
.
succ
();
...
...
@@ -65,7 +68,6 @@ public class AppStaffUserController extends BaseController<AppStaffUserBiz, AppS
@GetMapping
(
value
=
"one"
)
public
ObjectRestResponse
<
AppStaffUser
>
findOne
(
AppStaffUser
appStaffUser
)
{
AppStaffUser
staffUser
=
baseBiz
.
findOne
(
appStaffUser
);
if
(
staffUser
!=
null
)
{
return
ObjectRestResponse
.
succ
(
staffUser
);
}
...
...
@@ -74,11 +76,13 @@ public class AppStaffUserController extends BaseController<AppStaffUserBiz, AppS
@ApiOperation
(
"删除"
)
@DeleteMapping
(
value
=
"delete/{id}"
)
public
ObjectRestResponse
<
AppStaffUser
>
delete
(
@PathVariable
Integer
id
)
{
public
ObjectRestResponse
<
AppStaffUser
>
delete
(
@PathVariable
Integer
id
)
throws
Exception
{
IJWTInfo
infoFromToken
=
userAuthUtil
.
getInfoFromToken
(
authConfig
.
getToken
(
request
));
String
userid
=
infoFromToken
.
getId
();
AppStaffUser
staffUser
=
new
AppStaffUser
();
staffUser
.
setId
(
id
);
staffUser
.
setIsDel
(
1
);
baseBiz
.
update
SelectiveById
(
staffUser
);
baseBiz
.
update
(
staffUser
,
Integer
.
valueOf
(
userid
)
);
return
ObjectRestResponse
.
succ
();
}
...
...
@@ -87,10 +91,11 @@ public class AppStaffUserController extends BaseController<AppStaffUserBiz, AppS
@RequestMapping
(
value
=
"/{id}"
,
method
=
RequestMethod
.
PUT
)
@ResponseBody
public
ObjectRestResponse
update
(
@RequestBody
AppStaffUser
appStaffUser
)
throws
Exception
{
AppUserDTO
userDTO
=
(
AppUserDTO
)
publicController
.
userDetailByToken
(
authConfig
.
getToken
(
request
)).
getData
(
);
if
(
appStaffUser
.
getPhone
().
equals
(
userDTO
.
getUsern
ame
()))
{
IJWTInfo
infoFromToken
=
userAuthUtil
.
getInfoFromToken
(
authConfig
.
getToken
(
request
)
);
if
(
appStaffUser
.
getPhone
().
equals
(
infoFromToken
.
getUniqueN
ame
()))
{
return
ObjectRestResponse
.
createFailedResult
(
ResultCode
.
FAILED_CODE
,
"不能绑定本人为客户"
);
}
appStaffUser
.
setSuId
(
Integer
.
valueOf
(
infoFromToken
.
getId
()));
if
(
baseBiz
.
select
(
appStaffUser
))
{
baseBiz
.
updateSelectiveById
(
appStaffUser
);
return
ObjectRestResponse
.
succ
();
...
...
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