Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
long-tern-care-service
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
hubin
long-tern-care-service
Commits
bba75c66
Commit
bba75c66
authored
Apr 06, 2021
by
hubin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
登陆接口开发
parent
10d7dfb7
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
25 additions
and
33 deletions
+25
-33
UserDetailsServiceImpl.java
...java/com/hungraim/ltc/service/UserDetailsServiceImpl.java
+1
-1
SystemResource.java
...a/com/hungraim/ltc/pojo/entity/system/SystemResource.java
+2
-4
SystemRole.java
.../java/com/hungraim/ltc/pojo/entity/system/SystemRole.java
+2
-4
SystemUser.java
.../java/com/hungraim/ltc/pojo/entity/system/SystemUser.java
+1
-3
UserLoginInfoVO.java
...java/com/hungraim/ltc/pojo/vo/system/UserLoginInfoVO.java
+3
-3
ResourcesController.java
...m/hungraim/ltc/system/controller/ResourcesController.java
+4
-4
RoleController.java
...va/com/hungraim/ltc/system/controller/RoleController.java
+7
-7
UserController.java
...va/com/hungraim/ltc/system/controller/UserController.java
+4
-6
SystemAdminFeignService.java
...in/java/com/hungraim/ltc/api/SystemAdminFeignService.java
+1
-1
No files found.
auth-service/src/main/java/com/hungraim/ltc/service/UserDetailsServiceImpl.java
View file @
bba75c66
...
...
@@ -33,7 +33,7 @@ public class UserDetailsServiceImpl implements UserDetailsService {
}
SystemUser
systemUser
=
userRes
.
getData
();
//根据用户id获取用户权限
Result
<
List
<
Long
>>
roles
=
systemAdminFeignService
.
loadUserRolesByUserId
(
systemUser
.
getId
());
Result
<
List
<
Long
>>
roles
=
systemAdminFeignService
.
loadUserRolesByUserId
(
systemUser
.
get
User
Id
());
UserLoginInfoVO
userLoginInfoVO
=
new
UserLoginInfoVO
(
systemUser
);
userLoginInfoVO
.
setAuthorities
(
roles
.
getData
());
...
...
common/common-core/src/main/java/com/hungraim/ltc/pojo/entity/system/SystemResource.java
View file @
bba75c66
...
...
@@ -18,15 +18,13 @@ import java.util.List;
public
class
SystemResource
{
@TableId
@TableField
(
"RESOURCE_ID"
)
private
Long
id
;
private
Long
resourceId
;
private
String
resourceName
;
private
String
resourceUrl
;
private
String
method
;
private
String
resourceType
;
private
Long
parentId
;
@TableField
(
"RESOURCE_ICON"
)
private
String
icon
;
private
String
resourceIcon
;
private
Date
createTime
;
@TableField
(
exist
=
false
)
...
...
common/common-core/src/main/java/com/hungraim/ltc/pojo/entity/system/SystemRole.java
View file @
bba75c66
...
...
@@ -17,10 +17,8 @@ import java.util.Date;
public
class
SystemRole
{
@TableId
@TableField
(
"ROLE_ID"
)
private
Long
id
;
@TableField
(
"ROLE_NAME"
)
private
String
name
;
private
Long
roleId
;
private
String
roleName
;
private
String
status
;
private
Date
createTime
;
private
Date
modifyTime
;
...
...
common/common-core/src/main/java/com/hungraim/ltc/pojo/entity/system/SystemUser.java
View file @
bba75c66
...
...
@@ -17,14 +17,12 @@ import java.util.Date;
public
class
SystemUser
{
@TableId
@TableField
(
"USER_ID"
)
private
Long
id
;
private
Long
userId
;
private
String
account
;
private
String
password
;
private
String
realName
;
private
String
avatar
;
private
String
gender
;
private
String
marketerCode
;
private
Integer
userStatus
;
private
Date
createdTime
;
private
Date
updatedTime
;
...
...
common/common-core/src/main/java/com/hungraim/ltc/pojo/vo/system/UserLoginInfoVO.java
View file @
bba75c66
...
...
@@ -28,11 +28,11 @@ public class UserLoginInfoVO implements UserDetails {
this
.
username
=
user
.
getAccount
();
this
.
password
=
user
.
getPassword
();
this
.
name
=
user
.
getRealName
();
this
.
userId
=
user
.
getId
();
this
.
enable
=
"1"
.
equals
(
user
.
getUserStatus
())
;
this
.
userId
=
user
.
get
User
Id
();
this
.
enable
=
user
.
getUserStatus
()
==
1
;
}
public
void
setAuthorities
(
List
<
Long
>
roles
){
public
void
setAuthorities
(
List
<
Long
>
roles
)
{
if
(
CollectionUtil
.
isNotEmpty
(
roles
))
{
authorities
=
new
ArrayList
<>();
roles
.
forEach
(
roleId
->
authorities
.
add
(
new
SimpleGrantedAuthority
(
String
.
valueOf
(
roleId
))));
...
...
system/system-admin-service/src/main/java/com/hungraim/ltc/system/controller/ResourcesController.java
View file @
bba75c66
...
...
@@ -42,9 +42,9 @@ public class ResourcesController {
List
<
MainMenuVO
>
resourceList
=
resourceService
.
list
(
new
LambdaQueryWrapper
<
SystemResource
>().
eq
(
SystemResource:
:
getResourceType
,
"2"
))
.
stream
().
map
(
item
->
{
MainMenuVO
mainMenuVO
=
new
MainMenuVO
();
mainMenuVO
.
setIcon
(
item
.
getIcon
());
mainMenuVO
.
setIcon
(
item
.
get
Resource
Icon
());
mainMenuVO
.
setName
(
item
.
getResourceName
());
mainMenuVO
.
setId
(
item
.
getId
());
mainMenuVO
.
setId
(
item
.
get
Resource
Id
());
mainMenuVO
.
setParentId
(
item
.
getParentId
());
return
mainMenuVO
;
}).
collect
(
Collectors
.
toList
());
...
...
@@ -81,8 +81,8 @@ public class ResourcesController {
systemResource
.
setResourceName
(
reqResource
.
getName
());
systemResource
.
setResourceUrl
(
reqResource
.
getUrl
());
systemResource
.
setResourceType
(
reqResource
.
getType
());
systemResource
.
set
Icon
(
reqResource
.
getIcon
());
systemResource
.
setIcon
(
reqResource
.
getIcon
());
systemResource
.
set
ResourceId
(
reqResource
.
getId
());
systemResource
.
set
Resource
Icon
(
reqResource
.
getIcon
());
systemResource
.
setParentId
(
reqResource
.
getParentId
());
systemResource
.
setCreateTime
(
new
Date
());
resourceService
.
save
(
systemResource
);
...
...
system/system-admin-service/src/main/java/com/hungraim/ltc/system/controller/RoleController.java
View file @
bba75c66
...
...
@@ -53,14 +53,14 @@ public class RoleController {
}
SystemRole
role
=
roleService
.
getOne
(
new
LambdaQueryWrapper
<
SystemRole
>()
.
eq
(
SystemRole:
:
getName
,
reqRoleInfo
.
getName
()));
.
eq
(
SystemRole:
:
get
Role
Name
,
reqRoleInfo
.
getName
()));
if
(
role
!=
null
)
{
return
Result
.
failed
(
"角色名称不能重复!"
);
}
SystemRole
systemRole
=
new
SystemRole
();
systemRole
.
setName
(
reqRoleInfo
.
getName
());
systemRole
.
set
Role
Name
(
reqRoleInfo
.
getName
());
systemRole
.
setStatus
(
reqRoleInfo
.
getStatus
());
systemRole
.
setCreateTime
(
new
Date
());
roleService
.
save
(
systemRole
);
...
...
@@ -89,7 +89,7 @@ public class RoleController {
return
Result
.
failed
(
"名称不能为空!"
);
}
SystemRole
systemRole
=
roleService
.
getOne
(
new
LambdaQueryWrapper
<
SystemRole
>()
.
eq
(
SystemRole:
:
getName
,
roleName
));
.
eq
(
SystemRole:
:
get
Role
Name
,
roleName
));
if
(
systemRole
!=
null
)
{
return
Result
.
failed
(
"名称已存在!"
);
}
...
...
@@ -106,7 +106,7 @@ public class RoleController {
QueryWrapper
<
SystemRole
>
systemRoleQueryWrapper
=
new
QueryWrapper
<>();
if
(!
StrUtil
.
isBlankIfStr
(
reqRoleInfo
.
getName
()))
{
systemRoleQueryWrapper
.
and
(
wrapper
->
wrapper
.
lambda
().
like
(
SystemRole:
:
getName
,
reqRoleInfo
.
getName
()));
systemRoleQueryWrapper
.
and
(
wrapper
->
wrapper
.
lambda
().
like
(
SystemRole:
:
get
Role
Name
,
reqRoleInfo
.
getName
()));
}
if
(!
StrUtil
.
isBlankIfStr
(
reqRoleInfo
.
getStatus
()))
{
systemRoleQueryWrapper
.
and
(
wrapper
->
wrapper
.
lambda
().
eq
(
SystemRole:
:
getStatus
,
reqRoleInfo
.
getStatus
()));
...
...
@@ -124,13 +124,13 @@ public class RoleController {
if
(
reqRoleInfo
.
getId
()
==
null
||
reqRoleInfo
.
getId
()
==
0
)
{
return
Result
.
failed
(
"角色ID无效!"
);
}
SystemRole
systemRole
=
roleService
.
getOne
(
new
LambdaQueryWrapper
<
SystemRole
>().
eq
(
SystemRole:
:
getId
,
reqRoleInfo
.
getId
()));
SystemRole
systemRole
=
roleService
.
getOne
(
new
LambdaQueryWrapper
<
SystemRole
>().
eq
(
SystemRole:
:
get
Role
Id
,
reqRoleInfo
.
getId
()));
if
(
systemRole
==
null
)
{
return
Result
.
failed
(
"角色ID无效!"
);
}
boolean
flag
=
false
;
if
(!
reqRoleInfo
.
getName
().
equals
(
systemRole
.
getName
()))
{
systemRole
.
setName
(
reqRoleInfo
.
getName
());
if
(!
reqRoleInfo
.
getName
().
equals
(
systemRole
.
get
Role
Name
()))
{
systemRole
.
set
Role
Name
(
reqRoleInfo
.
getName
());
flag
=
true
;
}
if
(!
reqRoleInfo
.
getStatus
().
equals
(
systemRole
.
getStatus
()))
{
...
...
system/system-admin-service/src/main/java/com/hungraim/ltc/system/controller/UserController.java
View file @
bba75c66
...
...
@@ -95,16 +95,15 @@ public class UserController {
}
SystemUser
systemUser
=
userInfoService
.
getOne
(
new
LambdaQueryWrapper
<
SystemUser
>()
.
eq
(
SystemUser:
:
getAccount
,
reqUserInfo
.
getAccount
()).
or
()
.
eq
(
SystemUser:
:
getId
,
reqUserInfo
.
getId
()));
.
eq
(
SystemUser:
:
get
User
Id
,
reqUserInfo
.
getId
()));
if
(
systemUser
!=
null
)
{
return
Result
.
failed
(
"账号已存在!"
);
}
SystemUser
user
=
new
SystemUser
();
user
.
setId
(
reqUserInfo
.
getId
());
user
.
set
User
Id
(
reqUserInfo
.
getId
());
user
.
setAccount
(
reqUserInfo
.
getAccount
());
user
.
setPassword
(
new
BCryptPasswordEncoder
().
encode
(
reqUserInfo
.
getPassword
()));
user
.
setGender
(
reqUserInfo
.
getGender
());
user
.
setMarketerCode
(
reqUserInfo
.
getMarketerCode
());
user
.
setRealName
(
reqUserInfo
.
getName
());
user
.
setUserStatus
(
reqUserInfo
.
getEnable
());
user
.
setCreatedTime
(
new
Date
());
...
...
@@ -114,7 +113,7 @@ public class UserController {
roles
.
add
(
1L
);
List
<
SystemUserRole
>
roleList
=
roles
.
stream
().
map
(
roleId
->
{
SystemUserRole
systemUserRole
=
new
SystemUserRole
();
systemUserRole
.
setUserId
(
user
.
getId
());
systemUserRole
.
setUserId
(
user
.
get
User
Id
());
systemUserRole
.
setRoleId
(
roleId
);
return
systemUserRole
;
}).
collect
(
Collectors
.
toList
());
...
...
@@ -183,13 +182,12 @@ public class UserController {
List
<
SystemUser
>
users
=
userInfoService
.
list
(
systemUserQueryWrapper
);
List
<
ReqUserInfo
>
resUsers
=
users
.
stream
().
map
(
user
->
{
ReqUserInfo
userInfo
=
new
ReqUserInfo
();
userInfo
.
setId
(
user
.
getId
());
userInfo
.
setId
(
user
.
get
User
Id
());
userInfo
.
setName
(
user
.
getRealName
());
userInfo
.
setAccount
(
user
.
getAccount
());
userInfo
.
setEnable
(
user
.
getUserStatus
());
userInfo
.
setAvatar
(
user
.
getAvatar
());
userInfo
.
setGender
(
Gender
.
MAN
.
getCode
().
equals
(
user
.
getGender
())
?
Gender
.
MAN
.
getDesc
()
:
Gender
.
WOMAN
.
getDesc
());
userInfo
.
setMarketerCode
(
user
.
getMarketerCode
());
return
userInfo
;
}).
collect
(
Collectors
.
toList
());
return
Result
.
success
(
resUsers
);
...
...
system/system-api/src/main/java/com/hungraim/ltc/api/SystemAdminFeignService.java
View file @
bba75c66
...
...
@@ -11,7 +11,7 @@ import java.util.List;
/**
* @author hubin
*/
@FeignClient
(
"
ltc
-SYSTEM-ADMIN-SERVICE"
)
@FeignClient
(
"
LTC
-SYSTEM-ADMIN-SERVICE"
)
public
interface
SystemAdminFeignService
{
/**
...
...
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