Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
C
cmeeting
概览
概览
详情
活动
周期分析
版本库
存储库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
Issue Boards
Open sidebar
翟斌
cmeeting
Commits
da7f1eb6
提交
da7f1eb6
authored
7月 18, 2025
作者:
洪东保
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
权限相关接口
父级
23a57087
显示空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
115 行增加
和
52 行删除
+115
-52
src/main/java/com/cmeeting/controller/PermissionController.java
+4
-2
src/main/java/com/cmeeting/dto/PermissionCheckedDTO.java
+1
-0
src/main/java/com/cmeeting/service/ModulePermissionService.java
+2
-1
src/main/java/com/cmeeting/service/impl/ModulePermissionServiceImpl.java
+24
-9
src/main/java/com/cmeeting/vo/AuthVO.java
+84
-0
src/main/java/com/cmeeting/vo/PermissionVO.java
+0
-40
没有找到文件。
src/main/java/com/cmeeting/controller/PermissionController.java
浏览文件 @
da7f1eb6
...
...
@@ -7,6 +7,7 @@ import com.cmeeting.constant.PermissionPruposeType;
import
com.cmeeting.pojo.ModulePermission
;
import
com.cmeeting.service.ModulePermissionService
;
import
com.cmeeting.util.R
;
import
com.cmeeting.vo.AuthVO
;
import
com.cmeeting.vo.PermissionVO
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
...
...
@@ -47,14 +48,15 @@ public class PermissionController {
* 授权用户
* @param vo
* @return
* TODO 授权所有人未处理
*/
@PostMapping
(
"/auth"
)
public
R
auth
(
@Validated
@RequestBody
PermissionVO
.
Auth
vo
)
{
public
R
auth
(
@Validated
@RequestBody
AuthVO
vo
)
{
return
R
.
ok
(
modulePermissionService
.
auth
(
vo
.
getAuthData
()));
}
@PostMapping
(
"/remove"
)
public
R
remove
(
@Validated
Permission
VO
.
Add
vo
)
{
public
R
remove
(
@Validated
@RequestBody
Auth
VO
.
Add
vo
)
{
boolean
needTarget
=
vo
.
getPurpose
().
equals
(
PermissionPruposeType
.
TEMPLATE_TYPE_PERMISSION
)
||
vo
.
getPurpose
().
equals
(
PermissionPruposeType
.
TEMPLATE_PERMISSION
);
if
(
needTarget
&&
vo
.
getTargetId
()
==
null
)
{
...
...
src/main/java/com/cmeeting/dto/PermissionCheckedDTO.java
浏览文件 @
da7f1eb6
...
...
@@ -44,6 +44,7 @@ public class PermissionCheckedDTO implements Serializable {
* 0 部门 / 1 用户
*/
private
Integer
type
;
private
Integer
userType
;
private
String
name
;
private
String
deptName
;
}
...
...
src/main/java/com/cmeeting/service/ModulePermissionService.java
浏览文件 @
da7f1eb6
...
...
@@ -3,6 +3,7 @@ package com.cmeeting.service;
import
com.cmeeting.dto.PermissionCheckedDTO
;
import
com.cmeeting.pojo.ModulePermission
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.cmeeting.vo.AuthVO
;
import
com.cmeeting.vo.PermissionVO
;
import
java.util.List
;
...
...
@@ -19,7 +20,7 @@ public interface ModulePermissionService extends IService<ModulePermission> {
List
<
PermissionCheckedDTO
.
CateOrUser
>
checkedList
(
String
search
,
Integer
purpose
,
Long
targetId
);
Boolean
auth
(
List
<
Permission
VO
.
Add
>
authData
);
Boolean
auth
(
List
<
Auth
VO
.
Add
>
authData
);
List
<
PermissionCheckedDTO
.
User
>
personalCancelList
();
}
src/main/java/com/cmeeting/service/impl/ModulePermissionServiceImpl.java
浏览文件 @
da7f1eb6
...
...
@@ -15,6 +15,7 @@ import com.cmeeting.service.IShareUserService;
import
com.cmeeting.service.ModulePermissionService
;
import
com.cmeeting.mapper.primary.ModulePermissionMapper
;
import
com.cmeeting.service.SysUserSyncService
;
import
com.cmeeting.vo.AuthVO
;
import
com.cmeeting.vo.PermissionVO
;
import
org.springframework.security.core.parameters.P
;
import
org.springframework.stereotype.Service
;
...
...
@@ -51,20 +52,23 @@ public class ModulePermissionServiceImpl extends ServiceImpl<ModulePermissionMap
Set
<
String
>
deptIds
=
permissions
.
stream
()
.
filter
(
e
->
e
.
getType
().
equals
(
RecordTemplateConstant
.
REL_TYPE_DEPT
))
.
map
(
ModulePermission:
:
getRelId
).
collect
(
Collectors
.
toSet
());
Set
<
String
>
userIds
=
permissions
.
stream
().
filter
(
e
->
e
.
getType
().
equals
(
RecordTemplateConstant
.
REL_TYPE_USER
))
.
map
(
ModulePermission:
:
getRelId
).
collect
(
Collectors
.
toSet
());
// 授权了所有人
boolean
all
=
userIds
.
contains
(
CategoryConstant
.
ALL_EN
)
||
deptIds
.
contains
(
CategoryConstant
.
ALL_EN
);
List
<
PermissionCheckedDTO
.
Category
>
categoryList
=
dto
.
getCategoryList
();
if
(
CollUtil
.
isNotEmpty
(
deptIds
)
&&
CollUtil
.
isEmpty
(
categoryList
))
{
for
(
PermissionCheckedDTO
.
Category
category
:
categoryList
)
{
if
(
deptIds
.
contains
(
category
.
getId
()))
{
if
(
all
||
deptIds
.
contains
(
category
.
getId
()))
{
category
.
setCheck
(
true
);
}
}
}
List
<
PermissionCheckedDTO
.
User
>
userList
=
dto
.
getUserList
();
Set
<
String
>
userIds
=
permissions
.
stream
().
filter
(
e
->
e
.
getType
().
equals
(
RecordTemplateConstant
.
REL_TYPE_USER
))
.
map
(
ModulePermission:
:
getRelId
).
collect
(
Collectors
.
toSet
());
if
(
CollUtil
.
isNotEmpty
(
userIds
)
&&
CollUtil
.
isEmpty
(
userList
))
{
for
(
PermissionCheckedDTO
.
User
user
:
userList
)
{
if
(
userIds
.
contains
(
user
.
getId
()))
{
if
(
all
||
userIds
.
contains
(
user
.
getId
()))
{
user
.
setCheck
(
true
);
}
}
...
...
@@ -99,34 +103,45 @@ public class ModulePermissionServiceImpl extends ServiceImpl<ModulePermissionMap
.
eq
(
targetId
!=
null
,
ModulePermission:
:
getTargetId
,
targetId
)
.
select
(
ModulePermission:
:
getRelId
,
ModulePermission:
:
getType
)
);
if
(
CollUtil
.
isNotEmpty
(
modulePermissions
))
{
List
<
String
>
cateIds
=
modulePermissions
.
stream
().
filter
(
e
->
Objects
.
equals
(
e
.
getType
(),
RecordTemplateConstant
.
REL_TYPE_DEPT
)).
map
(
ModulePermission:
:
getRelId
).
collect
(
Collectors
.
toList
());
List
<
String
>
userIds
=
modulePermissions
.
stream
().
filter
(
e
->
Objects
.
equals
(
e
.
getType
(),
RecordTemplateConstant
.
REL_TYPE_USER
)).
map
(
ModulePermission:
:
getRelId
).
collect
(
Collectors
.
toList
());
Set
<
String
>
ids
=
modulePermissions
.
stream
().
map
(
ModulePermission:
:
getRelId
).
collect
(
Collectors
.
toSet
());
if
(
CollUtil
.
isNotEmpty
(
ids
)
&&
ids
.
contains
(
CategoryConstant
.
ALL_EN
))
{
PermissionCheckedDTO
.
CateOrUser
cateOrUser
=
PermissionCheckedDTO
.
CateOrUser
.
builder
()
.
id
(
CategoryConstant
.
ALL_EN
).
name
(
"所有人"
).
deptName
(
"所有人"
).
userType
(
UserTypeConstant
.
SYNC
).
type
(
RecordTemplateConstant
.
REL_TYPE_USER
).
build
();
retList
.
add
(
cateOrUser
);
return
retList
;
}
PermissionCheckedDTO
permissionCheckedDTO
=
permissionList
(
search
,
null
,
null
,
purpose
,
cateIds
,
userIds
);
if
(
CollUtil
.
isNotEmpty
(
permissionCheckedDTO
.
getUserList
()))
{
for
(
PermissionCheckedDTO
.
User
user
:
permissionCheckedDTO
.
getUserList
())
{
if
(
userIds
.
contains
(
user
.
getId
()))
{
PermissionCheckedDTO
.
CateOrUser
cateOrUser
=
PermissionCheckedDTO
.
CateOrUser
.
builder
()
.
id
(
user
.
getId
()).
name
(
user
.
getName
()).
deptName
(
user
.
getDeptNam
e
()).
type
(
RecordTemplateConstant
.
REL_TYPE_USER
).
build
();
.
id
(
user
.
getId
()).
name
(
user
.
getName
()).
deptName
(
user
.
getDeptName
()).
userType
(
user
.
getUserTyp
e
()).
type
(
RecordTemplateConstant
.
REL_TYPE_USER
).
build
();
retList
.
add
(
cateOrUser
);
}
}
}
if
(
CollUtil
.
isNotEmpty
(
permissionCheckedDTO
.
getCategoryList
()))
{
for
(
PermissionCheckedDTO
.
Category
category
:
permissionCheckedDTO
.
getCategoryList
())
{
if
(
cateIds
.
contains
(
category
.
getId
()))
{
PermissionCheckedDTO
.
CateOrUser
cateOrUser
=
PermissionCheckedDTO
.
CateOrUser
.
builder
()
.
id
(
category
.
getId
()).
name
(
category
.
getName
()).
deptName
(
category
.
getNam
e
()).
type
(
RecordTemplateConstant
.
REL_TYPE_DEPT
).
build
();
.
id
(
category
.
getId
()).
name
(
category
.
getName
()).
deptName
(
category
.
getName
()).
userType
(
category
.
getUserTyp
e
()).
type
(
RecordTemplateConstant
.
REL_TYPE_DEPT
).
build
();
retList
.
add
(
cateOrUser
);
}
}
}
}
return
retList
;
}
@Override
public
Boolean
auth
(
List
<
Permission
VO
.
Add
>
authData
)
{
public
Boolean
auth
(
List
<
Auth
VO
.
Add
>
authData
)
{
if
(
CollUtil
.
isNotEmpty
(
authData
))
{
List
<
ModulePermission
>
list
=
new
ArrayList
<>();
for
(
Permission
VO
.
Add
authDatum
:
authData
)
{
for
(
Auth
VO
.
Add
authDatum
:
authData
)
{
ModulePermission
permission
=
BeanUtil
.
copyProperties
(
authDatum
,
ModulePermission
.
class
);
permission
.
setCreateTime
(
new
Date
());
list
.
add
(
permission
);
...
...
src/main/java/com/cmeeting/vo/AuthVO.java
0 → 100644
浏览文件 @
da7f1eb6
package
com
.
cmeeting
.
vo
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
org.jetbrains.annotations.NotNull
;
import
javax.validation.constraints.NotEmpty
;
import
java.util.List
;
@Data
@AllArgsConstructor
@NoArgsConstructor
public
class
AuthVO
{
@NotEmpty
(
message
=
"param ids cant be null!"
)
private
List
<
Add
>
authData
;
@Data
@AllArgsConstructor
@NoArgsConstructor
public
static
class
Add
{
/**
* 类型,0-分类,1-用户
*/
@NotNull
private
Integer
type
;
/**
* 用户类型,2-通讯录,3-超管分享
*/
@NotNull
private
Integer
userType
;
/**
* 0-授权纪要功能,1-纪要类型分享,2-纪要模板分享,3-用户自己关闭纪要功能
*/
@NotNull
private
Integer
purpose
;
/**
* 关联id(分类id或用户id) 为all时 表示所有人授权/清空所有权限
*/
@NotNull
private
String
relId
;
/**
* purpose为0/3时为空,为1时是纪要类型id,2时纪要模板id
*/
private
Long
targetId
;
}
@Data
@AllArgsConstructor
@NoArgsConstructor
public
static
class
Remove
{
/**
* 类型,0-分类,1-用户
*/
@NotNull
private
Integer
type
;
/**
* 用户类型,2-通讯录,3-超管分享
*/
@NotNull
private
Integer
userType
;
/**
* 0-授权纪要功能,1-纪要类型分享,2-纪要模板分享,3-用户自己关闭纪要功能
*/
@NotNull
private
Integer
purpose
;
/**
* 关联id(分类id或用户id) 为all时 表示所有人授权/清空所有权限
*/
@NotNull
private
String
relId
;
/**
* purpose为0/3时为空,为1时是纪要类型id,2时纪要模板id
*/
private
Long
targetId
;
}
}
src/main/java/com/cmeeting/vo/PermissionVO.java
浏览文件 @
da7f1eb6
...
...
@@ -52,45 +52,5 @@ public class PermissionVO {
}
@Data
@AllArgsConstructor
@NoArgsConstructor
public
static
class
Auth
{
@NotEmpty
(
message
=
"param ids cant be null!"
)
private
List
<
Add
>
authData
;
}
@Data
public
static
class
Add
{
/**
* 类型,0-分类,1-用户
*/
@NotNull
private
Integer
type
;
/**
* 用户类型,2-通讯录,3-超管分享
*/
@NotNull
private
Integer
userType
;
/**
* 0-授权纪要功能,1-纪要类型分享,2-纪要模板分享,3-用户自己关闭纪要功能
*/
@NotNull
private
Integer
purpose
;
/**
* 关联id(分类id或用户id) 为all时 表示所有人授权/清空所有权限
*/
@NotNull
private
String
relId
;
/**
* purpose为0/3时为空,为1时是纪要类型id,2时纪要模板id
*/
private
Long
targetId
;
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论