Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
N
notes2.0
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
zjm
notes2.0
Commits
5dc66fb8
提交
5dc66fb8
authored
3月 06, 2020
作者:
gongwenjie
浏览文件
操作
浏览文件
下载
差异文件
合并分支 'gwj' 到 'master'
Gwj 查看合并请求
!22
上级
76a11c73
4acb4d53
流水线
#29
已取消 于阶段
变更
9
流水线
1
隐藏空白字符变更
内嵌
并排
正在显示
9 个修改的文件
包含
103 行增加
和
100 行删除
+103
-100
pom.xml
notes-pas/pom.xml
+0
-3
DepartmentDao.java
...src/main/java/com/zjty/tynotes/pas/dao/DepartmentDao.java
+2
-0
PasUserDao.java
...as/src/main/java/com/zjty/tynotes/pas/dao/PasUserDao.java
+1
-14
User.java
...s-pas/src/main/java/com/zjty/tynotes/pas/entity/User.java
+5
-4
DepartmentServiceImpl.java
.../zjty/tynotes/pas/service/impl/DepartmentServiceImpl.java
+14
-2
RoleServiceImpl.java
...va/com/zjty/tynotes/pas/service/impl/RoleServiceImpl.java
+0
-1
UserServiceImpl.java
...va/com/zjty/tynotes/pas/service/impl/UserServiceImpl.java
+4
-1
UserVo.java
...ava/com/zjty/tynotes/weekly/subject/entity/vo/UserVo.java
+4
-4
UserManageServiceImpl.java
...es/weekly/subject/service/impl/UserManageServiceImpl.java
+73
-71
没有找到文件。
notes-pas/pom.xml
浏览文件 @
5dc66fb8
...
@@ -51,8 +51,6 @@
...
@@ -51,8 +51,6 @@
<groupId>
org.springframework.boot
</groupId>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-security
</artifactId>
<artifactId>
spring-boot-starter-security
</artifactId>
</dependency>
</dependency>
</dependencies>
</dependencies>
</project>
</project>
\ No newline at end of file
notes-pas/src/main/java/com/zjty/tynotes/pas/dao/DepartmentDao.java
浏览文件 @
5dc66fb8
...
@@ -13,4 +13,6 @@ public interface DepartmentDao extends MongoRepository<Department,String> {
...
@@ -13,4 +13,6 @@ public interface DepartmentDao extends MongoRepository<Department,String> {
Department
findByLevel
(
String
level
);
Department
findByLevel
(
String
level
);
List
<
Department
>
findAllByParentId
(
String
parentId
);
List
<
Department
>
findAllByParentId
(
String
parentId
);
List
<
Department
>
findAllByIdIn
(
List
<
String
>
departmentIds
);
}
}
notes-pas/src/main/java/com/zjty/tynotes/pas/dao/PasUserDao.java
浏览文件 @
5dc66fb8
...
@@ -68,25 +68,12 @@ public interface PasUserDao extends MongoRepository<User, String> {
...
@@ -68,25 +68,12 @@ public interface PasUserDao extends MongoRepository<User, String> {
List
<
User
>
findAllByIdIn
(
List
<
String
>
ids
);
List
<
User
>
findAllByIdIn
(
List
<
String
>
ids
);
/**
/**
* 根
绝
用户名查询用户
* 根
据
用户名查询用户
* @param name
* @param name
* @return
* @return
*/
*/
List
<
User
>
findAllByUsername
(
String
name
);
List
<
User
>
findAllByUsername
(
String
name
);
/**
* 根据部门id查询用户
* @param id
* @return
*/
List
<
User
>
findAllByDepartmentId
(
String
id
);
/**
* 根据部门列表查询用户
* @param departmentIds
* @return
*/
List
<
User
>
findAllByDepartmentIdIn
(
List
<
String
>
departmentIds
);
...
...
notes-pas/src/main/java/com/zjty/tynotes/pas/entity/User.java
浏览文件 @
5dc66fb8
package
com
.
zjty
.
tynotes
.
pas
.
entity
;
package
com
.
zjty
.
tynotes
.
pas
.
entity
;
import
com.alibaba.fastjson.annotation.JSONField
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModel
;
...
@@ -81,9 +82,9 @@ public class User implements UserDetails, Serializable {
...
@@ -81,9 +82,9 @@ public class User implements UserDetails, Serializable {
@ApiModelProperty
(
value
=
"密码"
,
example
=
"password"
)
@ApiModelProperty
(
value
=
"密码"
,
example
=
"password"
)
private
String
password
;
private
String
password
;
@NotEmpty
(
message
=
"部门id
"
)
// @NotEmpty(message = "部门id集合
")
@ApiModelProperty
(
value
=
"部门id"
,
example
=
"1"
)
@ApiModelProperty
(
value
=
"部门id
集合
"
,
example
=
"1"
)
private
String
departmentId
;
private
List
<
String
>
departmentIds
;
@Transient
@Transient
private
List
<
Role
>
roles
;
private
List
<
Role
>
roles
;
...
@@ -150,7 +151,7 @@ public class User implements UserDetails, Serializable {
...
@@ -150,7 +151,7 @@ public class User implements UserDetails, Serializable {
this
.
setIdCard
(
"1231245325325"
);
this
.
setIdCard
(
"1231245325325"
);
ArrayList
<
String
>
list
=
new
ArrayList
<>();
ArrayList
<
String
>
list
=
new
ArrayList
<>();
list
.
add
(
"1"
);
list
.
add
(
"1"
);
this
.
setDepartmentId
(
"1"
);
this
.
setDepartmentId
s
(
new
ArrayList
<>()
);
this
.
setUsername
(
"zhangsan"
);
this
.
setUsername
(
"zhangsan"
);
this
.
setPassword
(
"123456"
);
this
.
setPassword
(
"123456"
);
return
this
;
return
this
;
...
...
notes-pas/src/main/java/com/zjty/tynotes/pas/service/impl/DepartmentServiceImpl.java
浏览文件 @
5dc66fb8
package
com
.
zjty
.
tynotes
.
pas
.
service
.
impl
;
package
com
.
zjty
.
tynotes
.
pas
.
service
.
impl
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.TypeReference
;
import
com.zjty.tynotes.pas.dao.DepartmentDao
;
import
com.zjty.tynotes.pas.dao.DepartmentDao
;
import
com.zjty.tynotes.pas.dao.PasUserDao
;
import
com.zjty.tynotes.pas.dao.PasUserDao
;
import
com.zjty.tynotes.pas.dao.RoleDao
;
import
com.zjty.tynotes.pas.dao.RoleDao
;
...
@@ -11,6 +13,7 @@ import org.springframework.beans.factory.annotation.Autowired;
...
@@ -11,6 +13,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
javax.validation.constraints.NotEmpty
;
import
javax.validation.constraints.NotNull
;
import
javax.validation.constraints.NotNull
;
import
java.util.*
;
import
java.util.*
;
...
@@ -68,10 +71,19 @@ public class DepartmentServiceImpl implements IDepartmentService {
...
@@ -68,10 +71,19 @@ public class DepartmentServiceImpl implements IDepartmentService {
@Override
@Override
public
boolean
deleteDepartment
(
String
id
)
{
public
boolean
deleteDepartment
(
String
id
)
{
List
<
Role
>
roles
=
roleDao
.
findAllByDepartmentId
(
id
);
List
<
Role
>
roles
=
roleDao
.
findAllByDepartmentId
(
id
);
List
<
User
>
users
=
pasUserDao
.
findAllByDepartmentId
(
id
);
List
<
User
>
userList
=
pasUserDao
.
findAll
();
for
(
User
user
:
userList
)
{
List
<
String
>
departmentIds
=
user
.
getDepartmentIds
();
if
(
departmentIds
!=
null
){
for
(
String
string
:
departmentIds
)
{
if
(
id
.
equals
(
string
)){
return
false
;
}
}
}
}
List
<
Department
>
departments
=
departmentDao
.
findAllByParentId
(
id
);
List
<
Department
>
departments
=
departmentDao
.
findAllByParentId
(
id
);
if
((
roles
==
null
||
roles
.
size
()==
0
)
if
((
roles
==
null
||
roles
.
size
()==
0
)
&&
(
users
==
null
||
users
.
size
()!=
0
)
&&
(
departments
!=
null
||
departments
.
size
()!=
0
)){
&&
(
departments
!=
null
||
departments
.
size
()!=
0
)){
departmentDao
.
deleteById
(
id
);
departmentDao
.
deleteById
(
id
);
return
true
;
return
true
;
...
...
notes-pas/src/main/java/com/zjty/tynotes/pas/service/impl/RoleServiceImpl.java
浏览文件 @
5dc66fb8
...
@@ -98,7 +98,6 @@ public class RoleServiceImpl implements IRoleService {
...
@@ -98,7 +98,6 @@ public class RoleServiceImpl implements IRoleService {
try
{
try
{
userRoleDao
.
deleteAllByRoleId
(
id
);
userRoleDao
.
deleteAllByRoleId
(
id
);
roleAuthorityDao
.
deleteAllByRoleId
(
id
);
roleAuthorityDao
.
deleteAllByRoleId
(
id
);
roleDao
.
deleteById
(
id
);
return
true
;
return
true
;
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
logger
.
error
(
"mongodb删除角色时出错"
);
logger
.
error
(
"mongodb删除角色时出错"
);
...
...
notes-pas/src/main/java/com/zjty/tynotes/pas/service/impl/UserServiceImpl.java
浏览文件 @
5dc66fb8
package
com
.
zjty
.
tynotes
.
pas
.
service
.
impl
;
package
com
.
zjty
.
tynotes
.
pas
.
service
.
impl
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.TypeReference
;
import
com.zjty.tynotes.pas.dao.*
;
import
com.zjty.tynotes.pas.dao.*
;
import
com.zjty.tynotes.pas.entity.*
;
import
com.zjty.tynotes.pas.entity.*
;
import
com.zjty.tynotes.pas.entity.vo.PageRequest
;
import
com.zjty.tynotes.pas.entity.vo.PageRequest
;
...
@@ -148,7 +150,6 @@ public class UserServiceImpl implements IUserService {
...
@@ -148,7 +150,6 @@ public class UserServiceImpl implements IUserService {
List
<
Role
>
roles
=
roleDao
.
findAllByIdIn
(
roleIds
);
List
<
Role
>
roles
=
roleDao
.
findAllByIdIn
(
roleIds
);
user
.
setRoles
(
roles
);
user
.
setRoles
(
roles
);
}
}
return
user
;
return
user
;
}
}
...
@@ -213,6 +214,7 @@ public class UserServiceImpl implements IUserService {
...
@@ -213,6 +214,7 @@ public class UserServiceImpl implements IUserService {
return
null
;
return
null
;
}
}
}
}
String
departmentIdList
=
JSON
.
toJSONString
(
user
.
getDepartmentIds
());
User
save
=
pasUserDao
.
save
(
user
);
User
save
=
pasUserDao
.
save
(
user
);
List
<
String
>
ids
=
new
ArrayList
<>();
List
<
String
>
ids
=
new
ArrayList
<>();
if
(
roles
!=
null
){
if
(
roles
!=
null
){
...
@@ -228,6 +230,7 @@ public class UserServiceImpl implements IUserService {
...
@@ -228,6 +230,7 @@ public class UserServiceImpl implements IUserService {
}
}
List
<
Role
>
roleList
=
roleDao
.
findAllByIdIn
(
ids
);
List
<
Role
>
roleList
=
roleDao
.
findAllByIdIn
(
ids
);
save
.
setRoles
(
roleList
);
save
.
setRoles
(
roleList
);
save
.
setDepartmentIds
(
user
.
getDepartmentIds
());
return
save
;
return
save
;
}
}
...
...
notes-weekly/src/main/java/com/zjty/tynotes/weekly/subject/entity/vo/UserVo.java
浏览文件 @
5dc66fb8
...
@@ -76,9 +76,9 @@ public class UserVo {
...
@@ -76,9 +76,9 @@ public class UserVo {
@ApiModelProperty
(
value
=
"密码"
,
example
=
"password"
)
@ApiModelProperty
(
value
=
"密码"
,
example
=
"password"
)
private
String
password
;
private
String
password
;
@NotEmpty
(
message
=
"部门id"
)
@NotEmpty
(
message
=
"部门id
集合
"
)
@ApiModelProperty
(
value
=
"部门id"
,
example
=
"1"
)
@ApiModelProperty
(
value
=
"部门id
集合
"
,
example
=
"1"
)
private
String
departmentId
;
private
List
<
String
>
departmentIds
;
private
List
<
Role
>
roles
;
private
List
<
Role
>
roles
;
...
@@ -105,7 +105,7 @@ public class UserVo {
...
@@ -105,7 +105,7 @@ public class UserVo {
this
.
email
=
user
.
getEmail
();
this
.
email
=
user
.
getEmail
();
this
.
username
=
user
.
getUsername
();
this
.
username
=
user
.
getUsername
();
this
.
password
=
user
.
getPassword
();
this
.
password
=
user
.
getPassword
();
this
.
departmentId
=
user
.
getDepartmentId
();
this
.
departmentId
s
=
user
.
getDepartmentIds
();
this
.
roles
=
new
ArrayList
<>();
this
.
roles
=
new
ArrayList
<>();
this
.
status
=
null
;
this
.
status
=
null
;
this
.
workCount
=
null
;
this
.
workCount
=
null
;
...
...
notes-weekly/src/main/java/com/zjty/tynotes/weekly/subject/service/impl/UserManageServiceImpl.java
浏览文件 @
5dc66fb8
...
@@ -63,58 +63,61 @@ public class UserManageServiceImpl implements UserManageService {
...
@@ -63,58 +63,61 @@ public class UserManageServiceImpl implements UserManageService {
*/
*/
@Override
@Override
public
PageResponse
<
UserVo
>
findUserList
(
PageRequest
pageRequest
)
{
public
PageResponse
<
UserVo
>
findUserList
(
PageRequest
pageRequest
)
{
List
<
User
>
users
=
new
ArrayList
<>();
String
deId
=
pageRequest
.
getDeId
();
PageResponse
<
UserVo
>
pageResponse
=
new
PageResponse
<>();
Integer
sort
=
pageRequest
.
getSort
();
pageResponse
.
setCurrentPage
(
pageRequest
.
getCurrentPage
());
return
null
;
pageResponse
.
setPageSize
(
pageRequest
.
getPageSize
());
// List<User> users = new ArrayList<>();
if
(
pageRequest
.
getDeId
()!=
null
){
// PageResponse<UserVo> pageResponse = new PageResponse<>();
users
=
pasUserDao
.
findAllByDepartmentId
(
pageRequest
.
getId
());
// pageResponse.setCurrentPage(pageRequest.getCurrentPage());
}
else
{
// pageResponse.setPageSize(pageRequest.getPageSize());
List
<
Department
>
departmentList
=
findDepartmentList
(
pageRequest
.
getId
());
// if(pageRequest.getDeId()!=null){
List
<
String
>
departmentIds
=
new
ArrayList
<>();
// users = pasUserDao.findAllByDepartmentId(pageRequest.getId());
for
(
Department
department
:
departmentList
)
{
// }else{
departmentIds
.
add
(
department
.
getId
());
// List<Department> departmentList = findDepartmentList(pageRequest.getId());
}
// List<String> departmentIds = new ArrayList<>();
users
=
pasUserDao
.
findAllByDepartmentIdIn
(
departmentIds
);
// for (Department department : departmentList) {
}
// departmentIds.add(department.getId());
List
<
String
>
userIds
=
new
ArrayList
<>();
// }
for
(
User
user
:
users
)
{
// users = pasUserDao.findAllByDepartmentIdIn(departmentIds);
userIds
.
add
(
user
.
getId
());
// }
}
// List<String> userIds = new ArrayList<>();
List
<
Personnel
>
personnels
=
internalService
.
personnels
(
userIds
);
// for (User user : users) {
List
<
UserVo
>
userVos
=
new
ArrayList
<>();
// userIds.add(user.getId());
for
(
User
user
:
users
)
{
// }
for
(
Personnel
personnel
:
personnels
)
{
// List<Personnel> personnels = internalService.personnels(userIds);
if
(
user
.
getId
().
equals
(
personnel
.
getId
())){
// List<UserVo> userVos = new ArrayList<>();
UserVo
userVo
=
new
UserVo
(
user
);
// for (User user : users) {
userVo
.
setWorkCount
(
personnel
.
getCount
());
// for (Personnel personnel : personnels) {
userVos
.
add
(
userVo
);
// if(user.getId().equals(personnel.getId())){
}
// UserVo userVo = new UserVo(user);
}
// userVo.setWorkCount(personnel.getCount());
}
// userVos.add(userVo);
// }
if
(
pageRequest
.
getSort
()!=
null
&&
pageRequest
.
getSort
()==
1
)
{
// }
Collections
.
sort
(
userVos
,
new
Comparator
<
UserVo
>()
{
// }
@Override
//
public
int
compare
(
UserVo
o1
,
UserVo
o2
)
{
// if(pageRequest.getSort()!=null && pageRequest.getSort()==1) {
return
o1
.
getWorkCount
()-
o2
.
getWorkCount
();
// Collections.sort(userVos, new Comparator<UserVo>() {
}
// @Override
});
// public int compare(UserVo o1, UserVo o2) {
}
else
{
// return o1.getWorkCount()-o2.getWorkCount();
Collections
.
sort
(
userVos
,
new
Comparator
<
UserVo
>()
{
// }
@Override
// });
public
int
compare
(
UserVo
o1
,
UserVo
o2
)
{
// }else{
return
o2
.
getWorkCount
()-
o1
.
getWorkCount
();
// Collections.sort(userVos, new Comparator<UserVo>() {
}
// @Override
});
// public int compare(UserVo o1, UserVo o2) {
}
// return o2.getWorkCount()-o1.getWorkCount();
int
startNum
=(
pageResponse
.
getCurrentPage
()-
1
)*
10
+
1
;
// }
int
endNum
=
startNum
+
pageResponse
.
getPageSize
();
// });
List
<
UserVo
>
userVos1
=
userVos
.
subList
(
startNum
-
1
,
endNum
-
1
);
// }
pageResponse
.
setRows
(
userVos1
);
// int startNum=(pageResponse.getCurrentPage()-1)*10+1;
pageResponse
.
setTotalPage
((
userVos
.
size
()/
pageResponse
.
getPageSize
())+
1
);
// int endNum = startNum+pageResponse.getPageSize();
pageResponse
.
setTotalCount
(
userVos
.
size
());
// List<UserVo> userVos1 = userVos.subList(startNum - 1, endNum - 1);
return
pageResponse
;
// pageResponse.setRows(userVos1);
// pageResponse.setTotalPage((userVos.size()/pageResponse.getPageSize())+1);
// pageResponse.setTotalCount(userVos.size());
// return null;
}
}
...
@@ -127,6 +130,7 @@ public class UserManageServiceImpl implements UserManageService {
...
@@ -127,6 +130,7 @@ public class UserManageServiceImpl implements UserManageService {
public
List
<
Department
>
findDepartmentList
(
String
id
)
{
public
List
<
Department
>
findDepartmentList
(
String
id
)
{
List
<
UserRole
>
userRoles
=
userRoleDao
.
findAllByUserId
(
id
);
List
<
UserRole
>
userRoles
=
userRoleDao
.
findAllByUserId
(
id
);
List
<
String
>
roleIds
=
new
ArrayList
<>();
List
<
String
>
roleIds
=
new
ArrayList
<>();
List
<
String
>
departmentIds
=
new
ArrayList
<>();
for
(
UserRole
userRole
:
userRoles
)
{
for
(
UserRole
userRole
:
userRoles
)
{
roleIds
.
add
(
userRole
.
getRoleId
());
roleIds
.
add
(
userRole
.
getRoleId
());
}
}
...
@@ -140,31 +144,29 @@ public class UserManageServiceImpl implements UserManageService {
...
@@ -140,31 +144,29 @@ public class UserManageServiceImpl implements UserManageService {
Authority
authority
=
authorityDao
.
findByIdInAndName
(
authorityIds
,
"查看人员"
);
Authority
authority
=
authorityDao
.
findByIdInAndName
(
authorityIds
,
"查看人员"
);
if
(
authority
!=
null
){
if
(
authority
!=
null
){
String
departmentId
=
role
.
getDepartmentId
();
String
departmentId
=
role
.
getDepartmentId
();
departmentIds
.
add
(
departmentId
);
}
}
}
}
List
<
String
>
departmentIdList
=
new
ArrayList
<>();
List
<
Role
>
roleList
=
new
ArrayList
<>();
getDepartments
(
departmentIdList
,
departmentIds
);
for
(
Role
role
:
roles
)
{
List
<
Department
>
departments
=
departmentDao
.
findAllByIdIn
(
departmentIdList
);
List
<
Authority
>
authorities
=
role
.
getAuthorities
();
for
(
Authority
authority
:
authorities
)
{
if
(
"查看人员"
.
equals
(
authority
.
getName
())){
roleList
.
add
(
role
);
}
}
}
List
<
Department
>
departments
=
new
ArrayList
<>();
if
(
roleList
!=
null
){
for
(
Role
role
:
roleList
)
{
String
departmentId
=
role
.
getDepartmentId
();
List
<
Department
>
departmentList
=
departmentDao
.
findAllByParentId
(
departmentId
);
findDepartmentList
(
departments
,
departmentList
);
}
return
departments
;
}
return
departments
;
return
departments
;
}
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
());
}
getDepartments
(
departmentIdList
,
departments
);
}
}
}
@Override
@Override
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论