Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
N
notes2.0
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
zjm
notes2.0
Commits
ff3b8bf9
提交
ff3b8bf9
authored
3月 07, 2020
作者:
gongwenjie
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
代码修改
上级
6ffd9ce5
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
119 行增加
和
3 行删除
+119
-3
SecurityConfig.java
...main/java/com/zjty/tynotes/pas/config/SecurityConfig.java
+2
-1
UserController.java
.../java/com/zjty/tynotes/pas/controller/UserController.java
+5
-2
IUserService.java
.../main/java/com/zjty/tynotes/pas/service/IUserService.java
+7
-0
UserServiceImpl.java
...va/com/zjty/tynotes/pas/service/impl/UserServiceImpl.java
+71
-0
Init.java
notes-pas/src/main/java/com/zjty/tynotes/pas/task/Init.java
+34
-0
没有找到文件。
notes-pas/src/main/java/com/zjty/tynotes/pas/config/SecurityConfig.java
浏览文件 @
ff3b8bf9
...
...
@@ -57,7 +57,8 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
.
cors
().
and
()
.
authorizeRequests
()
.
antMatchers
(
HttpMethod
.
GET
,
"/pas/department"
).
permitAll
()
// .requestMatchers(CorsUtils::isPreFlightRequest).permitAll()
.
antMatchers
(
"/pas/user/findUserList/**"
).
permitAll
()
// .requestMatchers(CorsUtils::isPreFlightRequest).permitAll()
.
antMatchers
(
"/pas/user"
).
hasAnyAuthority
(
"用户管理"
)
.
antMatchers
(
"/pas/authority"
).
hasAnyAuthority
(
"权限管理"
)
.
antMatchers
(
"/pas/config"
).
hasAnyAuthority
(
"考勤管理"
)
...
...
notes-pas/src/main/java/com/zjty/tynotes/pas/controller/UserController.java
浏览文件 @
ff3b8bf9
...
...
@@ -97,8 +97,11 @@ public class UserController {
return
ok
(
iUserService
.
findUserById
(
id
));
}
@ApiOperation
(
value
=
"根据用户id查询该用户可发布id的人员"
,
response
=
User
.
class
)
@GetMapping
(
"/findUserList/{id}"
)
public
ResponseEntity
findUserList
(
@PathVariable
(
"id"
)
String
id
)
{
return
ok
(
iUserService
.
findUserList
(
id
));
}
}
notes-pas/src/main/java/com/zjty/tynotes/pas/service/IUserService.java
浏览文件 @
ff3b8bf9
...
...
@@ -97,4 +97,11 @@ public interface IUserService {
*/
List
<
User
>
findParentManager
(
String
userId
);
/**
* 根据人员id查询可发布任务的人员
* @param userId
* @return
*/
List
<
User
>
findUserList
(
String
userId
);
}
notes-pas/src/main/java/com/zjty/tynotes/pas/service/impl/UserServiceImpl.java
浏览文件 @
ff3b8bf9
...
...
@@ -300,6 +300,77 @@ public class UserServiceImpl implements IUserService {
return
null
;
}
@Override
public
List
<
User
>
findUserList
(
String
userId
){
List
<
String
>
departmentList
=
findDepartmentList
(
userId
);
List
<
User
>
all
=
pasUserDao
.
findAll
();
List
<
User
>
users
=
new
ArrayList
<>();
if
(
all
!=
null
){
for
(
User
user
:
all
)
{
List
<
String
>
departmentIds
=
user
.
getDepartmentIds
();
if
(
departmentIds
!=
null
){
for
(
String
departId
:
departmentIds
)
{
if
(
departmentList
.
contains
(
departId
)){
users
.
add
(
user
);
break
;
}
}
}
}
}
return
users
;
}
/**
* 查询可查看的部门id集合
* @param id
* @return
*/
private
List
<
String
>
findDepartmentList
(
String
id
)
{
List
<
UserRole
>
userRoles
=
userRoleDao
.
findAllByUserId
(
id
);
List
<
String
>
roleIds
=
new
ArrayList
<>();
List
<
String
>
departmentIds
=
new
ArrayList
<>();
for
(
UserRole
userRole
:
userRoles
)
{
roleIds
.
add
(
userRole
.
getRoleId
());
}
List
<
Role
>
roles
=
roleDao
.
findAllByIdIn
(
roleIds
);
for
(
Role
role
:
roles
)
{
List
<
RoleAuthority
>
roleAuthorities
=
roleAuthorityDao
.
findAllByRoleId
(
role
.
getId
());
List
<
String
>
authorityIds
=
new
ArrayList
<>();
for
(
RoleAuthority
roleAuthority
:
roleAuthorities
)
{
authorityIds
.
add
(
roleAuthority
.
getAuthorityId
());
}
Authority
authority
=
authorityDao
.
findByIdInAndName
(
authorityIds
,
"发布任务"
);
if
(
authority
!=
null
){
String
departmentId
=
role
.
getDepartmentId
();
departmentIds
.
add
(
departmentId
);
}
}
List
<
String
>
departmentIdList
=
new
ArrayList
<>();
getDepartments
(
departmentIdList
,
departmentIds
);
return
departmentIdList
;
}
public
void
getDepartments
(
List
<
String
>
departmentIdList
,
List
<
String
>
departmentIds
)
{
for
(
String
string
:
departmentIds
)
{
if
(
departmentIdList
.
contains
(
string
)){
continue
;
}
List
<
Department
>
departmentList
=
departmentDao
.
findAllByParentId
(
string
);
List
<
String
>
departments
=
new
ArrayList
<>();
for
(
Department
department
:
departmentList
)
{
departments
.
add
(
department
.
getId
());
}
departmentIdList
.
add
(
string
);
getDepartments
(
departmentIdList
,
departments
);
}
}
}
notes-pas/src/main/java/com/zjty/tynotes/pas/task/Init.java
浏览文件 @
ff3b8bf9
package
com
.
zjty
.
tynotes
.
pas
.
task
;
import
com.zjty.tynotes.pas.dao.AuthorityDao
;
import
com.zjty.tynotes.pas.dao.PasUserDao
;
import
com.zjty.tynotes.pas.entity.Authority
;
import
com.zjty.tynotes.pas.entity.Role
;
...
...
@@ -32,6 +33,8 @@ public class Init implements CommandLineRunner {
@Autowired
private
IRoleService
iRoleService
;
@Autowired
private
AuthorityDao
authorityDao
;
public
User
root
;
...
...
@@ -40,6 +43,37 @@ public class Init implements CommandLineRunner {
@Override
public
void
run
(
String
...
args
)
throws
Exception
{
List
<
Authority
>
authorities1
=
new
ArrayList
<>();
List
<
Authority
>
authorityList
=
authorityDao
.
findAll
();
List
<
String
>
authorityName
=
new
ArrayList
<>();
if
(
authorityList
!=
null
){
for
(
Authority
authority
:
authorityList
)
{
authorityName
.
add
(
authority
.
getName
());
}
}
if
(!
authorityName
.
contains
(
"查看任务"
)){
authorities1
.
add
(
new
Authority
(
null
,
"查看任务"
,
"能够查看员工的任务"
));
}
if
(!
authorityName
.
contains
(
"发布任务"
)){
authorities1
.
add
(
new
Authority
(
null
,
"发布任务"
,
"能够发布任务给其他用户"
));
}
if
(!
authorityName
.
contains
(
"分解任务"
)){
authorities1
.
add
(
new
Authority
(
null
,
"分解任务"
,
"对任务具有分解的功能"
));
}
if
(!
authorityName
.
contains
(
"删除任务"
)){
authorities1
.
add
(
new
Authority
(
null
,
"删除任务"
,
"能够对任务进行删除"
));
}
if
(!
authorityName
.
contains
(
"修改任务"
)){
authorities1
.
add
(
new
Authority
(
null
,
"修改任务"
,
"能够对任务进行修改"
));
}
if
(!
authorityName
.
contains
(
"查看人员"
)){
authorities1
.
add
(
new
Authority
(
null
,
"查看人员"
,
"能够查看人员"
));
}
if
(
authorities1
!=
null
){
authorityDao
.
saveAll
(
authorities1
);
}
// iRoleService.deleteAll();
root
=
new
User
();
Role
role
=
new
Role
(
null
,
"管理员"
,
"管理系统的人员"
,
null
,
null
,
null
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论