Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
C
cmeeting
概览
概览
详情
活动
周期分析
版本库
存储库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
Issue Boards
Open sidebar
翟斌
cmeeting
Commits
708ef28e
提交
708ef28e
authored
7月 18, 2025
作者:
洪东保
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'hongdongbao'
父级
75060626
d1fba356
显示空白字符变更
内嵌
并排
正在显示
8 个修改的文件
包含
115 行增加
和
98 行删除
+115
-98
src/main/java/com/cmeeting/ad/service/impl/UserServiceImpl.java
+0
-41
src/main/java/com/cmeeting/controller/PermissionController.java
+3
-5
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
+25
-9
src/main/java/com/cmeeting/vo/AuthVO.java
+84
-0
src/main/java/com/cmeeting/vo/PermissionVO.java
+0
-40
src/main/resources/application.yml
+0
-2
没有找到文件。
src/main/java/com/cmeeting/ad/service/impl/UserServiceImpl.java
浏览文件 @
708ef28e
...
...
@@ -48,8 +48,6 @@ public class UserServiceImpl implements UserService {
public
String
aesKey
;
@Value
(
"${permission.applicationId}"
)
public
String
applicationId
;
@Value
(
"${removeMenus}"
)
private
String
removeMenus
;
@Value
(
"${jwt.expireTime}"
)
private
String
expireTime
;
@Value
(
"${permission.tenantId}"
)
...
...
@@ -105,45 +103,6 @@ public class UserServiceImpl implements UserService {
SecurityContextHolder
.
getContext
().
setAuthentication
(
authentication
);
RobotSecurityUser
userDetail
=
(
RobotSecurityUser
)
authentication
.
getPrincipal
();
String
token
=
jwtUtil
.
generateToken
(
userDetail
);
// List<SysMenu> menuList = commonMapper.getMenuList(permissionTenantId);
// // 需要对menuList进行过滤
// // 根据uid查询对应角色,然后查询角色对应的菜单权限
//
// menuList.sort(Comparator.comparingInt(SysMenu::getSort));
//
// // 总库去掉部分菜单
// if ("system".equals(userDetail.getUsername())) {
// List<String> removeMenuList = Arrays.asList(removeMenus.split(","));
// int size = menuList.size();
// for (int i = 0; i < size; i++) {
// SysMenu sysMenu = menuList.get(i);
// String tempName = sysMenu.getName();
// if (removeMenuList.contains(tempName)) {
// menuList.remove(sysMenu);
// size -= 1;
// i -= 1;
// }
// }
// }
// RoleTree loginMenus = getLoginMenus(menuList);
// HashSet<String> set = new HashSet<>();
// for (SysMenu sysMenu : menuList) {
// set.add(sysMenu.getPerms());
// }
// if (set.contains("interactCenter")) {
// //看是否勾选了首页配置 121是首页菜单的id
// loginMenus.getInteractCenter().add("modelList");
// loginMenus.getInteractCenter().add("modelPage");
// }
// if (set.contains("robotCenter")) {
// //看是否勾选了首页配置 121是首页菜单的id
// loginMenus.getRobotCenter().add("robotPage");
// }
// if (set.contains("processCenter")) {
// //看是否勾选了首页配置 121是首页菜单的id
// loginMenus.getProcessCenter().add("processPage");
// }
// userDetail.setMenus(loginMenus);
redisUtils
.
set
(
token
,
userDetail
,
Long
.
parseLong
(
expireTime
));
return
token
;
...
...
src/main/java/com/cmeeting/controller/PermissionController.java
浏览文件 @
708ef28e
package
com
.
cmeeting
.
controller
;
import
com.azure.core.annotation.Get
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.cmeeting.constant.CategoryConstant
;
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.*
;
import
javax.annotation.Resource
;
import
javax.mail.MessagingException
;
import
javax.validation.Valid
;
@RestController
@RequestMapping
(
"/permission"
)
...
...
@@ -49,12 +47,12 @@ public class PermissionController {
* @return
*/
@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
浏览文件 @
708ef28e
...
...
@@ -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
浏览文件 @
708ef28e
...
...
@@ -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
浏览文件 @
708ef28e
...
...
@@ -4,6 +4,7 @@ import cn.hutool.core.bean.BeanUtil;
import
cn.hutool.core.collection.CollUtil
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.cmeeting.ad.entity.RobotSecurityUser
;
import
com.cmeeting.ad.util.SecurityUtil
;
import
com.cmeeting.constant.CategoryConstant
;
import
com.cmeeting.constant.PermissionPruposeType
;
...
...
@@ -15,6 +16,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 +53,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 +104,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
浏览文件 @
708ef28e
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
浏览文件 @
708ef28e
...
...
@@ -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
;
}
}
src/main/resources/application.yml
浏览文件 @
708ef28e
...
...
@@ -135,8 +135,6 @@ userAdmin:
file-download-path
:
/download/minio/
docDomain
:
http://192.168.10.157:8102/knowledgePlatform
removeMenus
:
关键词回复,业务词库,同义词管理,答案库
jwt
:
header
:
Authorization
customHeader
:
'
Custom-Auth-Token'
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论