Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
device-back
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
1
议题
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Matrix
device-back
Commits
488c3b26
提交
488c3b26
authored
9月 15, 2020
作者:
133
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
添加根据用名称查询登入对象的接口
上级
e7640063
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
48 行增加
和
2 行删除
+48
-2
TaskServiceImpl.java
...om/tykj/dev/device/task/service/impl/TaskServiceImpl.java
+0
-1
TrainThemeVo.java
...ava/com/tykj/dev/device/train/entity/vo/TrainThemeVo.java
+1
-1
AuthenticationUtils.java
...va/com/tykj/dev/device/user/util/AuthenticationUtils.java
+47
-0
没有找到文件。
dev-device/device-task/src/main/java/com/tykj/dev/device/task/service/impl/TaskServiceImpl.java
浏览文件 @
488c3b26
...
...
@@ -123,7 +123,6 @@ public class TaskServiceImpl implements TaskService {
taskBto
.
setUserReadDetailList
(
new
ArrayList
<>());
//set customInfo
taskBto
.
setCustomInfo
(
customInfo
);
update
(
taskBto
);
return
taskBto
;
}
...
...
dev-device/device-train/src/main/java/com/tykj/dev/device/train/entity/vo/TrainThemeVo.java
浏览文件 @
488c3b26
...
...
@@ -40,7 +40,7 @@ public class TrainThemeVo {
private
String
originatorName
;
@ApiModelProperty
(
value
=
"状态"
,
example
=
"10"
)
private
String
trainStatus
;
private
Integer
trainStatus
;
/**
* 主办单位
...
...
dev-device/device-user/src/main/java/com/tykj/dev/device/user/util/AuthenticationUtils.java
浏览文件 @
488c3b26
package
com
.
tykj
.
dev
.
device
.
user
.
util
;
import
com.tykj.dev.device.user.subject.entity.Role
;
import
com.tykj.dev.device.user.subject.entity.SecurityUser
;
import
com.tykj.dev.device.user.subject.entity.User
;
import
com.tykj.dev.device.user.subject.entity.UserRole
;
import
com.tykj.dev.device.user.subject.service.*
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.core.Authentication
;
import
org.springframework.security.core.context.SecurityContextHolder
;
import
org.springframework.security.core.userdetails.UsernameNotFoundException
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
* 用户实体相关工具类
...
...
@@ -16,6 +25,18 @@ import org.springframework.security.core.context.SecurityContextHolder;
**/
@Slf4j
public
class
AuthenticationUtils
{
@Autowired
private
UserService
userService
;
@Autowired
private
UserRoleService
userRoleService
;
@Autowired
private
RoleService
roleService
;
@Autowired
private
RolePermissionsService
rolePermissionsService
;
@Autowired
PermissionsService
permissionsService
;
@Autowired
UnitsService
unitsService
;
public
static
String
ANONYMOUS_USER_STRING
=
"anonymousUser"
;
/***
...
...
@@ -37,4 +58,30 @@ public class AuthenticationUtils {
}
/**
* 根据用户名称查询登入对象
* @param userName 用户名称
*/
private
SecurityUser
findUserNameToSecurity
(
String
userName
)
{
SecurityUser
securityUser
=
new
SecurityUser
();
User
user
=
userService
.
findByUserName
(
userName
);
if
(
user
==
null
)
{
throw
new
UsernameNotFoundException
(
"用户名不正确"
);
}
else
{
List
<
UserRole
>
userRoles
=
userRoleService
.
findByUserId
(
user
.
getUserId
());
List
<
Integer
>
roleIds
=
new
ArrayList
<>();
if
(
userRoles
!=
null
)
{
for
(
UserRole
userRole
:
userRoles
)
{
roleIds
.
add
(
userRole
.
getRoleId
());
}
}
List
<
Role
>
roles
=
roleService
.
findAllByRoles
(
roleIds
);
user
.
setUnits
(
unitsService
.
findById
(
user
.
getUnitsId
()));
securityUser
.
setCurrentUserInfo
(
user
);
securityUser
.
setRoleList
(
roles
);
securityUser
.
setUsername
(
userName
);
return
securityUser
;
}
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论