mirror of
https://github.com/dromara/RuoYi-Vue-Plus.git
synced 2025-11-26 18:49:23 +08:00
Compare commits
22 Commits
c85f693ca6
...
v5.4.1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
64100cf1ff | ||
|
|
7e7d857ba5 | ||
|
|
d22b2a10df | ||
|
|
957a4d1fcd | ||
|
|
49ef8378fe | ||
|
|
57dd6831d3 | ||
|
|
8aa60abb1f | ||
|
|
7a9f51fc7a | ||
|
|
159e30c982 | ||
|
|
7334d91d6b | ||
|
|
95c01301f6 | ||
|
|
296466fa13 | ||
|
|
3c8d864b5f | ||
|
|
ea50a57602 | ||
|
|
7e14b98676 | ||
|
|
015b406001 | ||
|
|
098d3347a0 | ||
|
|
08d4493994 | ||
|
|
367d739e2d | ||
|
|
d6688a367d | ||
|
|
0b331796e2 | ||
|
|
456620b638 |
@@ -27,7 +27,7 @@
|
|||||||
> 成员前端项目地址: 基于soybean [ruoyi-plus-soybean](https://gitee.com/xlsea/ruoyi-plus-soybean)<br>
|
> 成员前端项目地址: 基于soybean [ruoyi-plus-soybean](https://gitee.com/xlsea/ruoyi-plus-soybean)<br>
|
||||||
> 成员项目地址: 删除多租户与工作流 [RuoYi-Vue-Plus-Single](https://gitee.com/ColorDreams/RuoYi-Vue-Plus-Single)<br>
|
> 成员项目地址: 删除多租户与工作流 [RuoYi-Vue-Plus-Single](https://gitee.com/ColorDreams/RuoYi-Vue-Plus-Single)<br>
|
||||||
|
|
||||||
> 文档地址: [plus-doc](https://plus-doc.dromara.org) 国内加速: [plus-doc.top](https://plus-doc.top)
|
> 文档地址: [plus-doc](https://plus-doc.dromara.org) 文档在华为云上如果打不开大概率是DNS问题 可以尝试切换网络等方式(或者科学上网)
|
||||||
|
|
||||||
## 赞助商
|
## 赞助商
|
||||||
|
|
||||||
@@ -37,8 +37,6 @@ CCFlow 驰聘低代码-流程-表单 - https://gitee.com/opencc/RuoYi-JFlow <br>
|
|||||||
引迈信息 软件开发平台 - https://www.jnpfsoft.com/index.html?from=plus-doc <br>
|
引迈信息 软件开发平台 - https://www.jnpfsoft.com/index.html?from=plus-doc <br>
|
||||||
<font color="red">**启山商城系统 多租户商城源码可免费商用可二次开发 - https://www.73app.cn/** </font><br>
|
<font color="red">**启山商城系统 多租户商城源码可免费商用可二次开发 - https://www.73app.cn/** </font><br>
|
||||||
Mall4J 高质量Java商城系统 - https://www.mall4j.com/cn/?statId=11 <br>
|
Mall4J 高质量Java商城系统 - https://www.mall4j.com/cn/?statId=11 <br>
|
||||||
aizuda flowlong 工作流 - https://gitee.com/aizuda/flowlong <br>
|
|
||||||
|
|
||||||
[如何成为赞助商 加群联系作者详谈](https://plus-doc.dromara.org/#/common/add_group)
|
[如何成为赞助商 加群联系作者详谈](https://plus-doc.dromara.org/#/common/add_group)
|
||||||
|
|
||||||
# 本框架与RuoYi的功能差异
|
# 本框架与RuoYi的功能差异
|
||||||
|
|||||||
2
pom.xml
2
pom.xml
@@ -31,7 +31,7 @@
|
|||||||
<redisson.version>3.50.0</redisson.version>
|
<redisson.version>3.50.0</redisson.version>
|
||||||
<lock4j.version>2.2.7</lock4j.version>
|
<lock4j.version>2.2.7</lock4j.version>
|
||||||
<dynamic-ds.version>4.3.1</dynamic-ds.version>
|
<dynamic-ds.version>4.3.1</dynamic-ds.version>
|
||||||
<snailjob.version>1.6.0</snailjob.version>
|
<snailjob.version>1.5.0</snailjob.version>
|
||||||
<mapstruct-plus.version>1.4.8</mapstruct-plus.version>
|
<mapstruct-plus.version>1.4.8</mapstruct-plus.version>
|
||||||
<mapstruct-plus.lombok.version>0.2.0</mapstruct-plus.lombok.version>
|
<mapstruct-plus.lombok.version>0.2.0</mapstruct-plus.lombok.version>
|
||||||
<lombok.version>1.18.36</lombok.version>
|
<lombok.version>1.18.36</lombok.version>
|
||||||
|
|||||||
@@ -21,8 +21,6 @@ import org.dromara.common.core.domain.model.SocialLoginBody;
|
|||||||
import org.dromara.common.core.utils.*;
|
import org.dromara.common.core.utils.*;
|
||||||
import org.dromara.common.encrypt.annotation.ApiEncrypt;
|
import org.dromara.common.encrypt.annotation.ApiEncrypt;
|
||||||
import org.dromara.common.json.utils.JsonUtils;
|
import org.dromara.common.json.utils.JsonUtils;
|
||||||
import org.dromara.common.ratelimiter.annotation.RateLimiter;
|
|
||||||
import org.dromara.common.ratelimiter.enums.LimitType;
|
|
||||||
import org.dromara.common.satoken.utils.LoginHelper;
|
import org.dromara.common.satoken.utils.LoginHelper;
|
||||||
import org.dromara.common.social.config.properties.SocialLoginConfigProperties;
|
import org.dromara.common.social.config.properties.SocialLoginConfigProperties;
|
||||||
import org.dromara.common.social.config.properties.SocialProperties;
|
import org.dromara.common.social.config.properties.SocialProperties;
|
||||||
@@ -200,7 +198,6 @@ public class AuthController {
|
|||||||
*
|
*
|
||||||
* @return 租户列表
|
* @return 租户列表
|
||||||
*/
|
*/
|
||||||
@RateLimiter(time = 60, count = 20, limitType = LimitType.IP)
|
|
||||||
@GetMapping("/tenant/list")
|
@GetMapping("/tenant/list")
|
||||||
public R<LoginTenantVo> tenantList(HttpServletRequest request) throws Exception {
|
public R<LoginTenantVo> tenantList(HttpServletRequest request) throws Exception {
|
||||||
// 返回对象
|
// 返回对象
|
||||||
|
|||||||
@@ -127,7 +127,6 @@ tenant:
|
|||||||
- sys_user_role
|
- sys_user_role
|
||||||
- sys_client
|
- sys_client
|
||||||
- sys_oss_config
|
- sys_oss_config
|
||||||
- flow_spel
|
|
||||||
|
|
||||||
# MyBatisPlus配置
|
# MyBatisPlus配置
|
||||||
# https://baomidou.com/config/
|
# https://baomidou.com/config/
|
||||||
@@ -190,6 +189,13 @@ springdoc:
|
|||||||
name: Lion Li
|
name: Lion Li
|
||||||
email: crazylionli@163.com
|
email: crazylionli@163.com
|
||||||
url: https://gitee.com/dromara/RuoYi-Vue-Plus
|
url: https://gitee.com/dromara/RuoYi-Vue-Plus
|
||||||
|
components:
|
||||||
|
# 鉴权方式配置
|
||||||
|
security-schemes:
|
||||||
|
apiKey:
|
||||||
|
type: APIKEY
|
||||||
|
in: HEADER
|
||||||
|
name: ${sa-token.token-name}
|
||||||
#这里定义了两个分组,可定义多个,也可以不定义
|
#这里定义了两个分组,可定义多个,也可以不定义
|
||||||
group-configs:
|
group-configs:
|
||||||
- group: 1.演示模块
|
- group: 1.演示模块
|
||||||
@@ -207,7 +213,7 @@ springdoc:
|
|||||||
xss:
|
xss:
|
||||||
# 过滤开关
|
# 过滤开关
|
||||||
enabled: true
|
enabled: true
|
||||||
# 排除链接
|
# 排除链接(多个用逗号分隔)
|
||||||
excludeUrls:
|
excludeUrls:
|
||||||
- /system/notice
|
- /system/notice
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ user.username.length.valid=账户长度必须在{min}到{max}个字符之间
|
|||||||
user.password.not.blank=用户密码不能为空
|
user.password.not.blank=用户密码不能为空
|
||||||
user.password.length.valid=用户密码长度必须在{min}到{max}个字符之间
|
user.password.length.valid=用户密码长度必须在{min}到{max}个字符之间
|
||||||
user.password.not.valid=* 5-50个字符
|
user.password.not.valid=* 5-50个字符
|
||||||
user.password.format.valid=密码必须包含大写字母、小写字母、数字和特殊字符
|
|
||||||
user.email.not.valid=邮箱格式错误
|
user.email.not.valid=邮箱格式错误
|
||||||
user.email.not.blank=邮箱不能为空
|
user.email.not.blank=邮箱不能为空
|
||||||
user.phonenumber.not.blank=用户手机号不能为空
|
user.phonenumber.not.blank=用户手机号不能为空
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ user.username.length.valid=Account length must be between {min} and {max} charac
|
|||||||
user.password.not.blank=Password cannot be empty
|
user.password.not.blank=Password cannot be empty
|
||||||
user.password.length.valid=Password length must be between {min} and {max} characters
|
user.password.length.valid=Password length must be between {min} and {max} characters
|
||||||
user.password.not.valid=* 5-50 characters
|
user.password.not.valid=* 5-50 characters
|
||||||
user.password.format.valid=Password must contain uppercase, lowercase, digit, and special character
|
|
||||||
user.email.not.valid=Mailbox format error
|
user.email.not.valid=Mailbox format error
|
||||||
user.email.not.blank=Mailbox cannot be blank
|
user.email.not.blank=Mailbox cannot be blank
|
||||||
user.phonenumber.not.blank=Phone number cannot be blank
|
user.phonenumber.not.blank=Phone number cannot be blank
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ user.username.length.valid=账户长度必须在{min}到{max}个字符之间
|
|||||||
user.password.not.blank=用户密码不能为空
|
user.password.not.blank=用户密码不能为空
|
||||||
user.password.length.valid=用户密码长度必须在{min}到{max}个字符之间
|
user.password.length.valid=用户密码长度必须在{min}到{max}个字符之间
|
||||||
user.password.not.valid=* 5-50个字符
|
user.password.not.valid=* 5-50个字符
|
||||||
user.password.format.valid=密码必须包含大写字母、小写字母、数字和特殊字符
|
|
||||||
user.email.not.valid=邮箱格式错误
|
user.email.not.valid=邮箱格式错误
|
||||||
user.email.not.blank=邮箱不能为空
|
user.email.not.blank=邮箱不能为空
|
||||||
user.phonenumber.not.blank=用户手机号不能为空
|
user.phonenumber.not.blank=用户手机号不能为空
|
||||||
|
|||||||
@@ -52,14 +52,14 @@ public class TaskAssigneeDTO implements Serializable {
|
|||||||
*/
|
*/
|
||||||
public static <T> List<TaskHandler> convertToHandlerList(
|
public static <T> List<TaskHandler> convertToHandlerList(
|
||||||
List<T> sourceList,
|
List<T> sourceList,
|
||||||
Function<T, String> storageId,
|
Function<T, Long> storageId,
|
||||||
Function<T, String> handlerCode,
|
Function<T, String> handlerCode,
|
||||||
Function<T, String> handlerName,
|
Function<T, String> handlerName,
|
||||||
Function<T, Long> groupName,
|
Function<T, Long> groupName,
|
||||||
Function<T, Date> createTimeMapper) {
|
Function<T, Date> createTimeMapper) {
|
||||||
return sourceList.stream()
|
return sourceList.stream()
|
||||||
.map(item -> new TaskHandler(
|
.map(item -> new TaskHandler(
|
||||||
storageId.apply(item),
|
String.valueOf(storageId.apply(item)),
|
||||||
handlerCode.apply(item),
|
handlerCode.apply(item),
|
||||||
handlerName.apply(item),
|
handlerName.apply(item),
|
||||||
groupName != null ? String.valueOf(groupName.apply(item)) : null,
|
groupName != null ? String.valueOf(groupName.apply(item)) : null,
|
||||||
|
|||||||
@@ -27,11 +27,6 @@ public class ProcessEvent implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private String flowCode;
|
private String flowCode;
|
||||||
|
|
||||||
/**
|
|
||||||
* 实例id
|
|
||||||
*/
|
|
||||||
private Long instanceId;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 业务id
|
* 业务id
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import lombok.Data;
|
|||||||
|
|
||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 流程任务监听
|
* 流程任务监听
|
||||||
@@ -47,11 +46,6 @@ public class ProcessTaskEvent implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private Long taskId;
|
private Long taskId;
|
||||||
|
|
||||||
/**
|
|
||||||
* 实例id
|
|
||||||
*/
|
|
||||||
private Long instanceId;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 业务id
|
* 业务id
|
||||||
*/
|
*/
|
||||||
@@ -62,9 +56,4 @@ public class ProcessTaskEvent implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private String status;
|
private String status;
|
||||||
|
|
||||||
/**
|
|
||||||
* 办理参数
|
|
||||||
*/
|
|
||||||
private Map<String, Object> params;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ public class PasswordLoginBody extends LoginBody {
|
|||||||
*/
|
*/
|
||||||
@NotBlank(message = "{user.password.not.blank}")
|
@NotBlank(message = "{user.password.not.blank}")
|
||||||
@Length(min = 5, max = 30, message = "{user.password.length.valid}")
|
@Length(min = 5, max = 30, message = "{user.password.length.valid}")
|
||||||
// @Pattern(regexp = RegexConstants.PASSWORD, message = "{user.password.format.valid}")
|
|
||||||
private String password;
|
private String password;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,12 +26,8 @@ public class RegisterBody extends LoginBody {
|
|||||||
*/
|
*/
|
||||||
@NotBlank(message = "{user.password.not.blank}")
|
@NotBlank(message = "{user.password.not.blank}")
|
||||||
@Length(min = 5, max = 30, message = "{user.password.length.valid}")
|
@Length(min = 5, max = 30, message = "{user.password.length.valid}")
|
||||||
// @Pattern(regexp = RegexConstants.PASSWORD, message = "{user.password.format.valid}")
|
|
||||||
private String password;
|
private String password;
|
||||||
|
|
||||||
/**
|
|
||||||
* 用户类型
|
|
||||||
*/
|
|
||||||
private String userType;
|
private String userType;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package org.dromara.common.core.service;
|
|||||||
import org.dromara.common.core.domain.dto.DeptDTO;
|
import org.dromara.common.core.domain.dto.DeptDTO;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通用 部门服务
|
* 通用 部门服务
|
||||||
@@ -35,12 +34,4 @@ public interface DeptService {
|
|||||||
*/
|
*/
|
||||||
List<DeptDTO> selectDeptsByList();
|
List<DeptDTO> selectDeptsByList();
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据部门 ID 列表查询部门名称映射关系
|
|
||||||
*
|
|
||||||
* @param deptIds 部门 ID 列表
|
|
||||||
* @return Map,其中 key 为部门 ID,value 为对应的部门名称
|
|
||||||
*/
|
|
||||||
Map<Long, String> selectDeptNamesByIds(List<Long> deptIds);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
package org.dromara.common.core.service;
|
package org.dromara.common.core.service;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通用 岗位服务
|
* 通用 岗位服务
|
||||||
*
|
*
|
||||||
@@ -10,12 +7,4 @@ import java.util.Map;
|
|||||||
*/
|
*/
|
||||||
public interface PostService {
|
public interface PostService {
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据岗位 ID 列表查询岗位名称映射关系
|
|
||||||
*
|
|
||||||
* @param postIds 岗位 ID 列表
|
|
||||||
* @return Map,其中 key 为岗位 ID,value 为对应的岗位名称
|
|
||||||
*/
|
|
||||||
Map<Long, String> selectPostNamesByIds(List<Long> postIds);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
package org.dromara.common.core.service;
|
package org.dromara.common.core.service;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通用 角色服务
|
* 通用 角色服务
|
||||||
*
|
*
|
||||||
@@ -10,12 +7,4 @@ import java.util.Map;
|
|||||||
*/
|
*/
|
||||||
public interface RoleService {
|
public interface RoleService {
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据角色 ID 列表查询角色名称映射关系
|
|
||||||
*
|
|
||||||
* @param roleIds 角色 ID 列表
|
|
||||||
* @return Map,其中 key 为角色 ID,value 为对应的角色名称
|
|
||||||
*/
|
|
||||||
Map<Long, String> selectRoleNamesByIds(List<Long> roleIds);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -100,4 +100,28 @@ public interface UserService {
|
|||||||
*/
|
*/
|
||||||
Map<Long, String> selectUserNamesByIds(List<Long> userIds);
|
Map<Long, String> selectUserNamesByIds(List<Long> userIds);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据角色 ID 列表查询角色名称映射关系
|
||||||
|
*
|
||||||
|
* @param roleIds 角色 ID 列表
|
||||||
|
* @return Map,其中 key 为角色 ID,value 为对应的角色名称
|
||||||
|
*/
|
||||||
|
Map<Long, String> selectRoleNamesByIds(List<Long> roleIds);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据部门 ID 列表查询部门名称映射关系
|
||||||
|
*
|
||||||
|
* @param deptIds 部门 ID 列表
|
||||||
|
* @return Map,其中 key 为部门 ID,value 为对应的部门名称
|
||||||
|
*/
|
||||||
|
Map<Long, String> selectDeptNamesByIds(List<Long> deptIds);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据岗位 ID 列表查询岗位名称映射关系
|
||||||
|
*
|
||||||
|
* @param postIds 岗位 ID 列表
|
||||||
|
* @return Map,其中 key 为岗位 ID,value 为对应的岗位名称
|
||||||
|
*/
|
||||||
|
Map<Long, String> selectPostNamesByIds(List<Long> postIds);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,15 +54,14 @@ public class SpringDocConfig {
|
|||||||
openApi.externalDocs(properties.getExternalDocs());
|
openApi.externalDocs(properties.getExternalDocs());
|
||||||
openApi.tags(properties.getTags());
|
openApi.tags(properties.getTags());
|
||||||
openApi.paths(properties.getPaths());
|
openApi.paths(properties.getPaths());
|
||||||
if (properties.getComponents() != null) {
|
openApi.components(properties.getComponents());
|
||||||
openApi.components(properties.getComponents());
|
Set<String> keySet = properties.getComponents().getSecuritySchemes().keySet();
|
||||||
Set<String> keySet = properties.getComponents().getSecuritySchemes().keySet();
|
List<SecurityRequirement> list = new ArrayList<>();
|
||||||
List<SecurityRequirement> list = new ArrayList<>();
|
SecurityRequirement securityRequirement = new SecurityRequirement();
|
||||||
SecurityRequirement securityRequirement = new SecurityRequirement();
|
keySet.forEach(securityRequirement::addList);
|
||||||
keySet.forEach(securityRequirement::addList);
|
list.add(securityRequirement);
|
||||||
list.add(securityRequirement);
|
openApi.security(list);
|
||||||
openApi.security(list);
|
|
||||||
}
|
|
||||||
return openApi;
|
return openApi;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,9 @@ import org.springframework.http.HttpMethod;
|
|||||||
import org.springframework.validation.BindingResult;
|
import org.springframework.validation.BindingResult;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.Collection;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.StringJoiner;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 操作日志记录处理
|
* 操作日志记录处理
|
||||||
@@ -174,28 +176,14 @@ public class LogAspect {
|
|||||||
if (ArrayUtil.isEmpty(paramsArray)) {
|
if (ArrayUtil.isEmpty(paramsArray)) {
|
||||||
return params.toString();
|
return params.toString();
|
||||||
}
|
}
|
||||||
String[] exclude = ArrayUtil.addAll(excludeParamNames, EXCLUDE_PROPERTIES);
|
|
||||||
for (Object o : paramsArray) {
|
for (Object o : paramsArray) {
|
||||||
if (ObjectUtil.isNotNull(o) && !isFilterObject(o)) {
|
if (ObjectUtil.isNotNull(o) && !isFilterObject(o)) {
|
||||||
String str = "";
|
String str = JsonUtils.toJsonString(o);
|
||||||
if (o instanceof List<?> list) {
|
Dict dict = JsonUtils.parseMap(str);
|
||||||
List<Dict> list1 = new ArrayList<>();
|
if (MapUtil.isNotEmpty(dict)) {
|
||||||
for (Object obj : list) {
|
MapUtil.removeAny(dict, EXCLUDE_PROPERTIES);
|
||||||
String str1 = JsonUtils.toJsonString(obj);
|
MapUtil.removeAny(dict, excludeParamNames);
|
||||||
Dict dict = JsonUtils.parseMap(str1);
|
str = JsonUtils.toJsonString(dict);
|
||||||
if (MapUtil.isNotEmpty(dict)) {
|
|
||||||
MapUtil.removeAny(dict, exclude);
|
|
||||||
list1.add(dict);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
str = JsonUtils.toJsonString(list1);
|
|
||||||
} else {
|
|
||||||
str = JsonUtils.toJsonString(o);
|
|
||||||
Dict dict = JsonUtils.parseMap(str);
|
|
||||||
if (MapUtil.isNotEmpty(dict)) {
|
|
||||||
MapUtil.removeAny(dict, exclude);
|
|
||||||
str = JsonUtils.toJsonString(dict);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
params.add(str);
|
params.add(str);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -177,12 +177,12 @@ public class OssClient {
|
|||||||
// 创建异步请求体(length如果为空会报错)
|
// 创建异步请求体(length如果为空会报错)
|
||||||
BlockingInputStreamAsyncRequestBody body = BlockingInputStreamAsyncRequestBody.builder()
|
BlockingInputStreamAsyncRequestBody body = BlockingInputStreamAsyncRequestBody.builder()
|
||||||
.contentLength(length)
|
.contentLength(length)
|
||||||
.subscribeTimeout(Duration.ofSeconds(120))
|
.subscribeTimeout(Duration.ofSeconds(30))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
// 使用 transferManager 进行上传
|
// 使用 transferManager 进行上传
|
||||||
Upload upload = transferManager.upload(
|
Upload upload = transferManager.upload(
|
||||||
x -> x.requestBody(body).addTransferListener(LoggingTransferListener.create())
|
x -> x.requestBody(body)
|
||||||
.putObjectRequest(
|
.putObjectRequest(
|
||||||
y -> y.bucket(properties.getBucketName())
|
y -> y.bucket(properties.getBucketName())
|
||||||
.key(key)
|
.key(key)
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package org.dromara.common.redis.utils;
|
package org.dromara.common.redis.utils;
|
||||||
|
|
||||||
import cn.hutool.core.date.DatePattern;
|
import cn.hutool.core.date.DatePattern;
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
import lombok.AccessLevel;
|
import lombok.AccessLevel;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import org.dromara.common.core.utils.SpringUtils;
|
import org.dromara.common.core.utils.SpringUtils;
|
||||||
@@ -9,10 +10,6 @@ import org.redisson.api.RIdGenerator;
|
|||||||
import org.redisson.api.RedissonClient;
|
import org.redisson.api.RedissonClient;
|
||||||
|
|
||||||
import java.time.Duration;
|
import java.time.Duration;
|
||||||
import java.time.LocalDate;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.time.format.DateTimeFormatter;
|
|
||||||
import java.time.temporal.TemporalAccessor;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 发号器工具类
|
* 发号器工具类
|
||||||
@@ -26,12 +23,12 @@ public class SequenceUtils {
|
|||||||
/**
|
/**
|
||||||
* 默认初始值
|
* 默认初始值
|
||||||
*/
|
*/
|
||||||
public static final long DEFAULT_INIT_VALUE = 1L;
|
public static final Long DEFAULT_INIT_VALUE = 1L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 默认步长
|
* 默认步长
|
||||||
*/
|
*/
|
||||||
public static final long DEFAULT_STEP_VALUE = 1L;
|
public static final Long DEFAULT_STEP_VALUE = 1L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 默认过期时间-天
|
* 默认过期时间-天
|
||||||
@@ -43,11 +40,6 @@ public class SequenceUtils {
|
|||||||
*/
|
*/
|
||||||
public static final Duration DEFAULT_EXPIRE_TIME_MINUTE = Duration.ofMinutes(1);
|
public static final Duration DEFAULT_EXPIRE_TIME_MINUTE = Duration.ofMinutes(1);
|
||||||
|
|
||||||
/**
|
|
||||||
* 默认最小ID容量位数 - 6位数(即至少可以生成的ID为999999个)
|
|
||||||
*/
|
|
||||||
public static final int DEFAULT_MIN_ID_CAPACITY_BITS = 6;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取Redisson客户端实例
|
* 获取Redisson客户端实例
|
||||||
*/
|
*/
|
||||||
@@ -62,11 +54,14 @@ public class SequenceUtils {
|
|||||||
* @param stepValue ID步长
|
* @param stepValue ID步长
|
||||||
* @return ID生成器
|
* @return ID生成器
|
||||||
*/
|
*/
|
||||||
public static RIdGenerator getIdGenerator(String key, Duration expireTime, long initValue, long stepValue) {
|
private static RIdGenerator getIdGenerator(String key, Duration expireTime, Long initValue, Long stepValue) {
|
||||||
|
if (initValue == null || initValue <= 0) {
|
||||||
|
initValue = DEFAULT_INIT_VALUE;
|
||||||
|
}
|
||||||
|
if (stepValue == null || stepValue <= 0) {
|
||||||
|
stepValue = DEFAULT_STEP_VALUE;
|
||||||
|
}
|
||||||
RIdGenerator idGenerator = REDISSON_CLIENT.getIdGenerator(key);
|
RIdGenerator idGenerator = REDISSON_CLIENT.getIdGenerator(key);
|
||||||
// 初始值和步长不能小于等于0
|
|
||||||
initValue = initValue <= 0 ? DEFAULT_INIT_VALUE : initValue;
|
|
||||||
stepValue = stepValue <= 0 ? DEFAULT_STEP_VALUE : stepValue;
|
|
||||||
// 设置初始值和步长
|
// 设置初始值和步长
|
||||||
idGenerator.tryInit(initValue, stepValue);
|
idGenerator.tryInit(initValue, stepValue);
|
||||||
// 设置过期时间
|
// 设置过期时间
|
||||||
@@ -74,17 +69,6 @@ public class SequenceUtils {
|
|||||||
return idGenerator;
|
return idGenerator;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取ID生成器
|
|
||||||
*
|
|
||||||
* @param key 业务key
|
|
||||||
* @param expireTime 过期时间
|
|
||||||
* @return ID生成器
|
|
||||||
*/
|
|
||||||
public static RIdGenerator getIdGenerator(String key, Duration expireTime) {
|
|
||||||
return getIdGenerator(key, expireTime, DEFAULT_INIT_VALUE, DEFAULT_STEP_VALUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取指定业务key的唯一id
|
* 获取指定业务key的唯一id
|
||||||
*
|
*
|
||||||
@@ -94,21 +78,10 @@ public class SequenceUtils {
|
|||||||
* @param stepValue ID步长
|
* @param stepValue ID步长
|
||||||
* @return 唯一id
|
* @return 唯一id
|
||||||
*/
|
*/
|
||||||
public static long getNextId(String key, Duration expireTime, long initValue, long stepValue) {
|
public static long nextId(String key, Duration expireTime, Long initValue, Long stepValue) {
|
||||||
return getIdGenerator(key, expireTime, initValue, stepValue).nextId();
|
return getIdGenerator(key, expireTime, initValue, stepValue).nextId();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取指定业务key的唯一id (ID初始值=1,ID步长=1)
|
|
||||||
*
|
|
||||||
* @param key 业务key
|
|
||||||
* @param expireTime 过期时间
|
|
||||||
* @return 唯一id
|
|
||||||
*/
|
|
||||||
public static long getNextId(String key, Duration expireTime) {
|
|
||||||
return getIdGenerator(key, expireTime).nextId();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取指定业务key的唯一id字符串
|
* 获取指定业务key的唯一id字符串
|
||||||
*
|
*
|
||||||
@@ -118,8 +91,19 @@ public class SequenceUtils {
|
|||||||
* @param stepValue ID步长
|
* @param stepValue ID步长
|
||||||
* @return 唯一id
|
* @return 唯一id
|
||||||
*/
|
*/
|
||||||
public static String getNextIdString(String key, Duration expireTime, long initValue, long stepValue) {
|
public static String nextIdStr(String key, Duration expireTime, Long initValue, Long stepValue) {
|
||||||
return String.valueOf(getNextId(key, expireTime, initValue, stepValue));
|
return String.valueOf(nextId(key, expireTime, initValue, stepValue));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取指定业务key的唯一id (ID初始值=1,ID步长=1)
|
||||||
|
*
|
||||||
|
* @param key 业务key
|
||||||
|
* @param expireTime 过期时间
|
||||||
|
* @return 唯一id
|
||||||
|
*/
|
||||||
|
public static long nextId(String key, Duration expireTime) {
|
||||||
|
return getIdGenerator(key, expireTime, DEFAULT_INIT_VALUE, DEFAULT_STEP_VALUE).nextId();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -129,8 +113,8 @@ public class SequenceUtils {
|
|||||||
* @param expireTime 过期时间
|
* @param expireTime 过期时间
|
||||||
* @return 唯一id
|
* @return 唯一id
|
||||||
*/
|
*/
|
||||||
public static String getNextIdString(String key, Duration expireTime) {
|
public static String nextIdStr(String key, Duration expireTime) {
|
||||||
return String.valueOf(getNextId(key, expireTime));
|
return String.valueOf(nextId(key, expireTime));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -141,210 +125,56 @@ public class SequenceUtils {
|
|||||||
* @param width 位数,不足左补0
|
* @param width 位数,不足左补0
|
||||||
* @return 补零后的唯一id字符串
|
* @return 补零后的唯一id字符串
|
||||||
*/
|
*/
|
||||||
public static String getPaddedNextIdString(String key, Duration expireTime, Integer width) {
|
public static String nextPaddedIdStr(String key, Duration expireTime, Integer width) {
|
||||||
return StringUtils.leftPad(getNextIdString(key, expireTime), width, '0');
|
return StringUtils.leftPad(nextIdStr(key, expireTime), width, '0');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取 yyyyMMdd 格式的唯一id
|
* 获取 yyyyMMdd 开头的唯一id
|
||||||
*
|
*
|
||||||
* @return 唯一id
|
* @return 唯一id
|
||||||
* @deprecated 请使用 {@link #getDateId(String)} 或 {@link #getDateId(String, boolean)}、{@link #getDateId(String, boolean, int)},确保不同业务的ID连续性
|
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
public static String nextIdDate() {
|
||||||
public static String getDateId() {
|
return nextIdDate("");
|
||||||
return getDateId("");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取 prefix + yyyyMMdd 格式的唯一id
|
* 获取 prefix + yyyyMMdd 开头的唯一id
|
||||||
*
|
*
|
||||||
* @param prefix 业务前缀
|
* @param prefix 业务前缀
|
||||||
* @return 唯一id
|
* @return 唯一id
|
||||||
*/
|
*/
|
||||||
public static String getDateId(String prefix) {
|
public static String nextIdDate(String prefix) {
|
||||||
return getDateId(prefix, true);
|
// 前缀+日期 构建 prefixKey
|
||||||
|
String prefixKey = StringUtils.format("{}{}", StringUtils.blankToDefault(prefix, ""), DateUtil.format(DateUtil.date(), DatePattern.PURE_DATE_FORMATTER));
|
||||||
|
// 获取下一个id
|
||||||
|
long nextId = getIdGenerator(prefixKey, DEFAULT_EXPIRE_TIME_DAY, DEFAULT_INIT_VALUE, DEFAULT_STEP_VALUE).nextId();
|
||||||
|
// 返回完整id
|
||||||
|
return StringUtils.format("{}{}", prefixKey, nextId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取 prefix + yyyyMMdd 格式的唯一id
|
* 获取 yyyyMMddHHmmss 开头的唯一id
|
||||||
*
|
|
||||||
* @param prefix 业务前缀
|
|
||||||
* @param isWithPrefix id是否携带业务前缀
|
|
||||||
* @return 唯一id
|
|
||||||
*/
|
|
||||||
public static String getDateId(String prefix, boolean isWithPrefix) {
|
|
||||||
return getDateId(prefix, isWithPrefix, -1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取 prefix + yyyyMMdd 格式的唯一id (启用ID补位,补位长度 = {@link #DEFAULT_MIN_ID_CAPACITY_BITS})})
|
|
||||||
*
|
|
||||||
* @param prefix 业务前缀
|
|
||||||
* @param isWithPrefix id是否携带业务前缀
|
|
||||||
* @return 唯一id
|
|
||||||
*/
|
|
||||||
public static String getPaddedDateId(String prefix, boolean isWithPrefix) {
|
|
||||||
return getDateId(prefix, isWithPrefix, DEFAULT_MIN_ID_CAPACITY_BITS);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取 prefix + yyyyMMdd 格式的唯一id
|
|
||||||
*
|
|
||||||
* @param prefix 业务前缀
|
|
||||||
* @param isWithPrefix id是否携带业务前缀
|
|
||||||
* @param minIdCapacityBits 最小ID容量位数,小于该位数的ID,左补0(小于等于0表示不启用补位)
|
|
||||||
* @return 唯一id
|
|
||||||
*/
|
|
||||||
public static String getDateId(String prefix, boolean isWithPrefix, int minIdCapacityBits) {
|
|
||||||
return getDateId(prefix, isWithPrefix, minIdCapacityBits, LocalDate.now());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取 prefix + yyyyMMdd 格式的唯一id
|
|
||||||
*
|
|
||||||
* @param prefix 业务前缀
|
|
||||||
* @param isWithPrefix id是否携带业务前缀
|
|
||||||
* @param minIdCapacityBits 最小ID容量位数,小于该位数的ID,左补0(小于等于0表示不启用补位)
|
|
||||||
* @param time 时间
|
|
||||||
* @return 唯一id
|
|
||||||
*/
|
|
||||||
public static String getDateId(String prefix, boolean isWithPrefix, int minIdCapacityBits, LocalDate time) {
|
|
||||||
return getDateId(prefix, isWithPrefix, minIdCapacityBits, time, DEFAULT_INIT_VALUE, DEFAULT_STEP_VALUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取 prefix + yyyyMMdd 格式的唯一id
|
|
||||||
*
|
|
||||||
* @param prefix 业务前缀
|
|
||||||
* @param isWithPrefix id是否携带业务前缀
|
|
||||||
* @param minIdCapacityBits 最小ID容量位数,小于该位数的ID,左补0(小于等于0表示不启用补位)
|
|
||||||
* @param time 时间
|
|
||||||
* @param initValue ID初始值
|
|
||||||
* @param stepValue ID步长
|
|
||||||
* @return 唯一id
|
|
||||||
*/
|
|
||||||
public static String getDateId(String prefix, boolean isWithPrefix, int minIdCapacityBits, LocalDate time, long initValue, long stepValue) {
|
|
||||||
return getDatePatternId(prefix, isWithPrefix, minIdCapacityBits, time, DatePattern.PURE_DATE_FORMATTER, DEFAULT_EXPIRE_TIME_DAY, initValue, stepValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取 yyyyMMddHHmmss 格式的唯一id
|
|
||||||
*
|
*
|
||||||
* @return 唯一id
|
* @return 唯一id
|
||||||
* @deprecated 请使用 {@link #getDateTimeId(String)} 或 {@link #getDateTimeId(String, boolean)}、{@link #getDateTimeId(String, boolean, int)},确保不同业务的ID连续性
|
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
public static String nextIdDateTime() {
|
||||||
public static String getDateTimeId() {
|
return nextIdDateTime("");
|
||||||
return getDateTimeId("", false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取 prefix + yyyyMMddHHmmss 格式的唯一id
|
* 获取 prefix + yyyyMMddHHmmss 开头的唯一id
|
||||||
*
|
*
|
||||||
* @param prefix 业务前缀
|
* @param prefix 业务前缀
|
||||||
* @return 唯一id
|
* @return 唯一id
|
||||||
*/
|
*/
|
||||||
public static String getDateTimeId(String prefix) {
|
public static String nextIdDateTime(String prefix) {
|
||||||
return getDateTimeId(prefix, true);
|
// 前缀+日期时间 构建 prefixKey
|
||||||
|
String prefixKey = StringUtils.format("{}{}", StringUtils.blankToDefault(prefix, ""), DateUtil.format(DateUtil.date(), DatePattern.PURE_DATETIME_FORMATTER));
|
||||||
|
// 获取下一个id
|
||||||
|
long nextId = getIdGenerator(prefixKey, DEFAULT_EXPIRE_TIME_MINUTE, DEFAULT_INIT_VALUE, DEFAULT_STEP_VALUE).nextId();
|
||||||
|
// 返回完整id
|
||||||
|
return StringUtils.format("{}{}", prefixKey, nextId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取 prefix + yyyyMMddHHmmss 格式的唯一id
|
|
||||||
*
|
|
||||||
* @param prefix 业务前缀
|
|
||||||
* @param isWithPrefix id是否携带业务前缀
|
|
||||||
* @return 唯一id
|
|
||||||
*/
|
|
||||||
public static String getDateTimeId(String prefix, boolean isWithPrefix) {
|
|
||||||
return getDateTimeId(prefix, isWithPrefix, -1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取 prefix + yyyyMMddHHmmss 格式的唯一id (启用ID补位,补位长度 = {@link #DEFAULT_MIN_ID_CAPACITY_BITS})})
|
|
||||||
*
|
|
||||||
* @param prefix 业务前缀
|
|
||||||
* @param isWithPrefix id是否携带业务前缀
|
|
||||||
* @return 唯一id
|
|
||||||
*/
|
|
||||||
public static String getPaddedDateTimeId(String prefix, boolean isWithPrefix) {
|
|
||||||
return getDateTimeId(prefix, isWithPrefix, DEFAULT_MIN_ID_CAPACITY_BITS);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取 prefix + yyyyMMddHHmmss 格式的唯一id
|
|
||||||
*
|
|
||||||
* @param prefix 业务前缀
|
|
||||||
* @param isWithPrefix id是否携带业务前缀
|
|
||||||
* @param minIdCapacityBits 最小ID容量位数,小于该位数的ID,左补0(小于等于0表示不启用补位)
|
|
||||||
* @return 唯一id
|
|
||||||
*/
|
|
||||||
public static String getDateTimeId(String prefix, boolean isWithPrefix, int minIdCapacityBits) {
|
|
||||||
return getDateTimeId(prefix, isWithPrefix, minIdCapacityBits, LocalDateTime.now());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取 prefix + yyyyMMddHHmmss 格式的唯一id
|
|
||||||
*
|
|
||||||
* @param prefix 业务前缀
|
|
||||||
* @param isWithPrefix id是否携带业务前缀
|
|
||||||
* @param minIdCapacityBits 最小ID容量位数,小于该位数的ID,左补0(小于等于0表示不启用补位)
|
|
||||||
* @param time 时间
|
|
||||||
* @return 唯一id
|
|
||||||
*/
|
|
||||||
public static String getDateTimeId(String prefix, boolean isWithPrefix, int minIdCapacityBits, LocalDateTime time) {
|
|
||||||
return getDateTimeId(prefix, isWithPrefix, minIdCapacityBits, time, DEFAULT_INIT_VALUE, DEFAULT_STEP_VALUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取 prefix + yyyyMMddHHmmss 格式的唯一id
|
|
||||||
*
|
|
||||||
* @param prefix 业务前缀
|
|
||||||
* @param isWithPrefix id是否携带业务前缀
|
|
||||||
* @param minIdCapacityBits 最小ID容量位数,小于该位数的ID,左补0(小于等于0表示不启用补位)
|
|
||||||
* @param initValue ID初始值
|
|
||||||
* @param stepValue ID步长
|
|
||||||
* @return 唯一id
|
|
||||||
*/
|
|
||||||
public static String getDateTimeId(String prefix, boolean isWithPrefix, int minIdCapacityBits, LocalDateTime time, long initValue, long stepValue) {
|
|
||||||
return getDatePatternId(prefix, isWithPrefix, minIdCapacityBits, time, DatePattern.PURE_DATETIME_FORMATTER, DEFAULT_EXPIRE_TIME_MINUTE, initValue, stepValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取指定业务key的指定时间格式的ID
|
|
||||||
*
|
|
||||||
* @param prefix 业务前缀
|
|
||||||
* @param isWithPrefix id是否携带业务前缀
|
|
||||||
* @param minIdCapacityBits 最小ID容量位数,小于该位数的ID,左补0(小于等于0表示不启用补位)
|
|
||||||
* @param temporalAccessor 时间访问器
|
|
||||||
* @param timeFormatter 时间格式
|
|
||||||
* @param expireTime 过期时间
|
|
||||||
* @param initValue ID初始值
|
|
||||||
* @param stepValue ID步长
|
|
||||||
* @return 唯一id
|
|
||||||
*/
|
|
||||||
private static String getDatePatternId(String prefix, boolean isWithPrefix, int minIdCapacityBits, TemporalAccessor temporalAccessor, DateTimeFormatter timeFormatter, Duration expireTime, long initValue, long stepValue) {
|
|
||||||
// 时间前缀
|
|
||||||
String timePrefix = timeFormatter.format(temporalAccessor);
|
|
||||||
// 业务前缀 + 时间前缀 构建 prefixKey
|
|
||||||
String prefixKey = StringUtils.format("{}{}", StringUtils.blankToDefault(prefix, ""), timePrefix);
|
|
||||||
|
|
||||||
// 获取id,例 -> 1
|
|
||||||
String nextId = getNextIdString(prefixKey, expireTime, initValue, stepValue);
|
|
||||||
|
|
||||||
// minIdCapacityBits 大于0,且 nextId 的长度小于 minIdCapacityBits,则左补0
|
|
||||||
if (minIdCapacityBits > 0 && nextId.length() < minIdCapacityBits) {
|
|
||||||
nextId = StringUtils.leftPad(nextId, minIdCapacityBits, '0');
|
|
||||||
}
|
|
||||||
|
|
||||||
// 是否携带业务前缀
|
|
||||||
if (isWithPrefix) {
|
|
||||||
// 例 -> P202507031
|
|
||||||
// 其中 P 为业务前缀,202507031 为 yyyyMMdd 格式时间, 1 为nextId
|
|
||||||
return StringUtils.format("{}{}", prefixKey, nextId);
|
|
||||||
}
|
|
||||||
// 例 -> 202507031
|
|
||||||
// 其中 202507031 为 yyyyMMdd 格式时间, 1 为nextId
|
|
||||||
return StringUtils.format("{}{}", timePrefix, nextId);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,7 +53,11 @@ public class PlusSaTokenDao implements SaTokenDaoBySessionFollowObject {
|
|||||||
if (timeout == NEVER_EXPIRE) {
|
if (timeout == NEVER_EXPIRE) {
|
||||||
RedisUtils.setCacheObject(key, value);
|
RedisUtils.setCacheObject(key, value);
|
||||||
} else {
|
} else {
|
||||||
RedisUtils.setCacheObject(key, value, Duration.ofSeconds(timeout));
|
if (RedisUtils.hasKey(key)) {
|
||||||
|
RedisUtils.setCacheObject(key, value, true);
|
||||||
|
} else {
|
||||||
|
RedisUtils.setCacheObject(key, value, Duration.ofSeconds(timeout));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
CAFFEINE.invalidate(key);
|
CAFFEINE.invalidate(key);
|
||||||
}
|
}
|
||||||
@@ -130,7 +134,11 @@ public class PlusSaTokenDao implements SaTokenDaoBySessionFollowObject {
|
|||||||
if (timeout == NEVER_EXPIRE) {
|
if (timeout == NEVER_EXPIRE) {
|
||||||
RedisUtils.setCacheObject(key, object);
|
RedisUtils.setCacheObject(key, object);
|
||||||
} else {
|
} else {
|
||||||
RedisUtils.setCacheObject(key, object, Duration.ofSeconds(timeout));
|
if (RedisUtils.hasKey(key)) {
|
||||||
|
RedisUtils.setCacheObject(key, object, true);
|
||||||
|
} else {
|
||||||
|
RedisUtils.setCacheObject(key, object, Duration.ofSeconds(timeout));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
CAFFEINE.invalidate(key);
|
CAFFEINE.invalidate(key);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package org.dromara.common.satoken.core.service;
|
package org.dromara.common.satoken.core.service;
|
||||||
|
|
||||||
import cn.dev33.satoken.stp.StpInterface;
|
import cn.dev33.satoken.stp.StpInterface;
|
||||||
import cn.hutool.core.collection.CollUtil;
|
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import org.dromara.common.core.domain.model.LoginUser;
|
import org.dromara.common.core.domain.model.LoginUser;
|
||||||
import org.dromara.common.core.enums.UserType;
|
import org.dromara.common.core.enums.UserType;
|
||||||
@@ -40,12 +39,8 @@ public class SaPermissionImpl implements StpInterface {
|
|||||||
if (userType == UserType.APP_USER) {
|
if (userType == UserType.APP_USER) {
|
||||||
// 其他端 自行根据业务编写
|
// 其他端 自行根据业务编写
|
||||||
}
|
}
|
||||||
if (CollUtil.isNotEmpty(loginUser.getMenuPermission())) {
|
// SYS_USER 默认返回权限
|
||||||
// SYS_USER 默认返回权限
|
return new ArrayList<>(loginUser.getMenuPermission());
|
||||||
return new ArrayList<>(loginUser.getMenuPermission());
|
|
||||||
} else {
|
|
||||||
return new ArrayList<>();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -67,12 +62,8 @@ public class SaPermissionImpl implements StpInterface {
|
|||||||
if (userType == UserType.APP_USER) {
|
if (userType == UserType.APP_USER) {
|
||||||
// 其他端 自行根据业务编写
|
// 其他端 自行根据业务编写
|
||||||
}
|
}
|
||||||
if (CollUtil.isNotEmpty(loginUser.getRolePermission())) {
|
// SYS_USER 默认返回权限
|
||||||
// SYS_USER 默认返回权限
|
return new ArrayList<>(loginUser.getRolePermission());
|
||||||
return new ArrayList<>(loginUser.getRolePermission());
|
|
||||||
} else {
|
|
||||||
return new ArrayList<>();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private PermissionService getPermissionService() {
|
private PermissionService getPermissionService() {
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import lombok.RequiredArgsConstructor;
|
|||||||
import org.dromara.common.core.domain.R;
|
import org.dromara.common.core.domain.R;
|
||||||
import org.dromara.common.satoken.utils.LoginHelper;
|
import org.dromara.common.satoken.utils.LoginHelper;
|
||||||
import org.dromara.common.sse.core.SseEmitterManager;
|
import org.dromara.common.sse.core.SseEmitterManager;
|
||||||
|
import org.dromara.common.sse.dto.SseMessageDto;
|
||||||
import org.springframework.beans.factory.DisposableBean;
|
import org.springframework.beans.factory.DisposableBean;
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
@@ -13,6 +14,8 @@ import org.springframework.web.bind.annotation.GetMapping;
|
|||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
import org.springframework.web.servlet.mvc.method.annotation.SseEmitter;
|
import org.springframework.web.servlet.mvc.method.annotation.SseEmitter;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SSE 控制器
|
* SSE 控制器
|
||||||
*
|
*
|
||||||
@@ -30,9 +33,7 @@ public class SseController implements DisposableBean {
|
|||||||
*/
|
*/
|
||||||
@GetMapping(value = "${sse.path}", produces = MediaType.TEXT_EVENT_STREAM_VALUE)
|
@GetMapping(value = "${sse.path}", produces = MediaType.TEXT_EVENT_STREAM_VALUE)
|
||||||
public SseEmitter connect() {
|
public SseEmitter connect() {
|
||||||
if (!StpUtil.isLogin()) {
|
StpUtil.checkLogin();
|
||||||
return null;
|
|
||||||
}
|
|
||||||
String tokenValue = StpUtil.getTokenValue();
|
String tokenValue = StpUtil.getTokenValue();
|
||||||
Long userId = LoginHelper.getUserId();
|
Long userId = LoginHelper.getUserId();
|
||||||
return sseEmitterManager.connect(userId, tokenValue);
|
return sseEmitterManager.connect(userId, tokenValue);
|
||||||
@@ -50,32 +51,31 @@ public class SseController implements DisposableBean {
|
|||||||
return R.ok();
|
return R.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 以下为demo仅供参考 禁止使用 请在业务逻辑中使用工具发送而不是用接口发送
|
/**
|
||||||
// /**
|
* 向特定用户发送消息
|
||||||
// * 向特定用户发送消息
|
*
|
||||||
// *
|
* @param userId 目标用户的 ID
|
||||||
// * @param userId 目标用户的 ID
|
* @param msg 要发送的消息内容
|
||||||
// * @param msg 要发送的消息内容
|
*/
|
||||||
// */
|
@GetMapping(value = "${sse.path}/send")
|
||||||
// @GetMapping(value = "${sse.path}/send")
|
public R<Void> send(Long userId, String msg) {
|
||||||
// public R<Void> send(Long userId, String msg) {
|
SseMessageDto dto = new SseMessageDto();
|
||||||
// SseMessageDto dto = new SseMessageDto();
|
dto.setUserIds(List.of(userId));
|
||||||
// dto.setUserIds(List.of(userId));
|
dto.setMessage(msg);
|
||||||
// dto.setMessage(msg);
|
sseEmitterManager.publishMessage(dto);
|
||||||
// sseEmitterManager.publishMessage(dto);
|
return R.ok();
|
||||||
// return R.ok();
|
}
|
||||||
// }
|
|
||||||
//
|
/**
|
||||||
// /**
|
* 向所有用户发送消息
|
||||||
// * 向所有用户发送消息
|
*
|
||||||
// *
|
* @param msg 要发送的消息内容
|
||||||
// * @param msg 要发送的消息内容
|
*/
|
||||||
// */
|
@GetMapping(value = "${sse.path}/sendAll")
|
||||||
// @GetMapping(value = "${sse.path}/sendAll")
|
public R<Void> send(String msg) {
|
||||||
// public R<Void> send(String msg) {
|
sseEmitterManager.publishAll(msg);
|
||||||
// sseEmitterManager.publishAll(msg);
|
return R.ok();
|
||||||
// return R.ok();
|
}
|
||||||
// }
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 清理资源。此方法目前不执行任何操作,但避免因未实现而导致错误
|
* 清理资源。此方法目前不执行任何操作,但避免因未实现而导致错误
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package org.dromara.monitor.admin.config;
|
|||||||
import de.codecentric.boot.admin.server.config.AdminServerProperties;
|
import de.codecentric.boot.admin.server.config.AdminServerProperties;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.context.annotation.Scope;
|
|
||||||
import org.springframework.security.config.Customizer;
|
import org.springframework.security.config.Customizer;
|
||||||
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
||||||
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
|
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
|
||||||
@@ -11,8 +10,7 @@ import org.springframework.security.config.annotation.web.configurers.AbstractHt
|
|||||||
import org.springframework.security.config.annotation.web.configurers.HeadersConfigurer;
|
import org.springframework.security.config.annotation.web.configurers.HeadersConfigurer;
|
||||||
import org.springframework.security.web.SecurityFilterChain;
|
import org.springframework.security.web.SecurityFilterChain;
|
||||||
import org.springframework.security.web.authentication.SavedRequestAwareAuthenticationSuccessHandler;
|
import org.springframework.security.web.authentication.SavedRequestAwareAuthenticationSuccessHandler;
|
||||||
import org.springframework.security.web.servlet.util.matcher.MvcRequestMatcher;
|
import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
|
||||||
import org.springframework.web.servlet.handler.HandlerMappingIntrospector;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* admin 监控 安全配置
|
* admin 监控 安全配置
|
||||||
@@ -30,7 +28,7 @@ public class SecurityConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public SecurityFilterChain filterChain(HttpSecurity httpSecurity, MvcRequestMatcher.Builder mvc) throws Exception {
|
public SecurityFilterChain filterChain(HttpSecurity httpSecurity) throws Exception {
|
||||||
SavedRequestAwareAuthenticationSuccessHandler successHandler = new SavedRequestAwareAuthenticationSuccessHandler();
|
SavedRequestAwareAuthenticationSuccessHandler successHandler = new SavedRequestAwareAuthenticationSuccessHandler();
|
||||||
successHandler.setTargetUrlParameter("redirectTo");
|
successHandler.setTargetUrlParameter("redirectTo");
|
||||||
successHandler.setDefaultTargetUrl(adminContextPath + "/");
|
successHandler.setDefaultTargetUrl(adminContextPath + "/");
|
||||||
@@ -40,8 +38,8 @@ public class SecurityConfig {
|
|||||||
header.frameOptions(HeadersConfigurer.FrameOptionsConfig::disable))
|
header.frameOptions(HeadersConfigurer.FrameOptionsConfig::disable))
|
||||||
.authorizeHttpRequests((authorize) ->
|
.authorizeHttpRequests((authorize) ->
|
||||||
authorize.requestMatchers(
|
authorize.requestMatchers(
|
||||||
mvc.pattern(adminContextPath + "/assets/**"),
|
new AntPathRequestMatcher(adminContextPath + "/assets/**"),
|
||||||
mvc.pattern(adminContextPath + "/login")
|
new AntPathRequestMatcher(adminContextPath + "/login")
|
||||||
).permitAll()
|
).permitAll()
|
||||||
.anyRequest().authenticated())
|
.anyRequest().authenticated())
|
||||||
.formLogin((formLogin) ->
|
.formLogin((formLogin) ->
|
||||||
@@ -53,10 +51,4 @@ public class SecurityConfig {
|
|||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Scope("prototype")
|
|
||||||
@Bean
|
|
||||||
public MvcRequestMatcher.Builder mvc(HandlerMappingIntrospector introspector) {
|
|
||||||
return new MvcRequestMatcher.Builder(introspector);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,28 +16,15 @@ spring:
|
|||||||
|
|
||||||
--- # snail-job 服务端配置
|
--- # snail-job 服务端配置
|
||||||
snail-job:
|
snail-job:
|
||||||
# 服务端节点IP(默认按照`NetUtil.getLocalIpStr()`)
|
# 拉取重试数据的每批次的大小
|
||||||
server-host:
|
retry-pull-page-size: 1000
|
||||||
# 服务端netty的端口号
|
# 拉取重试数据的每批次的大小
|
||||||
|
job-pull-page-size: 1000
|
||||||
|
# 服务器端口
|
||||||
server-port: 17888
|
server-port: 17888
|
||||||
# 合并日志默认保存天数
|
# 日志保存时间(单位: day)
|
||||||
merge-Log-days: 1
|
|
||||||
# 合并日志默认的条数
|
|
||||||
merge-Log-num: 500
|
|
||||||
# 配置每批次拉取重试数据的大小
|
|
||||||
retry-pull-page-size: 100
|
|
||||||
# 配置日志保存时间(单位:天)
|
|
||||||
log-storage: 7
|
log-storage: 7
|
||||||
# bucket的总数量
|
|
||||||
bucket-total: 128
|
|
||||||
# Dashboard 任务容错天数
|
|
||||||
summary-day: 7
|
|
||||||
# 配置负载均衡周期时间
|
|
||||||
load-balance-cycle-time: 10
|
|
||||||
# 通知类型默认使用grpc(netty 已经下线)
|
|
||||||
rpc-type: grpc
|
rpc-type: grpc
|
||||||
# 重试任务拉取的并行度
|
|
||||||
retry-max-pull-parallel: 2
|
|
||||||
|
|
||||||
--- # 监控中心配置
|
--- # 监控中心配置
|
||||||
spring.boot.admin.client:
|
spring.boot.admin.client:
|
||||||
|
|||||||
@@ -16,28 +16,15 @@ spring:
|
|||||||
|
|
||||||
--- # snail-job 服务端配置
|
--- # snail-job 服务端配置
|
||||||
snail-job:
|
snail-job:
|
||||||
# 服务端节点IP(默认按照`NetUtil.getLocalIpStr()`)
|
# 拉取重试数据的每批次的大小
|
||||||
server-host:
|
retry-pull-page-size: 1000
|
||||||
# 服务端netty的端口号
|
# 拉取重试数据的每批次的大小
|
||||||
|
job-pull-page-size: 1000
|
||||||
|
# 服务器端口
|
||||||
server-port: 17888
|
server-port: 17888
|
||||||
# 合并日志默认保存天数
|
# 日志保存时间(单位: day)
|
||||||
merge-Log-days: 1
|
|
||||||
# 合并日志默认的条数
|
|
||||||
merge-Log-num: 500
|
|
||||||
# 配置每批次拉取重试数据的大小
|
|
||||||
retry-pull-page-size: 100
|
|
||||||
# 配置日志保存时间(单位:天)
|
|
||||||
log-storage: 7
|
log-storage: 7
|
||||||
# bucket的总数量
|
|
||||||
bucket-total: 128
|
|
||||||
# Dashboard 任务容错天数
|
|
||||||
summary-day: 7
|
|
||||||
# 配置负载均衡周期时间
|
|
||||||
load-balance-cycle-time: 10
|
|
||||||
# 通知类型默认使用grpc(netty 已经下线)
|
|
||||||
rpc-type: grpc
|
rpc-type: grpc
|
||||||
# 重试任务拉取的并行度
|
|
||||||
retry-max-pull-parallel: 2
|
|
||||||
|
|
||||||
--- # 监控中心配置
|
--- # 监控中心配置
|
||||||
spring.boot.admin.client:
|
spring.boot.admin.client:
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package org.dromara.demo.controller;
|
package org.dromara.demo.controller;
|
||||||
|
|
||||||
|
import cn.dev33.satoken.annotation.SaIgnore;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.dromara.common.core.domain.R;
|
import org.dromara.common.core.domain.R;
|
||||||
import org.dromara.common.mail.utils.MailUtils;
|
import org.dromara.common.mail.utils.MailUtils;
|
||||||
@@ -17,11 +18,12 @@ import java.util.Arrays;
|
|||||||
*
|
*
|
||||||
* @author Michelle.Chung
|
* @author Michelle.Chung
|
||||||
*/
|
*/
|
||||||
|
@SaIgnore
|
||||||
@Validated
|
@Validated
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/demo/mail")
|
@RequestMapping("/demo/mail")
|
||||||
public class MailSendController {
|
public class MailController {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 发送邮件
|
* 发送邮件
|
||||||
@@ -42,11 +44,11 @@ public class MailSendController {
|
|||||||
* @param to 接收人
|
* @param to 接收人
|
||||||
* @param subject 标题
|
* @param subject 标题
|
||||||
* @param text 内容
|
* @param text 内容
|
||||||
|
* @param filePath 附件路径
|
||||||
*/
|
*/
|
||||||
@GetMapping("/sendMessageWithAttachment")
|
@GetMapping("/sendMessageWithAttachment")
|
||||||
public R<Void> sendMessageWithAttachment(String to, String subject, String text) {
|
public R<Void> sendMessageWithAttachment(String to, String subject, String text, String filePath) {
|
||||||
// 附件路径 禁止前端传递 有任意读取系统文件风险
|
MailUtils.sendText(to, subject, text, new File(filePath));
|
||||||
MailUtils.sendText(to, subject, text, new File("/xxx/xxx"));
|
|
||||||
return R.ok();
|
return R.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -56,11 +58,10 @@ public class MailSendController {
|
|||||||
* @param to 接收人
|
* @param to 接收人
|
||||||
* @param subject 标题
|
* @param subject 标题
|
||||||
* @param text 内容
|
* @param text 内容
|
||||||
|
* @param paths 附件路径
|
||||||
*/
|
*/
|
||||||
@GetMapping("/sendMessageWithAttachments")
|
@GetMapping("/sendMessageWithAttachments")
|
||||||
public R<Void> sendMessageWithAttachments(String to, String subject, String text) {
|
public R<Void> sendMessageWithAttachments(String to, String subject, String text, String[] paths) {
|
||||||
// 附件路径 禁止前端传递 有任意读取系统文件风险
|
|
||||||
String[] paths = new String[]{"/xxx/xxx", "/xxx/xxx"};
|
|
||||||
File[] array = Arrays.stream(paths).map(File::new).toArray(File[]::new);
|
File[] array = Arrays.stream(paths).map(File::new).toArray(File[]::new);
|
||||||
MailUtils.sendText(to, subject, text, array);
|
MailUtils.sendText(to, subject, text, array);
|
||||||
return R.ok();
|
return R.ok();
|
||||||
@@ -42,11 +42,6 @@
|
|||||||
<artifactId>ruoyi-common-log</artifactId>
|
<artifactId>ruoyi-common-log</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.dromara</groupId>
|
|
||||||
<artifactId>ruoyi-common-idempotent</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!--velocity代码生成使用模板 -->
|
<!--velocity代码生成使用模板 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.velocity</groupId>
|
<groupId>org.apache.velocity</groupId>
|
||||||
|
|||||||
@@ -3,11 +3,9 @@ package org.dromara.generator.controller;
|
|||||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
import cn.hutool.core.convert.Convert;
|
import cn.hutool.core.convert.Convert;
|
||||||
import cn.hutool.core.io.IoUtil;
|
import cn.hutool.core.io.IoUtil;
|
||||||
import com.baomidou.lock.annotation.Lock4j;
|
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.dromara.common.core.domain.R;
|
import org.dromara.common.core.domain.R;
|
||||||
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
|
||||||
import org.dromara.common.log.annotation.Log;
|
import org.dromara.common.log.annotation.Log;
|
||||||
import org.dromara.common.log.enums.BusinessType;
|
import org.dromara.common.log.enums.BusinessType;
|
||||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||||
@@ -52,7 +50,6 @@ public class GenController extends BaseController {
|
|||||||
*
|
*
|
||||||
* @param tableId 表ID
|
* @param tableId 表ID
|
||||||
*/
|
*/
|
||||||
@RepeatSubmit()
|
|
||||||
@SaCheckPermission("tool:gen:query")
|
@SaCheckPermission("tool:gen:query")
|
||||||
@GetMapping(value = "/{tableId}")
|
@GetMapping(value = "/{tableId}")
|
||||||
public R<Map<String, Object>> getInfo(@PathVariable Long tableId) {
|
public R<Map<String, Object>> getInfo(@PathVariable Long tableId) {
|
||||||
@@ -94,7 +91,6 @@ public class GenController extends BaseController {
|
|||||||
*/
|
*/
|
||||||
@SaCheckPermission("tool:gen:import")
|
@SaCheckPermission("tool:gen:import")
|
||||||
@Log(title = "代码生成", businessType = BusinessType.IMPORT)
|
@Log(title = "代码生成", businessType = BusinessType.IMPORT)
|
||||||
@RepeatSubmit()
|
|
||||||
@PostMapping("/importTable")
|
@PostMapping("/importTable")
|
||||||
public R<Void> importTableSave(String tables, String dataName) {
|
public R<Void> importTableSave(String tables, String dataName) {
|
||||||
String[] tableNames = Convert.toStrArray(tables);
|
String[] tableNames = Convert.toStrArray(tables);
|
||||||
@@ -109,7 +105,6 @@ public class GenController extends BaseController {
|
|||||||
*/
|
*/
|
||||||
@SaCheckPermission("tool:gen:edit")
|
@SaCheckPermission("tool:gen:edit")
|
||||||
@Log(title = "代码生成", businessType = BusinessType.UPDATE)
|
@Log(title = "代码生成", businessType = BusinessType.UPDATE)
|
||||||
@RepeatSubmit()
|
|
||||||
@PutMapping
|
@PutMapping
|
||||||
public R<Void> editSave(@Validated @RequestBody GenTable genTable) {
|
public R<Void> editSave(@Validated @RequestBody GenTable genTable) {
|
||||||
genTableService.validateEdit(genTable);
|
genTableService.validateEdit(genTable);
|
||||||
@@ -175,7 +170,6 @@ public class GenController extends BaseController {
|
|||||||
*/
|
*/
|
||||||
@SaCheckPermission("tool:gen:edit")
|
@SaCheckPermission("tool:gen:edit")
|
||||||
@Log(title = "代码生成", businessType = BusinessType.UPDATE)
|
@Log(title = "代码生成", businessType = BusinessType.UPDATE)
|
||||||
@Lock4j
|
|
||||||
@GetMapping("/synchDb/{tableId}")
|
@GetMapping("/synchDb/{tableId}")
|
||||||
public R<Void> synchDb(@PathVariable("tableId") Long tableId) {
|
public R<Void> synchDb(@PathVariable("tableId") Long tableId) {
|
||||||
genTableService.synchDb(tableId);
|
genTableService.synchDb(tableId);
|
||||||
|
|||||||
@@ -302,7 +302,7 @@ public class GenTableServiceImpl implements IGenTableService {
|
|||||||
tableColumn.setColumnComment(column.getComment());
|
tableColumn.setColumnComment(column.getComment());
|
||||||
tableColumn.setColumnType(column.getOriginType().toLowerCase());
|
tableColumn.setColumnType(column.getOriginType().toLowerCase());
|
||||||
tableColumn.setSort(column.getPosition());
|
tableColumn.setSort(column.getPosition());
|
||||||
tableColumn.setIsRequired(column.isNullable() ? "0" : "1");
|
tableColumn.setIsRequired(column.isNullable() ? "1" : "0");
|
||||||
tableColumn.setIsIncrement(column.isAutoIncrement() ? "1" : "0");
|
tableColumn.setIsIncrement(column.isAutoIncrement() ? "1" : "0");
|
||||||
tableColumns.add(tableColumn);
|
tableColumns.add(tableColumn);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,13 +1,11 @@
|
|||||||
package org.dromara.system.controller.monitor;
|
package org.dromara.system.controller.monitor;
|
||||||
|
|
||||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
import com.baomidou.lock.annotation.Lock4j;
|
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.dromara.common.core.constant.CacheConstants;
|
import org.dromara.common.core.constant.CacheConstants;
|
||||||
import org.dromara.common.core.domain.R;
|
import org.dromara.common.core.domain.R;
|
||||||
import org.dromara.common.excel.utils.ExcelUtil;
|
import org.dromara.common.excel.utils.ExcelUtil;
|
||||||
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
|
||||||
import org.dromara.common.log.annotation.Log;
|
import org.dromara.common.log.annotation.Log;
|
||||||
import org.dromara.common.log.enums.BusinessType;
|
import org.dromara.common.log.enums.BusinessType;
|
||||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||||
@@ -71,7 +69,6 @@ public class SysLogininforController extends BaseController {
|
|||||||
*/
|
*/
|
||||||
@SaCheckPermission("monitor:logininfor:remove")
|
@SaCheckPermission("monitor:logininfor:remove")
|
||||||
@Log(title = "登录日志", businessType = BusinessType.CLEAN)
|
@Log(title = "登录日志", businessType = BusinessType.CLEAN)
|
||||||
@Lock4j
|
|
||||||
@DeleteMapping("/clean")
|
@DeleteMapping("/clean")
|
||||||
public R<Void> clean() {
|
public R<Void> clean() {
|
||||||
logininforService.cleanLogininfor();
|
logininforService.cleanLogininfor();
|
||||||
@@ -80,7 +77,6 @@ public class SysLogininforController extends BaseController {
|
|||||||
|
|
||||||
@SaCheckPermission("monitor:logininfor:unlock")
|
@SaCheckPermission("monitor:logininfor:unlock")
|
||||||
@Log(title = "账户解锁", businessType = BusinessType.OTHER)
|
@Log(title = "账户解锁", businessType = BusinessType.OTHER)
|
||||||
@RepeatSubmit()
|
|
||||||
@GetMapping("/unlock/{userName}")
|
@GetMapping("/unlock/{userName}")
|
||||||
public R<Void> unlock(@PathVariable("userName") String userName) {
|
public R<Void> unlock(@PathVariable("userName") String userName) {
|
||||||
String loginName = CacheConstants.PWD_ERR_CNT_KEY + userName;
|
String loginName = CacheConstants.PWD_ERR_CNT_KEY + userName;
|
||||||
|
|||||||
@@ -1,22 +1,21 @@
|
|||||||
package org.dromara.system.controller.monitor;
|
package org.dromara.system.controller.monitor;
|
||||||
|
|
||||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
import com.baomidou.lock.annotation.Lock4j;
|
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import org.dromara.common.core.domain.R;
|
|
||||||
import org.dromara.common.excel.utils.ExcelUtil;
|
|
||||||
import org.dromara.common.log.annotation.Log;
|
import org.dromara.common.log.annotation.Log;
|
||||||
import org.dromara.common.log.enums.BusinessType;
|
|
||||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
|
||||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
|
||||||
import org.dromara.common.web.core.BaseController;
|
import org.dromara.common.web.core.BaseController;
|
||||||
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||||
|
import org.dromara.common.core.domain.R;
|
||||||
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||||
|
import org.dromara.common.log.enums.BusinessType;
|
||||||
|
import org.dromara.common.excel.utils.ExcelUtil;
|
||||||
import org.dromara.system.domain.bo.SysOperLogBo;
|
import org.dromara.system.domain.bo.SysOperLogBo;
|
||||||
import org.dromara.system.domain.vo.SysOperLogVo;
|
import org.dromara.system.domain.vo.SysOperLogVo;
|
||||||
import org.dromara.system.service.ISysOperLogService;
|
import org.dromara.system.service.ISysOperLogService;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -68,7 +67,6 @@ public class SysOperlogController extends BaseController {
|
|||||||
*/
|
*/
|
||||||
@Log(title = "操作日志", businessType = BusinessType.CLEAN)
|
@Log(title = "操作日志", businessType = BusinessType.CLEAN)
|
||||||
@SaCheckPermission("monitor:operlog:remove")
|
@SaCheckPermission("monitor:operlog:remove")
|
||||||
@Lock4j
|
|
||||||
@DeleteMapping("/clean")
|
@DeleteMapping("/clean")
|
||||||
public R<Void> clean() {
|
public R<Void> clean() {
|
||||||
operLogService.cleanOperLog();
|
operLogService.cleanOperLog();
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ import org.dromara.common.core.domain.R;
|
|||||||
import org.dromara.common.core.domain.dto.UserOnlineDTO;
|
import org.dromara.common.core.domain.dto.UserOnlineDTO;
|
||||||
import org.dromara.common.core.utils.StreamUtils;
|
import org.dromara.common.core.utils.StreamUtils;
|
||||||
import org.dromara.common.core.utils.StringUtils;
|
import org.dromara.common.core.utils.StringUtils;
|
||||||
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
|
||||||
import org.dromara.common.log.annotation.Log;
|
import org.dromara.common.log.annotation.Log;
|
||||||
import org.dromara.common.log.enums.BusinessType;
|
import org.dromara.common.log.enums.BusinessType;
|
||||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||||
@@ -82,7 +81,6 @@ public class SysUserOnlineController extends BaseController {
|
|||||||
*/
|
*/
|
||||||
@SaCheckPermission("monitor:online:forceLogout")
|
@SaCheckPermission("monitor:online:forceLogout")
|
||||||
@Log(title = "在线用户", businessType = BusinessType.FORCE)
|
@Log(title = "在线用户", businessType = BusinessType.FORCE)
|
||||||
@RepeatSubmit()
|
|
||||||
@DeleteMapping("/{tokenId}")
|
@DeleteMapping("/{tokenId}")
|
||||||
public R<Void> forceLogout(@PathVariable String tokenId) {
|
public R<Void> forceLogout(@PathVariable String tokenId) {
|
||||||
try {
|
try {
|
||||||
@@ -116,7 +114,6 @@ public class SysUserOnlineController extends BaseController {
|
|||||||
* @param tokenId token值
|
* @param tokenId token值
|
||||||
*/
|
*/
|
||||||
@Log(title = "在线设备", businessType = BusinessType.FORCE)
|
@Log(title = "在线设备", businessType = BusinessType.FORCE)
|
||||||
@RepeatSubmit()
|
|
||||||
@DeleteMapping("/myself/{tokenId}")
|
@DeleteMapping("/myself/{tokenId}")
|
||||||
public R<Void> remove(@PathVariable("tokenId") String tokenId) {
|
public R<Void> remove(@PathVariable("tokenId") String tokenId) {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import jakarta.servlet.http.HttpServletResponse;
|
|||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.dromara.common.core.domain.R;
|
import org.dromara.common.core.domain.R;
|
||||||
import org.dromara.common.excel.utils.ExcelUtil;
|
import org.dromara.common.excel.utils.ExcelUtil;
|
||||||
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
|
||||||
import org.dromara.common.log.annotation.Log;
|
import org.dromara.common.log.annotation.Log;
|
||||||
import org.dromara.common.log.enums.BusinessType;
|
import org.dromara.common.log.enums.BusinessType;
|
||||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||||
@@ -79,7 +78,6 @@ public class SysConfigController extends BaseController {
|
|||||||
*/
|
*/
|
||||||
@SaCheckPermission("system:config:add")
|
@SaCheckPermission("system:config:add")
|
||||||
@Log(title = "参数管理", businessType = BusinessType.INSERT)
|
@Log(title = "参数管理", businessType = BusinessType.INSERT)
|
||||||
@RepeatSubmit()
|
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public R<Void> add(@Validated @RequestBody SysConfigBo config) {
|
public R<Void> add(@Validated @RequestBody SysConfigBo config) {
|
||||||
if (!configService.checkConfigKeyUnique(config)) {
|
if (!configService.checkConfigKeyUnique(config)) {
|
||||||
@@ -94,7 +92,6 @@ public class SysConfigController extends BaseController {
|
|||||||
*/
|
*/
|
||||||
@SaCheckPermission("system:config:edit")
|
@SaCheckPermission("system:config:edit")
|
||||||
@Log(title = "参数管理", businessType = BusinessType.UPDATE)
|
@Log(title = "参数管理", businessType = BusinessType.UPDATE)
|
||||||
@RepeatSubmit()
|
|
||||||
@PutMapping
|
@PutMapping
|
||||||
public R<Void> edit(@Validated @RequestBody SysConfigBo config) {
|
public R<Void> edit(@Validated @RequestBody SysConfigBo config) {
|
||||||
if (!configService.checkConfigKeyUnique(config)) {
|
if (!configService.checkConfigKeyUnique(config)) {
|
||||||
@@ -109,7 +106,6 @@ public class SysConfigController extends BaseController {
|
|||||||
*/
|
*/
|
||||||
@SaCheckPermission("system:config:edit")
|
@SaCheckPermission("system:config:edit")
|
||||||
@Log(title = "参数管理", businessType = BusinessType.UPDATE)
|
@Log(title = "参数管理", businessType = BusinessType.UPDATE)
|
||||||
@RepeatSubmit()
|
|
||||||
@PutMapping("/updateByKey")
|
@PutMapping("/updateByKey")
|
||||||
public R<Void> updateByKey(@RequestBody SysConfigBo config) {
|
public R<Void> updateByKey(@RequestBody SysConfigBo config) {
|
||||||
configService.updateConfig(config);
|
configService.updateConfig(config);
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import lombok.RequiredArgsConstructor;
|
|||||||
import org.dromara.common.core.constant.SystemConstants;
|
import org.dromara.common.core.constant.SystemConstants;
|
||||||
import org.dromara.common.core.domain.R;
|
import org.dromara.common.core.domain.R;
|
||||||
import org.dromara.common.core.utils.StringUtils;
|
import org.dromara.common.core.utils.StringUtils;
|
||||||
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
|
||||||
import org.dromara.common.log.annotation.Log;
|
import org.dromara.common.log.annotation.Log;
|
||||||
import org.dromara.common.log.enums.BusinessType;
|
import org.dromara.common.log.enums.BusinessType;
|
||||||
import org.dromara.common.web.core.BaseController;
|
import org.dromara.common.web.core.BaseController;
|
||||||
@@ -74,7 +73,6 @@ public class SysDeptController extends BaseController {
|
|||||||
*/
|
*/
|
||||||
@SaCheckPermission("system:dept:add")
|
@SaCheckPermission("system:dept:add")
|
||||||
@Log(title = "部门管理", businessType = BusinessType.INSERT)
|
@Log(title = "部门管理", businessType = BusinessType.INSERT)
|
||||||
@RepeatSubmit()
|
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public R<Void> add(@Validated @RequestBody SysDeptBo dept) {
|
public R<Void> add(@Validated @RequestBody SysDeptBo dept) {
|
||||||
if (!deptService.checkDeptNameUnique(dept)) {
|
if (!deptService.checkDeptNameUnique(dept)) {
|
||||||
@@ -88,7 +86,6 @@ public class SysDeptController extends BaseController {
|
|||||||
*/
|
*/
|
||||||
@SaCheckPermission("system:dept:edit")
|
@SaCheckPermission("system:dept:edit")
|
||||||
@Log(title = "部门管理", businessType = BusinessType.UPDATE)
|
@Log(title = "部门管理", businessType = BusinessType.UPDATE)
|
||||||
@RepeatSubmit()
|
|
||||||
@PutMapping
|
@PutMapping
|
||||||
public R<Void> edit(@Validated @RequestBody SysDeptBo dept) {
|
public R<Void> edit(@Validated @RequestBody SysDeptBo dept) {
|
||||||
Long deptId = dept.getDeptId();
|
Long deptId = dept.getDeptId();
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import jakarta.servlet.http.HttpServletResponse;
|
|||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.dromara.common.core.domain.R;
|
import org.dromara.common.core.domain.R;
|
||||||
import org.dromara.common.excel.utils.ExcelUtil;
|
import org.dromara.common.excel.utils.ExcelUtil;
|
||||||
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
|
||||||
import org.dromara.common.log.annotation.Log;
|
import org.dromara.common.log.annotation.Log;
|
||||||
import org.dromara.common.log.enums.BusinessType;
|
import org.dromara.common.log.enums.BusinessType;
|
||||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||||
@@ -87,7 +86,6 @@ public class SysDictDataController extends BaseController {
|
|||||||
*/
|
*/
|
||||||
@SaCheckPermission("system:dict:add")
|
@SaCheckPermission("system:dict:add")
|
||||||
@Log(title = "字典数据", businessType = BusinessType.INSERT)
|
@Log(title = "字典数据", businessType = BusinessType.INSERT)
|
||||||
@RepeatSubmit()
|
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public R<Void> add(@Validated @RequestBody SysDictDataBo dict) {
|
public R<Void> add(@Validated @RequestBody SysDictDataBo dict) {
|
||||||
if (!dictDataService.checkDictDataUnique(dict)) {
|
if (!dictDataService.checkDictDataUnique(dict)) {
|
||||||
@@ -102,7 +100,6 @@ public class SysDictDataController extends BaseController {
|
|||||||
*/
|
*/
|
||||||
@SaCheckPermission("system:dict:edit")
|
@SaCheckPermission("system:dict:edit")
|
||||||
@Log(title = "字典数据", businessType = BusinessType.UPDATE)
|
@Log(title = "字典数据", businessType = BusinessType.UPDATE)
|
||||||
@RepeatSubmit()
|
|
||||||
@PutMapping
|
@PutMapping
|
||||||
public R<Void> edit(@Validated @RequestBody SysDictDataBo dict) {
|
public R<Void> edit(@Validated @RequestBody SysDictDataBo dict) {
|
||||||
if (!dictDataService.checkDictDataUnique(dict)) {
|
if (!dictDataService.checkDictDataUnique(dict)) {
|
||||||
|
|||||||
@@ -1,12 +1,10 @@
|
|||||||
package org.dromara.system.controller.system;
|
package org.dromara.system.controller.system;
|
||||||
|
|
||||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
import com.baomidou.lock.annotation.Lock4j;
|
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.dromara.common.core.domain.R;
|
import org.dromara.common.core.domain.R;
|
||||||
import org.dromara.common.excel.utils.ExcelUtil;
|
import org.dromara.common.excel.utils.ExcelUtil;
|
||||||
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
|
||||||
import org.dromara.common.log.annotation.Log;
|
import org.dromara.common.log.annotation.Log;
|
||||||
import org.dromara.common.log.enums.BusinessType;
|
import org.dromara.common.log.enums.BusinessType;
|
||||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||||
@@ -70,7 +68,6 @@ public class SysDictTypeController extends BaseController {
|
|||||||
*/
|
*/
|
||||||
@SaCheckPermission("system:dict:add")
|
@SaCheckPermission("system:dict:add")
|
||||||
@Log(title = "字典类型", businessType = BusinessType.INSERT)
|
@Log(title = "字典类型", businessType = BusinessType.INSERT)
|
||||||
@RepeatSubmit()
|
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public R<Void> add(@Validated @RequestBody SysDictTypeBo dict) {
|
public R<Void> add(@Validated @RequestBody SysDictTypeBo dict) {
|
||||||
if (!dictTypeService.checkDictTypeUnique(dict)) {
|
if (!dictTypeService.checkDictTypeUnique(dict)) {
|
||||||
@@ -85,7 +82,6 @@ public class SysDictTypeController extends BaseController {
|
|||||||
*/
|
*/
|
||||||
@SaCheckPermission("system:dict:edit")
|
@SaCheckPermission("system:dict:edit")
|
||||||
@Log(title = "字典类型", businessType = BusinessType.UPDATE)
|
@Log(title = "字典类型", businessType = BusinessType.UPDATE)
|
||||||
@RepeatSubmit()
|
|
||||||
@PutMapping
|
@PutMapping
|
||||||
public R<Void> edit(@Validated @RequestBody SysDictTypeBo dict) {
|
public R<Void> edit(@Validated @RequestBody SysDictTypeBo dict) {
|
||||||
if (!dictTypeService.checkDictTypeUnique(dict)) {
|
if (!dictTypeService.checkDictTypeUnique(dict)) {
|
||||||
@@ -113,7 +109,6 @@ public class SysDictTypeController extends BaseController {
|
|||||||
*/
|
*/
|
||||||
@SaCheckPermission("system:dict:remove")
|
@SaCheckPermission("system:dict:remove")
|
||||||
@Log(title = "字典类型", businessType = BusinessType.CLEAN)
|
@Log(title = "字典类型", businessType = BusinessType.CLEAN)
|
||||||
@Lock4j
|
|
||||||
@DeleteMapping("/refreshCache")
|
@DeleteMapping("/refreshCache")
|
||||||
public R<Void> refreshCache() {
|
public R<Void> refreshCache() {
|
||||||
dictTypeService.resetDictCache();
|
dictTypeService.resetDictCache();
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import org.dromara.common.core.constant.SystemConstants;
|
|||||||
import org.dromara.common.core.constant.TenantConstants;
|
import org.dromara.common.core.constant.TenantConstants;
|
||||||
import org.dromara.common.core.domain.R;
|
import org.dromara.common.core.domain.R;
|
||||||
import org.dromara.common.core.utils.StringUtils;
|
import org.dromara.common.core.utils.StringUtils;
|
||||||
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
|
||||||
import org.dromara.common.log.annotation.Log;
|
import org.dromara.common.log.annotation.Log;
|
||||||
import org.dromara.common.log.enums.BusinessType;
|
import org.dromara.common.log.enums.BusinessType;
|
||||||
import org.dromara.common.satoken.utils.LoginHelper;
|
import org.dromara.common.satoken.utils.LoginHelper;
|
||||||
@@ -130,7 +129,6 @@ public class SysMenuController extends BaseController {
|
|||||||
@SaCheckRole(TenantConstants.SUPER_ADMIN_ROLE_KEY)
|
@SaCheckRole(TenantConstants.SUPER_ADMIN_ROLE_KEY)
|
||||||
@SaCheckPermission("system:menu:add")
|
@SaCheckPermission("system:menu:add")
|
||||||
@Log(title = "菜单管理", businessType = BusinessType.INSERT)
|
@Log(title = "菜单管理", businessType = BusinessType.INSERT)
|
||||||
@RepeatSubmit()
|
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public R<Void> add(@Validated @RequestBody SysMenuBo menu) {
|
public R<Void> add(@Validated @RequestBody SysMenuBo menu) {
|
||||||
if (!menuService.checkMenuNameUnique(menu)) {
|
if (!menuService.checkMenuNameUnique(menu)) {
|
||||||
@@ -147,7 +145,6 @@ public class SysMenuController extends BaseController {
|
|||||||
@SaCheckRole(TenantConstants.SUPER_ADMIN_ROLE_KEY)
|
@SaCheckRole(TenantConstants.SUPER_ADMIN_ROLE_KEY)
|
||||||
@SaCheckPermission("system:menu:edit")
|
@SaCheckPermission("system:menu:edit")
|
||||||
@Log(title = "菜单管理", businessType = BusinessType.UPDATE)
|
@Log(title = "菜单管理", businessType = BusinessType.UPDATE)
|
||||||
@RepeatSubmit()
|
|
||||||
@PutMapping
|
@PutMapping
|
||||||
public R<Void> edit(@Validated @RequestBody SysMenuBo menu) {
|
public R<Void> edit(@Validated @RequestBody SysMenuBo menu) {
|
||||||
if (!menuService.checkMenuNameUnique(menu)) {
|
if (!menuService.checkMenuNameUnique(menu)) {
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import cn.dev33.satoken.annotation.SaCheckPermission;
|
|||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.dromara.common.core.domain.R;
|
import org.dromara.common.core.domain.R;
|
||||||
import org.dromara.common.core.service.DictService;
|
import org.dromara.common.core.service.DictService;
|
||||||
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
|
||||||
import org.dromara.common.log.annotation.Log;
|
import org.dromara.common.log.annotation.Log;
|
||||||
import org.dromara.common.log.enums.BusinessType;
|
import org.dromara.common.log.enums.BusinessType;
|
||||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||||
@@ -56,7 +55,6 @@ public class SysNoticeController extends BaseController {
|
|||||||
*/
|
*/
|
||||||
@SaCheckPermission("system:notice:add")
|
@SaCheckPermission("system:notice:add")
|
||||||
@Log(title = "通知公告", businessType = BusinessType.INSERT)
|
@Log(title = "通知公告", businessType = BusinessType.INSERT)
|
||||||
@RepeatSubmit()
|
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public R<Void> add(@Validated @RequestBody SysNoticeBo notice) {
|
public R<Void> add(@Validated @RequestBody SysNoticeBo notice) {
|
||||||
int rows = noticeService.insertNotice(notice);
|
int rows = noticeService.insertNotice(notice);
|
||||||
@@ -73,7 +71,6 @@ public class SysNoticeController extends BaseController {
|
|||||||
*/
|
*/
|
||||||
@SaCheckPermission("system:notice:edit")
|
@SaCheckPermission("system:notice:edit")
|
||||||
@Log(title = "通知公告", businessType = BusinessType.UPDATE)
|
@Log(title = "通知公告", businessType = BusinessType.UPDATE)
|
||||||
@RepeatSubmit()
|
|
||||||
@PutMapping
|
@PutMapping
|
||||||
public R<Void> edit(@Validated @RequestBody SysNoticeBo notice) {
|
public R<Void> edit(@Validated @RequestBody SysNoticeBo notice) {
|
||||||
return toAjax(noticeService.updateNotice(notice));
|
return toAjax(noticeService.updateNotice(notice));
|
||||||
|
|||||||
@@ -98,7 +98,6 @@ public class SysOssConfigController extends BaseController {
|
|||||||
*/
|
*/
|
||||||
@SaCheckPermission("system:ossConfig:edit")
|
@SaCheckPermission("system:ossConfig:edit")
|
||||||
@Log(title = "对象存储状态修改", businessType = BusinessType.UPDATE)
|
@Log(title = "对象存储状态修改", businessType = BusinessType.UPDATE)
|
||||||
@RepeatSubmit()
|
|
||||||
@PutMapping("/changeStatus")
|
@PutMapping("/changeStatus")
|
||||||
public R<Void> changeStatus(@RequestBody SysOssConfigBo bo) {
|
public R<Void> changeStatus(@RequestBody SysOssConfigBo bo) {
|
||||||
return toAjax(ossConfigService.updateOssConfigStatus(bo));
|
return toAjax(ossConfigService.updateOssConfigStatus(bo));
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import lombok.RequiredArgsConstructor;
|
|||||||
import org.dromara.common.core.constant.SystemConstants;
|
import org.dromara.common.core.constant.SystemConstants;
|
||||||
import org.dromara.common.core.domain.R;
|
import org.dromara.common.core.domain.R;
|
||||||
import org.dromara.common.excel.utils.ExcelUtil;
|
import org.dromara.common.excel.utils.ExcelUtil;
|
||||||
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
|
||||||
import org.dromara.common.log.annotation.Log;
|
import org.dromara.common.log.annotation.Log;
|
||||||
import org.dromara.common.log.enums.BusinessType;
|
import org.dromara.common.log.enums.BusinessType;
|
||||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||||
@@ -20,7 +19,6 @@ import org.springframework.validation.annotation.Validated;
|
|||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -72,7 +70,6 @@ public class SysPostController extends BaseController {
|
|||||||
*/
|
*/
|
||||||
@SaCheckPermission("system:post:add")
|
@SaCheckPermission("system:post:add")
|
||||||
@Log(title = "岗位管理", businessType = BusinessType.INSERT)
|
@Log(title = "岗位管理", businessType = BusinessType.INSERT)
|
||||||
@RepeatSubmit()
|
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public R<Void> add(@Validated @RequestBody SysPostBo post) {
|
public R<Void> add(@Validated @RequestBody SysPostBo post) {
|
||||||
if (!postService.checkPostNameUnique(post)) {
|
if (!postService.checkPostNameUnique(post)) {
|
||||||
@@ -88,7 +85,6 @@ public class SysPostController extends BaseController {
|
|||||||
*/
|
*/
|
||||||
@SaCheckPermission("system:post:edit")
|
@SaCheckPermission("system:post:edit")
|
||||||
@Log(title = "岗位管理", businessType = BusinessType.UPDATE)
|
@Log(title = "岗位管理", businessType = BusinessType.UPDATE)
|
||||||
@RepeatSubmit()
|
|
||||||
@PutMapping
|
@PutMapping
|
||||||
public R<Void> edit(@Validated @RequestBody SysPostBo post) {
|
public R<Void> edit(@Validated @RequestBody SysPostBo post) {
|
||||||
if (!postService.checkPostNameUnique(post)) {
|
if (!postService.checkPostNameUnique(post)) {
|
||||||
@@ -111,7 +107,7 @@ public class SysPostController extends BaseController {
|
|||||||
@Log(title = "岗位管理", businessType = BusinessType.DELETE)
|
@Log(title = "岗位管理", businessType = BusinessType.DELETE)
|
||||||
@DeleteMapping("/{postIds}")
|
@DeleteMapping("/{postIds}")
|
||||||
public R<Void> remove(@PathVariable Long[] postIds) {
|
public R<Void> remove(@PathVariable Long[] postIds) {
|
||||||
return toAjax(postService.deletePostByIds(Arrays.asList(postIds)));
|
return toAjax(postService.deletePostByIds(postIds));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ import org.dromara.common.web.core.BaseController;
|
|||||||
import org.dromara.system.domain.bo.SysUserBo;
|
import org.dromara.system.domain.bo.SysUserBo;
|
||||||
import org.dromara.system.domain.bo.SysUserPasswordBo;
|
import org.dromara.system.domain.bo.SysUserPasswordBo;
|
||||||
import org.dromara.system.domain.bo.SysUserProfileBo;
|
import org.dromara.system.domain.bo.SysUserProfileBo;
|
||||||
import org.dromara.system.domain.vo.ProfileUserVo;
|
|
||||||
import org.dromara.system.domain.vo.SysOssVo;
|
import org.dromara.system.domain.vo.SysOssVo;
|
||||||
import org.dromara.system.domain.vo.SysUserVo;
|
import org.dromara.system.domain.vo.SysUserVo;
|
||||||
import org.dromara.system.service.ISysOssService;
|
import org.dromara.system.service.ISysOssService;
|
||||||
@@ -51,9 +50,7 @@ public class SysProfileController extends BaseController {
|
|||||||
SysUserVo user = userService.selectUserById(LoginHelper.getUserId());
|
SysUserVo user = userService.selectUserById(LoginHelper.getUserId());
|
||||||
String roleGroup = userService.selectUserRoleGroup(user.getUserId());
|
String roleGroup = userService.selectUserRoleGroup(user.getUserId());
|
||||||
String postGroup = userService.selectUserPostGroup(user.getUserId());
|
String postGroup = userService.selectUserPostGroup(user.getUserId());
|
||||||
// 单独做一个vo专门给个人中心用 避免数据被脱敏
|
ProfileVo profileVo = new ProfileVo(user, roleGroup, postGroup);
|
||||||
ProfileUserVo profileUser = BeanUtil.toBean(user, ProfileUserVo.class);
|
|
||||||
ProfileVo profileVo = new ProfileVo(profileUser, roleGroup, postGroup);
|
|
||||||
return R.ok(profileVo);
|
return R.ok(profileVo);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -131,6 +128,6 @@ public class SysProfileController extends BaseController {
|
|||||||
|
|
||||||
public record AvatarVo(String imgUrl) {}
|
public record AvatarVo(String imgUrl) {}
|
||||||
|
|
||||||
public record ProfileVo(ProfileUserVo user, String roleGroup, String postGroup) {}
|
public record ProfileVo(SysUserVo user, String roleGroup, String postGroup) {}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import jakarta.servlet.http.HttpServletResponse;
|
|||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.dromara.common.core.domain.R;
|
import org.dromara.common.core.domain.R;
|
||||||
import org.dromara.common.excel.utils.ExcelUtil;
|
import org.dromara.common.excel.utils.ExcelUtil;
|
||||||
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
|
||||||
import org.dromara.common.log.annotation.Log;
|
import org.dromara.common.log.annotation.Log;
|
||||||
import org.dromara.common.log.enums.BusinessType;
|
import org.dromara.common.log.enums.BusinessType;
|
||||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||||
@@ -78,7 +77,6 @@ public class SysRoleController extends BaseController {
|
|||||||
*/
|
*/
|
||||||
@SaCheckPermission("system:role:add")
|
@SaCheckPermission("system:role:add")
|
||||||
@Log(title = "角色管理", businessType = BusinessType.INSERT)
|
@Log(title = "角色管理", businessType = BusinessType.INSERT)
|
||||||
@RepeatSubmit()
|
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public R<Void> add(@Validated @RequestBody SysRoleBo role) {
|
public R<Void> add(@Validated @RequestBody SysRoleBo role) {
|
||||||
roleService.checkRoleAllowed(role);
|
roleService.checkRoleAllowed(role);
|
||||||
@@ -96,7 +94,6 @@ public class SysRoleController extends BaseController {
|
|||||||
*/
|
*/
|
||||||
@SaCheckPermission("system:role:edit")
|
@SaCheckPermission("system:role:edit")
|
||||||
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
|
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
|
||||||
@RepeatSubmit()
|
|
||||||
@PutMapping
|
@PutMapping
|
||||||
public R<Void> edit(@Validated @RequestBody SysRoleBo role) {
|
public R<Void> edit(@Validated @RequestBody SysRoleBo role) {
|
||||||
roleService.checkRoleAllowed(role);
|
roleService.checkRoleAllowed(role);
|
||||||
@@ -119,7 +116,6 @@ public class SysRoleController extends BaseController {
|
|||||||
*/
|
*/
|
||||||
@SaCheckPermission("system:role:edit")
|
@SaCheckPermission("system:role:edit")
|
||||||
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
|
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
|
||||||
@RepeatSubmit()
|
|
||||||
@PutMapping("/dataScope")
|
@PutMapping("/dataScope")
|
||||||
public R<Void> dataScope(@RequestBody SysRoleBo role) {
|
public R<Void> dataScope(@RequestBody SysRoleBo role) {
|
||||||
roleService.checkRoleAllowed(role);
|
roleService.checkRoleAllowed(role);
|
||||||
@@ -132,7 +128,6 @@ public class SysRoleController extends BaseController {
|
|||||||
*/
|
*/
|
||||||
@SaCheckPermission("system:role:edit")
|
@SaCheckPermission("system:role:edit")
|
||||||
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
|
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
|
||||||
@RepeatSubmit()
|
|
||||||
@PutMapping("/changeStatus")
|
@PutMapping("/changeStatus")
|
||||||
public R<Void> changeStatus(@RequestBody SysRoleBo role) {
|
public R<Void> changeStatus(@RequestBody SysRoleBo role) {
|
||||||
roleService.checkRoleAllowed(role);
|
roleService.checkRoleAllowed(role);
|
||||||
@@ -149,7 +144,7 @@ public class SysRoleController extends BaseController {
|
|||||||
@Log(title = "角色管理", businessType = BusinessType.DELETE)
|
@Log(title = "角色管理", businessType = BusinessType.DELETE)
|
||||||
@DeleteMapping("/{roleIds}")
|
@DeleteMapping("/{roleIds}")
|
||||||
public R<Void> remove(@PathVariable Long[] roleIds) {
|
public R<Void> remove(@PathVariable Long[] roleIds) {
|
||||||
return toAjax(roleService.deleteRoleByIds(List.of(roleIds)));
|
return toAjax(roleService.deleteRoleByIds(roleIds));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -186,7 +181,6 @@ public class SysRoleController extends BaseController {
|
|||||||
*/
|
*/
|
||||||
@SaCheckPermission("system:role:edit")
|
@SaCheckPermission("system:role:edit")
|
||||||
@Log(title = "角色管理", businessType = BusinessType.GRANT)
|
@Log(title = "角色管理", businessType = BusinessType.GRANT)
|
||||||
@RepeatSubmit()
|
|
||||||
@PutMapping("/authUser/cancel")
|
@PutMapping("/authUser/cancel")
|
||||||
public R<Void> cancelAuthUser(@RequestBody SysUserRole userRole) {
|
public R<Void> cancelAuthUser(@RequestBody SysUserRole userRole) {
|
||||||
return toAjax(roleService.deleteAuthUser(userRole));
|
return toAjax(roleService.deleteAuthUser(userRole));
|
||||||
@@ -200,7 +194,6 @@ public class SysRoleController extends BaseController {
|
|||||||
*/
|
*/
|
||||||
@SaCheckPermission("system:role:edit")
|
@SaCheckPermission("system:role:edit")
|
||||||
@Log(title = "角色管理", businessType = BusinessType.GRANT)
|
@Log(title = "角色管理", businessType = BusinessType.GRANT)
|
||||||
@RepeatSubmit()
|
|
||||||
@PutMapping("/authUser/cancelAll")
|
@PutMapping("/authUser/cancelAll")
|
||||||
public R<Void> cancelAuthUserAll(Long roleId, Long[] userIds) {
|
public R<Void> cancelAuthUserAll(Long roleId, Long[] userIds) {
|
||||||
return toAjax(roleService.deleteAuthUsers(roleId, userIds));
|
return toAjax(roleService.deleteAuthUsers(roleId, userIds));
|
||||||
@@ -214,7 +207,6 @@ public class SysRoleController extends BaseController {
|
|||||||
*/
|
*/
|
||||||
@SaCheckPermission("system:role:edit")
|
@SaCheckPermission("system:role:edit")
|
||||||
@Log(title = "角色管理", businessType = BusinessType.GRANT)
|
@Log(title = "角色管理", businessType = BusinessType.GRANT)
|
||||||
@RepeatSubmit()
|
|
||||||
@PutMapping("/authUser/selectAll")
|
@PutMapping("/authUser/selectAll")
|
||||||
public R<Void> selectAuthUserAll(Long roleId, Long[] userIds) {
|
public R<Void> selectAuthUserAll(Long roleId, Long[] userIds) {
|
||||||
roleService.checkRoleDataScope(roleId);
|
roleService.checkRoleDataScope(roleId);
|
||||||
|
|||||||
@@ -118,7 +118,6 @@ public class SysTenantController extends BaseController {
|
|||||||
@SaCheckRole(TenantConstants.SUPER_ADMIN_ROLE_KEY)
|
@SaCheckRole(TenantConstants.SUPER_ADMIN_ROLE_KEY)
|
||||||
@SaCheckPermission("system:tenant:edit")
|
@SaCheckPermission("system:tenant:edit")
|
||||||
@Log(title = "租户管理", businessType = BusinessType.UPDATE)
|
@Log(title = "租户管理", businessType = BusinessType.UPDATE)
|
||||||
@RepeatSubmit()
|
|
||||||
@PutMapping("/changeStatus")
|
@PutMapping("/changeStatus")
|
||||||
public R<Void> changeStatus(@RequestBody SysTenantBo bo) {
|
public R<Void> changeStatus(@RequestBody SysTenantBo bo) {
|
||||||
tenantService.checkTenantAllowed(bo.getTenantId());
|
tenantService.checkTenantAllowed(bo.getTenantId());
|
||||||
@@ -171,7 +170,6 @@ public class SysTenantController extends BaseController {
|
|||||||
@SaCheckRole(TenantConstants.SUPER_ADMIN_ROLE_KEY)
|
@SaCheckRole(TenantConstants.SUPER_ADMIN_ROLE_KEY)
|
||||||
@SaCheckPermission("system:tenant:edit")
|
@SaCheckPermission("system:tenant:edit")
|
||||||
@Log(title = "租户管理", businessType = BusinessType.UPDATE)
|
@Log(title = "租户管理", businessType = BusinessType.UPDATE)
|
||||||
@Lock4j
|
|
||||||
@GetMapping("/syncTenantPackage")
|
@GetMapping("/syncTenantPackage")
|
||||||
public R<Void> syncTenantPackage(@NotBlank(message = "租户ID不能为空") String tenantId,
|
public R<Void> syncTenantPackage(@NotBlank(message = "租户ID不能为空") String tenantId,
|
||||||
@NotNull(message = "套餐ID不能为空") Long packageId) {
|
@NotNull(message = "套餐ID不能为空") Long packageId) {
|
||||||
@@ -183,7 +181,6 @@ public class SysTenantController extends BaseController {
|
|||||||
*/
|
*/
|
||||||
@SaCheckRole(TenantConstants.SUPER_ADMIN_ROLE_KEY)
|
@SaCheckRole(TenantConstants.SUPER_ADMIN_ROLE_KEY)
|
||||||
@Log(title = "租户管理", businessType = BusinessType.INSERT)
|
@Log(title = "租户管理", businessType = BusinessType.INSERT)
|
||||||
@Lock4j
|
|
||||||
@GetMapping("/syncTenantDict")
|
@GetMapping("/syncTenantDict")
|
||||||
public R<Void> syncTenantDict() {
|
public R<Void> syncTenantDict() {
|
||||||
if (!TenantHelper.isEnable()) {
|
if (!TenantHelper.isEnable()) {
|
||||||
|
|||||||
@@ -121,7 +121,6 @@ public class SysTenantPackageController extends BaseController {
|
|||||||
@SaCheckRole(TenantConstants.SUPER_ADMIN_ROLE_KEY)
|
@SaCheckRole(TenantConstants.SUPER_ADMIN_ROLE_KEY)
|
||||||
@SaCheckPermission("system:tenantPackage:edit")
|
@SaCheckPermission("system:tenantPackage:edit")
|
||||||
@Log(title = "租户套餐", businessType = BusinessType.UPDATE)
|
@Log(title = "租户套餐", businessType = BusinessType.UPDATE)
|
||||||
@RepeatSubmit()
|
|
||||||
@PutMapping("/changeStatus")
|
@PutMapping("/changeStatus")
|
||||||
public R<Void> changeStatus(@RequestBody SysTenantPackageBo bo) {
|
public R<Void> changeStatus(@RequestBody SysTenantPackageBo bo) {
|
||||||
return toAjax(tenantPackageService.updatePackageStatus(bo));
|
return toAjax(tenantPackageService.updatePackageStatus(bo));
|
||||||
|
|||||||
@@ -16,12 +16,10 @@ import org.dromara.common.core.utils.StringUtils;
|
|||||||
import org.dromara.common.encrypt.annotation.ApiEncrypt;
|
import org.dromara.common.encrypt.annotation.ApiEncrypt;
|
||||||
import org.dromara.common.excel.core.ExcelResult;
|
import org.dromara.common.excel.core.ExcelResult;
|
||||||
import org.dromara.common.excel.utils.ExcelUtil;
|
import org.dromara.common.excel.utils.ExcelUtil;
|
||||||
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
|
||||||
import org.dromara.common.log.annotation.Log;
|
import org.dromara.common.log.annotation.Log;
|
||||||
import org.dromara.common.log.enums.BusinessType;
|
import org.dromara.common.log.enums.BusinessType;
|
||||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||||
import org.dromara.common.mybatis.helper.DataPermissionHelper;
|
|
||||||
import org.dromara.common.satoken.utils.LoginHelper;
|
import org.dromara.common.satoken.utils.LoginHelper;
|
||||||
import org.dromara.common.tenant.helper.TenantHelper;
|
import org.dromara.common.tenant.helper.TenantHelper;
|
||||||
import org.dromara.common.web.core.BaseController;
|
import org.dromara.common.web.core.BaseController;
|
||||||
@@ -112,8 +110,7 @@ public class SysUserController extends BaseController {
|
|||||||
// 超级管理员 如果重新加载用户信息需清除动态租户
|
// 超级管理员 如果重新加载用户信息需清除动态租户
|
||||||
TenantHelper.clearDynamic();
|
TenantHelper.clearDynamic();
|
||||||
}
|
}
|
||||||
|
SysUserVo user = userService.selectUserById(loginUser.getUserId());
|
||||||
SysUserVo user = DataPermissionHelper.ignore(() -> userService.selectUserById(loginUser.getUserId()));
|
|
||||||
if (ObjectUtil.isNull(user)) {
|
if (ObjectUtil.isNull(user)) {
|
||||||
return R.fail("没有权限访问用户数据!");
|
return R.fail("没有权限访问用户数据!");
|
||||||
}
|
}
|
||||||
@@ -157,7 +154,6 @@ public class SysUserController extends BaseController {
|
|||||||
*/
|
*/
|
||||||
@SaCheckPermission("system:user:add")
|
@SaCheckPermission("system:user:add")
|
||||||
@Log(title = "用户管理", businessType = BusinessType.INSERT)
|
@Log(title = "用户管理", businessType = BusinessType.INSERT)
|
||||||
@RepeatSubmit()
|
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public R<Void> add(@Validated @RequestBody SysUserBo user) {
|
public R<Void> add(@Validated @RequestBody SysUserBo user) {
|
||||||
deptService.checkDeptDataScope(user.getDeptId());
|
deptService.checkDeptDataScope(user.getDeptId());
|
||||||
@@ -182,7 +178,6 @@ public class SysUserController extends BaseController {
|
|||||||
*/
|
*/
|
||||||
@SaCheckPermission("system:user:edit")
|
@SaCheckPermission("system:user:edit")
|
||||||
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
|
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
|
||||||
@RepeatSubmit()
|
|
||||||
@PutMapping
|
@PutMapping
|
||||||
public R<Void> edit(@Validated @RequestBody SysUserBo user) {
|
public R<Void> edit(@Validated @RequestBody SysUserBo user) {
|
||||||
userService.checkUserAllowed(user.getUserId());
|
userService.checkUserAllowed(user.getUserId());
|
||||||
@@ -232,7 +227,6 @@ public class SysUserController extends BaseController {
|
|||||||
@ApiEncrypt
|
@ApiEncrypt
|
||||||
@SaCheckPermission("system:user:resetPwd")
|
@SaCheckPermission("system:user:resetPwd")
|
||||||
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
|
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
|
||||||
@RepeatSubmit()
|
|
||||||
@PutMapping("/resetPwd")
|
@PutMapping("/resetPwd")
|
||||||
public R<Void> resetPwd(@RequestBody SysUserBo user) {
|
public R<Void> resetPwd(@RequestBody SysUserBo user) {
|
||||||
userService.checkUserAllowed(user.getUserId());
|
userService.checkUserAllowed(user.getUserId());
|
||||||
@@ -246,7 +240,6 @@ public class SysUserController extends BaseController {
|
|||||||
*/
|
*/
|
||||||
@SaCheckPermission("system:user:edit")
|
@SaCheckPermission("system:user:edit")
|
||||||
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
|
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
|
||||||
@RepeatSubmit()
|
|
||||||
@PutMapping("/changeStatus")
|
@PutMapping("/changeStatus")
|
||||||
public R<Void> changeStatus(@RequestBody SysUserBo user) {
|
public R<Void> changeStatus(@RequestBody SysUserBo user) {
|
||||||
userService.checkUserAllowed(user.getUserId());
|
userService.checkUserAllowed(user.getUserId());
|
||||||
@@ -279,7 +272,6 @@ public class SysUserController extends BaseController {
|
|||||||
*/
|
*/
|
||||||
@SaCheckPermission("system:user:edit")
|
@SaCheckPermission("system:user:edit")
|
||||||
@Log(title = "用户管理", businessType = BusinessType.GRANT)
|
@Log(title = "用户管理", businessType = BusinessType.GRANT)
|
||||||
@RepeatSubmit()
|
|
||||||
@PutMapping("/authRole")
|
@PutMapping("/authRole")
|
||||||
public R<Void> insertAuthRole(Long userId, Long[] roleIds) {
|
public R<Void> insertAuthRole(Long userId, Long[] roleIds) {
|
||||||
userService.checkUserDataScope(userId);
|
userService.checkUserDataScope(userId);
|
||||||
|
|||||||
@@ -1,75 +0,0 @@
|
|||||||
package org.dromara.system.domain;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.io.Serial;
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 附件扩展字段对象(存储在 SysOss.ext1 的 JSON 字符串中)
|
|
||||||
*
|
|
||||||
* @author AprilWind
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class SysOssExt implements Serializable {
|
|
||||||
|
|
||||||
@Serial
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 所属业务类型(如 avatar、report、contract)
|
|
||||||
*/
|
|
||||||
private String bizType;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 文件大小(单位:字节)
|
|
||||||
*/
|
|
||||||
private Long fileSize;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 文件类型(MIME类型,如 image/png)
|
|
||||||
*/
|
|
||||||
private String contentType;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 来源标识(如 userUpload、systemImport)
|
|
||||||
*/
|
|
||||||
private String source;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 上传 IP 地址,便于审计和追踪
|
|
||||||
*/
|
|
||||||
private String uploadIp;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 附件说明或备注
|
|
||||||
*/
|
|
||||||
private String remark;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 附件标签,如 ["图片", "证件"]
|
|
||||||
*/
|
|
||||||
private List<String> tags;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 业务绑定ID(如某业务记录ID)
|
|
||||||
*/
|
|
||||||
private String refId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 绑定业务类型
|
|
||||||
*/
|
|
||||||
private String refType;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 是否为临时文件,用于区分正式或待清理
|
|
||||||
*/
|
|
||||||
private Boolean isTemp;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 文件MD5值(可用于去重或校验)
|
|
||||||
*/
|
|
||||||
private String md5;
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,17 +1,17 @@
|
|||||||
package org.dromara.system.domain.bo;
|
package org.dromara.system.domain.bo;
|
||||||
|
|
||||||
import io.github.linpeilie.annotations.AutoMapper;
|
|
||||||
import jakarta.validation.constraints.NotBlank;
|
|
||||||
import jakarta.validation.constraints.NotNull;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
import org.dromara.common.core.validate.AddGroup;
|
import org.dromara.common.core.validate.AddGroup;
|
||||||
import org.dromara.common.core.validate.EditGroup;
|
import org.dromara.common.core.validate.EditGroup;
|
||||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
|
||||||
import org.dromara.system.domain.SysTenant;
|
import org.dromara.system.domain.SysTenant;
|
||||||
|
import io.github.linpeilie.annotations.AutoMapper;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import jakarta.validation.constraints.*;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
|
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 租户业务对象 sys_tenant
|
* 租户业务对象 sys_tenant
|
||||||
*
|
*
|
||||||
@@ -62,7 +62,6 @@ public class SysTenantBo extends BaseEntity {
|
|||||||
* 密码(创建系统用户)
|
* 密码(创建系统用户)
|
||||||
*/
|
*/
|
||||||
@NotBlank(message = "密码不能为空", groups = { AddGroup.class })
|
@NotBlank(message = "密码不能为空", groups = { AddGroup.class })
|
||||||
// @Pattern(regexp = RegexConstants.PASSWORD, message = "{user.password.format.valid}", groups = { AddGroup.class })
|
|
||||||
private String password;
|
private String password;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,90 +0,0 @@
|
|||||||
package org.dromara.system.domain.vo;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
import org.dromara.common.translation.annotation.Translation;
|
|
||||||
import org.dromara.common.translation.constant.TransConstant;
|
|
||||||
|
|
||||||
import java.io.Serial;
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 用户信息视图对象 sys_user
|
|
||||||
*
|
|
||||||
* @author Lion Li
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class ProfileUserVo implements Serializable {
|
|
||||||
|
|
||||||
@Serial
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 用户ID
|
|
||||||
*/
|
|
||||||
private Long userId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 租户ID
|
|
||||||
*/
|
|
||||||
private String tenantId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 部门ID
|
|
||||||
*/
|
|
||||||
private Long deptId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 用户账号
|
|
||||||
*/
|
|
||||||
private String userName;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 用户昵称
|
|
||||||
*/
|
|
||||||
private String nickName;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 用户类型(sys_user系统用户)
|
|
||||||
*/
|
|
||||||
private String userType;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 用户邮箱
|
|
||||||
*/
|
|
||||||
private String email;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 手机号码
|
|
||||||
*/
|
|
||||||
private String phonenumber;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 用户性别(0男 1女 2未知)
|
|
||||||
*/
|
|
||||||
private String sex;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 头像地址
|
|
||||||
*/
|
|
||||||
@Translation(type = TransConstant.OSS_ID_TO_URL)
|
|
||||||
private Long avatar;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 最后登录IP
|
|
||||||
*/
|
|
||||||
private String loginIp;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 最后登录时间
|
|
||||||
*/
|
|
||||||
private Date loginDate;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 部门名
|
|
||||||
*/
|
|
||||||
@Translation(type = TransConstant.DEPT_ID_TO_NAME, mapper = "deptId")
|
|
||||||
private String deptName;
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -3,7 +3,7 @@ package org.dromara.system.mapper;
|
|||||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import org.dromara.common.core.utils.StreamUtils;
|
import org.apache.ibatis.annotations.Param;
|
||||||
import org.dromara.common.mybatis.annotation.DataColumn;
|
import org.dromara.common.mybatis.annotation.DataColumn;
|
||||||
import org.dromara.common.mybatis.annotation.DataPermission;
|
import org.dromara.common.mybatis.annotation.DataPermission;
|
||||||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||||
@@ -20,38 +20,6 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
public interface SysDeptMapper extends BaseMapperPlus<SysDept, SysDeptVo> {
|
public interface SysDeptMapper extends BaseMapperPlus<SysDept, SysDeptVo> {
|
||||||
|
|
||||||
/**
|
|
||||||
* 构建角色对应的部门 SQL 查询语句
|
|
||||||
*
|
|
||||||
* <p>该 SQL 用于查询某个角色关联的所有部门 ID,常用于数据权限控制</p>
|
|
||||||
*
|
|
||||||
* @param roleId 角色ID
|
|
||||||
* @return 查询部门ID的 SQL 语句字符串
|
|
||||||
*/
|
|
||||||
default String buildDeptByRoleSql(Long roleId) {
|
|
||||||
return """
|
|
||||||
select dept_id from sys_role_dept where role_id = %d
|
|
||||||
""".formatted(roleId);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 构建 SQL 查询,用于获取当前角色拥有的部门中所有的父部门ID
|
|
||||||
*
|
|
||||||
* <p>
|
|
||||||
* 该 SQL 用于 deptCheckStrictly 场景下,排除非叶子节点(父节点)用。
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @param roleId 角色ID
|
|
||||||
* @return SQL 语句字符串,查询角色下部门的所有父部门ID
|
|
||||||
*/
|
|
||||||
default String buildParentDeptByRoleSql(Long roleId) {
|
|
||||||
return """
|
|
||||||
select parent_id from sys_dept where dept_id in (
|
|
||||||
select dept_id from sys_role_dept where role_id = %d
|
|
||||||
)
|
|
||||||
""".formatted(roleId);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询部门管理数据
|
* 查询部门管理数据
|
||||||
*
|
*
|
||||||
@@ -104,19 +72,6 @@ public interface SysDeptMapper extends BaseMapperPlus<SysDept, SysDeptVo> {
|
|||||||
.apply(DataBaseHelper.findInSet(parentId, "ancestors")));
|
.apply(DataBaseHelper.findInSet(parentId, "ancestors")));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询某个部门及其所有子部门ID(含自身)
|
|
||||||
*
|
|
||||||
* @param parentId 父部门ID
|
|
||||||
* @return 部门ID集合
|
|
||||||
*/
|
|
||||||
default List<Long> selectDeptAndChildById(Long parentId) {
|
|
||||||
List<SysDept> deptList = this.selectListByParentId(parentId);
|
|
||||||
List<Long> deptIds = StreamUtils.toList(deptList, SysDept::getDeptId);
|
|
||||||
deptIds.add(parentId);
|
|
||||||
return deptIds;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据角色ID查询部门树信息
|
* 根据角色ID查询部门树信息
|
||||||
*
|
*
|
||||||
@@ -124,16 +79,6 @@ public interface SysDeptMapper extends BaseMapperPlus<SysDept, SysDeptVo> {
|
|||||||
* @param deptCheckStrictly 部门树选择项是否关联显示
|
* @param deptCheckStrictly 部门树选择项是否关联显示
|
||||||
* @return 选中部门列表
|
* @return 选中部门列表
|
||||||
*/
|
*/
|
||||||
default List<Long> selectDeptListByRoleId(Long roleId, boolean deptCheckStrictly) {
|
List<Long> selectDeptListByRoleId(@Param("roleId") Long roleId, @Param("deptCheckStrictly") boolean deptCheckStrictly);
|
||||||
LambdaQueryWrapper<SysDept> wrapper = new LambdaQueryWrapper<>();
|
|
||||||
wrapper.select(SysDept::getDeptId)
|
|
||||||
.inSql(SysDept::getDeptId, this.buildDeptByRoleSql(roleId))
|
|
||||||
.orderByAsc(SysDept::getParentId)
|
|
||||||
.orderByAsc(SysDept::getOrderNum);
|
|
||||||
if (deptCheckStrictly) {
|
|
||||||
wrapper.notInSql(SysDept::getDeptId, this.buildParentDeptByRoleSql(roleId));
|
|
||||||
}
|
|
||||||
return this.selectObjs(wrapper);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,16 +1,15 @@
|
|||||||
package org.dromara.system.mapper;
|
package org.dromara.system.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
import org.dromara.common.core.constant.SystemConstants;
|
import org.dromara.common.core.constant.SystemConstants;
|
||||||
import org.dromara.common.core.utils.StreamUtils;
|
|
||||||
import org.dromara.common.core.utils.StringUtils;
|
|
||||||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||||
import org.dromara.system.domain.SysMenu;
|
import org.dromara.system.domain.SysMenu;
|
||||||
import org.dromara.system.domain.vo.SysMenuVo;
|
import org.dromara.system.domain.vo.SysMenuVo;
|
||||||
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 菜单表 数据层
|
* 菜单表 数据层
|
||||||
@@ -20,58 +19,12 @@ import java.util.Set;
|
|||||||
public interface SysMenuMapper extends BaseMapperPlus<SysMenu, SysMenuVo> {
|
public interface SysMenuMapper extends BaseMapperPlus<SysMenu, SysMenuVo> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 构建用户权限菜单 SQL
|
* 根据用户查询系统菜单列表
|
||||||
*
|
*
|
||||||
* <p>
|
* @param queryWrapper 查询条件
|
||||||
* 查询用户所属角色所拥有的菜单权限,用于权限判断、菜单加载等场景
|
* @return 菜单列表
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @param userId 用户ID
|
|
||||||
* @return SQL 字符串,用于 inSql 条件
|
|
||||||
*/
|
*/
|
||||||
default String buildMenuByUserSql(Long userId) {
|
List<SysMenu> selectMenuListByUserId(@Param(Constants.WRAPPER) Wrapper<SysMenu> queryWrapper);
|
||||||
return """
|
|
||||||
select menu_id from sys_role_menu where role_id in (
|
|
||||||
select role_id from sys_user_role where user_id = %d
|
|
||||||
)
|
|
||||||
""".formatted(userId);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 构建角色对应的菜单ID SQL 子查询
|
|
||||||
*
|
|
||||||
* <p>
|
|
||||||
* 用于根据角色ID查询其所拥有的菜单权限(用于权限标识、菜单显示等场景)
|
|
||||||
* 通常配合 inSql 使用
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @param roleId 角色ID
|
|
||||||
* @return 查询菜单ID的 SQL 子查询字符串
|
|
||||||
*/
|
|
||||||
default String buildMenuByRoleSql(Long roleId) {
|
|
||||||
return """
|
|
||||||
select menu_id from sys_role_menu where role_id = %d
|
|
||||||
""".formatted(roleId);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 构建角色所关联菜单的父菜单ID查询 SQL
|
|
||||||
*
|
|
||||||
* <p>
|
|
||||||
* 用于配合菜单勾选树结构的 {@code menuCheckStrictly} 模式,过滤掉非叶子节点(父菜单),
|
|
||||||
* 只返回角色实际勾选的末级菜单
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @param roleId 角色ID
|
|
||||||
* @return SQL 语句字符串(查询菜单的父菜单ID)
|
|
||||||
*/
|
|
||||||
default String buildParentMenuByRoleSql(Long roleId) {
|
|
||||||
return """
|
|
||||||
select parent_id from sys_menu where menu_id in (
|
|
||||||
select menu_id from sys_role_menu where role_id = %d
|
|
||||||
)
|
|
||||||
""".formatted(roleId);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据用户ID查询权限
|
* 根据用户ID查询权限
|
||||||
@@ -79,15 +32,7 @@ public interface SysMenuMapper extends BaseMapperPlus<SysMenu, SysMenuVo> {
|
|||||||
* @param userId 用户ID
|
* @param userId 用户ID
|
||||||
* @return 权限列表
|
* @return 权限列表
|
||||||
*/
|
*/
|
||||||
default Set<String> selectMenuPermsByUserId(Long userId) {
|
List<String> selectMenuPermsByUserId(Long userId);
|
||||||
List<String> list = this.selectObjs(
|
|
||||||
new LambdaQueryWrapper<SysMenu>()
|
|
||||||
.select(SysMenu::getPerms)
|
|
||||||
.inSql(SysMenu::getMenuId, this.buildMenuByUserSql(userId))
|
|
||||||
.isNotNull(SysMenu::getPerms)
|
|
||||||
);
|
|
||||||
return new HashSet<>(StreamUtils.filter(list, StringUtils::isNotBlank));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据角色ID查询权限
|
* 根据角色ID查询权限
|
||||||
@@ -95,15 +40,7 @@ public interface SysMenuMapper extends BaseMapperPlus<SysMenu, SysMenuVo> {
|
|||||||
* @param roleId 角色ID
|
* @param roleId 角色ID
|
||||||
* @return 权限列表
|
* @return 权限列表
|
||||||
*/
|
*/
|
||||||
default Set<String> selectMenuPermsByRoleId(Long roleId) {
|
List<String> selectMenuPermsByRoleId(Long roleId);
|
||||||
List<String> list = this.selectObjs(
|
|
||||||
new LambdaQueryWrapper<SysMenu>()
|
|
||||||
.select(SysMenu::getPerms)
|
|
||||||
.inSql(SysMenu::getMenuId, this.buildMenuByRoleSql(roleId))
|
|
||||||
.isNotNull(SysMenu::getPerms)
|
|
||||||
);
|
|
||||||
return new HashSet<>(StreamUtils.filter(list, StringUtils::isNotBlank));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据用户ID查询菜单
|
* 根据用户ID查询菜单
|
||||||
@@ -119,6 +56,14 @@ public interface SysMenuMapper extends BaseMapperPlus<SysMenu, SysMenuVo> {
|
|||||||
return this.selectList(lqw);
|
return this.selectList(lqw);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据用户ID查询菜单
|
||||||
|
*
|
||||||
|
* @param userId 用户ID
|
||||||
|
* @return 菜单列表
|
||||||
|
*/
|
||||||
|
List<SysMenu> selectMenuTreeByUserId(Long userId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据角色ID查询菜单树信息
|
* 根据角色ID查询菜单树信息
|
||||||
*
|
*
|
||||||
@@ -126,16 +71,6 @@ public interface SysMenuMapper extends BaseMapperPlus<SysMenu, SysMenuVo> {
|
|||||||
* @param menuCheckStrictly 菜单树选择项是否关联显示
|
* @param menuCheckStrictly 菜单树选择项是否关联显示
|
||||||
* @return 选中菜单列表
|
* @return 选中菜单列表
|
||||||
*/
|
*/
|
||||||
default List<Long> selectMenuListByRoleId(Long roleId, boolean menuCheckStrictly) {
|
List<Long> selectMenuListByRoleId(@Param("roleId") Long roleId, @Param("menuCheckStrictly") boolean menuCheckStrictly);
|
||||||
LambdaQueryWrapper<SysMenu> wrapper = new LambdaQueryWrapper<>();
|
|
||||||
wrapper.select(SysMenu::getMenuId)
|
|
||||||
.inSql(SysMenu::getMenuId, buildMenuByRoleSql(roleId))
|
|
||||||
.orderByAsc(SysMenu::getParentId)
|
|
||||||
.orderByAsc(SysMenu::getOrderNum);
|
|
||||||
if (menuCheckStrictly) {
|
|
||||||
wrapper.notInSql(SysMenu::getMenuId, this.buildParentMenuByRoleSql(roleId));
|
|
||||||
}
|
|
||||||
return this.selectObjs(wrapper);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package org.dromara.system.mapper;
|
package org.dromara.system.mapper;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import org.dromara.common.mybatis.annotation.DataColumn;
|
import org.dromara.common.mybatis.annotation.DataColumn;
|
||||||
import org.dromara.common.mybatis.annotation.DataPermission;
|
import org.dromara.common.mybatis.annotation.DataPermission;
|
||||||
@@ -34,42 +33,11 @@ public interface SysPostMapper extends BaseMapperPlus<SysPost, SysPostVo> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询岗位列表
|
* 查询用户所属岗位组
|
||||||
*
|
|
||||||
* @param queryWrapper 查询条件
|
|
||||||
* @return 岗位信息列表
|
|
||||||
*/
|
|
||||||
@DataPermission({
|
|
||||||
@DataColumn(key = "deptName", value = "dept_id"),
|
|
||||||
@DataColumn(key = "userName", value = "create_by")
|
|
||||||
})
|
|
||||||
default List<SysPostVo> selectPostList(Wrapper<SysPost> queryWrapper) {
|
|
||||||
return this.selectVoList(queryWrapper);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据岗位ID集合查询岗位数量
|
|
||||||
*
|
|
||||||
* @param postIds 岗位ID列表
|
|
||||||
* @return 匹配的岗位数量
|
|
||||||
*/
|
|
||||||
@DataPermission({
|
|
||||||
@DataColumn(key = "deptName", value = "dept_id"),
|
|
||||||
@DataColumn(key = "userName", value = "create_by")
|
|
||||||
})
|
|
||||||
default long selectPostCount(List<Long> postIds) {
|
|
||||||
return this.selectCount(new LambdaQueryWrapper<SysPost>().in(SysPost::getPostId, postIds));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据用户ID查询其关联的岗位列表
|
|
||||||
*
|
*
|
||||||
* @param userId 用户ID
|
* @param userId 用户ID
|
||||||
* @return 岗位信息列表
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
default List<SysPostVo> selectPostsByUserId(Long userId) {
|
List<SysPostVo> selectPostsByUserId(Long userId);
|
||||||
return this.selectVoList(new LambdaQueryWrapper<SysPost>()
|
|
||||||
.inSql(SysPost::getPostId, "select post_id from sys_user_post where user_id = " + userId));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package org.dromara.system.mapper;
|
package org.dromara.system.mapper;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
@@ -20,18 +19,6 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
public interface SysRoleMapper extends BaseMapperPlus<SysRole, SysRoleVo> {
|
public interface SysRoleMapper extends BaseMapperPlus<SysRole, SysRoleVo> {
|
||||||
|
|
||||||
/**
|
|
||||||
* 构建根据用户ID查询角色ID的SQL子查询
|
|
||||||
*
|
|
||||||
* @param userId 用户ID
|
|
||||||
* @return 查询用户对应角色ID的SQL语句字符串
|
|
||||||
*/
|
|
||||||
default String buildRoleByUserSql(Long userId) {
|
|
||||||
return """
|
|
||||||
select role_id from sys_user_role where user_id = %d
|
|
||||||
""".formatted(userId);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页查询角色列表
|
* 分页查询角色列表
|
||||||
*
|
*
|
||||||
@@ -40,40 +27,22 @@ public interface SysRoleMapper extends BaseMapperPlus<SysRole, SysRoleVo> {
|
|||||||
* @return 包含角色信息的分页结果
|
* @return 包含角色信息的分页结果
|
||||||
*/
|
*/
|
||||||
@DataPermission({
|
@DataPermission({
|
||||||
@DataColumn(key = "deptName", value = "create_dept"),
|
@DataColumn(key = "deptName", value = "d.dept_id"),
|
||||||
@DataColumn(key = "userName", value = "create_by")
|
@DataColumn(key = "userName", value = "r.create_by")
|
||||||
})
|
})
|
||||||
default Page<SysRoleVo> selectPageRoleList(@Param("page") Page<SysRole> page, @Param(Constants.WRAPPER) Wrapper<SysRole> queryWrapper) {
|
Page<SysRoleVo> selectPageRoleList(@Param("page") Page<SysRole> page, @Param(Constants.WRAPPER) Wrapper<SysRole> queryWrapper);
|
||||||
return this.selectVoPage(page, queryWrapper);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据条件查询角色数据
|
* 根据条件分页查询角色数据
|
||||||
*
|
*
|
||||||
* @param queryWrapper 查询条件
|
* @param queryWrapper 查询条件
|
||||||
* @return 角色数据集合信息
|
* @return 角色数据集合信息
|
||||||
*/
|
*/
|
||||||
@DataPermission({
|
@DataPermission({
|
||||||
@DataColumn(key = "deptName", value = "create_dept"),
|
@DataColumn(key = "deptName", value = "d.dept_id"),
|
||||||
@DataColumn(key = "userName", value = "create_by")
|
@DataColumn(key = "userName", value = "r.create_by")
|
||||||
})
|
})
|
||||||
default List<SysRoleVo> selectRoleList(@Param(Constants.WRAPPER) Wrapper<SysRole> queryWrapper) {
|
List<SysRoleVo> selectRoleList(@Param(Constants.WRAPPER) Wrapper<SysRole> queryWrapper);
|
||||||
return this.selectVoList(queryWrapper);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据角色ID集合查询角色数量
|
|
||||||
*
|
|
||||||
* @param roleIds 角色ID列表
|
|
||||||
* @return 匹配的角色数量
|
|
||||||
*/
|
|
||||||
@DataPermission({
|
|
||||||
@DataColumn(key = "deptName", value = "create_dept"),
|
|
||||||
@DataColumn(key = "userName", value = "create_by")
|
|
||||||
})
|
|
||||||
default long selectRoleCount(List<Long> roleIds) {
|
|
||||||
return this.selectCount(new LambdaQueryWrapper<SysRole>().in(SysRole::getRoleId, roleIds));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据角色ID查询角色信息
|
* 根据角色ID查询角色信息
|
||||||
@@ -82,12 +51,10 @@ public interface SysRoleMapper extends BaseMapperPlus<SysRole, SysRoleVo> {
|
|||||||
* @return 对应的角色信息
|
* @return 对应的角色信息
|
||||||
*/
|
*/
|
||||||
@DataPermission({
|
@DataPermission({
|
||||||
@DataColumn(key = "deptName", value = "create_dept"),
|
@DataColumn(key = "deptName", value = "d.dept_id"),
|
||||||
@DataColumn(key = "userName", value = "create_by")
|
@DataColumn(key = "userName", value = "r.create_by")
|
||||||
})
|
})
|
||||||
default SysRoleVo selectRoleById(Long roleId) {
|
SysRoleVo selectRoleById(Long roleId);
|
||||||
return this.selectVoById(roleId);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据用户ID查询角色
|
* 根据用户ID查询角色
|
||||||
@@ -95,11 +62,14 @@ public interface SysRoleMapper extends BaseMapperPlus<SysRole, SysRoleVo> {
|
|||||||
* @param userId 用户ID
|
* @param userId 用户ID
|
||||||
* @return 角色列表
|
* @return 角色列表
|
||||||
*/
|
*/
|
||||||
default List<SysRoleVo> selectRolesByUserId(Long userId) {
|
List<SysRoleVo> selectRolePermissionByUserId(Long userId);
|
||||||
return this.selectVoList(new LambdaQueryWrapper<SysRole>()
|
|
||||||
.select(SysRole::getRoleId, SysRole::getRoleName, SysRole::getRoleKey,
|
/**
|
||||||
SysRole::getRoleSort, SysRole::getDataScope, SysRole::getStatus)
|
* 根据用户ID查询角色
|
||||||
.inSql(SysRole::getRoleId, this.buildRoleByUserSql(userId)));
|
*
|
||||||
}
|
* @param userId 用户ID
|
||||||
|
* @return 角色列表
|
||||||
|
*/
|
||||||
|
List<SysRoleVo> selectRolesByUserId(Long userId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ public interface SysUserMapper extends BaseMapperPlus<SysUser, SysUserVo> {
|
|||||||
*/
|
*/
|
||||||
@DataPermission({
|
@DataPermission({
|
||||||
@DataColumn(key = "deptName", value = "dept_id"),
|
@DataColumn(key = "deptName", value = "dept_id"),
|
||||||
@DataColumn(key = "userName", value = "create_by")
|
@DataColumn(key = "userName", value = "user_id")
|
||||||
})
|
})
|
||||||
default Page<SysUserVo> selectPageUserList(Page<SysUser> page, Wrapper<SysUser> queryWrapper) {
|
default Page<SysUserVo> selectPageUserList(Page<SysUser> page, Wrapper<SysUser> queryWrapper) {
|
||||||
return this.selectVoPage(page, queryWrapper);
|
return this.selectVoPage(page, queryWrapper);
|
||||||
@@ -44,7 +44,7 @@ public interface SysUserMapper extends BaseMapperPlus<SysUser, SysUserVo> {
|
|||||||
*/
|
*/
|
||||||
@DataPermission({
|
@DataPermission({
|
||||||
@DataColumn(key = "deptName", value = "dept_id"),
|
@DataColumn(key = "deptName", value = "dept_id"),
|
||||||
@DataColumn(key = "userName", value = "create_by")
|
@DataColumn(key = "userName", value = "user_id")
|
||||||
})
|
})
|
||||||
default List<SysUserVo> selectUserList(Wrapper<SysUser> queryWrapper) {
|
default List<SysUserVo> selectUserList(Wrapper<SysUser> queryWrapper) {
|
||||||
return this.selectVoList(queryWrapper);
|
return this.selectVoList(queryWrapper);
|
||||||
@@ -58,7 +58,7 @@ public interface SysUserMapper extends BaseMapperPlus<SysUser, SysUserVo> {
|
|||||||
*/
|
*/
|
||||||
@DataPermission({
|
@DataPermission({
|
||||||
@DataColumn(key = "deptName", value = "d.dept_id"),
|
@DataColumn(key = "deptName", value = "d.dept_id"),
|
||||||
@DataColumn(key = "userName", value = "u.create_by")
|
@DataColumn(key = "userName", value = "u.user_id")
|
||||||
})
|
})
|
||||||
List<SysUserExportVo> selectUserExportList(@Param(Constants.WRAPPER) Wrapper<SysUser> queryWrapper);
|
List<SysUserExportVo> selectUserExportList(@Param(Constants.WRAPPER) Wrapper<SysUser> queryWrapper);
|
||||||
|
|
||||||
@@ -71,7 +71,7 @@ public interface SysUserMapper extends BaseMapperPlus<SysUser, SysUserVo> {
|
|||||||
*/
|
*/
|
||||||
@DataPermission({
|
@DataPermission({
|
||||||
@DataColumn(key = "deptName", value = "d.dept_id"),
|
@DataColumn(key = "deptName", value = "d.dept_id"),
|
||||||
@DataColumn(key = "userName", value = "u.create_by")
|
@DataColumn(key = "userName", value = "u.user_id")
|
||||||
})
|
})
|
||||||
Page<SysUserVo> selectAllocatedList(@Param("page") Page<SysUser> page, @Param(Constants.WRAPPER) Wrapper<SysUser> queryWrapper);
|
Page<SysUserVo> selectAllocatedList(@Param("page") Page<SysUser> page, @Param(Constants.WRAPPER) Wrapper<SysUser> queryWrapper);
|
||||||
|
|
||||||
@@ -83,7 +83,7 @@ public interface SysUserMapper extends BaseMapperPlus<SysUser, SysUserVo> {
|
|||||||
*/
|
*/
|
||||||
@DataPermission({
|
@DataPermission({
|
||||||
@DataColumn(key = "deptName", value = "d.dept_id"),
|
@DataColumn(key = "deptName", value = "d.dept_id"),
|
||||||
@DataColumn(key = "userName", value = "u.create_by")
|
@DataColumn(key = "userName", value = "u.user_id")
|
||||||
})
|
})
|
||||||
Page<SysUserVo> selectUnallocatedList(@Param("page") Page<SysUser> page, @Param(Constants.WRAPPER) Wrapper<SysUser> queryWrapper);
|
Page<SysUserVo> selectUnallocatedList(@Param("page") Page<SysUser> page, @Param(Constants.WRAPPER) Wrapper<SysUser> queryWrapper);
|
||||||
|
|
||||||
@@ -95,7 +95,7 @@ public interface SysUserMapper extends BaseMapperPlus<SysUser, SysUserVo> {
|
|||||||
*/
|
*/
|
||||||
@DataPermission({
|
@DataPermission({
|
||||||
@DataColumn(key = "deptName", value = "dept_id"),
|
@DataColumn(key = "deptName", value = "dept_id"),
|
||||||
@DataColumn(key = "userName", value = "create_by")
|
@DataColumn(key = "userName", value = "user_id")
|
||||||
})
|
})
|
||||||
default long countUserById(Long userId) {
|
default long countUserById(Long userId) {
|
||||||
return this.selectCount(new LambdaQueryWrapper<SysUser>().eq(SysUser::getUserId, userId));
|
return this.selectCount(new LambdaQueryWrapper<SysUser>().eq(SysUser::getUserId, userId));
|
||||||
@@ -111,7 +111,7 @@ public interface SysUserMapper extends BaseMapperPlus<SysUser, SysUserVo> {
|
|||||||
@Override
|
@Override
|
||||||
@DataPermission({
|
@DataPermission({
|
||||||
@DataColumn(key = "deptName", value = "dept_id"),
|
@DataColumn(key = "deptName", value = "dept_id"),
|
||||||
@DataColumn(key = "userName", value = "create_by")
|
@DataColumn(key = "userName", value = "user_id")
|
||||||
})
|
})
|
||||||
int update(@Param(Constants.ENTITY) SysUser user, @Param(Constants.WRAPPER) Wrapper<SysUser> updateWrapper);
|
int update(@Param(Constants.ENTITY) SysUser user, @Param(Constants.WRAPPER) Wrapper<SysUser> updateWrapper);
|
||||||
|
|
||||||
@@ -124,7 +124,7 @@ public interface SysUserMapper extends BaseMapperPlus<SysUser, SysUserVo> {
|
|||||||
@Override
|
@Override
|
||||||
@DataPermission({
|
@DataPermission({
|
||||||
@DataColumn(key = "deptName", value = "dept_id"),
|
@DataColumn(key = "deptName", value = "dept_id"),
|
||||||
@DataColumn(key = "userName", value = "create_by")
|
@DataColumn(key = "userName", value = "user_id")
|
||||||
})
|
})
|
||||||
int updateById(@Param(Constants.ENTITY) SysUser user);
|
int updateById(@Param(Constants.ENTITY) SysUser user);
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package org.dromara.system.mapper;
|
package org.dromara.system.mapper;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
||||||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||||
import org.dromara.system.domain.SysUserRole;
|
import org.dromara.system.domain.SysUserRole;
|
||||||
|
|
||||||
@@ -19,10 +18,6 @@ public interface SysUserRoleMapper extends BaseMapperPlus<SysUserRole, SysUserRo
|
|||||||
* @param roleId 角色ID
|
* @param roleId 角色ID
|
||||||
* @return 关联到指定角色的用户ID列表
|
* @return 关联到指定角色的用户ID列表
|
||||||
*/
|
*/
|
||||||
default List<Long> selectUserIdsByRoleId(Long roleId) {
|
List<Long> selectUserIdsByRoleId(Long roleId);
|
||||||
return this.selectObjs(new LambdaQueryWrapper<SysUserRole>()
|
|
||||||
.select(SysUserRole::getUserId).eq(SysUserRole::getRoleId, roleId)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,13 +14,7 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
public interface ISysConfigService {
|
public interface ISysConfigService {
|
||||||
|
|
||||||
/**
|
|
||||||
* 分页查询参数配置列表
|
|
||||||
*
|
|
||||||
* @param config 查询条件
|
|
||||||
* @param pageQuery 分页参数
|
|
||||||
* @return 参数配置分页列表
|
|
||||||
*/
|
|
||||||
TableDataInfo<SysConfigVo> selectPageConfigList(SysConfigBo config, PageQuery pageQuery);
|
TableDataInfo<SysConfigVo> selectPageConfigList(SysConfigBo config, PageQuery pageQuery);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -14,13 +14,7 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
public interface ISysDictDataService {
|
public interface ISysDictDataService {
|
||||||
|
|
||||||
/**
|
|
||||||
* 分页查询字典数据列表
|
|
||||||
*
|
|
||||||
* @param dictData 查询条件
|
|
||||||
* @param pageQuery 分页参数
|
|
||||||
* @return 字典数据分页列表
|
|
||||||
*/
|
|
||||||
TableDataInfo<SysDictDataVo> selectPageDictDataList(SysDictDataBo dictData, PageQuery pageQuery);
|
TableDataInfo<SysDictDataVo> selectPageDictDataList(SysDictDataBo dictData, PageQuery pageQuery);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -15,13 +15,7 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
public interface ISysDictTypeService {
|
public interface ISysDictTypeService {
|
||||||
|
|
||||||
/**
|
|
||||||
* 分页查询字典类型列表
|
|
||||||
*
|
|
||||||
* @param dictType 查询条件
|
|
||||||
* @param pageQuery 分页参数
|
|
||||||
* @return 字典类型分页列表
|
|
||||||
*/
|
|
||||||
TableDataInfo<SysDictTypeVo> selectPageDictTypeList(SysDictTypeBo dictType, PageQuery pageQuery);
|
TableDataInfo<SysDictTypeVo> selectPageDictTypeList(SysDictTypeBo dictType, PageQuery pageQuery);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -14,13 +14,7 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
public interface ISysLogininforService {
|
public interface ISysLogininforService {
|
||||||
|
|
||||||
/**
|
|
||||||
* 分页查询登录日志列表
|
|
||||||
*
|
|
||||||
* @param logininfor 查询条件
|
|
||||||
* @param pageQuery 分页参数
|
|
||||||
* @return 登录日志分页列表
|
|
||||||
*/
|
|
||||||
TableDataInfo<SysLogininforVo> selectPageLogininforList(SysLogininforBo logininfor, PageQuery pageQuery);
|
TableDataInfo<SysLogininforVo> selectPageLogininforList(SysLogininforBo logininfor, PageQuery pageQuery);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -14,13 +14,7 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
public interface ISysNoticeService {
|
public interface ISysNoticeService {
|
||||||
|
|
||||||
/**
|
|
||||||
* 分页查询通知公告列表
|
|
||||||
*
|
|
||||||
* @param notice 查询条件
|
|
||||||
* @param pageQuery 分页参数
|
|
||||||
* @return 通知公告分页列表
|
|
||||||
*/
|
|
||||||
TableDataInfo<SysNoticeVo> selectPageNoticeList(SysNoticeBo notice, PageQuery pageQuery);
|
TableDataInfo<SysNoticeVo> selectPageNoticeList(SysNoticeBo notice, PageQuery pageQuery);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -14,13 +14,6 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
public interface ISysOperLogService {
|
public interface ISysOperLogService {
|
||||||
|
|
||||||
/**
|
|
||||||
* 分页查询操作日志列表
|
|
||||||
*
|
|
||||||
* @param operLog 查询条件
|
|
||||||
* @param pageQuery 分页参数
|
|
||||||
* @return 操作日志分页列表
|
|
||||||
*/
|
|
||||||
TableDataInfo<SysOperLogVo> selectPageOperLogList(SysOperLogBo operLog, PageQuery pageQuery);
|
TableDataInfo<SysOperLogVo> selectPageOperLogList(SysOperLogBo operLog, PageQuery pageQuery);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -14,13 +14,7 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
public interface ISysPostService {
|
public interface ISysPostService {
|
||||||
|
|
||||||
/**
|
|
||||||
* 分页查询岗位列表
|
|
||||||
*
|
|
||||||
* @param post 查询条件
|
|
||||||
* @param pageQuery 分页参数
|
|
||||||
* @return 岗位分页列表
|
|
||||||
*/
|
|
||||||
TableDataInfo<SysPostVo> selectPagePostList(SysPostBo post, PageQuery pageQuery);
|
TableDataInfo<SysPostVo> selectPagePostList(SysPostBo post, PageQuery pageQuery);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -116,7 +110,7 @@ public interface ISysPostService {
|
|||||||
* @param postIds 需要删除的岗位ID
|
* @param postIds 需要删除的岗位ID
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
int deletePostByIds(List<Long> postIds);
|
int deletePostByIds(Long[] postIds);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增保存岗位信息
|
* 新增保存岗位信息
|
||||||
|
|||||||
@@ -16,17 +16,11 @@ import java.util.Set;
|
|||||||
*/
|
*/
|
||||||
public interface ISysRoleService {
|
public interface ISysRoleService {
|
||||||
|
|
||||||
/**
|
|
||||||
* 分页查询角色列表
|
|
||||||
*
|
|
||||||
* @param role 查询条件
|
|
||||||
* @param pageQuery 分页参数
|
|
||||||
* @return 角色分页列表
|
|
||||||
*/
|
|
||||||
TableDataInfo<SysRoleVo> selectPageRoleList(SysRoleBo role, PageQuery pageQuery);
|
TableDataInfo<SysRoleVo> selectPageRoleList(SysRoleBo role, PageQuery pageQuery);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据条件查询角色数据
|
* 根据条件分页查询角色数据
|
||||||
*
|
*
|
||||||
* @param role 角色信息
|
* @param role 角色信息
|
||||||
* @return 角色数据集合信息
|
* @return 角色数据集合信息
|
||||||
@@ -118,13 +112,6 @@ public interface ISysRoleService {
|
|||||||
*/
|
*/
|
||||||
void checkRoleDataScope(Long roleId);
|
void checkRoleDataScope(Long roleId);
|
||||||
|
|
||||||
/**
|
|
||||||
* 校验角色是否有数据权限
|
|
||||||
*
|
|
||||||
* @param roleIds 角色ID列表(支持传单个ID)
|
|
||||||
*/
|
|
||||||
void checkRoleDataScope(List<Long> roleIds);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过角色ID查询角色使用数量
|
* 通过角色ID查询角色使用数量
|
||||||
*
|
*
|
||||||
@@ -180,7 +167,7 @@ public interface ISysRoleService {
|
|||||||
* @param roleIds 需要删除的角色ID
|
* @param roleIds 需要删除的角色ID
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
int deleteRoleByIds(List<Long> roleIds);
|
int deleteRoleByIds(Long[] roleIds);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 取消授权用户角色
|
* 取消授权用户角色
|
||||||
@@ -208,29 +195,8 @@ public interface ISysRoleService {
|
|||||||
*/
|
*/
|
||||||
int insertAuthUsers(Long roleId, Long[] userIds);
|
int insertAuthUsers(Long roleId, Long[] userIds);
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据角色ID清除该角色关联的所有在线用户的登录状态(踢出在线用户)
|
|
||||||
*
|
|
||||||
* <p>
|
|
||||||
* 先判断角色是否绑定用户,若无绑定则直接返回
|
|
||||||
* 然后遍历当前所有在线Token,查找拥有该角色的用户并强制登出
|
|
||||||
* 注意:在线用户量过大时,操作可能导致 Redis 阻塞,需谨慎调用
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @param roleId 角色ID
|
|
||||||
*/
|
|
||||||
void cleanOnlineUserByRole(Long roleId);
|
void cleanOnlineUserByRole(Long roleId);
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据用户ID列表清除对应在线用户的登录状态(踢出指定用户)
|
|
||||||
*
|
|
||||||
* <p>
|
|
||||||
* 遍历当前所有在线Token,匹配用户ID列表中的用户,强制登出
|
|
||||||
* 注意:在线用户量过大时,操作可能导致 Redis 阻塞,需谨慎调用
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @param userIds 需要清除的用户ID列表
|
|
||||||
*/
|
|
||||||
void cleanOnlineUser(List<Long> userIds);
|
void cleanOnlineUser(List<Long> userIds);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,13 +41,6 @@ public class SysConfigServiceImpl implements ISysConfigService, ConfigService {
|
|||||||
|
|
||||||
private final SysConfigMapper baseMapper;
|
private final SysConfigMapper baseMapper;
|
||||||
|
|
||||||
/**
|
|
||||||
* 分页查询参数配置列表
|
|
||||||
*
|
|
||||||
* @param config 查询条件
|
|
||||||
* @param pageQuery 分页参数
|
|
||||||
* @return 参数配置分页列表
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public TableDataInfo<SysConfigVo> selectPageConfigList(SysConfigBo config, PageQuery pageQuery) {
|
public TableDataInfo<SysConfigVo> selectPageConfigList(SysConfigBo config, PageQuery pageQuery) {
|
||||||
LambdaQueryWrapper<SysConfig> lqw = buildQueryWrapper(config);
|
LambdaQueryWrapper<SysConfig> lqw = buildQueryWrapper(config);
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.dromara.common.core.constant.CacheNames;
|
import org.dromara.common.core.constant.CacheNames;
|
||||||
import org.dromara.common.core.utils.StreamUtils;
|
import org.dromara.common.core.utils.StreamUtils;
|
||||||
|
import org.dromara.system.domain.SysDept;
|
||||||
import org.dromara.system.domain.SysRoleDept;
|
import org.dromara.system.domain.SysRoleDept;
|
||||||
import org.dromara.system.mapper.SysDeptMapper;
|
import org.dromara.system.mapper.SysDeptMapper;
|
||||||
import org.dromara.system.mapper.SysRoleDeptMapper;
|
import org.dromara.system.mapper.SysRoleDeptMapper;
|
||||||
@@ -65,8 +66,13 @@ public class SysDataScopeServiceImpl implements ISysDataScopeService {
|
|||||||
if (ObjectUtil.isNull(deptId)) {
|
if (ObjectUtil.isNull(deptId)) {
|
||||||
return "-1";
|
return "-1";
|
||||||
}
|
}
|
||||||
List<Long> deptIds = deptMapper.selectDeptAndChildById(deptId);
|
List<SysDept> deptList = deptMapper.selectListByParentId(deptId);
|
||||||
return CollUtil.isNotEmpty(deptIds) ? StreamUtils.join(deptIds, Convert::toStr) : "-1";
|
List<Long> ids = StreamUtils.toList(deptList, SysDept::getDeptId);
|
||||||
|
ids.add(deptId);
|
||||||
|
if (CollUtil.isNotEmpty(ids)) {
|
||||||
|
return StreamUtils.join(ids, Convert::toStr);
|
||||||
|
}
|
||||||
|
return "-1";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,7 +36,10 @@ import org.springframework.cache.annotation.Caching;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 部门管理 服务实现
|
* 部门管理 服务实现
|
||||||
@@ -107,7 +110,10 @@ public class SysDeptServiceImpl implements ISysDeptService, DeptService {
|
|||||||
if (ObjectUtil.isNotNull(bo.getBelongDeptId())) {
|
if (ObjectUtil.isNotNull(bo.getBelongDeptId())) {
|
||||||
//部门树搜索
|
//部门树搜索
|
||||||
lqw.and(x -> {
|
lqw.and(x -> {
|
||||||
List<Long> deptIds = baseMapper.selectDeptAndChildById(bo.getBelongDeptId());
|
Long parentId = bo.getBelongDeptId();
|
||||||
|
List<SysDept> deptList = baseMapper.selectListByParentId(parentId);
|
||||||
|
List<Long> deptIds = StreamUtils.toList(deptList, SysDept::getDeptId);
|
||||||
|
deptIds.add(parentId);
|
||||||
x.in(SysDept::getDeptId, deptIds);
|
x.in(SysDept::getDeptId, deptIds);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -403,24 +409,4 @@ public class SysDeptServiceImpl implements ISysDeptService, DeptService {
|
|||||||
return baseMapper.deleteById(deptId);
|
return baseMapper.deleteById(deptId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据部门 ID 列表查询部门名称映射关系
|
|
||||||
*
|
|
||||||
* @param deptIds 部门 ID 列表
|
|
||||||
* @return Map,其中 key 为部门 ID,value 为对应的部门名称
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Map<Long, String> selectDeptNamesByIds(List<Long> deptIds) {
|
|
||||||
if (CollUtil.isEmpty(deptIds)) {
|
|
||||||
return Collections.emptyMap();
|
|
||||||
}
|
|
||||||
List<SysDept> list = baseMapper.selectList(
|
|
||||||
new LambdaQueryWrapper<SysDept>()
|
|
||||||
.select(SysDept::getDeptId, SysDept::getDeptName)
|
|
||||||
.in(SysDept::getDeptId, deptIds)
|
|
||||||
);
|
|
||||||
return StreamUtils.toMap(list, SysDept::getDeptId, SysDept::getDeptName);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,13 +33,6 @@ public class SysDictDataServiceImpl implements ISysDictDataService {
|
|||||||
|
|
||||||
private final SysDictDataMapper baseMapper;
|
private final SysDictDataMapper baseMapper;
|
||||||
|
|
||||||
/**
|
|
||||||
* 分页查询字典数据列表
|
|
||||||
*
|
|
||||||
* @param dictData 查询条件
|
|
||||||
* @param pageQuery 分页参数
|
|
||||||
* @return 字典数据分页列表
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public TableDataInfo<SysDictDataVo> selectPageDictDataList(SysDictDataBo dictData, PageQuery pageQuery) {
|
public TableDataInfo<SysDictDataVo> selectPageDictDataList(SysDictDataBo dictData, PageQuery pageQuery) {
|
||||||
LambdaQueryWrapper<SysDictData> lqw = buildQueryWrapper(dictData);
|
LambdaQueryWrapper<SysDictData> lqw = buildQueryWrapper(dictData);
|
||||||
|
|||||||
@@ -48,13 +48,6 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService, DictService
|
|||||||
private final SysDictTypeMapper baseMapper;
|
private final SysDictTypeMapper baseMapper;
|
||||||
private final SysDictDataMapper dictDataMapper;
|
private final SysDictDataMapper dictDataMapper;
|
||||||
|
|
||||||
/**
|
|
||||||
* 分页查询字典类型列表
|
|
||||||
*
|
|
||||||
* @param dictType 查询条件
|
|
||||||
* @param pageQuery 分页参数
|
|
||||||
* @return 字典类型分页列表
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public TableDataInfo<SysDictTypeVo> selectPageDictTypeList(SysDictTypeBo dictType, PageQuery pageQuery) {
|
public TableDataInfo<SysDictTypeVo> selectPageDictTypeList(SysDictTypeBo dictType, PageQuery pageQuery) {
|
||||||
LambdaQueryWrapper<SysDictType> lqw = buildQueryWrapper(dictType);
|
LambdaQueryWrapper<SysDictType> lqw = buildQueryWrapper(dictType);
|
||||||
|
|||||||
@@ -108,13 +108,6 @@ public class SysLogininforServiceImpl implements ISysLogininforService {
|
|||||||
return "[" + msg.toString() + "]";
|
return "[" + msg.toString() + "]";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 分页查询登录日志列表
|
|
||||||
*
|
|
||||||
* @param logininfor 查询条件
|
|
||||||
* @param pageQuery 分页参数
|
|
||||||
* @return 登录日志分页列表
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public TableDataInfo<SysLogininforVo> selectPageLogininforList(SysLogininforBo logininfor, PageQuery pageQuery) {
|
public TableDataInfo<SysLogininforVo> selectPageLogininforList(SysLogininforBo logininfor, PageQuery pageQuery) {
|
||||||
Map<String, Object> params = logininfor.getParams();
|
Map<String, Object> params = logininfor.getParams();
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ import cn.hutool.core.convert.Convert;
|
|||||||
import cn.hutool.core.lang.tree.Tree;
|
import cn.hutool.core.lang.tree.Tree;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.dromara.common.core.constant.Constants;
|
import org.dromara.common.core.constant.Constants;
|
||||||
import org.dromara.common.core.constant.SystemConstants;
|
import org.dromara.common.core.constant.SystemConstants;
|
||||||
@@ -65,20 +67,29 @@ public class SysMenuServiceImpl implements ISysMenuService {
|
|||||||
@Override
|
@Override
|
||||||
public List<SysMenuVo> selectMenuList(SysMenuBo menu, Long userId) {
|
public List<SysMenuVo> selectMenuList(SysMenuBo menu, Long userId) {
|
||||||
List<SysMenuVo> menuList;
|
List<SysMenuVo> menuList;
|
||||||
LambdaQueryWrapper<SysMenu> wrapper = new LambdaQueryWrapper<>();
|
// 管理员显示所有菜单信息
|
||||||
// 管理员显示所有菜单信息 不是管理员 按用户id过滤菜单
|
if (LoginHelper.isSuperAdmin(userId)) {
|
||||||
if (!LoginHelper.isSuperAdmin(userId)) {
|
menuList = baseMapper.selectVoList(new LambdaQueryWrapper<SysMenu>()
|
||||||
// 通过用户id获取角色id 通过角色id获取菜单id 然后in菜单
|
.like(StringUtils.isNotBlank(menu.getMenuName()), SysMenu::getMenuName, menu.getMenuName())
|
||||||
wrapper.inSql(SysMenu::getMenuId, baseMapper.buildMenuByUserSql(userId));
|
|
||||||
}
|
|
||||||
menuList = baseMapper.selectVoList(
|
|
||||||
wrapper.like(StringUtils.isNotBlank(menu.getMenuName()), SysMenu::getMenuName, menu.getMenuName())
|
|
||||||
.eq(StringUtils.isNotBlank(menu.getVisible()), SysMenu::getVisible, menu.getVisible())
|
.eq(StringUtils.isNotBlank(menu.getVisible()), SysMenu::getVisible, menu.getVisible())
|
||||||
.eq(StringUtils.isNotBlank(menu.getStatus()), SysMenu::getStatus, menu.getStatus())
|
.eq(StringUtils.isNotBlank(menu.getStatus()), SysMenu::getStatus, menu.getStatus())
|
||||||
.eq(StringUtils.isNotBlank(menu.getMenuType()), SysMenu::getMenuType, menu.getMenuType())
|
.eq(StringUtils.isNotBlank(menu.getMenuType()), SysMenu::getMenuType, menu.getMenuType())
|
||||||
.eq(ObjectUtil.isNotNull(menu.getParentId()), SysMenu::getParentId, menu.getParentId())
|
.eq(ObjectUtil.isNotNull(menu.getParentId()), SysMenu::getParentId, menu.getParentId())
|
||||||
.orderByAsc(SysMenu::getParentId)
|
.orderByAsc(SysMenu::getParentId)
|
||||||
.orderByAsc(SysMenu::getOrderNum));
|
.orderByAsc(SysMenu::getOrderNum));
|
||||||
|
} else {
|
||||||
|
QueryWrapper<SysMenu> wrapper = Wrappers.query();
|
||||||
|
wrapper.inSql("r.role_id", "select role_id from sys_user_role where user_id = " + userId)
|
||||||
|
.like(StringUtils.isNotBlank(menu.getMenuName()), "m.menu_name", menu.getMenuName())
|
||||||
|
.eq(StringUtils.isNotBlank(menu.getVisible()), "m.visible", menu.getVisible())
|
||||||
|
.eq(StringUtils.isNotBlank(menu.getStatus()), "m.status", menu.getStatus())
|
||||||
|
.eq(StringUtils.isNotBlank(menu.getMenuType()), "m.menu_type", menu.getMenuType())
|
||||||
|
.eq(ObjectUtil.isNotNull(menu.getParentId()), "m.parent_id", menu.getParentId())
|
||||||
|
.orderByAsc("m.parent_id")
|
||||||
|
.orderByAsc("m.order_num");
|
||||||
|
List<SysMenu> list = baseMapper.selectMenuListByUserId(wrapper);
|
||||||
|
menuList = MapstructUtils.convert(list, SysMenuVo.class);
|
||||||
|
}
|
||||||
return menuList;
|
return menuList;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -90,7 +101,14 @@ public class SysMenuServiceImpl implements ISysMenuService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Set<String> selectMenuPermsByUserId(Long userId) {
|
public Set<String> selectMenuPermsByUserId(Long userId) {
|
||||||
return baseMapper.selectMenuPermsByUserId(userId);
|
List<String> perms = baseMapper.selectMenuPermsByUserId(userId);
|
||||||
|
Set<String> permsSet = new HashSet<>();
|
||||||
|
for (String perm : perms) {
|
||||||
|
if (StringUtils.isNotEmpty(perm)) {
|
||||||
|
permsSet.addAll(StringUtils.splitList(perm.trim()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return permsSet;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -101,7 +119,14 @@ public class SysMenuServiceImpl implements ISysMenuService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Set<String> selectMenuPermsByRoleId(Long roleId) {
|
public Set<String> selectMenuPermsByRoleId(Long roleId) {
|
||||||
return baseMapper.selectMenuPermsByRoleId(roleId);
|
List<String> perms = baseMapper.selectMenuPermsByRoleId(roleId);
|
||||||
|
Set<String> permsSet = new HashSet<>();
|
||||||
|
for (String perm : perms) {
|
||||||
|
if (StringUtils.isNotEmpty(perm)) {
|
||||||
|
permsSet.addAll(StringUtils.splitList(perm.trim()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return permsSet;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -116,13 +141,7 @@ public class SysMenuServiceImpl implements ISysMenuService {
|
|||||||
if (LoginHelper.isSuperAdmin(userId)) {
|
if (LoginHelper.isSuperAdmin(userId)) {
|
||||||
menus = baseMapper.selectMenuTreeAll();
|
menus = baseMapper.selectMenuTreeAll();
|
||||||
} else {
|
} else {
|
||||||
LambdaQueryWrapper<SysMenu> wrapper = new LambdaQueryWrapper<>();
|
menus = baseMapper.selectMenuTreeByUserId(userId);
|
||||||
menus = baseMapper.selectList(
|
|
||||||
wrapper.in(SysMenu::getMenuType, SystemConstants.TYPE_DIR, SystemConstants.TYPE_MENU)
|
|
||||||
.eq(SysMenu::getStatus, SystemConstants.NORMAL)
|
|
||||||
.inSql(SysMenu::getMenuId, baseMapper.buildMenuByUserSql(userId))
|
|
||||||
.orderByAsc(SysMenu::getParentId)
|
|
||||||
.orderByAsc(SysMenu::getOrderNum));
|
|
||||||
}
|
}
|
||||||
return getChildPerms(menus, Constants.TOP_PARENT_ID);
|
return getChildPerms(menus, Constants.TOP_PARENT_ID);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package org.dromara.system.service.impl;
|
|||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import org.dromara.common.core.utils.MapstructUtils;
|
import org.dromara.common.core.utils.MapstructUtils;
|
||||||
import org.dromara.common.core.utils.ObjectUtils;
|
import org.dromara.common.core.utils.ObjectUtils;
|
||||||
import org.dromara.common.core.utils.StringUtils;
|
import org.dromara.common.core.utils.StringUtils;
|
||||||
@@ -17,6 +16,7 @@ import org.dromara.system.domain.vo.SysUserVo;
|
|||||||
import org.dromara.system.mapper.SysNoticeMapper;
|
import org.dromara.system.mapper.SysNoticeMapper;
|
||||||
import org.dromara.system.mapper.SysUserMapper;
|
import org.dromara.system.mapper.SysUserMapper;
|
||||||
import org.dromara.system.service.ISysNoticeService;
|
import org.dromara.system.service.ISysNoticeService;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
@@ -34,13 +34,6 @@ public class SysNoticeServiceImpl implements ISysNoticeService {
|
|||||||
private final SysNoticeMapper baseMapper;
|
private final SysNoticeMapper baseMapper;
|
||||||
private final SysUserMapper userMapper;
|
private final SysUserMapper userMapper;
|
||||||
|
|
||||||
/**
|
|
||||||
* 分页查询通知公告列表
|
|
||||||
*
|
|
||||||
* @param notice 查询条件
|
|
||||||
* @param pageQuery 分页参数
|
|
||||||
* @return 通知公告分页列表
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public TableDataInfo<SysNoticeVo> selectPageNoticeList(SysNoticeBo notice, PageQuery pageQuery) {
|
public TableDataInfo<SysNoticeVo> selectPageNoticeList(SysNoticeBo notice, PageQuery pageQuery) {
|
||||||
LambdaQueryWrapper<SysNotice> lqw = buildQueryWrapper(notice);
|
LambdaQueryWrapper<SysNotice> lqw = buildQueryWrapper(notice);
|
||||||
|
|||||||
@@ -49,13 +49,6 @@ public class SysOperLogServiceImpl implements ISysOperLogService {
|
|||||||
insertOperlog(operLog);
|
insertOperlog(operLog);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 分页查询操作日志列表
|
|
||||||
*
|
|
||||||
* @param operLog 查询条件
|
|
||||||
* @param pageQuery 分页参数
|
|
||||||
* @return 操作日志分页列表
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public TableDataInfo<SysOperLogVo> selectPageOperLogList(SysOperLogBo operLog, PageQuery pageQuery) {
|
public TableDataInfo<SysOperLogVo> selectPageOperLogList(SysOperLogBo operLog, PageQuery pageQuery) {
|
||||||
LambdaQueryWrapper<SysOperLog> lqw = buildQueryWrapper(operLog);
|
LambdaQueryWrapper<SysOperLog> lqw = buildQueryWrapper(operLog);
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ import org.dromara.common.core.utils.SpringUtils;
|
|||||||
import org.dromara.common.core.utils.StreamUtils;
|
import org.dromara.common.core.utils.StreamUtils;
|
||||||
import org.dromara.common.core.utils.StringUtils;
|
import org.dromara.common.core.utils.StringUtils;
|
||||||
import org.dromara.common.core.utils.file.FileUtils;
|
import org.dromara.common.core.utils.file.FileUtils;
|
||||||
import org.dromara.common.json.utils.JsonUtils;
|
|
||||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||||
import org.dromara.common.oss.core.OssClient;
|
import org.dromara.common.oss.core.OssClient;
|
||||||
@@ -25,7 +24,6 @@ import org.dromara.common.oss.entity.UploadResult;
|
|||||||
import org.dromara.common.oss.enums.AccessPolicyType;
|
import org.dromara.common.oss.enums.AccessPolicyType;
|
||||||
import org.dromara.common.oss.factory.OssFactory;
|
import org.dromara.common.oss.factory.OssFactory;
|
||||||
import org.dromara.system.domain.SysOss;
|
import org.dromara.system.domain.SysOss;
|
||||||
import org.dromara.system.domain.SysOssExt;
|
|
||||||
import org.dromara.system.domain.bo.SysOssBo;
|
import org.dromara.system.domain.bo.SysOssBo;
|
||||||
import org.dromara.system.domain.vo.SysOssVo;
|
import org.dromara.system.domain.vo.SysOssVo;
|
||||||
import org.dromara.system.mapper.SysOssMapper;
|
import org.dromara.system.mapper.SysOssMapper;
|
||||||
@@ -201,11 +199,8 @@ public class SysOssServiceImpl implements ISysOssService, OssService {
|
|||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new ServiceException(e.getMessage());
|
throw new ServiceException(e.getMessage());
|
||||||
}
|
}
|
||||||
SysOssExt ext1 = new SysOssExt();
|
|
||||||
ext1.setFileSize(file.getSize());
|
|
||||||
ext1.setContentType(file.getContentType());
|
|
||||||
// 保存文件信息
|
// 保存文件信息
|
||||||
return buildResultEntity(originalfileName, suffix, storage.getConfigKey(), uploadResult, ext1);
|
return buildResultEntity(originalfileName, suffix, storage.getConfigKey(), uploadResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -220,21 +215,18 @@ public class SysOssServiceImpl implements ISysOssService, OssService {
|
|||||||
String suffix = StringUtils.substring(originalfileName, originalfileName.lastIndexOf("."), originalfileName.length());
|
String suffix = StringUtils.substring(originalfileName, originalfileName.lastIndexOf("."), originalfileName.length());
|
||||||
OssClient storage = OssFactory.instance();
|
OssClient storage = OssFactory.instance();
|
||||||
UploadResult uploadResult = storage.uploadSuffix(file, suffix);
|
UploadResult uploadResult = storage.uploadSuffix(file, suffix);
|
||||||
SysOssExt ext1 = new SysOssExt();
|
|
||||||
ext1.setFileSize(file.length());
|
|
||||||
// 保存文件信息
|
// 保存文件信息
|
||||||
return buildResultEntity(originalfileName, suffix, storage.getConfigKey(), uploadResult, ext1);
|
return buildResultEntity(originalfileName, suffix, storage.getConfigKey(), uploadResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
private SysOssVo buildResultEntity(String originalfileName, String suffix, String configKey, UploadResult uploadResult, SysOssExt ext1) {
|
private SysOssVo buildResultEntity(String originalfileName, String suffix, String configKey, UploadResult uploadResult) {
|
||||||
SysOss oss = new SysOss();
|
SysOss oss = new SysOss();
|
||||||
oss.setUrl(uploadResult.getUrl());
|
oss.setUrl(uploadResult.getUrl());
|
||||||
oss.setFileSuffix(suffix);
|
oss.setFileSuffix(suffix);
|
||||||
oss.setFileName(uploadResult.getFilename());
|
oss.setFileName(uploadResult.getFilename());
|
||||||
oss.setOriginalName(originalfileName);
|
oss.setOriginalName(originalfileName);
|
||||||
oss.setService(configKey);
|
oss.setService(configKey);
|
||||||
oss.setExt1(JsonUtils.toJsonString(ext1));
|
|
||||||
baseMapper.insert(oss);
|
baseMapper.insert(oss);
|
||||||
SysOssVo sysOssVo = MapstructUtils.convert(oss, SysOssVo.class);
|
SysOssVo sysOssVo = MapstructUtils.convert(oss, SysOssVo.class);
|
||||||
return this.matchingUrl(sysOssVo);
|
return this.matchingUrl(sysOssVo);
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import org.dromara.common.core.utils.StreamUtils;
|
|||||||
import org.dromara.common.core.utils.StringUtils;
|
import org.dromara.common.core.utils.StringUtils;
|
||||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||||
|
import org.dromara.system.domain.SysDept;
|
||||||
import org.dromara.system.domain.SysPost;
|
import org.dromara.system.domain.SysPost;
|
||||||
import org.dromara.system.domain.SysUserPost;
|
import org.dromara.system.domain.SysUserPost;
|
||||||
import org.dromara.system.domain.bo.SysPostBo;
|
import org.dromara.system.domain.bo.SysPostBo;
|
||||||
@@ -24,7 +25,7 @@ import org.dromara.system.mapper.SysUserPostMapper;
|
|||||||
import org.dromara.system.service.ISysPostService;
|
import org.dromara.system.service.ISysPostService;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@@ -41,13 +42,6 @@ public class SysPostServiceImpl implements ISysPostService, PostService {
|
|||||||
private final SysDeptMapper deptMapper;
|
private final SysDeptMapper deptMapper;
|
||||||
private final SysUserPostMapper userPostMapper;
|
private final SysUserPostMapper userPostMapper;
|
||||||
|
|
||||||
/**
|
|
||||||
* 分页查询岗位列表
|
|
||||||
*
|
|
||||||
* @param post 查询条件
|
|
||||||
* @param pageQuery 分页参数
|
|
||||||
* @return 岗位分页列表
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public TableDataInfo<SysPostVo> selectPagePostList(SysPostBo post, PageQuery pageQuery) {
|
public TableDataInfo<SysPostVo> selectPagePostList(SysPostBo post, PageQuery pageQuery) {
|
||||||
Page<SysPostVo> page = baseMapper.selectPagePostList(pageQuery.build(), buildQueryWrapper(post));
|
Page<SysPostVo> page = baseMapper.selectPagePostList(pageQuery.build(), buildQueryWrapper(post));
|
||||||
@@ -98,7 +92,9 @@ public class SysPostServiceImpl implements ISysPostService, PostService {
|
|||||||
} else if (ObjectUtil.isNotNull(bo.getBelongDeptId())) {
|
} else if (ObjectUtil.isNotNull(bo.getBelongDeptId())) {
|
||||||
//部门树搜索
|
//部门树搜索
|
||||||
wrapper.and(x -> {
|
wrapper.and(x -> {
|
||||||
List<Long> deptIds = deptMapper.selectDeptAndChildById(bo.getBelongDeptId());
|
List<SysDept> deptList = deptMapper.selectListByParentId(bo.getBelongDeptId());
|
||||||
|
List<Long> deptIds = StreamUtils.toList(deptList, SysDept::getDeptId);
|
||||||
|
deptIds.add(bo.getBelongDeptId());
|
||||||
x.in(SysPost::getDeptId, deptIds);
|
x.in(SysPost::getDeptId, deptIds);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -221,14 +217,14 @@ public class SysPostServiceImpl implements ISysPostService, PostService {
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int deletePostByIds(List<Long> postIds) {
|
public int deletePostByIds(Long[] postIds) {
|
||||||
List<SysPost> list = baseMapper.selectByIds(postIds);
|
for (Long postId : postIds) {
|
||||||
for (SysPost post : list) {
|
SysPost post = baseMapper.selectById(postId);
|
||||||
if (this.countUserPostById(post.getPostId()) > 0) {
|
if (countUserPostById(postId) > 0) {
|
||||||
throw new ServiceException(String.format("%1$s已分配,不能删除!", post.getPostName()));
|
throw new ServiceException(String.format("%1$s已分配,不能删除!", post.getPostName()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return baseMapper.deleteByIds(postIds);
|
return baseMapper.deleteByIds(Arrays.asList(postIds));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -255,23 +251,4 @@ public class SysPostServiceImpl implements ISysPostService, PostService {
|
|||||||
return baseMapper.updateById(post);
|
return baseMapper.updateById(post);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据岗位 ID 列表查询岗位名称映射关系
|
|
||||||
*
|
|
||||||
* @param postIds 岗位 ID 列表
|
|
||||||
* @return Map,其中 key 为岗位 ID,value 为对应的岗位名称
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Map<Long, String> selectPostNamesByIds(List<Long> postIds) {
|
|
||||||
if (CollUtil.isEmpty(postIds)) {
|
|
||||||
return Collections.emptyMap();
|
|
||||||
}
|
|
||||||
List<SysPost> list = baseMapper.selectList(
|
|
||||||
new LambdaQueryWrapper<SysPost>()
|
|
||||||
.select(SysPost::getPostId, SysPost::getPostName)
|
|
||||||
.in(SysPost::getPostId, postIds)
|
|
||||||
);
|
|
||||||
return StreamUtils.toMap(list, SysPost::getPostId, SysPost::getPostName);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import cn.hutool.core.collection.CollUtil;
|
|||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
@@ -54,13 +55,6 @@ public class SysRoleServiceImpl implements ISysRoleService, RoleService {
|
|||||||
private final SysUserRoleMapper userRoleMapper;
|
private final SysUserRoleMapper userRoleMapper;
|
||||||
private final SysRoleDeptMapper roleDeptMapper;
|
private final SysRoleDeptMapper roleDeptMapper;
|
||||||
|
|
||||||
/**
|
|
||||||
* 分页查询角色列表
|
|
||||||
*
|
|
||||||
* @param role 查询条件
|
|
||||||
* @param pageQuery 分页参数
|
|
||||||
* @return 角色分页列表
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public TableDataInfo<SysRoleVo> selectPageRoleList(SysRoleBo role, PageQuery pageQuery) {
|
public TableDataInfo<SysRoleVo> selectPageRoleList(SysRoleBo role, PageQuery pageQuery) {
|
||||||
Page<SysRoleVo> page = baseMapper.selectPageRoleList(pageQuery.build(), this.buildQueryWrapper(role));
|
Page<SysRoleVo> page = baseMapper.selectPageRoleList(pageQuery.build(), this.buildQueryWrapper(role));
|
||||||
@@ -68,7 +62,7 @@ public class SysRoleServiceImpl implements ISysRoleService, RoleService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据条件查询角色数据
|
* 根据条件分页查询角色数据
|
||||||
*
|
*
|
||||||
* @param role 角色信息
|
* @param role 角色信息
|
||||||
* @return 角色数据集合信息
|
* @return 角色数据集合信息
|
||||||
@@ -80,14 +74,15 @@ public class SysRoleServiceImpl implements ISysRoleService, RoleService {
|
|||||||
|
|
||||||
private Wrapper<SysRole> buildQueryWrapper(SysRoleBo bo) {
|
private Wrapper<SysRole> buildQueryWrapper(SysRoleBo bo) {
|
||||||
Map<String, Object> params = bo.getParams();
|
Map<String, Object> params = bo.getParams();
|
||||||
LambdaQueryWrapper<SysRole> wrapper = Wrappers.lambdaQuery();
|
QueryWrapper<SysRole> wrapper = Wrappers.query();
|
||||||
wrapper.eq(ObjectUtil.isNotNull(bo.getRoleId()), SysRole::getRoleId, bo.getRoleId())
|
wrapper.eq("r.del_flag", SystemConstants.NORMAL)
|
||||||
.like(StringUtils.isNotBlank(bo.getRoleName()), SysRole::getRoleName, bo.getRoleName())
|
.eq(ObjectUtil.isNotNull(bo.getRoleId()), "r.role_id", bo.getRoleId())
|
||||||
.eq(StringUtils.isNotBlank(bo.getStatus()), SysRole::getStatus, bo.getStatus())
|
.like(StringUtils.isNotBlank(bo.getRoleName()), "r.role_name", bo.getRoleName())
|
||||||
.like(StringUtils.isNotBlank(bo.getRoleKey()), SysRole::getRoleKey, bo.getRoleKey())
|
.eq(StringUtils.isNotBlank(bo.getStatus()), "r.status", bo.getStatus())
|
||||||
|
.like(StringUtils.isNotBlank(bo.getRoleKey()), "r.role_key", bo.getRoleKey())
|
||||||
.between(params.get("beginTime") != null && params.get("endTime") != null,
|
.between(params.get("beginTime") != null && params.get("endTime") != null,
|
||||||
SysRole::getCreateTime, params.get("beginTime"), params.get("endTime"))
|
"r.create_time", params.get("beginTime"), params.get("endTime"))
|
||||||
.orderByAsc(SysRole::getRoleSort).orderByAsc(SysRole::getCreateTime);
|
.orderByAsc("r.role_sort").orderByAsc("r.create_time");
|
||||||
return wrapper;
|
return wrapper;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -181,9 +176,9 @@ public class SysRoleServiceImpl implements ISysRoleService, RoleService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<SysRoleVo> selectRoleByIds(List<Long> roleIds) {
|
public List<SysRoleVo> selectRoleByIds(List<Long> roleIds) {
|
||||||
return baseMapper.selectRoleList(new LambdaQueryWrapper<SysRole>()
|
return baseMapper.selectRoleList(new QueryWrapper<SysRole>()
|
||||||
.eq(SysRole::getStatus, SystemConstants.NORMAL)
|
.eq("r.status", SystemConstants.NORMAL)
|
||||||
.in(CollUtil.isNotEmpty(roleIds), SysRole::getRoleId, roleIds));
|
.in(CollUtil.isNotEmpty(roleIds), "r.role_id", roleIds));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -254,23 +249,14 @@ public class SysRoleServiceImpl implements ISysRoleService, RoleService {
|
|||||||
if (ObjectUtil.isNull(roleId)) {
|
if (ObjectUtil.isNull(roleId)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.checkRoleDataScope(Collections.singletonList(roleId));
|
if (LoginHelper.isSuperAdmin()) {
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 校验角色是否有数据权限
|
|
||||||
*
|
|
||||||
* @param roleIds 角色ID列表(支持传单个ID)
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void checkRoleDataScope(List<Long> roleIds) {
|
|
||||||
if (CollUtil.isEmpty(roleIds) || LoginHelper.isSuperAdmin()) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
long count = baseMapper.selectRoleCount(roleIds);
|
List<SysRoleVo> roles = this.selectRoleList(new SysRoleBo(roleId));
|
||||||
if (count != roleIds.size()) {
|
if (CollUtil.isEmpty(roles)) {
|
||||||
throw new ServiceException("没有权限访问部分角色数据!");
|
throw new ServiceException("没有权限访问角色数据!");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -373,7 +359,7 @@ public class SysRoleServiceImpl implements ISysRoleService, RoleService {
|
|||||||
rm.setMenuId(menuId);
|
rm.setMenuId(menuId);
|
||||||
list.add(rm);
|
list.add(rm);
|
||||||
}
|
}
|
||||||
if (CollUtil.isNotEmpty(list)) {
|
if (list.size() > 0) {
|
||||||
rows = roleMenuMapper.insertBatch(list) ? list.size() : 0;
|
rows = roleMenuMapper.insertBatch(list) ? list.size() : 0;
|
||||||
}
|
}
|
||||||
return rows;
|
return rows;
|
||||||
@@ -394,7 +380,7 @@ public class SysRoleServiceImpl implements ISysRoleService, RoleService {
|
|||||||
rd.setDeptId(deptId);
|
rd.setDeptId(deptId);
|
||||||
list.add(rd);
|
list.add(rd);
|
||||||
}
|
}
|
||||||
if (CollUtil.isNotEmpty(list)) {
|
if (list.size() > 0) {
|
||||||
rows = roleDeptMapper.insertBatch(list) ? list.size() : 0;
|
rows = roleDeptMapper.insertBatch(list) ? list.size() : 0;
|
||||||
}
|
}
|
||||||
return rows;
|
return rows;
|
||||||
@@ -426,20 +412,21 @@ public class SysRoleServiceImpl implements ISysRoleService, RoleService {
|
|||||||
@CacheEvict(cacheNames = CacheNames.SYS_ROLE_CUSTOM, allEntries = true)
|
@CacheEvict(cacheNames = CacheNames.SYS_ROLE_CUSTOM, allEntries = true)
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public int deleteRoleByIds(List<Long> roleIds) {
|
public int deleteRoleByIds(Long[] roleIds) {
|
||||||
this.checkRoleDataScope(roleIds);
|
for (Long roleId : roleIds) {
|
||||||
List<SysRole> roles = baseMapper.selectByIds(roleIds);
|
SysRole role = baseMapper.selectById(roleId);
|
||||||
for (SysRole role : roles) {
|
|
||||||
checkRoleAllowed(BeanUtil.toBean(role, SysRoleBo.class));
|
checkRoleAllowed(BeanUtil.toBean(role, SysRoleBo.class));
|
||||||
if (countUserRoleByRoleId(role.getRoleId()) > 0) {
|
checkRoleDataScope(roleId);
|
||||||
|
if (countUserRoleByRoleId(roleId) > 0) {
|
||||||
throw new ServiceException(String.format("%1$s已分配,不能删除!", role.getRoleName()));
|
throw new ServiceException(String.format("%1$s已分配,不能删除!", role.getRoleName()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
List<Long> ids = Arrays.asList(roleIds);
|
||||||
// 删除角色与菜单关联
|
// 删除角色与菜单关联
|
||||||
roleMenuMapper.delete(new LambdaQueryWrapper<SysRoleMenu>().in(SysRoleMenu::getRoleId, roleIds));
|
roleMenuMapper.delete(new LambdaQueryWrapper<SysRoleMenu>().in(SysRoleMenu::getRoleId, ids));
|
||||||
// 删除角色与部门关联
|
// 删除角色与部门关联
|
||||||
roleDeptMapper.delete(new LambdaQueryWrapper<SysRoleDept>().in(SysRoleDept::getRoleId, roleIds));
|
roleDeptMapper.delete(new LambdaQueryWrapper<SysRoleDept>().in(SysRoleDept::getRoleId, ids));
|
||||||
return baseMapper.deleteByIds(roleIds);
|
return baseMapper.deleteByIds(ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -450,9 +437,6 @@ public class SysRoleServiceImpl implements ISysRoleService, RoleService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int deleteAuthUser(SysUserRole userRole) {
|
public int deleteAuthUser(SysUserRole userRole) {
|
||||||
if (LoginHelper.getUserId().equals(userRole.getUserId())) {
|
|
||||||
throw new ServiceException("不允许修改当前用户角色!");
|
|
||||||
}
|
|
||||||
int rows = userRoleMapper.delete(new LambdaQueryWrapper<SysUserRole>()
|
int rows = userRoleMapper.delete(new LambdaQueryWrapper<SysUserRole>()
|
||||||
.eq(SysUserRole::getRoleId, userRole.getRoleId())
|
.eq(SysUserRole::getRoleId, userRole.getRoleId())
|
||||||
.eq(SysUserRole::getUserId, userRole.getUserId()));
|
.eq(SysUserRole::getUserId, userRole.getUserId()));
|
||||||
@@ -472,9 +456,6 @@ public class SysRoleServiceImpl implements ISysRoleService, RoleService {
|
|||||||
@Override
|
@Override
|
||||||
public int deleteAuthUsers(Long roleId, Long[] userIds) {
|
public int deleteAuthUsers(Long roleId, Long[] userIds) {
|
||||||
List<Long> ids = List.of(userIds);
|
List<Long> ids = List.of(userIds);
|
||||||
if (ids.contains(LoginHelper.getUserId())) {
|
|
||||||
throw new ServiceException("不允许修改当前用户角色!");
|
|
||||||
}
|
|
||||||
int rows = userRoleMapper.delete(new LambdaQueryWrapper<SysUserRole>()
|
int rows = userRoleMapper.delete(new LambdaQueryWrapper<SysUserRole>()
|
||||||
.eq(SysUserRole::getRoleId, roleId)
|
.eq(SysUserRole::getRoleId, roleId)
|
||||||
.in(SysUserRole::getUserId, ids));
|
.in(SysUserRole::getUserId, ids));
|
||||||
@@ -496,9 +477,6 @@ public class SysRoleServiceImpl implements ISysRoleService, RoleService {
|
|||||||
// 新增用户与角色管理
|
// 新增用户与角色管理
|
||||||
int rows = 1;
|
int rows = 1;
|
||||||
List<Long> ids = List.of(userIds);
|
List<Long> ids = List.of(userIds);
|
||||||
if (ids.contains(LoginHelper.getUserId())) {
|
|
||||||
throw new ServiceException("不允许修改当前用户角色!");
|
|
||||||
}
|
|
||||||
List<SysUserRole> list = StreamUtils.toList(ids, userId -> {
|
List<SysUserRole> list = StreamUtils.toList(ids, userId -> {
|
||||||
SysUserRole ur = new SysUserRole();
|
SysUserRole ur = new SysUserRole();
|
||||||
ur.setUserId(userId);
|
ur.setUserId(userId);
|
||||||
@@ -514,17 +492,6 @@ public class SysRoleServiceImpl implements ISysRoleService, RoleService {
|
|||||||
return rows;
|
return rows;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据角色ID清除该角色关联的所有在线用户的登录状态(踢出在线用户)
|
|
||||||
*
|
|
||||||
* <p>
|
|
||||||
* 先判断角色是否绑定用户,若无绑定则直接返回
|
|
||||||
* 然后遍历当前所有在线Token,查找拥有该角色的用户并强制登出
|
|
||||||
* 注意:在线用户量过大时,操作可能导致 Redis 阻塞,需谨慎调用
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @param roleId 角色ID
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void cleanOnlineUserByRole(Long roleId) {
|
public void cleanOnlineUserByRole(Long roleId) {
|
||||||
// 如果角色未绑定用户 直接返回
|
// 如果角色未绑定用户 直接返回
|
||||||
@@ -556,16 +523,6 @@ public class SysRoleServiceImpl implements ISysRoleService, RoleService {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据用户ID列表清除对应在线用户的登录状态(踢出指定用户)
|
|
||||||
*
|
|
||||||
* <p>
|
|
||||||
* 遍历当前所有在线Token,匹配用户ID列表中的用户,强制登出
|
|
||||||
* 注意:在线用户量过大时,操作可能导致 Redis 阻塞,需谨慎调用
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @param userIds 需要清除的用户ID列表
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void cleanOnlineUser(List<Long> userIds) {
|
public void cleanOnlineUser(List<Long> userIds) {
|
||||||
List<String> keys = StpUtil.searchTokenValue("", 0, -1, false);
|
List<String> keys = StpUtil.searchTokenValue("", 0, -1, false);
|
||||||
@@ -592,23 +549,4 @@ public class SysRoleServiceImpl implements ISysRoleService, RoleService {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据角色 ID 列表查询角色名称映射关系
|
|
||||||
*
|
|
||||||
* @param roleIds 角色 ID 列表
|
|
||||||
* @return Map,其中 key 为角色 ID,value 为对应的角色名称
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Map<Long, String> selectRoleNamesByIds(List<Long> roleIds) {
|
|
||||||
if (CollUtil.isEmpty(roleIds)) {
|
|
||||||
return Collections.emptyMap();
|
|
||||||
}
|
|
||||||
List<SysRole> list = baseMapper.selectList(
|
|
||||||
new LambdaQueryWrapper<SysRole>()
|
|
||||||
.select(SysRole::getRoleId, SysRole::getRoleName)
|
|
||||||
.in(SysRole::getRoleId, roleIds)
|
|
||||||
);
|
|
||||||
return StreamUtils.toMap(list, SysRole::getRoleId, SysRole::getRoleName);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ public class SysTaskAssigneeServiceImpl implements TaskAssigneeService {
|
|||||||
TableDataInfo<SysRoleVo> page = roleService.selectPageRoleList(bo, pageQuery);
|
TableDataInfo<SysRoleVo> page = roleService.selectPageRoleList(bo, pageQuery);
|
||||||
// 使用封装的字段映射方法进行转换
|
// 使用封装的字段映射方法进行转换
|
||||||
List<TaskAssigneeDTO.TaskHandler> handlers = TaskAssigneeDTO.convertToHandlerList(page.getRows(),
|
List<TaskAssigneeDTO.TaskHandler> handlers = TaskAssigneeDTO.convertToHandlerList(page.getRows(),
|
||||||
item -> String.valueOf(item.getRoleId()), SysRoleVo::getRoleKey, SysRoleVo::getRoleName, null, SysRoleVo::getCreateTime);
|
SysRoleVo::getRoleId, SysRoleVo::getRoleKey, SysRoleVo::getRoleName, null, SysRoleVo::getCreateTime);
|
||||||
return new TaskAssigneeDTO(page.getTotal(), handlers);
|
return new TaskAssigneeDTO(page.getTotal(), handlers);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -83,7 +83,7 @@ public class SysTaskAssigneeServiceImpl implements TaskAssigneeService {
|
|||||||
TableDataInfo<SysPostVo> page = postService.selectPagePostList(bo, pageQuery);
|
TableDataInfo<SysPostVo> page = postService.selectPagePostList(bo, pageQuery);
|
||||||
// 使用封装的字段映射方法进行转换
|
// 使用封装的字段映射方法进行转换
|
||||||
List<TaskAssigneeDTO.TaskHandler> handlers = TaskAssigneeDTO.convertToHandlerList(page.getRows(),
|
List<TaskAssigneeDTO.TaskHandler> handlers = TaskAssigneeDTO.convertToHandlerList(page.getRows(),
|
||||||
p -> String.valueOf(p.getPostId()), SysPostVo::getPostCategory, SysPostVo::getPostName, SysPostVo::getDeptId, SysPostVo::getCreateTime);
|
SysPostVo::getPostId, SysPostVo::getPostCategory, SysPostVo::getPostName, SysPostVo::getDeptId, SysPostVo::getCreateTime);
|
||||||
return new TaskAssigneeDTO(page.getTotal(), handlers);
|
return new TaskAssigneeDTO(page.getTotal(), handlers);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -107,7 +107,7 @@ public class SysTaskAssigneeServiceImpl implements TaskAssigneeService {
|
|||||||
TableDataInfo<SysDeptVo> page = deptService.selectPageDeptList(bo, pageQuery);
|
TableDataInfo<SysDeptVo> page = deptService.selectPageDeptList(bo, pageQuery);
|
||||||
// 使用封装的字段映射方法进行转换
|
// 使用封装的字段映射方法进行转换
|
||||||
List<TaskAssigneeDTO.TaskHandler> handlers = TaskAssigneeDTO.convertToHandlerList(page.getRows(),
|
List<TaskAssigneeDTO.TaskHandler> handlers = TaskAssigneeDTO.convertToHandlerList(page.getRows(),
|
||||||
d -> String.valueOf(d.getDeptId()), SysDeptVo::getDeptCategory, SysDeptVo::getDeptName, SysDeptVo::getParentId, SysDeptVo::getCreateTime);
|
SysDeptVo::getDeptId, SysDeptVo::getDeptCategory, SysDeptVo::getDeptName, SysDeptVo::getParentId, SysDeptVo::getCreateTime);
|
||||||
return new TaskAssigneeDTO(page.getTotal(), handlers);
|
return new TaskAssigneeDTO(page.getTotal(), handlers);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -131,7 +131,7 @@ public class SysTaskAssigneeServiceImpl implements TaskAssigneeService {
|
|||||||
TableDataInfo<SysUserVo> page = userService.selectPageUserList(bo, pageQuery);
|
TableDataInfo<SysUserVo> page = userService.selectPageUserList(bo, pageQuery);
|
||||||
// 使用封装的字段映射方法进行转换
|
// 使用封装的字段映射方法进行转换
|
||||||
List<TaskAssigneeDTO.TaskHandler> handlers = TaskAssigneeDTO.convertToHandlerList(page.getRows(),
|
List<TaskAssigneeDTO.TaskHandler> handlers = TaskAssigneeDTO.convertToHandlerList(page.getRows(),
|
||||||
u -> String.valueOf(u.getUserId()), SysUserVo::getUserName, SysUserVo::getNickName, SysUserVo::getDeptId, SysUserVo::getCreateTime);
|
SysUserVo::getUserId, SysUserVo::getUserName, SysUserVo::getNickName, SysUserVo::getDeptId, SysUserVo::getCreateTime);
|
||||||
return new TaskAssigneeDTO(page.getTotal(), handlers);
|
return new TaskAssigneeDTO(page.getTotal(), handlers);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -414,15 +414,12 @@ public class SysTenantServiceImpl implements ISysTenantService {
|
|||||||
dictTypeList.addAll(dictTypeMapper.selectList());
|
dictTypeList.addAll(dictTypeMapper.selectList());
|
||||||
dictDataList.addAll(dictDataMapper.selectList());
|
dictDataList.addAll(dictDataMapper.selectList());
|
||||||
});
|
});
|
||||||
// 所有租户字典类型
|
Map<String, List<SysDictType>> typeMap = StreamUtils.groupByKey(dictTypeList, TenantEntity::getTenantId);
|
||||||
Map<String, List<SysDictType>> dictTypeMap = StreamUtils.groupByKey(dictTypeList, TenantEntity::getTenantId);
|
Map<String, Map<String, List<SysDictData>>> typeDataMap = StreamUtils.groupBy2Key(
|
||||||
// 所有租户字典数据
|
dictDataList, TenantEntity::getTenantId, SysDictData::getDictType);
|
||||||
Map<String, Map<String, List<SysDictData>>> dictDataMap = StreamUtils.groupBy2Key(dictDataList, TenantEntity::getTenantId, SysDictData::getDictType);
|
// 管理租户字典数据
|
||||||
|
List<SysDictType> defaultTypeMap = typeMap.get(TenantConstants.DEFAULT_TENANT_ID);
|
||||||
// 默认租户字典类型列表
|
Map<String, List<SysDictData>> defaultTypeDataMap = typeDataMap.get(TenantConstants.DEFAULT_TENANT_ID);
|
||||||
List<SysDictType> defaultDictTypeList = dictTypeMap.get(TenantConstants.DEFAULT_TENANT_ID);
|
|
||||||
// 默认租户字典数据
|
|
||||||
Map<String, List<SysDictData>> defaultDictDataMap = dictDataMap.get(TenantConstants.DEFAULT_TENANT_ID);
|
|
||||||
|
|
||||||
// 获取所有租户编号
|
// 获取所有租户编号
|
||||||
List<String> tenantIds = baseMapper.selectObjs(
|
List<String> tenantIds = baseMapper.selectObjs(
|
||||||
@@ -430,67 +427,57 @@ public class SysTenantServiceImpl implements ISysTenantService {
|
|||||||
.eq(SysTenant::getStatus, SystemConstants.NORMAL), x -> {
|
.eq(SysTenant::getStatus, SystemConstants.NORMAL), x -> {
|
||||||
return Convert.toStr(x);
|
return Convert.toStr(x);
|
||||||
});
|
});
|
||||||
// 待入库的字典类型和字典数据
|
|
||||||
List<SysDictType> saveTypeList = new ArrayList<>();
|
List<SysDictType> saveTypeList = new ArrayList<>();
|
||||||
List<SysDictData> saveDataList = new ArrayList<>();
|
List<SysDictData> saveDataList = new ArrayList<>();
|
||||||
// 待同步的租户编号(用于清除对于租户的字典缓存)
|
Set<String> set = new HashSet<>();
|
||||||
Set<String> syncTenantIds = new HashSet<>();
|
|
||||||
// 循环所有租户,处理需要同步的数据
|
|
||||||
for (String tenantId : tenantIds) {
|
for (String tenantId : tenantIds) {
|
||||||
// 排除默认租户
|
|
||||||
if (TenantConstants.DEFAULT_TENANT_ID.equals(tenantId)) {
|
if (TenantConstants.DEFAULT_TENANT_ID.equals(tenantId)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// 根据默认租户的字典类型进行数据同步
|
for (SysDictType dictType : defaultTypeMap) {
|
||||||
for (SysDictType dictType : defaultDictTypeList) {
|
List<String> typeList = StreamUtils.toList(typeMap.get(tenantId), SysDictType::getDictType);
|
||||||
// 获取当前租户的字典类型列表
|
List<SysDictData> dataList = defaultTypeDataMap.get(dictType.getDictType());
|
||||||
List<String> typeList = StreamUtils.toList(dictTypeMap.get(tenantId), SysDictType::getDictType);
|
|
||||||
// 根据字典类型获取默认租户的字典数据
|
|
||||||
List<SysDictData> defaultDictDataList = defaultDictDataMap.get(dictType.getDictType());
|
|
||||||
// 排除不需要同步的字典数据
|
|
||||||
Set<String> excludeDictDataSet = CollUtil.newHashSet();
|
|
||||||
// 处理 存在type不存在data 的情况
|
|
||||||
if (typeList.contains(dictType.getDictType())) {
|
if (typeList.contains(dictType.getDictType())) {
|
||||||
// 获取租户字典数据
|
List<SysDictData> dataListTenant = typeDataMap.get(tenantId).get(dictType.getDictType());
|
||||||
Optional.ofNullable(dictDataMap.get(tenantId))
|
Map<String, SysDictData> map = StreamUtils.toIdentityMap(dataListTenant, SysDictData::getDictValue);
|
||||||
// 获取租户当前字典类型的字典数据
|
for (SysDictData dictData : dataList) {
|
||||||
.map(tenantDictDataMap -> tenantDictDataMap.get(dictType.getDictType()))
|
if (!map.containsKey(dictData.getDictValue())) {
|
||||||
// 保存字典数据项的字典键值,用于判断数据是否需要同步
|
SysDictData data = BeanUtil.toBean(dictData, SysDictData.class);
|
||||||
.map(data -> StreamUtils.toSet(data, SysDictData::getDictValue))
|
// 设置字典编码为 null
|
||||||
// 添加到排除集合中
|
data.setDictCode(null);
|
||||||
.ifPresent(excludeDictDataSet::addAll);
|
data.setTenantId(tenantId);
|
||||||
|
data.setCreateTime(null);
|
||||||
|
data.setUpdateTime(null);
|
||||||
|
data.setCreateDept(null);
|
||||||
|
data.setCreateBy(null);
|
||||||
|
data.setUpdateBy(null);
|
||||||
|
set.add(tenantId);
|
||||||
|
saveDataList.add(data);
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// 同步字典类型
|
|
||||||
SysDictType type = BeanUtil.toBean(dictType, SysDictType.class);
|
SysDictType type = BeanUtil.toBean(dictType, SysDictType.class);
|
||||||
type.setDictId(null);
|
type.setDictId(null);
|
||||||
type.setTenantId(tenantId);
|
type.setTenantId(tenantId);
|
||||||
type.setCreateTime(null);
|
type.setCreateTime(null);
|
||||||
type.setUpdateTime(null);
|
type.setUpdateTime(null);
|
||||||
syncTenantIds.add(tenantId);
|
set.add(tenantId);
|
||||||
saveTypeList.add(type);
|
saveTypeList.add(type);
|
||||||
}
|
if (CollUtil.isNotEmpty(dataList)) {
|
||||||
|
// 筛选出 dictType 对应的 data
|
||||||
// 默认租户字典数据不为空再去处理
|
for (SysDictData dictData : dataList) {
|
||||||
if (CollUtil.isNotEmpty(defaultDictDataList)) {
|
SysDictData data = BeanUtil.toBean(dictData, SysDictData.class);
|
||||||
// 提前优化排除判断if条件语句,对于 && 并联条件,该优化可以避免不必要的 excludeDictDataSet.contains() 函数调用
|
// 设置字典编码为 null
|
||||||
boolean isExclude = CollUtil.isNotEmpty(excludeDictDataSet);
|
data.setDictCode(null);
|
||||||
// 筛选出 dictType 对应的 data
|
data.setTenantId(tenantId);
|
||||||
for (SysDictData dictData : defaultDictDataList) {
|
data.setCreateTime(null);
|
||||||
// 排除不需要同步的字典数据
|
data.setUpdateTime(null);
|
||||||
if (isExclude && excludeDictDataSet.contains(dictData.getDictValue())) {
|
data.setCreateDept(null);
|
||||||
continue;
|
data.setCreateBy(null);
|
||||||
|
data.setUpdateBy(null);
|
||||||
|
set.add(tenantId);
|
||||||
|
saveDataList.add(data);
|
||||||
}
|
}
|
||||||
SysDictData data = BeanUtil.toBean(dictData, SysDictData.class);
|
|
||||||
// 设置字典编码为 null
|
|
||||||
data.setDictCode(null);
|
|
||||||
data.setTenantId(tenantId);
|
|
||||||
data.setCreateTime(null);
|
|
||||||
data.setUpdateTime(null);
|
|
||||||
data.setCreateDept(null);
|
|
||||||
data.setCreateBy(null);
|
|
||||||
data.setUpdateBy(null);
|
|
||||||
syncTenantIds.add(tenantId);
|
|
||||||
saveDataList.add(data);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -503,7 +490,7 @@ public class SysTenantServiceImpl implements ISysTenantService {
|
|||||||
dictDataMapper.insertBatch(saveDataList);
|
dictDataMapper.insertBatch(saveDataList);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
for (String tenantId : syncTenantIds) {
|
for (String tenantId : set) {
|
||||||
TenantHelper.dynamic(tenantId, () -> CacheUtils.clear(CacheNames.SYS_DICT));
|
TenantHelper.dynamic(tenantId, () -> CacheUtils.clear(CacheNames.SYS_DICT));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,9 +22,7 @@ import org.dromara.common.core.utils.*;
|
|||||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||||
import org.dromara.common.satoken.utils.LoginHelper;
|
import org.dromara.common.satoken.utils.LoginHelper;
|
||||||
import org.dromara.system.domain.SysUser;
|
import org.dromara.system.domain.*;
|
||||||
import org.dromara.system.domain.SysUserPost;
|
|
||||||
import org.dromara.system.domain.SysUserRole;
|
|
||||||
import org.dromara.system.domain.bo.SysUserBo;
|
import org.dromara.system.domain.bo.SysUserBo;
|
||||||
import org.dromara.system.domain.vo.SysPostVo;
|
import org.dromara.system.domain.vo.SysPostVo;
|
||||||
import org.dromara.system.domain.vo.SysRoleVo;
|
import org.dromara.system.domain.vo.SysRoleVo;
|
||||||
@@ -38,6 +36,7 @@ import org.springframework.stereotype.Service;
|
|||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户 业务层处理
|
* 用户 业务层处理
|
||||||
@@ -80,8 +79,10 @@ public class SysUserServiceImpl implements ISysUserService, UserService {
|
|||||||
.between(params.get("beginTime") != null && params.get("endTime") != null,
|
.between(params.get("beginTime") != null && params.get("endTime") != null,
|
||||||
"u.create_time", params.get("beginTime"), params.get("endTime"))
|
"u.create_time", params.get("beginTime"), params.get("endTime"))
|
||||||
.and(ObjectUtil.isNotNull(user.getDeptId()), w -> {
|
.and(ObjectUtil.isNotNull(user.getDeptId()), w -> {
|
||||||
List<Long> deptIds = deptMapper.selectDeptAndChildById(user.getDeptId());
|
List<SysDept> deptList = deptMapper.selectListByParentId(user.getDeptId());
|
||||||
w.in("u.dept_id", deptIds);
|
List<Long> ids = StreamUtils.toList(deptList, SysDept::getDeptId);
|
||||||
|
ids.add(user.getDeptId());
|
||||||
|
w.in("u.dept_id", ids);
|
||||||
}).orderByAsc("u.user_id");
|
}).orderByAsc("u.user_id");
|
||||||
return baseMapper.selectUserExportList(wrapper);
|
return baseMapper.selectUserExportList(wrapper);
|
||||||
}
|
}
|
||||||
@@ -99,7 +100,9 @@ public class SysUserServiceImpl implements ISysUserService, UserService {
|
|||||||
.between(params.get("beginTime") != null && params.get("endTime") != null,
|
.between(params.get("beginTime") != null && params.get("endTime") != null,
|
||||||
SysUser::getCreateTime, params.get("beginTime"), params.get("endTime"))
|
SysUser::getCreateTime, params.get("beginTime"), params.get("endTime"))
|
||||||
.and(ObjectUtil.isNotNull(user.getDeptId()), w -> {
|
.and(ObjectUtil.isNotNull(user.getDeptId()), w -> {
|
||||||
List<Long> ids = deptMapper.selectDeptAndChildById(user.getDeptId());
|
List<SysDept> deptList = deptMapper.selectListByParentId(user.getDeptId());
|
||||||
|
List<Long> ids = StreamUtils.toList(deptList, SysDept::getDeptId);
|
||||||
|
ids.add(user.getDeptId());
|
||||||
w.in(SysUser::getDeptId, ids);
|
w.in(SysUser::getDeptId, ids);
|
||||||
}).orderByAsc(SysUser::getUserId);
|
}).orderByAsc(SysUser::getUserId);
|
||||||
if (StringUtils.isNotBlank(user.getExcludeUserIds())) {
|
if (StringUtils.isNotBlank(user.getExcludeUserIds())) {
|
||||||
@@ -451,31 +454,21 @@ public class SysUserServiceImpl implements ISysUserService, UserService {
|
|||||||
* @param clear 清除已存在的关联数据
|
* @param clear 清除已存在的关联数据
|
||||||
*/
|
*/
|
||||||
private void insertUserPost(SysUserBo user, boolean clear) {
|
private void insertUserPost(SysUserBo user, boolean clear) {
|
||||||
Long[] postIdArr = user.getPostIds();
|
Long[] posts = user.getPostIds();
|
||||||
if (ArrayUtil.isEmpty(postIdArr)) {
|
if (ArrayUtil.isNotEmpty(posts)) {
|
||||||
return;
|
if (clear) {
|
||||||
}
|
// 删除用户与岗位关联
|
||||||
List<Long> postIds = Arrays.asList(postIdArr);
|
userPostMapper.delete(new LambdaQueryWrapper<SysUserPost>().eq(SysUserPost::getUserId, user.getUserId()));
|
||||||
|
}
|
||||||
// 校验是否有权限操作这些岗位(含数据权限控制)
|
// 新增用户与岗位管理
|
||||||
if (postMapper.selectPostCount(postIds) != postIds.size()) {
|
List<SysUserPost> list = StreamUtils.toList(List.of(posts), postId -> {
|
||||||
throw new ServiceException("没有权限访问岗位的数据");
|
|
||||||
}
|
|
||||||
|
|
||||||
// 是否清除旧的用户岗位绑定
|
|
||||||
if (clear) {
|
|
||||||
userPostMapper.delete(new LambdaQueryWrapper<SysUserPost>().eq(SysUserPost::getUserId, user.getUserId()));
|
|
||||||
}
|
|
||||||
|
|
||||||
// 构建用户岗位关联列表并批量插入
|
|
||||||
List<SysUserPost> list = StreamUtils.toList(postIds,
|
|
||||||
postId -> {
|
|
||||||
SysUserPost up = new SysUserPost();
|
SysUserPost up = new SysUserPost();
|
||||||
up.setUserId(user.getUserId());
|
up.setUserId(user.getUserId());
|
||||||
up.setPostId(postId);
|
up.setPostId(postId);
|
||||||
return up;
|
return up;
|
||||||
});
|
});
|
||||||
userPostMapper.insertBatch(list);
|
userPostMapper.insertBatch(list);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -486,36 +479,30 @@ public class SysUserServiceImpl implements ISysUserService, UserService {
|
|||||||
* @param clear 清除已存在的关联数据
|
* @param clear 清除已存在的关联数据
|
||||||
*/
|
*/
|
||||||
private void insertUserRole(Long userId, Long[] roleIds, boolean clear) {
|
private void insertUserRole(Long userId, Long[] roleIds, boolean clear) {
|
||||||
if (ArrayUtil.isEmpty(roleIds)) {
|
if (ArrayUtil.isNotEmpty(roleIds)) {
|
||||||
return;
|
List<Long> roleList = new ArrayList<>(List.of(roleIds));
|
||||||
}
|
if (!LoginHelper.isSuperAdmin(userId)) {
|
||||||
|
roleList.remove(SystemConstants.SUPER_ADMIN_ID);
|
||||||
List<Long> roleList = new ArrayList<>(Arrays.asList(roleIds));
|
}
|
||||||
|
// 判断是否具有此角色的操作权限
|
||||||
// 非超级管理员,禁止包含超级管理员角色
|
List<SysRoleVo> roles = roleMapper.selectRoleList(
|
||||||
if (!LoginHelper.isSuperAdmin(userId)) {
|
new QueryWrapper<SysRole>().in("r.role_id", roleList));
|
||||||
roleList.remove(SystemConstants.SUPER_ADMIN_ID);
|
if (CollUtil.isEmpty(roles)) {
|
||||||
}
|
throw new ServiceException("没有权限访问角色的数据");
|
||||||
|
}
|
||||||
// 校验是否有权限访问这些角色(含数据权限控制)
|
if (clear) {
|
||||||
if (roleMapper.selectRoleCount(roleList) != roleList.size()) {
|
// 删除用户与角色关联
|
||||||
throw new ServiceException("没有权限访问角色的数据");
|
userRoleMapper.delete(new LambdaQueryWrapper<SysUserRole>().eq(SysUserRole::getUserId, userId));
|
||||||
}
|
}
|
||||||
|
// 新增用户与角色管理
|
||||||
// 是否清除原有绑定
|
List<SysUserRole> list = StreamUtils.toList(roleList, roleId -> {
|
||||||
if (clear) {
|
|
||||||
userRoleMapper.delete(new LambdaQueryWrapper<SysUserRole>().eq(SysUserRole::getUserId, userId));
|
|
||||||
}
|
|
||||||
|
|
||||||
// 批量插入用户-角色关联
|
|
||||||
List<SysUserRole> list = StreamUtils.toList(roleList,
|
|
||||||
roleId -> {
|
|
||||||
SysUserRole ur = new SysUserRole();
|
SysUserRole ur = new SysUserRole();
|
||||||
ur.setUserId(userId);
|
ur.setUserId(userId);
|
||||||
ur.setRoleId(roleId);
|
ur.setRoleId(roleId);
|
||||||
return ur;
|
return ur;
|
||||||
});
|
});
|
||||||
userRoleMapper.insertBatch(list);
|
userRoleMapper.insertBatch(list);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -761,12 +748,69 @@ public class SysUserServiceImpl implements ISysUserService, UserService {
|
|||||||
if (CollUtil.isEmpty(userIds)) {
|
if (CollUtil.isEmpty(userIds)) {
|
||||||
return Collections.emptyMap();
|
return Collections.emptyMap();
|
||||||
}
|
}
|
||||||
List<SysUser> list = baseMapper.selectList(
|
return baseMapper.selectList(
|
||||||
new LambdaQueryWrapper<SysUser>()
|
new LambdaQueryWrapper<SysUser>()
|
||||||
.select(SysUser::getUserId, SysUser::getNickName)
|
.select(SysUser::getUserId, SysUser::getNickName)
|
||||||
.in(SysUser::getUserId, userIds)
|
.in(SysUser::getUserId, userIds)
|
||||||
);
|
).stream()
|
||||||
return StreamUtils.toMap(list, SysUser::getUserId, SysUser::getNickName);
|
.collect(Collectors.toMap(SysUser::getUserId, SysUser::getNickName));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据角色 ID 列表查询角色名称映射关系
|
||||||
|
*
|
||||||
|
* @param roleIds 角色 ID 列表
|
||||||
|
* @return Map,其中 key 为角色 ID,value 为对应的角色名称
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Map<Long, String> selectRoleNamesByIds(List<Long> roleIds) {
|
||||||
|
if (CollUtil.isEmpty(roleIds)) {
|
||||||
|
return Collections.emptyMap();
|
||||||
|
}
|
||||||
|
return roleMapper.selectList(
|
||||||
|
new LambdaQueryWrapper<SysRole>()
|
||||||
|
.select(SysRole::getRoleId, SysRole::getRoleName)
|
||||||
|
.in(SysRole::getRoleId, roleIds)
|
||||||
|
).stream()
|
||||||
|
.collect(Collectors.toMap(SysRole::getRoleId, SysRole::getRoleName));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据部门 ID 列表查询部门名称映射关系
|
||||||
|
*
|
||||||
|
* @param deptIds 部门 ID 列表
|
||||||
|
* @return Map,其中 key 为部门 ID,value 为对应的部门名称
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Map<Long, String> selectDeptNamesByIds(List<Long> deptIds) {
|
||||||
|
if (CollUtil.isEmpty(deptIds)) {
|
||||||
|
return Collections.emptyMap();
|
||||||
|
}
|
||||||
|
return deptMapper.selectList(
|
||||||
|
new LambdaQueryWrapper<SysDept>()
|
||||||
|
.select(SysDept::getDeptId, SysDept::getDeptName)
|
||||||
|
.in(SysDept::getDeptId, deptIds)
|
||||||
|
).stream()
|
||||||
|
.collect(Collectors.toMap(SysDept::getDeptId, SysDept::getDeptName));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据岗位 ID 列表查询岗位名称映射关系
|
||||||
|
*
|
||||||
|
* @param postIds 岗位 ID 列表
|
||||||
|
* @return Map,其中 key 为岗位 ID,value 为对应的岗位名称
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Map<Long, String> selectPostNamesByIds(List<Long> postIds) {
|
||||||
|
if (CollUtil.isEmpty(postIds)) {
|
||||||
|
return Collections.emptyMap();
|
||||||
|
}
|
||||||
|
return postMapper.selectList(
|
||||||
|
new LambdaQueryWrapper<SysPost>()
|
||||||
|
.select(SysPost::getPostId, SysPost::getPostName)
|
||||||
|
.in(SysPost::getPostId, postIds)
|
||||||
|
).stream()
|
||||||
|
.collect(Collectors.toMap(SysPost::getPostId, SysPost::getPostName));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,4 +4,18 @@
|
|||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="org.dromara.system.mapper.SysDeptMapper">
|
<mapper namespace="org.dromara.system.mapper.SysDeptMapper">
|
||||||
|
|
||||||
|
<resultMap type="org.dromara.system.domain.vo.SysDeptVo" id="SysDeptResult">
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<select id="selectDeptListByRoleId" resultType="Long">
|
||||||
|
select d.dept_id
|
||||||
|
from sys_dept d
|
||||||
|
left join sys_role_dept rd on d.dept_id = rd.dept_id
|
||||||
|
where rd.role_id = #{roleId}
|
||||||
|
<if test="deptCheckStrictly">
|
||||||
|
and d.dept_id not in (select d.parent_id from sys_dept d inner join sys_role_dept rd on d.dept_id = rd.dept_id and rd.role_id = #{roleId})
|
||||||
|
</if>
|
||||||
|
order by d.parent_id, d.order_num
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@@ -4,4 +4,67 @@
|
|||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="org.dromara.system.mapper.SysMenuMapper">
|
<mapper namespace="org.dromara.system.mapper.SysMenuMapper">
|
||||||
|
|
||||||
|
<resultMap type="org.dromara.system.domain.SysMenu" id="SysMenuResult">
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<select id="selectMenuListByUserId" resultMap="SysMenuResult">
|
||||||
|
select distinct m.menu_id, m.parent_id, m.menu_name, m.path, m.component, m.query_param, m.visible, m.status,
|
||||||
|
m.perms, m.is_frame, m.is_cache, m.menu_type, m.icon, m.order_num, m.create_time
|
||||||
|
from sys_menu m
|
||||||
|
left join sys_role_menu rm on m.menu_id = rm.menu_id
|
||||||
|
left join sys_role r on rm.role_id = r.role_id
|
||||||
|
${ew.getCustomSqlSegment}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectMenuTreeByUserId" parameterType="Long" resultMap="SysMenuResult">
|
||||||
|
select distinct m.menu_id,
|
||||||
|
m.parent_id,
|
||||||
|
m.menu_name,
|
||||||
|
m.path,
|
||||||
|
m.component,
|
||||||
|
m.query_param,
|
||||||
|
m.visible,
|
||||||
|
m.status,
|
||||||
|
m.perms,
|
||||||
|
m.is_frame,
|
||||||
|
m.is_cache,
|
||||||
|
m.menu_type,
|
||||||
|
m.icon,
|
||||||
|
m.order_num,
|
||||||
|
m.create_time
|
||||||
|
from sys_menu m
|
||||||
|
left join sys_role_menu rm on m.menu_id = rm.menu_id and m.status = '0'
|
||||||
|
left join sys_role r on rm.role_id = r.role_id and r.status = '0'
|
||||||
|
where m.menu_type in ('M', 'C')
|
||||||
|
and r.role_id in (select role_id from sys_user_role where user_id = #{userId})
|
||||||
|
order by m.parent_id, m.order_num
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectMenuListByRoleId" resultType="Long">
|
||||||
|
select m.menu_id
|
||||||
|
from sys_menu m
|
||||||
|
left join sys_role_menu rm on m.menu_id = rm.menu_id
|
||||||
|
where rm.role_id = #{roleId}
|
||||||
|
<if test="menuCheckStrictly">
|
||||||
|
and m.menu_id not in (select m.parent_id from sys_menu m inner join sys_role_menu rm on m.menu_id =
|
||||||
|
rm.menu_id and rm.role_id = #{roleId})
|
||||||
|
</if>
|
||||||
|
order by m.parent_id, m.order_num
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectMenuPermsByUserId" parameterType="Long" resultType="String">
|
||||||
|
select distinct m.perms
|
||||||
|
from sys_menu m
|
||||||
|
left join sys_role_menu rm on m.menu_id = rm.menu_id and m.status = '0'
|
||||||
|
left join sys_role r on r.role_id = rm.role_id and r.status = '0'
|
||||||
|
where r.role_id in (select role_id from sys_user_role where user_id = #{userId})
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectMenuPermsByRoleId" parameterType="Long" resultType="String">
|
||||||
|
select distinct m.perms
|
||||||
|
from sys_menu m
|
||||||
|
left join sys_role_menu rm on m.menu_id = rm.menu_id
|
||||||
|
where m.status = '0' and rm.role_id = #{roleId}
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@@ -4,4 +4,15 @@
|
|||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="org.dromara.system.mapper.SysPostMapper">
|
<mapper namespace="org.dromara.system.mapper.SysPostMapper">
|
||||||
|
|
||||||
|
<resultMap type="org.dromara.system.domain.vo.SysPostVo" id="SysPostResult">
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<select id="selectPostsByUserId" parameterType="Long" resultMap="SysPostResult">
|
||||||
|
select p.post_id, p.dept_id, p.post_name, p.post_code, p.post_category
|
||||||
|
from sys_post p
|
||||||
|
left join sys_user_post up on up.post_id = p.post_id
|
||||||
|
left join sys_user u on u.user_id = up.user_id
|
||||||
|
where u.user_id = #{userId}
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@@ -4,4 +4,56 @@
|
|||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="org.dromara.system.mapper.SysRoleMapper">
|
<mapper namespace="org.dromara.system.mapper.SysRoleMapper">
|
||||||
|
|
||||||
|
<resultMap type="org.dromara.system.domain.vo.SysRoleVo" id="SysRoleResult">
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectRoleVo">
|
||||||
|
select distinct r.role_id,
|
||||||
|
r.role_name,
|
||||||
|
r.role_key,
|
||||||
|
r.role_sort,
|
||||||
|
r.data_scope,
|
||||||
|
r.menu_check_strictly,
|
||||||
|
r.dept_check_strictly,
|
||||||
|
r.status,
|
||||||
|
r.del_flag,
|
||||||
|
r.create_time,
|
||||||
|
r.remark
|
||||||
|
from sys_role r
|
||||||
|
left join sys_user_role sur on sur.role_id = r.role_id
|
||||||
|
left join sys_user u on u.user_id = sur.user_id
|
||||||
|
left join sys_dept d on u.dept_id = d.dept_id
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectPageRoleList" resultMap="SysRoleResult">
|
||||||
|
<include refid="selectRoleVo"/>
|
||||||
|
${ew.getCustomSqlSegment}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectRoleList" resultMap="SysRoleResult">
|
||||||
|
<include refid="selectRoleVo"/>
|
||||||
|
${ew.getCustomSqlSegment}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectRolePermissionByUserId" parameterType="Long" resultMap="SysRoleResult">
|
||||||
|
<include refid="selectRoleVo"/>
|
||||||
|
WHERE r.del_flag = '0' and sur.user_id = #{userId}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectRolesByUserId" parameterType="Long" resultMap="SysRoleResult">
|
||||||
|
select r.role_id,
|
||||||
|
r.role_name,
|
||||||
|
r.role_key,
|
||||||
|
r.role_sort,
|
||||||
|
r.data_scope,
|
||||||
|
r.status
|
||||||
|
from sys_role r
|
||||||
|
WHERE r.del_flag = '0' and r.role_id in (select role_id from sys_user_role where user_id = #{userId})
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectRoleById" resultMap="SysRoleResult">
|
||||||
|
<include refid="selectRoleVo"/>
|
||||||
|
WHERE r.del_flag = '0' and r.role_id = #{roleId}
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@@ -4,4 +4,10 @@
|
|||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="org.dromara.system.mapper.SysUserRoleMapper">
|
<mapper namespace="org.dromara.system.mapper.SysUserRoleMapper">
|
||||||
|
|
||||||
|
<select id="selectUserIdsByRoleId" resultType="Long">
|
||||||
|
select u.user_id from sys_user u
|
||||||
|
inner join sys_user_role sur
|
||||||
|
on u.user_id = sur.user_id and sur.role_id = #{roleId}
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@@ -18,11 +18,6 @@ public interface FlowConstant {
|
|||||||
*/
|
*/
|
||||||
String BUSINESS_ID = "businessId";
|
String BUSINESS_ID = "businessId";
|
||||||
|
|
||||||
/**
|
|
||||||
* 部门id
|
|
||||||
*/
|
|
||||||
String INITIATOR_DEPT_ID = "initiatorDeptId";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 委托
|
* 委托
|
||||||
*/
|
*/
|
||||||
@@ -83,9 +78,4 @@ public interface FlowConstant {
|
|||||||
*/
|
*/
|
||||||
String WF_TASK_STATUS = "wf_task_status";
|
String WF_TASK_STATUS = "wf_task_status";
|
||||||
|
|
||||||
/**
|
|
||||||
* 自动通过
|
|
||||||
*/
|
|
||||||
String AUTO_PASS = "autoPass";
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,12 +35,7 @@ public enum TaskAssigneeEnum {
|
|||||||
/**
|
/**
|
||||||
* 岗位
|
* 岗位
|
||||||
*/
|
*/
|
||||||
POST("岗位", "post:"),
|
POST("岗位", "post:");
|
||||||
|
|
||||||
/**
|
|
||||||
* SPEL表达式
|
|
||||||
*/
|
|
||||||
SPEL("SpEL表达式", "");
|
|
||||||
|
|
||||||
private final String desc;
|
private final String desc;
|
||||||
private final String code;
|
private final String code;
|
||||||
|
|||||||
@@ -100,15 +100,5 @@ public enum TaskStatusEnum {
|
|||||||
return STATUS_DESC_MAP.getOrDefault(status, StrUtil.EMPTY);
|
return STATUS_DESC_MAP.getOrDefault(status, StrUtil.EMPTY);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 判断状态是否为通过或退回
|
|
||||||
*
|
|
||||||
* @param status 状态值
|
|
||||||
* @return true 表示是通过或退回状态
|
|
||||||
*/
|
|
||||||
public static boolean isPassOrBack(String status) {
|
|
||||||
return PASS.getStatus().equals(status) || BACK.getStatus().equals(status);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -66,6 +66,7 @@ public class FlwCategoryController extends BaseController {
|
|||||||
@SaCheckPermission("workflow:category:query")
|
@SaCheckPermission("workflow:category:query")
|
||||||
@GetMapping("/{categoryId}")
|
@GetMapping("/{categoryId}")
|
||||||
public R<FlowCategoryVo> getInfo(@NotNull(message = "主键不能为空") @PathVariable Long categoryId) {
|
public R<FlowCategoryVo> getInfo(@NotNull(message = "主键不能为空") @PathVariable Long categoryId) {
|
||||||
|
flwCategoryService.checkCategoryDataScope(categoryId);
|
||||||
return R.ok(flwCategoryService.queryById(categoryId));
|
return R.ok(flwCategoryService.queryById(categoryId));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -92,6 +93,7 @@ public class FlwCategoryController extends BaseController {
|
|||||||
@PutMapping()
|
@PutMapping()
|
||||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody FlowCategoryBo category) {
|
public R<Void> edit(@Validated(EditGroup.class) @RequestBody FlowCategoryBo category) {
|
||||||
Long categoryId = category.getCategoryId();
|
Long categoryId = category.getCategoryId();
|
||||||
|
flwCategoryService.checkCategoryDataScope(categoryId);
|
||||||
if (!flwCategoryService.checkCategoryNameUnique(category)) {
|
if (!flwCategoryService.checkCategoryNameUnique(category)) {
|
||||||
return R.fail("修改流程分类'" + category.getCategoryName() + "'失败,流程分类名称已存在");
|
return R.fail("修改流程分类'" + category.getCategoryName() + "'失败,流程分类名称已存在");
|
||||||
} else if (category.getParentId().equals(categoryId)) {
|
} else if (category.getParentId().equals(categoryId)) {
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ import org.dromara.workflow.common.ConditionalOnEnable;
|
|||||||
import org.dromara.workflow.domain.bo.FlowCancelBo;
|
import org.dromara.workflow.domain.bo.FlowCancelBo;
|
||||||
import org.dromara.workflow.domain.bo.FlowInstanceBo;
|
import org.dromara.workflow.domain.bo.FlowInstanceBo;
|
||||||
import org.dromara.workflow.domain.bo.FlowInvalidBo;
|
import org.dromara.workflow.domain.bo.FlowInvalidBo;
|
||||||
import org.dromara.workflow.domain.bo.FlowVariableBo;
|
|
||||||
import org.dromara.workflow.domain.vo.FlowInstanceVo;
|
import org.dromara.workflow.domain.vo.FlowInstanceVo;
|
||||||
import org.dromara.workflow.service.IFlwInstanceService;
|
import org.dromara.workflow.service.IFlwInstanceService;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
@@ -89,16 +88,6 @@ public class FlwInstanceController extends BaseController {
|
|||||||
return toAjax(flwInstanceService.deleteByInstanceIds(instanceIds));
|
return toAjax(flwInstanceService.deleteByInstanceIds(instanceIds));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 按照实例id删除已完成得流程实例
|
|
||||||
*
|
|
||||||
* @param instanceIds 实例id
|
|
||||||
*/
|
|
||||||
@DeleteMapping("/deleteHisByInstanceIds/{instanceIds}")
|
|
||||||
public R<Void> deleteHisByInstanceIds(@PathVariable List<Long> instanceIds) {
|
|
||||||
return toAjax(flwInstanceService.deleteHisByInstanceIds(instanceIds));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 撤销流程
|
* 撤销流程
|
||||||
*
|
*
|
||||||
@@ -153,17 +142,6 @@ public class FlwInstanceController extends BaseController {
|
|||||||
return R.ok(flwInstanceService.instanceVariable(instanceId));
|
return R.ok(flwInstanceService.instanceVariable(instanceId));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改流程变量
|
|
||||||
*
|
|
||||||
* @param bo 参数
|
|
||||||
*/
|
|
||||||
@RepeatSubmit()
|
|
||||||
@PutMapping("/updateVariable")
|
|
||||||
public R<Void> updateVariable(@Validated @RequestBody FlowVariableBo bo) {
|
|
||||||
return toAjax(flwInstanceService.updateVariable(bo));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 作废流程
|
* 作废流程
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -1,93 +0,0 @@
|
|||||||
package org.dromara.workflow.controller;
|
|
||||||
|
|
||||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
|
||||||
import jakarta.validation.constraints.NotEmpty;
|
|
||||||
import jakarta.validation.constraints.NotNull;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import org.dromara.common.core.domain.R;
|
|
||||||
import org.dromara.common.core.validate.AddGroup;
|
|
||||||
import org.dromara.common.core.validate.EditGroup;
|
|
||||||
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
|
||||||
import org.dromara.common.log.annotation.Log;
|
|
||||||
import org.dromara.common.log.enums.BusinessType;
|
|
||||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
|
||||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
|
||||||
import org.dromara.common.web.core.BaseController;
|
|
||||||
import org.dromara.workflow.common.ConditionalOnEnable;
|
|
||||||
import org.dromara.workflow.domain.bo.FlowSpelBo;
|
|
||||||
import org.dromara.workflow.domain.vo.FlowSpelVo;
|
|
||||||
import org.dromara.workflow.service.IFlwSpelService;
|
|
||||||
import org.springframework.validation.annotation.Validated;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 流程spel达式定义
|
|
||||||
*
|
|
||||||
* @author Michelle.Chung
|
|
||||||
* @date 2025-07-04
|
|
||||||
*/
|
|
||||||
@ConditionalOnEnable
|
|
||||||
@Validated
|
|
||||||
@RequiredArgsConstructor
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/workflow/spel")
|
|
||||||
public class FlwSpelController extends BaseController {
|
|
||||||
|
|
||||||
private final IFlwSpelService flwSpelService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询流程spel达式定义列表
|
|
||||||
*/
|
|
||||||
@SaCheckPermission("workflow:spel:list")
|
|
||||||
@GetMapping("/list")
|
|
||||||
public TableDataInfo<FlowSpelVo> list(FlowSpelBo bo, PageQuery pageQuery) {
|
|
||||||
return flwSpelService.queryPageList(bo, pageQuery);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取流程spel达式定义详细信息
|
|
||||||
*
|
|
||||||
* @param id 主键
|
|
||||||
*/
|
|
||||||
@SaCheckPermission("workflow:spel:query")
|
|
||||||
@GetMapping("/{id}")
|
|
||||||
public R<FlowSpelVo> getInfo(@NotNull(message = "主键不能为空") @PathVariable Long id) {
|
|
||||||
return R.ok(flwSpelService.queryById(id));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增流程spel达式定义
|
|
||||||
*/
|
|
||||||
@SaCheckPermission("workflow:spel:add")
|
|
||||||
@Log(title = "流程spel达式定义", businessType = BusinessType.INSERT)
|
|
||||||
@RepeatSubmit()
|
|
||||||
@PostMapping()
|
|
||||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody FlowSpelBo bo) {
|
|
||||||
return toAjax(flwSpelService.insertByBo(bo));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改流程spel达式定义
|
|
||||||
*/
|
|
||||||
@SaCheckPermission("workflow:spel:edit")
|
|
||||||
@Log(title = "流程spel达式定义", businessType = BusinessType.UPDATE)
|
|
||||||
@RepeatSubmit()
|
|
||||||
@PutMapping()
|
|
||||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody FlowSpelBo bo) {
|
|
||||||
return toAjax(flwSpelService.updateByBo(bo));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除流程spel达式定义
|
|
||||||
*
|
|
||||||
* @param ids 主键串
|
|
||||||
*/
|
|
||||||
@SaCheckPermission("workflow:spel:remove")
|
|
||||||
@Log(title = "流程spel达式定义", businessType = BusinessType.DELETE)
|
|
||||||
@DeleteMapping("/{ids}")
|
|
||||||
public R<Void> remove(@NotEmpty(message = "主键不能为空") @PathVariable Long[] ids) {
|
|
||||||
return toAjax(flwSpelService.deleteWithValidByIds(List.of(ids), true));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -191,12 +191,12 @@ public class FlwTaskController extends BaseController {
|
|||||||
/**
|
/**
|
||||||
* 获取可驳回的前置节点
|
* 获取可驳回的前置节点
|
||||||
*
|
*
|
||||||
* @param taskId 任务id
|
* @param definitionId 流程定义id
|
||||||
* @param nowNodeCode 当前节点
|
* @param nowNodeCode 当前节点
|
||||||
*/
|
*/
|
||||||
@GetMapping("/getBackTaskNode/{taskId}/{nowNodeCode}")
|
@GetMapping("/getBackTaskNode/{definitionId}/{nowNodeCode}")
|
||||||
public R<List<Node>> getBackTaskNode(@PathVariable Long taskId, @PathVariable String nowNodeCode) {
|
public R<List<Node>> getBackTaskNode(@PathVariable Long definitionId, @PathVariable String nowNodeCode) {
|
||||||
return R.ok(flwTaskService.getBackTaskNode(taskId, nowNodeCode));
|
return R.ok(flwTaskService.getBackTaskNode(definitionId, nowNodeCode));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -206,19 +206,7 @@ public class FlwTaskController extends BaseController {
|
|||||||
*/
|
*/
|
||||||
@GetMapping("/currentTaskAllUser/{taskId}")
|
@GetMapping("/currentTaskAllUser/{taskId}")
|
||||||
public R<List<UserDTO>> currentTaskAllUser(@PathVariable Long taskId) {
|
public R<List<UserDTO>> currentTaskAllUser(@PathVariable Long taskId) {
|
||||||
return R.ok(flwTaskService.currentTaskAllUser(List.of(taskId)));
|
return R.ok(flwTaskService.currentTaskAllUser(taskId));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 催办任务
|
|
||||||
*
|
|
||||||
* @param bo 参数
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@PostMapping("/urgeTask")
|
|
||||||
public R<Void> urgeTask(@RequestBody FlowUrgeTaskBo bo) {
|
|
||||||
return toAjax(flwTaskService.urgeTask(bo));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -82,17 +82,6 @@ public class TestLeaveController extends BaseController {
|
|||||||
return R.ok(testLeaveService.insertByBo(bo));
|
return R.ok(testLeaveService.insertByBo(bo));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 提交请假并提交流程
|
|
||||||
*/
|
|
||||||
@SaCheckPermission("workflow:leave:add")
|
|
||||||
@Log(title = "请假", businessType = BusinessType.INSERT)
|
|
||||||
@RepeatSubmit()
|
|
||||||
@PostMapping("/submitAndFlowStart")
|
|
||||||
public R<TestLeaveVo> submitAndFlowStart(@Validated(AddGroup.class) @RequestBody TestLeaveBo bo) {
|
|
||||||
return R.ok(testLeaveService.submitAndFlowStart(bo));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改请假
|
* 修改请假
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,69 +0,0 @@
|
|||||||
package org.dromara.workflow.domain;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
|
||||||
|
|
||||||
import java.io.Serial;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 流程spel达式定义对象 flow_spel
|
|
||||||
*
|
|
||||||
* @author Michelle.Chung
|
|
||||||
* @date 2025-07-04
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@EqualsAndHashCode(callSuper = true)
|
|
||||||
@TableName("flow_spel")
|
|
||||||
public class FlowSpel extends BaseEntity {
|
|
||||||
|
|
||||||
@Serial
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 主键id
|
|
||||||
*/
|
|
||||||
@TableId(value = "id")
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 组件名称
|
|
||||||
*/
|
|
||||||
private String componentName;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 方法名
|
|
||||||
*/
|
|
||||||
private String methodName;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 参数
|
|
||||||
*/
|
|
||||||
private String methodParams;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 预览spel表达式
|
|
||||||
*/
|
|
||||||
private String viewSpel;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 状态(0正常 1停用)
|
|
||||||
*/
|
|
||||||
private String status;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 备注
|
|
||||||
*/
|
|
||||||
private String remark;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除标志
|
|
||||||
*/
|
|
||||||
@TableLogic
|
|
||||||
private String delFlag;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,60 +0,0 @@
|
|||||||
package org.dromara.workflow.domain.bo;
|
|
||||||
|
|
||||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
|
||||||
import org.dromara.common.core.validate.AddGroup;
|
|
||||||
import org.dromara.common.core.validate.EditGroup;
|
|
||||||
import io.github.linpeilie.annotations.AutoMapper;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
import jakarta.validation.constraints.*;
|
|
||||||
import org.dromara.workflow.domain.FlowSpel;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 流程spel达式定义业务对象 flow_spel
|
|
||||||
*
|
|
||||||
* @author Michelle.Chung
|
|
||||||
* @date 2025-07-04
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@EqualsAndHashCode(callSuper = true)
|
|
||||||
@AutoMapper(target = FlowSpel.class, reverseConvertGenerate = false)
|
|
||||||
public class FlowSpelBo extends BaseEntity {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 主键id
|
|
||||||
*/
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 组件名称
|
|
||||||
*/
|
|
||||||
private String componentName;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 方法名
|
|
||||||
*/
|
|
||||||
private String methodName;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 参数
|
|
||||||
*/
|
|
||||||
private String methodParams;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 预览spel值
|
|
||||||
*/
|
|
||||||
@NotBlank(message = "预览spel值不能为空", groups = { AddGroup.class, EditGroup.class })
|
|
||||||
private String viewSpel;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 状态(0正常 1停用)
|
|
||||||
*/
|
|
||||||
@NotBlank(message = "状态(0正常 1停用)不能为空", groups = { AddGroup.class, EditGroup.class })
|
|
||||||
private String status;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 备注
|
|
||||||
*/
|
|
||||||
private String remark;
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
package org.dromara.workflow.domain.bo;
|
|
||||||
|
|
||||||
import jakarta.validation.constraints.NotNull;
|
|
||||||
import lombok.Data;
|
|
||||||
import org.dromara.common.core.validate.AddGroup;
|
|
||||||
|
|
||||||
import java.io.Serial;
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 流程变量参数
|
|
||||||
*
|
|
||||||
* @author may
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class FlowUrgeTaskBo implements Serializable {
|
|
||||||
|
|
||||||
@Serial
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 任务id
|
|
||||||
*/
|
|
||||||
@NotNull(message = "任务id为空", groups = AddGroup.class)
|
|
||||||
private List<Long> taskIdList;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 消息类型
|
|
||||||
*/
|
|
||||||
private List<String> messageType;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 催办内容
|
|
||||||
*/
|
|
||||||
@NotNull(message = "催办内容为空", groups = AddGroup.class)
|
|
||||||
private String message;
|
|
||||||
}
|
|
||||||
@@ -1,39 +0,0 @@
|
|||||||
package org.dromara.workflow.domain.bo;
|
|
||||||
|
|
||||||
import jakarta.validation.constraints.NotNull;
|
|
||||||
import lombok.Data;
|
|
||||||
import org.dromara.common.core.validate.AddGroup;
|
|
||||||
|
|
||||||
import java.io.Serial;
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 流程变量参数
|
|
||||||
*
|
|
||||||
* @author may
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class FlowVariableBo implements Serializable {
|
|
||||||
|
|
||||||
@Serial
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 流程实例id
|
|
||||||
*/
|
|
||||||
@NotNull(message = "流程实例id为空", groups = AddGroup.class)
|
|
||||||
private Long instanceId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 流程变量key
|
|
||||||
*/
|
|
||||||
@NotNull(message = "流程变量key为空", groups = AddGroup.class)
|
|
||||||
private String key;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 流程变量value
|
|
||||||
*/
|
|
||||||
@NotNull(message = "流程变量value为空", groups = AddGroup.class)
|
|
||||||
private String value;
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -31,11 +31,6 @@ public class TestLeaveBo extends BaseEntity {
|
|||||||
@NotNull(message = "主键不能为空", groups = {EditGroup.class})
|
@NotNull(message = "主键不能为空", groups = {EditGroup.class})
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
/**
|
|
||||||
* 流程code
|
|
||||||
*/
|
|
||||||
private String flowCode;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 请假类型
|
* 请假类型
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,79 +0,0 @@
|
|||||||
package org.dromara.workflow.domain.vo;
|
|
||||||
|
|
||||||
import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
|
|
||||||
import cn.idev.excel.annotation.ExcelProperty;
|
|
||||||
import org.dromara.common.excel.annotation.ExcelDictFormat;
|
|
||||||
import org.dromara.common.excel.convert.ExcelDictConvert;
|
|
||||||
import io.github.linpeilie.annotations.AutoMapper;
|
|
||||||
import lombok.Data;
|
|
||||||
import org.dromara.workflow.domain.FlowSpel;
|
|
||||||
|
|
||||||
import java.io.Serial;
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 流程spel达式定义视图对象 flow_spel
|
|
||||||
*
|
|
||||||
* @author Michelle.Chung
|
|
||||||
* @date 2025-07-04
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@ExcelIgnoreUnannotated
|
|
||||||
@AutoMapper(target = FlowSpel.class)
|
|
||||||
public class FlowSpelVo implements Serializable {
|
|
||||||
|
|
||||||
@Serial
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 主键id
|
|
||||||
*/
|
|
||||||
@ExcelProperty(value = "主键id")
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 组件名称
|
|
||||||
*/
|
|
||||||
@ExcelProperty(value = "组件名称")
|
|
||||||
private String componentName;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 方法名
|
|
||||||
*/
|
|
||||||
@ExcelProperty(value = "方法名")
|
|
||||||
private String methodName;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 参数
|
|
||||||
*/
|
|
||||||
@ExcelProperty(value = "参数")
|
|
||||||
private String methodParams;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 预览spel值
|
|
||||||
*/
|
|
||||||
@ExcelProperty(value = "预览spel值")
|
|
||||||
private String viewSpel;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 状态(0正常 1停用)
|
|
||||||
*/
|
|
||||||
@ExcelProperty(value = "状态", converter = ExcelDictConvert.class)
|
|
||||||
@ExcelDictFormat(readConverterExp = "0=正常,1=停用")
|
|
||||||
private String status;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 备注
|
|
||||||
*/
|
|
||||||
@ExcelProperty(value = "备注")
|
|
||||||
private String remark;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 创建时间
|
|
||||||
*/
|
|
||||||
@ExcelProperty(value = "创建时间")
|
|
||||||
private Date createTime;
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -145,7 +145,6 @@ public class FlowTaskVo implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* 办理人名称
|
* 办理人名称
|
||||||
*/
|
*/
|
||||||
@Translation(type = TransConstant.USER_ID_TO_NICKNAME, mapper = "assigneeIds")
|
|
||||||
private String assigneeNames;
|
private String assigneeNames;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -39,7 +39,6 @@ public class FlowProcessEventHandler {
|
|||||||
ProcessEvent processEvent = new ProcessEvent();
|
ProcessEvent processEvent = new ProcessEvent();
|
||||||
processEvent.setTenantId(tenantId);
|
processEvent.setTenantId(tenantId);
|
||||||
processEvent.setFlowCode(flowCode);
|
processEvent.setFlowCode(flowCode);
|
||||||
processEvent.setInstanceId(instance.getId());
|
|
||||||
processEvent.setBusinessId(instance.getBusinessId());
|
processEvent.setBusinessId(instance.getBusinessId());
|
||||||
processEvent.setNodeType(instance.getNodeType());
|
processEvent.setNodeType(instance.getNodeType());
|
||||||
processEvent.setNodeCode(instance.getNodeCode());
|
processEvent.setNodeCode(instance.getNodeCode());
|
||||||
@@ -56,23 +55,20 @@ public class FlowProcessEventHandler {
|
|||||||
* @param flowCode 流程定义编码
|
* @param flowCode 流程定义编码
|
||||||
* @param instance 实例数据
|
* @param instance 实例数据
|
||||||
* @param taskId 任务id
|
* @param taskId 任务id
|
||||||
* @param params 上一个任务的办理参数
|
|
||||||
*/
|
*/
|
||||||
public void processTaskHandler(String flowCode, Instance instance, Long taskId, Map<String, Object> params) {
|
public void processTaskHandler(String flowCode, Instance instance, Long taskId) {
|
||||||
String tenantId = TenantHelper.getTenantId();
|
String tenantId = TenantHelper.getTenantId();
|
||||||
log.info("【流程任务事件发布】租户ID: {}, 流程编码: {}, 业务ID: {}, 节点类型: {}, 节点编码: {}, 节点名称: {}, 任务ID: {}",
|
log.info("【流程任务事件发布】租户ID: {}, 流程编码: {}, 业务ID: {}, 节点类型: {}, 节点编码: {}, 节点名称: {}, 任务ID: {}",
|
||||||
tenantId, flowCode, instance.getBusinessId(), instance.getNodeType(), instance.getNodeCode(), instance.getNodeName(), taskId);
|
tenantId, flowCode, instance.getBusinessId(), instance.getNodeType(), instance.getNodeCode(), instance.getNodeName(), taskId);
|
||||||
ProcessTaskEvent processTaskEvent = new ProcessTaskEvent();
|
ProcessTaskEvent processTaskEvent = new ProcessTaskEvent();
|
||||||
processTaskEvent.setTenantId(tenantId);
|
processTaskEvent.setTenantId(tenantId);
|
||||||
processTaskEvent.setFlowCode(flowCode);
|
processTaskEvent.setFlowCode(flowCode);
|
||||||
processTaskEvent.setInstanceId(instance.getId());
|
|
||||||
processTaskEvent.setBusinessId(instance.getBusinessId());
|
processTaskEvent.setBusinessId(instance.getBusinessId());
|
||||||
processTaskEvent.setNodeType(instance.getNodeType());
|
processTaskEvent.setNodeType(instance.getNodeType());
|
||||||
processTaskEvent.setNodeCode(instance.getNodeCode());
|
processTaskEvent.setNodeCode(instance.getNodeCode());
|
||||||
processTaskEvent.setNodeName(instance.getNodeName());
|
processTaskEvent.setNodeName(instance.getNodeName());
|
||||||
processTaskEvent.setTaskId(taskId);
|
processTaskEvent.setTaskId(taskId);
|
||||||
processTaskEvent.setStatus(instance.getFlowStatus());
|
processTaskEvent.setStatus(instance.getFlowStatus());
|
||||||
processTaskEvent.setParams(params);
|
|
||||||
SpringUtils.context().publishEvent(processTaskEvent);
|
SpringUtils.context().publishEvent(processTaskEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,14 +3,11 @@ package org.dromara.workflow.handler;
|
|||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.dromara.common.core.domain.dto.UserDTO;
|
|
||||||
import org.dromara.common.core.utils.StreamUtils;
|
|
||||||
import org.dromara.common.core.utils.StringUtils;
|
|
||||||
import org.dromara.common.satoken.utils.LoginHelper;
|
import org.dromara.common.satoken.utils.LoginHelper;
|
||||||
import org.dromara.warm.flow.core.dto.FlowParams;
|
import org.dromara.warm.flow.core.dto.FlowParams;
|
||||||
import org.dromara.warm.flow.core.handler.PermissionHandler;
|
import org.dromara.warm.flow.core.handler.PermissionHandler;
|
||||||
import org.dromara.workflow.common.ConditionalOnEnable;
|
import org.dromara.workflow.common.ConditionalOnEnable;
|
||||||
import org.dromara.workflow.service.IFlwTaskAssigneeService;
|
import org.dromara.workflow.service.IFlwCommonService;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
@@ -27,7 +24,7 @@ import java.util.List;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
public class WorkflowPermissionHandler implements PermissionHandler {
|
public class WorkflowPermissionHandler implements PermissionHandler {
|
||||||
|
|
||||||
private final IFlwTaskAssigneeService flwTaskAssigneeService;
|
private final IFlwCommonService flwCommonService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 办理人权限标识,比如用户,角色,部门等,用于校验是否有权限办理任务
|
* 办理人权限标识,比如用户,角色,部门等,用于校验是否有权限办理任务
|
||||||
@@ -54,11 +51,9 @@ public class WorkflowPermissionHandler implements PermissionHandler {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<String> convertPermissions(List<String> permissions) {
|
public List<String> convertPermissions(List<String> permissions) {
|
||||||
if (CollUtil.isEmpty(permissions)) {
|
if (CollUtil.isNotEmpty(permissions)) {
|
||||||
return permissions;
|
permissions = flwCommonService.buildUser(permissions);
|
||||||
}
|
}
|
||||||
String storageIds = CollUtil.join(permissions, StringUtils.SEPARATOR);
|
return permissions;
|
||||||
List<UserDTO> users = flwTaskAssigneeService.fetchUsersByStorageIds(storageIds);
|
|
||||||
return StreamUtils.toList(users, userDTO -> String.valueOf(userDTO.getUserId()));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user