Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
N
notes2.0
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
zjm
notes2.0
Commits
2a5060fe
提交
2a5060fe
authored
3月 09, 2020
作者:
gongwenjie
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
代码修改
上级
2ca10300
隐藏空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
101 行增加
和
54 行删除
+101
-54
pom.xml
notes-pas/pom.xml
+14
-14
UserController.java
.../java/com/zjty/tynotes/pas/controller/UserController.java
+2
-6
IDepartmentService.java
...java/com/zjty/tynotes/pas/service/IDepartmentService.java
+3
-0
IUserService.java
.../main/java/com/zjty/tynotes/pas/service/IUserService.java
+8
-1
DepartmentServiceImpl.java
.../zjty/tynotes/pas/service/impl/DepartmentServiceImpl.java
+5
-3
UserServiceImpl.java
...va/com/zjty/tynotes/pas/service/impl/UserServiceImpl.java
+20
-4
Init.java
notes-pas/src/main/java/com/zjty/tynotes/pas/task/Init.java
+49
-26
没有找到文件。
notes-pas/pom.xml
浏览文件 @
2a5060fe
...
...
@@ -52,21 +52,21 @@
<artifactId>
spring-boot-starter-security
</artifactId>
</dependency>
<
dependency
>
<
groupId>
com.dingtalk
</groupId
>
<
artifactId>
2
</artifactId
>
<
version>
2.3
</version
>
<
scope>
system
</scope
>
<
systemPath>
${project.basedir}/src/main/resources/jar/taobao-sdk-java-auto_1479188381469-20200309-source.jar
</systemPath
>
<
/dependency
>
<
!--<dependency>--
>
<
!--<groupId>com.dingtalk</groupId>--
>
<
!--<artifactId>2</artifactId>--
>
<
!--<version>2.3</version>--
>
<
!--<scope>system</scope>--
>
<
!--<systemPath>${project.basedir}/src/main/resources/jar/taobao-sdk-java-auto_1479188381469-20200309-source.jar</systemPath>--
>
<
!--</dependency>--
>
<
dependency
>
<
groupId>
com.dingtalk
</groupId
>
<
artifactId>
3
</artifactId
>
<
version>
2.3
</version
>
<
scope>
system
</scope
>
<
systemPath>
${project.basedir}/src/main/resources/jar/taobao-sdk-java-auto_1479188381469-20200309.jar
</systemPath
>
<
/dependency
>
<
!--<dependency>--
>
<
!--<groupId>com.dingtalk</groupId>--
>
<
!--<artifactId>3</artifactId>--
>
<
!--<version>2.3</version>--
>
<
!--<scope>system</scope>--
>
<
!--<systemPath>${project.basedir}/src/main/resources/jar/taobao-sdk-java-auto_1479188381469-20200309.jar</systemPath>--
>
<
!--</dependency>--
>
</dependencies>
...
...
notes-pas/src/main/java/com/zjty/tynotes/pas/controller/UserController.java
浏览文件 @
2a5060fe
package
com
.
zjty
.
tynotes
.
pas
.
controller
;
import
com.dingtalk.api.DefaultDingTalkClient
;
import
com.dingtalk.api.DingTalkClient
;
import
com.zjty.tynotes.misc.config.AutoDocument
;
import
com.zjty.tynotes.pas.entity.User
;
import
com.zjty.tynotes.pas.entity.vo.PageRequest
;
...
...
@@ -102,12 +100,10 @@ public class UserController {
@ApiOperation
(
value
=
"根据用户id查询该用户可发布id的人员"
,
response
=
User
.
class
)
@GetMapping
(
"/findUserList/{id}"
)
public
ResponseEntity
findUserList
(
@PathVariable
(
"id"
)
String
id
)
{
return
ok
(
iUserService
.
findUserList
(
id
));
String
authoryName
=
"发布任务"
;
return
ok
(
iUserService
.
findUserList
(
id
,
authoryName
));
}
public
static
void
main
(
String
[]
args
)
{
DingTalkClient
client
=
new
DefaultDingTalkClient
(
"https://oapi.dingtalk.com/user/get"
);
}
}
notes-pas/src/main/java/com/zjty/tynotes/pas/service/IDepartmentService.java
浏览文件 @
2a5060fe
...
...
@@ -43,4 +43,7 @@ public interface IDepartmentService {
boolean
deleteDepartment
(
String
id
);
boolean
updateDepartment
(
Department
department
);
}
notes-pas/src/main/java/com/zjty/tynotes/pas/service/IUserService.java
浏览文件 @
2a5060fe
...
...
@@ -102,6 +102,13 @@ public interface IUserService {
* @param userId
* @return
*/
List
<
User
>
findUserList
(
String
userId
);
List
<
User
>
findUserList
(
String
userId
,
String
authoryName
);
/**
* 供任务模块调用,根据人员id查询该人员能看到任务的所有人员.
* @param userId
* @return
*/
List
<
String
>
findUsers
(
String
userId
);
}
notes-pas/src/main/java/com/zjty/tynotes/pas/service/impl/DepartmentServiceImpl.java
浏览文件 @
2a5060fe
...
...
@@ -3,9 +3,7 @@ package com.zjty.tynotes.pas.service.impl;
import
com.zjty.tynotes.pas.dao.DepartmentDao
;
import
com.zjty.tynotes.pas.dao.PasUserDao
;
import
com.zjty.tynotes.pas.dao.RoleDao
;
import
com.zjty.tynotes.pas.entity.Department
;
import
com.zjty.tynotes.pas.entity.Role
;
import
com.zjty.tynotes.pas.entity.User
;
import
com.zjty.tynotes.pas.entity.*
;
import
com.zjty.tynotes.pas.service.IDepartmentService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
...
...
@@ -114,4 +112,8 @@ public class DepartmentServiceImpl implements IDepartmentService {
department
.
setDepartments
(
departmentList
);
}
}
}
notes-pas/src/main/java/com/zjty/tynotes/pas/service/impl/UserServiceImpl.java
浏览文件 @
2a5060fe
...
...
@@ -301,8 +301,8 @@ public class UserServiceImpl implements IUserService {
}
@Override
public
List
<
User
>
findUserList
(
String
userId
){
List
<
String
>
departmentList
=
findDepartmentList
(
userId
);
public
List
<
User
>
findUserList
(
String
userId
,
String
authoryName
){
List
<
String
>
departmentList
=
findDepartmentList
(
userId
,
authoryName
);
List
<
User
>
all
=
pasUserDao
.
findAll
();
List
<
User
>
users
=
new
ArrayList
<>();
if
(
all
!=
null
){
...
...
@@ -323,12 +323,28 @@ public class UserServiceImpl implements IUserService {
}
/**
* 根据人员id查询可查看的所有人员
* @param userId
* @return
*/
@Override
public
List
<
String
>
findUsers
(
String
userId
){
String
authorityName
=
"查看任务"
;
List
<
User
>
userList
=
findUserList
(
userId
,
authorityName
);
List
<
String
>
userIds
=
new
ArrayList
<>();
for
(
User
user
:
userList
)
{
userIds
.
add
(
user
.
getId
());
}
return
userIds
;
}
/**
* 查询可查看的部门id集合
* @param id
* @return
*/
private
List
<
String
>
findDepartmentList
(
String
id
)
{
private
List
<
String
>
findDepartmentList
(
String
id
,
String
authoryName
)
{
List
<
UserRole
>
userRoles
=
userRoleDao
.
findAllByUserId
(
id
);
List
<
String
>
roleIds
=
new
ArrayList
<>();
List
<
String
>
departmentIds
=
new
ArrayList
<>();
...
...
@@ -342,7 +358,7 @@ public class UserServiceImpl implements IUserService {
for
(
RoleAuthority
roleAuthority
:
roleAuthorities
)
{
authorityIds
.
add
(
roleAuthority
.
getAuthorityId
());
}
Authority
authority
=
authorityDao
.
findByIdInAndName
(
authorityIds
,
"发布任务"
);
Authority
authority
=
authorityDao
.
findByIdInAndName
(
authorityIds
,
authoryName
);
if
(
authority
!=
null
){
String
departmentId
=
role
.
getDepartmentId
();
departmentIds
.
add
(
departmentId
);
...
...
notes-pas/src/main/java/com/zjty/tynotes/pas/task/Init.java
浏览文件 @
2a5060fe
...
...
@@ -2,9 +2,9 @@ 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
;
import
com.zjty.tynotes.pas.entity.
User
;
import
com.zjty.tynotes.pas.
dao.RoleDao
;
import
com.zjty.tynotes.pas.
dao.UserRoleDao
;
import
com.zjty.tynotes.pas.entity.
*
;
import
com.zjty.tynotes.pas.service.IAuthorityService
;
import
com.zjty.tynotes.pas.service.IDepartmentService
;
import
com.zjty.tynotes.pas.service.IRoleService
;
...
...
@@ -35,6 +35,10 @@ public class Init implements CommandLineRunner {
private
IRoleService
iRoleService
;
@Autowired
private
AuthorityDao
authorityDao
;
@Autowired
private
RoleDao
roleDao
;
@Autowired
private
UserRoleDao
userRoleDao
;
public
User
root
;
...
...
@@ -75,30 +79,49 @@ public class Init implements CommandLineRunner {
// iRoleService.deleteAll();
root
=
new
User
();
Role
role
=
new
Role
(
null
,
"管理员"
,
"管理系统的人员"
,
null
,
null
,
null
);
List
<
Authority
>
authorities
=
new
ArrayList
<>();
Authority
authority2
=
new
Authority
(
null
,
"用户管理"
,
"无"
);
Authority
authority1
=
new
Authority
(
null
,
"权限管理"
,
"无"
);
Authority
authority3
=
new
Authority
(
null
,
"角色管理"
,
"无"
);
Authority
authority4
=
new
Authority
(
null
,
"考勤管理"
,
"无"
);
Authority
authority5
=
new
Authority
(
null
,
"部门管理"
,
"无"
);
authorities
.
add
(
authority2
);
authorities
.
add
(
authority1
);
authorities
.
add
(
authority3
);
authorities
.
add
(
authority4
);
authorities
.
add
(
authority5
);
role
.
setAuthorities
(
authorities
);
root
.
createUser
();
root
.
setUsername
(
"root"
);
root
.
setPassword
(
bCryptPasswordEncoder
.
encode
(
"root"
));
List
<
Role
>
roles
=
new
ArrayList
<>();
roles
.
add
(
role
);
root
.
setRoles
(
roles
);
User
user
=
pasUserDao
.
findByUsername
(
"管理员"
);
if
(
user
!=
null
){
root
=
user
;
}
else
{
this
.
root
=
new
User
();
Role
role
=
new
Role
(
null
,
"管理员"
,
"管理系统的人员"
,
null
,
null
,
null
);
List
<
Authority
>
authorities
=
new
ArrayList
<>();
Authority
authority2
=
new
Authority
(
null
,
"用户管理"
,
"无"
);
Authority
authority1
=
new
Authority
(
null
,
"权限管理"
,
"无"
);
Authority
authority3
=
new
Authority
(
null
,
"角色管理"
,
"无"
);
Authority
authority4
=
new
Authority
(
null
,
"考勤管理"
,
"无"
);
Authority
authority5
=
new
Authority
(
null
,
"部门管理"
,
"无"
);
authorities
.
add
(
authority2
);
authorities
.
add
(
authority1
);
authorities
.
add
(
authority3
);
authorities
.
add
(
authority4
);
authorities
.
add
(
authority5
);
role
.
setAuthorities
(
authorities
);
this
.
root
.
createUser
();
this
.
root
.
setUsername
(
"root"
);
root
.
setPassword
(
"root"
);
List
<
Role
>
roles
=
new
ArrayList
<>();
roles
.
add
(
role
);
this
.
root
.
setRoles
(
roles
);
List
<
Authority
>
authorities2
=
authorityDao
.
saveAll
(
authorities
);
List
<
Role
>
roles1
=
roleDao
.
saveAll
(
roles
);
Role
role1
=
roles1
.
get
(
0
);
String
id
=
role1
.
getId
();
List
<
RoleAuthority
>
roleAuthorities
=
new
ArrayList
<>();
for
(
Authority
authority
:
authorities2
)
{
roleAuthorities
.
add
(
new
RoleAuthority
(
null
,
id
,
authority
.
getId
()));
}
User
save
=
pasUserDao
.
save
(
this
.
root
);
UserRole
userRole
=
new
UserRole
(
null
,
save
.
getId
(),
id
);
userRoleDao
.
save
(
userRole
);
this
.
root
.
setPassword
(
bCryptPasswordEncoder
.
encode
(
root
.
getPassword
()));
}
;
// User user1 = new User();
// user1.createUser();
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论