From 9318f182b0a226d1a55d5989e37f037d1b87c910 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90Li?=
<15040126243@163.com>
Date: Sat, 17 Aug 2024 10:10:51 +0800
Subject: [PATCH 01/12] =?UTF-8?q?reset=20=E5=9B=9E=E6=BB=9A=20=E4=BF=AE?=
=?UTF-8?q?=E6=94=B9spring=E6=BA=90=E7=A0=81=E4=B8=8A=E4=B8=8B=E6=96=87?=
=?UTF-8?q?=E6=8C=81=E6=9C=89=E8=80=85(=E5=AD=98=E5=9C=A8=E6=95=B0?=
=?UTF-8?q?=E6=8D=AE=E6=9C=AA=E6=B8=85=E7=90=86=E5=86=85=E5=AD=98=E6=B3=84?=
=?UTF-8?q?=E6=BC=8F=E9=97=AE=E9=A2=98)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../web/listener/UserActionListener.java | 1 +
.../dromara/web/service/SysLoginService.java | 6 +-
.../web/service/SysRegisterService.java | 2 +
ruoyi-common/ruoyi-common-core/pom.xml | 7 -
.../context/request/RequestContextHolder.java | 161 ------------------
.../dromara/common/log/aspect/LogAspect.java | 14 ++
.../common/log/event/LogininforEvent.java | 7 +
.../impl/SysLogininforServiceImpl.java | 2 +-
.../service/impl/SysOperLogServiceImpl.java | 25 +--
9 files changed, 31 insertions(+), 194 deletions(-)
delete mode 100644 ruoyi-common/ruoyi-common-core/src/main/java/org/springframework/web/context/request/RequestContextHolder.java
diff --git a/ruoyi-admin/src/main/java/org/dromara/web/listener/UserActionListener.java b/ruoyi-admin/src/main/java/org/dromara/web/listener/UserActionListener.java
index a958de62d..07595e092 100644
--- a/ruoyi-admin/src/main/java/org/dromara/web/listener/UserActionListener.java
+++ b/ruoyi-admin/src/main/java/org/dromara/web/listener/UserActionListener.java
@@ -71,6 +71,7 @@ public class UserActionListener implements SaTokenListener {
logininforEvent.setUsername(username);
logininforEvent.setStatus(Constants.LOGIN_SUCCESS);
logininforEvent.setMessage(MessageUtils.message("user.login.success"));
+ logininforEvent.setRequest(ServletUtils.getRequest());
SpringUtils.context().publishEvent(logininforEvent);
// 更新登录信息
loginService.recordLoginInfo((Long) loginModel.getExtra(LoginHelper.USER_KEY), ip);
diff --git a/ruoyi-admin/src/main/java/org/dromara/web/service/SysLoginService.java b/ruoyi-admin/src/main/java/org/dromara/web/service/SysLoginService.java
index 9345c92fd..c7ad9179c 100644
--- a/ruoyi-admin/src/main/java/org/dromara/web/service/SysLoginService.java
+++ b/ruoyi-admin/src/main/java/org/dromara/web/service/SysLoginService.java
@@ -19,10 +19,7 @@ import org.dromara.common.core.enums.LoginType;
import org.dromara.common.core.enums.TenantStatus;
import org.dromara.common.core.exception.ServiceException;
import org.dromara.common.core.exception.user.UserException;
-import org.dromara.common.core.utils.DateUtils;
-import org.dromara.common.core.utils.MessageUtils;
-import org.dromara.common.core.utils.SpringUtils;
-import org.dromara.common.core.utils.StringUtils;
+import org.dromara.common.core.utils.*;
import org.dromara.common.log.event.LogininforEvent;
import org.dromara.common.mybatis.helper.DataPermissionHelper;
import org.dromara.common.redis.utils.RedisUtils;
@@ -142,6 +139,7 @@ public class SysLoginService {
logininforEvent.setUsername(username);
logininforEvent.setStatus(status);
logininforEvent.setMessage(message);
+ logininforEvent.setRequest(ServletUtils.getRequest());
SpringUtils.context().publishEvent(logininforEvent);
}
diff --git a/ruoyi-admin/src/main/java/org/dromara/web/service/SysRegisterService.java b/ruoyi-admin/src/main/java/org/dromara/web/service/SysRegisterService.java
index c7545fa65..ddab279bc 100644
--- a/ruoyi-admin/src/main/java/org/dromara/web/service/SysRegisterService.java
+++ b/ruoyi-admin/src/main/java/org/dromara/web/service/SysRegisterService.java
@@ -11,6 +11,7 @@ import org.dromara.common.core.exception.user.CaptchaException;
import org.dromara.common.core.exception.user.CaptchaExpireException;
import org.dromara.common.core.exception.user.UserException;
import org.dromara.common.core.utils.MessageUtils;
+import org.dromara.common.core.utils.ServletUtils;
import org.dromara.common.core.utils.SpringUtils;
import org.dromara.common.core.utils.StringUtils;
import org.dromara.common.log.event.LogininforEvent;
@@ -107,6 +108,7 @@ public class SysRegisterService {
logininforEvent.setUsername(username);
logininforEvent.setStatus(status);
logininforEvent.setMessage(message);
+ logininforEvent.setRequest(ServletUtils.getRequest());
SpringUtils.context().publishEvent(logininforEvent);
}
diff --git a/ruoyi-common/ruoyi-common-core/pom.xml b/ruoyi-common/ruoyi-common-core/pom.xml
index f6f8c2556..5925c9b3c 100644
--- a/ruoyi-common/ruoyi-common-core/pom.xml
+++ b/ruoyi-common/ruoyi-common-core/pom.xml
@@ -99,13 +99,6 @@
transmittable-thread-local
-
- jakarta.faces
- jakarta.faces-api
- 4.1.0
- true
-
-
diff --git a/ruoyi-common/ruoyi-common-core/src/main/java/org/springframework/web/context/request/RequestContextHolder.java b/ruoyi-common/ruoyi-common-core/src/main/java/org/springframework/web/context/request/RequestContextHolder.java
deleted file mode 100644
index 7f9622dbc..000000000
--- a/ruoyi-common/ruoyi-common-core/src/main/java/org/springframework/web/context/request/RequestContextHolder.java
+++ /dev/null
@@ -1,161 +0,0 @@
-/*
- * Copyright 2002-2023 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.springframework.web.context.request;
-
-import com.alibaba.ttl.TransmittableThreadLocal;
-import jakarta.faces.context.FacesContext;
-import org.springframework.lang.Nullable;
-import org.springframework.util.ClassUtils;
-
-/**
- * Holder class to expose the web request in the form of a thread-bound
- * {@link RequestAttributes} object. The request will be inherited
- * by any child threads spawned by the current thread if the
- * {@code inheritable} flag is set to {@code true}.
- *
- *
Use {@link RequestContextListener} or
- * {@link org.springframework.web.filter.RequestContextFilter} to expose
- * the current web request. Note that
- * already exposes the current request by default.
- *
- * 修改 spring 上下文存储方式 将 ThreadLocal 替换为 TransmittableThreadLocal
- * 支持线程上下文切换变量传递 异步获取 spring 上下文
- *
- * @author Juergen Hoeller
- * @author Rod Johnson
- * @since 2.0
- * @see RequestContextListener
- * @see org.springframework.web.filter.RequestContextFilter
- */
-public abstract class RequestContextHolder {
-
- private static final boolean jsfPresent =
- ClassUtils.isPresent("jakarta.faces.context.FacesContext", RequestContextHolder.class.getClassLoader());
-
- // ThreadLocal 替换为 TransmittableThreadLocal
- private static final ThreadLocal requestAttributesHolder =
- new TransmittableThreadLocal<>();
-
- private static final ThreadLocal inheritableRequestAttributesHolder =
- new TransmittableThreadLocal<>();
-
-
- /**
- * Reset the RequestAttributes for the current thread.
- */
- public static void resetRequestAttributes() {
- requestAttributesHolder.remove();
- inheritableRequestAttributesHolder.remove();
- }
-
- /**
- * Bind the given RequestAttributes to the current thread,
- * not exposing it as inheritable for child threads.
- * @param attributes the RequestAttributes to expose
- * @see #setRequestAttributes(RequestAttributes, boolean)
- */
- public static void setRequestAttributes(@Nullable RequestAttributes attributes) {
- setRequestAttributes(attributes, false);
- }
-
- /**
- * Bind the given RequestAttributes to the current thread.
- * @param attributes the RequestAttributes to expose,
- * or {@code null} to reset the thread-bound context
- * @param inheritable whether to expose the RequestAttributes as inheritable
- * for child threads (using an {@link InheritableThreadLocal})
- */
- public static void setRequestAttributes(@Nullable RequestAttributes attributes, boolean inheritable) {
- if (attributes == null) {
- resetRequestAttributes();
- }
- else {
- if (inheritable) {
- inheritableRequestAttributesHolder.set(attributes);
- requestAttributesHolder.remove();
- }
- else {
- requestAttributesHolder.set(attributes);
- inheritableRequestAttributesHolder.remove();
- }
- }
- }
-
- /**
- * Return the RequestAttributes currently bound to the thread.
- * @return the RequestAttributes currently bound to the thread,
- * or {@code null} if none bound
- */
- @Nullable
- public static RequestAttributes getRequestAttributes() {
- RequestAttributes attributes = requestAttributesHolder.get();
- if (attributes == null) {
- attributes = inheritableRequestAttributesHolder.get();
- }
- return attributes;
- }
-
- /**
- * Return the RequestAttributes currently bound to the thread.
- * Exposes the previously bound RequestAttributes instance, if any.
- * Falls back to the current JSF FacesContext, if any.
- * @return the RequestAttributes currently bound to the thread
- * @throws IllegalStateException if no RequestAttributes object
- * is bound to the current thread
- * @see #setRequestAttributes
- * @see ServletRequestAttributes
- * @see FacesRequestAttributes
- * @see jakarta.faces.context.FacesContext#getCurrentInstance()
- */
- public static RequestAttributes currentRequestAttributes() throws IllegalStateException {
- RequestAttributes attributes = getRequestAttributes();
- if (attributes == null) {
- if (jsfPresent) {
- attributes = FacesRequestAttributesFactory.getFacesRequestAttributes();
- }
- if (attributes == null) {
- throw new IllegalStateException("No thread-bound request found: " +
- "Are you referring to request attributes outside of an actual web request, " +
- "or processing a request outside of the originally receiving thread? " +
- "If you are actually operating within a web request and still receive this message, " +
- "your code is probably running outside of DispatcherServlet: " +
- "In this case, use RequestContextListener or RequestContextFilter to expose the current request.");
- }
- }
- return attributes;
- }
-
-
- /**
- * Inner class to avoid hard-coded JSF dependency.
- */
- private static class FacesRequestAttributesFactory {
-
- @Nullable
- public static RequestAttributes getFacesRequestAttributes() {
- try {
- FacesContext facesContext = FacesContext.getCurrentInstance();
- return (facesContext != null ? new FacesRequestAttributes(facesContext) : null);
- }
- catch (NoClassDefFoundError err) {
- // typically for com/sun/faces/util/Util if only the JSF API jar is present
- return null;
- }
- }
- }
-
-}
diff --git a/ruoyi-common/ruoyi-common-log/src/main/java/org/dromara/common/log/aspect/LogAspect.java b/ruoyi-common/ruoyi-common-log/src/main/java/org/dromara/common/log/aspect/LogAspect.java
index 8e257a23c..cdbd00f09 100644
--- a/ruoyi-common/ruoyi-common-log/src/main/java/org/dromara/common/log/aspect/LogAspect.java
+++ b/ruoyi-common/ruoyi-common-log/src/main/java/org/dromara/common/log/aspect/LogAspect.java
@@ -13,6 +13,7 @@ import org.aspectj.lang.annotation.AfterReturning;
import org.aspectj.lang.annotation.AfterThrowing;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
+import org.dromara.common.core.domain.model.LoginUser;
import org.dromara.common.core.utils.ServletUtils;
import org.dromara.common.core.utils.SpringUtils;
import org.dromara.common.core.utils.StringUtils;
@@ -20,6 +21,7 @@ import org.dromara.common.json.utils.JsonUtils;
import org.dromara.common.log.annotation.Log;
import org.dromara.common.log.enums.BusinessStatus;
import org.dromara.common.log.event.OperLogEvent;
+import org.dromara.common.satoken.utils.LoginHelper;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.http.HttpMethod;
import org.springframework.validation.BindingResult;
@@ -86,6 +88,16 @@ public class LogAspect {
// *========数据库日志=========*//
OperLogEvent operLog = new OperLogEvent();
+ operLog.setTenantId(LoginHelper.getTenantId());
+ operLog.setStatus(BusinessStatus.SUCCESS.ordinal());
+ // 请求的地址
+ String ip = ServletUtils.getClientIP();
+ operLog.setOperIp(ip);
+ operLog.setOperUrl(StringUtils.substring(ServletUtils.getRequest().getRequestURI(), 0, 255));
+ LoginUser loginUser = LoginHelper.getLoginUser();
+ operLog.setOperName(loginUser.getUsername());
+ operLog.setDeptName(loginUser.getDeptName());
+
if (e != null) {
operLog.setStatus(BusinessStatus.FAIL.ordinal());
operLog.setErrorMsg(StringUtils.substring(e.getMessage(), 0, 2000));
@@ -94,6 +106,8 @@ public class LogAspect {
String className = joinPoint.getTarget().getClass().getName();
String methodName = joinPoint.getSignature().getName();
operLog.setMethod(className + "." + methodName + "()");
+ // 设置请求方式
+ operLog.setRequestMethod(ServletUtils.getRequest().getMethod());
// 处理设置注解上的参数
getControllerMethodDescription(joinPoint, controllerLog, operLog, jsonResult);
// 设置消耗时间
diff --git a/ruoyi-common/ruoyi-common-log/src/main/java/org/dromara/common/log/event/LogininforEvent.java b/ruoyi-common/ruoyi-common-log/src/main/java/org/dromara/common/log/event/LogininforEvent.java
index 212bf18b5..938eaadde 100644
--- a/ruoyi-common/ruoyi-common-log/src/main/java/org/dromara/common/log/event/LogininforEvent.java
+++ b/ruoyi-common/ruoyi-common-log/src/main/java/org/dromara/common/log/event/LogininforEvent.java
@@ -2,6 +2,8 @@ package org.dromara.common.log.event;
import lombok.Data;
+import jakarta.servlet.http.HttpServletRequest;
+
import java.io.Serial;
import java.io.Serializable;
@@ -37,6 +39,11 @@ public class LogininforEvent implements Serializable {
*/
private String message;
+ /**
+ * 请求体
+ */
+ private HttpServletRequest request;
+
/**
* 其他参数
*/
diff --git a/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/impl/SysLogininforServiceImpl.java b/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/impl/SysLogininforServiceImpl.java
index dfd490ae9..b95baf44b 100644
--- a/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/impl/SysLogininforServiceImpl.java
+++ b/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/impl/SysLogininforServiceImpl.java
@@ -55,7 +55,7 @@ public class SysLogininforServiceImpl implements ISysLogininforService {
@Async
@EventListener
public void recordLogininfor(LogininforEvent logininforEvent) {
- HttpServletRequest request = ServletUtils.getRequest();
+ HttpServletRequest request = logininforEvent.getRequest();
final UserAgent userAgent = UserAgentUtil.parse(request.getHeader("User-Agent"));
final String ip = ServletUtils.getClientIP(request);
// 客户端信息
diff --git a/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/impl/SysOperLogServiceImpl.java b/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/impl/SysOperLogServiceImpl.java
index 45f263839..b78b9dcc8 100644
--- a/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/impl/SysOperLogServiceImpl.java
+++ b/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/impl/SysOperLogServiceImpl.java
@@ -3,23 +3,18 @@ package org.dromara.system.service.impl;
import cn.hutool.core.util.ArrayUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import jakarta.servlet.http.HttpServletRequest;
-import lombok.RequiredArgsConstructor;
-import org.dromara.common.core.domain.model.LoginUser;
import org.dromara.common.core.utils.MapstructUtils;
-import org.dromara.common.core.utils.ServletUtils;
-import org.dromara.common.core.utils.StringUtils;
-import org.dromara.common.core.utils.ip.AddressUtils;
-import org.dromara.common.log.enums.BusinessStatus;
-import org.dromara.common.log.event.OperLogEvent;
import org.dromara.common.mybatis.core.page.PageQuery;
import org.dromara.common.mybatis.core.page.TableDataInfo;
-import org.dromara.common.satoken.utils.LoginHelper;
+import org.dromara.common.core.utils.StringUtils;
+import org.dromara.common.core.utils.ip.AddressUtils;
+import org.dromara.common.log.event.OperLogEvent;
import org.dromara.system.domain.SysOperLog;
import org.dromara.system.domain.bo.SysOperLogBo;
import org.dromara.system.domain.vo.SysOperLogVo;
import org.dromara.system.mapper.SysOperLogMapper;
import org.dromara.system.service.ISysOperLogService;
+import lombok.RequiredArgsConstructor;
import org.springframework.context.event.EventListener;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
@@ -49,18 +44,6 @@ public class SysOperLogServiceImpl implements ISysOperLogService {
@EventListener
public void recordOper(OperLogEvent operLogEvent) {
SysOperLogBo operLog = MapstructUtils.convert(operLogEvent, SysOperLogBo.class);
- operLog.setTenantId(LoginHelper.getTenantId());
- operLog.setStatus(BusinessStatus.SUCCESS.ordinal());
- // 请求的地址
- String ip = ServletUtils.getClientIP();
- operLog.setOperIp(ip);
- HttpServletRequest request = ServletUtils.getRequest();
- operLog.setOperUrl(StringUtils.substring(request.getRequestURI(), 0, 255));
- LoginUser loginUser = LoginHelper.getLoginUser();
- operLog.setOperName(loginUser.getUsername());
- operLog.setDeptName(loginUser.getDeptName());
- // 设置请求方式
- operLog.setRequestMethod(request.getMethod());
// 远程查询操作地点
operLog.setOperLocation(AddressUtils.getRealAddressByIP(operLog.getOperIp()));
insertOperlog(operLog);
From b33b645ef01512024d0aa84b7e3a74b48e6c04bf Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90Li?=
<15040126243@163.com>
Date: Sat, 17 Aug 2024 10:29:33 +0800
Subject: [PATCH 02/12] =?UTF-8?q?remove=20=E7=A7=BB=E9=99=A4=20alibaba=20t?=
=?UTF-8?q?tl=20=E4=B8=8E=E7=BA=BF=E7=A8=8B=E6=B1=A0=E6=90=AD=E9=85=8D?=
=?UTF-8?q?=E6=9C=89=E9=97=AE=E9=A2=98(=E5=8F=AF=E4=BC=A0=E9=80=92?=
=?UTF-8?q?=E4=BD=86=E6=97=A0=E6=B3=95=E6=B8=85=E9=99=A4=E4=B8=8E=E6=9B=B4?=
=?UTF-8?q?=E6=96=B0)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
pom.xml | 1 -
ruoyi-common/ruoyi-common-core/pom.xml | 5 -----
.../java/org/dromara/common/tenant/helper/TenantHelper.java | 3 +--
3 files changed, 1 insertion(+), 8 deletions(-)
diff --git a/pom.xml b/pom.xml
index 7772834d6..42b5e08de 100644
--- a/pom.xml
+++ b/pom.xml
@@ -32,7 +32,6 @@
3.34.1
2.2.7
4.3.1
- 2.14.4
1.1.1
1.4.3
0.2.0
diff --git a/ruoyi-common/ruoyi-common-core/pom.xml b/ruoyi-common/ruoyi-common-core/pom.xml
index 5925c9b3c..ad37e90db 100644
--- a/ruoyi-common/ruoyi-common-core/pom.xml
+++ b/ruoyi-common/ruoyi-common-core/pom.xml
@@ -94,11 +94,6 @@
ip2region
-
- com.alibaba
- transmittable-thread-local
-
-
diff --git a/ruoyi-common/ruoyi-common-tenant/src/main/java/org/dromara/common/tenant/helper/TenantHelper.java b/ruoyi-common/ruoyi-common-tenant/src/main/java/org/dromara/common/tenant/helper/TenantHelper.java
index 9d087e113..6d12b6f49 100644
--- a/ruoyi-common/ruoyi-common-tenant/src/main/java/org/dromara/common/tenant/helper/TenantHelper.java
+++ b/ruoyi-common/ruoyi-common-tenant/src/main/java/org/dromara/common/tenant/helper/TenantHelper.java
@@ -2,7 +2,6 @@ package org.dromara.common.tenant.helper;
import cn.dev33.satoken.stp.StpUtil;
import cn.hutool.core.convert.Convert;
-import com.alibaba.ttl.TransmittableThreadLocal;
import com.baomidou.mybatisplus.core.plugins.IgnoreStrategy;
import com.baomidou.mybatisplus.core.plugins.InterceptorIgnoreHelper;
import lombok.AccessLevel;
@@ -27,7 +26,7 @@ public class TenantHelper {
private static final String DYNAMIC_TENANT_KEY = GlobalConstants.GLOBAL_REDIS_KEY + "dynamicTenant";
- private static final ThreadLocal TEMP_DYNAMIC_TENANT = new TransmittableThreadLocal<>();
+ private static final ThreadLocal TEMP_DYNAMIC_TENANT = new ThreadLocal<>();
/**
* 租户功能是否启用
From fb97649151348ca7f44c3f9e563d1a09d4b799d8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90Li?=
<15040126243@163.com>
Date: Sat, 17 Aug 2024 10:30:03 +0800
Subject: [PATCH 03/12] =?UTF-8?q?remove=20=E7=A7=BB=E9=99=A4=20alibaba=20t?=
=?UTF-8?q?tl=20=E4=B8=8E=E7=BA=BF=E7=A8=8B=E6=B1=A0=E6=90=AD=E9=85=8D?=
=?UTF-8?q?=E6=9C=89=E9=97=AE=E9=A2=98(=E5=8F=AF=E4=BC=A0=E9=80=92?=
=?UTF-8?q?=E4=BD=86=E6=97=A0=E6=B3=95=E6=B8=85=E9=99=A4=E4=B8=8E=E6=9B=B4?=
=?UTF-8?q?=E6=96=B0)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
pom.xml | 6 ------
1 file changed, 6 deletions(-)
diff --git a/pom.xml b/pom.xml
index 42b5e08de..321ea8e00 100644
--- a/pom.xml
+++ b/pom.xml
@@ -292,12 +292,6 @@
${snailjob.version}
-
- com.alibaba
- transmittable-thread-local
- ${alibaba-ttl.version}
-
-
org.bouncycastle
From 3f2499feacbde73ecd14bd3bfa416c2e4ec11b9a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90Li?=
<15040126243@163.com>
Date: Mon, 19 Aug 2024 09:14:50 +0800
Subject: [PATCH 04/12] =?UTF-8?q?update=20=E4=BC=98=E5=8C=96=20=E7=A7=9F?=
=?UTF-8?q?=E6=88=B7=E7=9B=B8=E5=85=B3controller=20=E5=A2=9E=E5=8A=A0?=
=?UTF-8?q?=E7=A7=9F=E6=88=B7=E5=BC=80=E5=85=B3=E9=85=8D=E7=BD=AE=E6=8E=A7?=
=?UTF-8?q?=E5=88=B6=E6=98=AF=E5=90=A6=E6=B3=A8=E5=86=8C?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../dromara/system/controller/system/SysTenantController.java | 2 ++
.../system/controller/system/SysTenantPackageController.java | 2 ++
2 files changed, 4 insertions(+)
diff --git a/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/controller/system/SysTenantController.java b/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/controller/system/SysTenantController.java
index 60be68a95..bad240c72 100644
--- a/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/controller/system/SysTenantController.java
+++ b/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/controller/system/SysTenantController.java
@@ -24,6 +24,7 @@ import org.dromara.common.web.core.BaseController;
import org.dromara.system.domain.bo.SysTenantBo;
import org.dromara.system.domain.vo.SysTenantVo;
import org.dromara.system.service.ISysTenantService;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@@ -38,6 +39,7 @@ import java.util.List;
@RequiredArgsConstructor
@RestController
@RequestMapping("/system/tenant")
+@ConditionalOnProperty(value = "tenant.enable", havingValue = "true")
public class SysTenantController extends BaseController {
private final ISysTenantService tenantService;
diff --git a/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/controller/system/SysTenantPackageController.java b/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/controller/system/SysTenantPackageController.java
index acaf5f83c..4bfe597cf 100644
--- a/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/controller/system/SysTenantPackageController.java
+++ b/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/controller/system/SysTenantPackageController.java
@@ -20,6 +20,7 @@ import jakarta.servlet.http.HttpServletResponse;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import lombok.RequiredArgsConstructor;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@@ -34,6 +35,7 @@ import java.util.List;
@RequiredArgsConstructor
@RestController
@RequestMapping("/system/tenant/package")
+@ConditionalOnProperty(value = "tenant.enable", havingValue = "true")
public class SysTenantPackageController extends BaseController {
private final ISysTenantPackageService tenantPackageService;
From 23aafe1cfe0cb53ad488f90ede0b3805cbabe70c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90Li?=
<15040126243@163.com>
Date: Wed, 21 Aug 2024 13:54:01 +0800
Subject: [PATCH 05/12] =?UTF-8?q?update=20=E4=BC=98=E5=8C=96=20=E5=BF=BD?=
=?UTF-8?q?=E7=95=A5=E7=A7=9F=E6=88=B7=E4=B8=8E=E5=BF=BD=E7=95=A5=E6=95=B0?=
=?UTF-8?q?=E6=8D=AE=E6=9D=83=E9=99=90=E6=94=AF=E6=8C=81=E5=B5=8C=E5=A5=97?=
=?UTF-8?q?=E4=BD=BF=E7=94=A8?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../mybatis/helper/DataPermissionHelper.java | 41 ++++++++++++++++++-
.../common/tenant/helper/TenantHelper.java | 41 ++++++++++++++++++-
2 files changed, 78 insertions(+), 4 deletions(-)
diff --git a/ruoyi-common/ruoyi-common-mybatis/src/main/java/org/dromara/common/mybatis/helper/DataPermissionHelper.java b/ruoyi-common/ruoyi-common-mybatis/src/main/java/org/dromara/common/mybatis/helper/DataPermissionHelper.java
index 2afe9ee47..ccb0fca34 100644
--- a/ruoyi-common/ruoyi-common-mybatis/src/main/java/org/dromara/common/mybatis/helper/DataPermissionHelper.java
+++ b/ruoyi-common/ruoyi-common-mybatis/src/main/java/org/dromara/common/mybatis/helper/DataPermissionHelper.java
@@ -2,14 +2,17 @@ package org.dromara.common.mybatis.helper;
import cn.dev33.satoken.context.SaHolder;
import cn.dev33.satoken.context.model.SaStorage;
+import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.plugins.IgnoreStrategy;
import com.baomidou.mybatisplus.core.plugins.InterceptorIgnoreHelper;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
+import org.dromara.common.core.utils.reflect.ReflectUtils;
import java.util.HashMap;
import java.util.Map;
+import java.util.Stack;
import java.util.function.Supplier;
/**
@@ -24,6 +27,8 @@ public class DataPermissionHelper {
private static final String DATA_PERMISSION_KEY = "data:permission";
+ private static final ThreadLocal> REENTRANT_IGNORE = ThreadLocal.withInitial(Stack::new);
+
/**
* 从上下文中获取指定键的变量值,并将其转换为指定的类型
*
@@ -66,18 +71,50 @@ public class DataPermissionHelper {
throw new NullPointerException("data permission context type exception");
}
+ private static IgnoreStrategy getIgnoreStrategy() {
+ Object ignoreStrategyLocal = ReflectUtils.getStaticFieldValue(ReflectUtils.getField(InterceptorIgnoreHelper.class, "IGNORE_STRATEGY_LOCAL"));
+ if (ignoreStrategyLocal instanceof ThreadLocal> IGNORE_STRATEGY_LOCAL) {
+ if (IGNORE_STRATEGY_LOCAL.get() instanceof IgnoreStrategy ignoreStrategy) {
+ return ignoreStrategy;
+ }
+ }
+ return null;
+ }
+
/**
* 开启忽略数据权限(开启后需手动调用 {@link #disableIgnore()} 关闭)
*/
public static void enableIgnore() {
- InterceptorIgnoreHelper.handle(IgnoreStrategy.builder().dataPermission(true).build());
+ IgnoreStrategy ignoreStrategy = getIgnoreStrategy();
+ if (ObjectUtil.isNull(ignoreStrategy)) {
+ InterceptorIgnoreHelper.handle(IgnoreStrategy.builder().dataPermission(true).build());
+ } else {
+ ignoreStrategy.setDataPermission(true);
+ }
+ Stack reentrantStack = REENTRANT_IGNORE.get();
+ reentrantStack.push(reentrantStack.size() + 1);
}
/**
* 关闭忽略数据权限
*/
public static void disableIgnore() {
- InterceptorIgnoreHelper.clearIgnoreStrategy();
+ IgnoreStrategy ignoreStrategy = getIgnoreStrategy();
+ if (ObjectUtil.isNotNull(ignoreStrategy)) {
+ boolean noOtherIgnoreStrategy = !Boolean.TRUE.equals(ignoreStrategy.getDynamicTableName())
+ && !Boolean.TRUE.equals(ignoreStrategy.getBlockAttack())
+ && !Boolean.TRUE.equals(ignoreStrategy.getIllegalSql())
+ && !Boolean.TRUE.equals(ignoreStrategy.getTenantLine())
+ && CollectionUtil.isEmpty(ignoreStrategy.getOthers());
+ Stack reentrantStack = REENTRANT_IGNORE.get();
+ boolean empty = reentrantStack.isEmpty() || reentrantStack.pop() == 1;
+ if (noOtherIgnoreStrategy && empty) {
+ InterceptorIgnoreHelper.clearIgnoreStrategy();
+ } else if (empty) {
+ ignoreStrategy.setDataPermission(false);
+ }
+
+ }
}
/**
diff --git a/ruoyi-common/ruoyi-common-tenant/src/main/java/org/dromara/common/tenant/helper/TenantHelper.java b/ruoyi-common/ruoyi-common-tenant/src/main/java/org/dromara/common/tenant/helper/TenantHelper.java
index 6d12b6f49..b18561267 100644
--- a/ruoyi-common/ruoyi-common-tenant/src/main/java/org/dromara/common/tenant/helper/TenantHelper.java
+++ b/ruoyi-common/ruoyi-common-tenant/src/main/java/org/dromara/common/tenant/helper/TenantHelper.java
@@ -1,7 +1,9 @@
package org.dromara.common.tenant.helper;
import cn.dev33.satoken.stp.StpUtil;
+import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.convert.Convert;
+import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.plugins.IgnoreStrategy;
import com.baomidou.mybatisplus.core.plugins.InterceptorIgnoreHelper;
import lombok.AccessLevel;
@@ -10,9 +12,11 @@ import lombok.extern.slf4j.Slf4j;
import org.dromara.common.core.constant.GlobalConstants;
import org.dromara.common.core.utils.SpringUtils;
import org.dromara.common.core.utils.StringUtils;
+import org.dromara.common.core.utils.reflect.ReflectUtils;
import org.dromara.common.redis.utils.RedisUtils;
import org.dromara.common.satoken.utils.LoginHelper;
+import java.util.Stack;
import java.util.function.Supplier;
/**
@@ -28,6 +32,8 @@ public class TenantHelper {
private static final ThreadLocal TEMP_DYNAMIC_TENANT = new ThreadLocal<>();
+ private static final ThreadLocal> REENTRANT_IGNORE = ThreadLocal.withInitial(Stack::new);
+
/**
* 租户功能是否启用
*/
@@ -35,18 +41,49 @@ public class TenantHelper {
return Convert.toBool(SpringUtils.getProperty("tenant.enable"), false);
}
+ private static IgnoreStrategy getIgnoreStrategy() {
+ Object ignoreStrategyLocal = ReflectUtils.getStaticFieldValue(ReflectUtils.getField(InterceptorIgnoreHelper.class, "IGNORE_STRATEGY_LOCAL"));
+ if (ignoreStrategyLocal instanceof ThreadLocal> IGNORE_STRATEGY_LOCAL) {
+ if (IGNORE_STRATEGY_LOCAL.get() instanceof IgnoreStrategy ignoreStrategy) {
+ return ignoreStrategy;
+ }
+ }
+ return null;
+ }
+
/**
* 开启忽略租户(开启后需手动调用 {@link #disableIgnore()} 关闭)
*/
public static void enableIgnore() {
- InterceptorIgnoreHelper.handle(IgnoreStrategy.builder().tenantLine(true).build());
+ IgnoreStrategy ignoreStrategy = getIgnoreStrategy();
+ if (ObjectUtil.isNull(ignoreStrategy)) {
+ InterceptorIgnoreHelper.handle(IgnoreStrategy.builder().tenantLine(true).build());
+ } else {
+ ignoreStrategy.setTenantLine(true);
+ }
+ Stack reentrantStack = REENTRANT_IGNORE.get();
+ reentrantStack.push(reentrantStack.size() + 1);
}
/**
* 关闭忽略租户
*/
public static void disableIgnore() {
- InterceptorIgnoreHelper.clearIgnoreStrategy();
+ IgnoreStrategy ignoreStrategy = getIgnoreStrategy();
+ if (ObjectUtil.isNotNull(ignoreStrategy)) {
+ boolean noOtherIgnoreStrategy = !Boolean.TRUE.equals(ignoreStrategy.getDynamicTableName())
+ && !Boolean.TRUE.equals(ignoreStrategy.getBlockAttack())
+ && !Boolean.TRUE.equals(ignoreStrategy.getIllegalSql())
+ && !Boolean.TRUE.equals(ignoreStrategy.getDataPermission())
+ && CollectionUtil.isEmpty(ignoreStrategy.getOthers());
+ Stack reentrantStack = REENTRANT_IGNORE.get();
+ boolean empty = reentrantStack.isEmpty() || reentrantStack.pop() == 1;
+ if (noOtherIgnoreStrategy && empty) {
+ InterceptorIgnoreHelper.clearIgnoreStrategy();
+ } else if (empty) {
+ ignoreStrategy.setTenantLine(false);
+ }
+ }
}
/**
From 4743eb1d3b2d9ee46845f36e50cd8102308c834f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90Li?=
<15040126243@163.com>
Date: Wed, 21 Aug 2024 13:54:40 +0800
Subject: [PATCH 06/12] =?UTF-8?q?update=20=E4=BC=98=E5=8C=96=20=E5=BF=BD?=
=?UTF-8?q?=E7=95=A5=E7=A7=9F=E6=88=B7=E4=B8=8E=E5=BF=BD=E7=95=A5=E6=95=B0?=
=?UTF-8?q?=E6=8D=AE=E6=9D=83=E9=99=90=E6=94=AF=E6=8C=81=E5=B5=8C=E5=A5=97?=
=?UTF-8?q?=E4=BD=BF=E7=94=A8?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../org/dromara/common/mybatis/helper/DataPermissionHelper.java | 2 --
1 file changed, 2 deletions(-)
diff --git a/ruoyi-common/ruoyi-common-mybatis/src/main/java/org/dromara/common/mybatis/helper/DataPermissionHelper.java b/ruoyi-common/ruoyi-common-mybatis/src/main/java/org/dromara/common/mybatis/helper/DataPermissionHelper.java
index ccb0fca34..932f17388 100644
--- a/ruoyi-common/ruoyi-common-mybatis/src/main/java/org/dromara/common/mybatis/helper/DataPermissionHelper.java
+++ b/ruoyi-common/ruoyi-common-mybatis/src/main/java/org/dromara/common/mybatis/helper/DataPermissionHelper.java
@@ -119,7 +119,6 @@ public class DataPermissionHelper {
/**
* 在忽略数据权限中执行
- * 禁止在忽略数据权限中执行忽略数据权限
*
* @param handle 处理执行方法
*/
@@ -134,7 +133,6 @@ public class DataPermissionHelper {
/**
* 在忽略数据权限中执行
- * 禁止在忽略数据权限中执行忽略数据权限
*
* @param handle 处理执行方法
*/
From 0af532f4f1bfd359773eaad75eee4ef487302a0a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90Li?=
<15040126243@163.com>
Date: Thu, 22 Aug 2024 11:19:13 +0800
Subject: [PATCH 07/12] =?UTF-8?q?update=20=E4=BC=98=E5=8C=96=20=E5=8E=BB?=
=?UTF-8?q?=E9=99=A4=E6=97=A5=E5=BF=97=E9=83=A8=E7=BD=B2=E7=8E=AF=E5=A2=83?=
=?UTF-8?q?=E5=88=A4=E6=96=AD=20=E9=80=9A=E8=BF=87=E6=97=A5=E5=BF=97?=
=?UTF-8?q?=E7=BA=A7=E5=88=AB=E6=8E=A7=E5=88=B6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../PlusWebInvokeTimeInterceptor.java | 57 ++++++++-----------
1 file changed, 25 insertions(+), 32 deletions(-)
diff --git a/ruoyi-common/ruoyi-common-web/src/main/java/org/dromara/common/web/interceptor/PlusWebInvokeTimeInterceptor.java b/ruoyi-common/ruoyi-common-web/src/main/java/org/dromara/common/web/interceptor/PlusWebInvokeTimeInterceptor.java
index 12c808647..614a559d7 100644
--- a/ruoyi-common/ruoyi-common-web/src/main/java/org/dromara/common/web/interceptor/PlusWebInvokeTimeInterceptor.java
+++ b/ruoyi-common/ruoyi-common-web/src/main/java/org/dromara/common/web/interceptor/PlusWebInvokeTimeInterceptor.java
@@ -6,7 +6,6 @@ import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.time.StopWatch;
-import org.dromara.common.core.utils.SpringUtils;
import org.dromara.common.core.utils.StringUtils;
import org.dromara.common.json.utils.JsonUtils;
import org.dromara.common.web.filter.RepeatedlyRequestWrapper;
@@ -19,7 +18,6 @@ import java.util.Map;
/**
* web的调用时间统计拦截器
- * dev环境有效
*
* @author Lion Li
* @since 3.3.0
@@ -27,37 +25,34 @@ import java.util.Map;
@Slf4j
public class PlusWebInvokeTimeInterceptor implements HandlerInterceptor {
- private final String prodProfile = "prod";
-
private final static ThreadLocal KEY_CACHE = new ThreadLocal<>();
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
- if (!prodProfile.equals(SpringUtils.getActiveProfile())) {
- String url = request.getMethod() + " " + request.getRequestURI();
+ String url = request.getMethod() + " " + request.getRequestURI();
- // 打印请求参数
- if (isJsonRequest(request)) {
- String jsonParam = "";
- if (request instanceof RepeatedlyRequestWrapper) {
- BufferedReader reader = request.getReader();
- jsonParam = IoUtil.read(reader);
- }
- log.info("[PLUS]开始请求 => URL[{}],参数类型[json],参数:[{}]", url, jsonParam);
- } else {
- Map parameterMap = request.getParameterMap();
- if (MapUtil.isNotEmpty(parameterMap)) {
- String parameters = JsonUtils.toJsonString(parameterMap);
- log.info("[PLUS]开始请求 => URL[{}],参数类型[param],参数:[{}]", url, parameters);
- } else {
- log.info("[PLUS]开始请求 => URL[{}],无参数", url);
- }
+ // 打印请求参数
+ if (isJsonRequest(request)) {
+ String jsonParam = "";
+ if (request instanceof RepeatedlyRequestWrapper) {
+ BufferedReader reader = request.getReader();
+ jsonParam = IoUtil.read(reader);
+ }
+ log.info("[PLUS]开始请求 => URL[{}],参数类型[json],参数:[{}]", url, jsonParam);
+ } else {
+ Map parameterMap = request.getParameterMap();
+ if (MapUtil.isNotEmpty(parameterMap)) {
+ String parameters = JsonUtils.toJsonString(parameterMap);
+ log.info("[PLUS]开始请求 => URL[{}],参数类型[param],参数:[{}]", url, parameters);
+ } else {
+ log.info("[PLUS]开始请求 => URL[{}],无参数", url);
}
-
- StopWatch stopWatch = new StopWatch();
- KEY_CACHE.set(stopWatch);
- stopWatch.start();
}
+
+ StopWatch stopWatch = new StopWatch();
+ KEY_CACHE.set(stopWatch);
+ stopWatch.start();
+
return true;
}
@@ -68,12 +63,10 @@ public class PlusWebInvokeTimeInterceptor implements HandlerInterceptor {
@Override
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
- if (!prodProfile.equals(SpringUtils.getActiveProfile())) {
- StopWatch stopWatch = KEY_CACHE.get();
- stopWatch.stop();
- log.info("[PLUS]结束请求 => URL[{}],耗时:[{}]毫秒", request.getMethod() + " " + request.getRequestURI(), stopWatch.getTime());
- KEY_CACHE.remove();
- }
+ StopWatch stopWatch = KEY_CACHE.get();
+ stopWatch.stop();
+ log.info("[PLUS]结束请求 => URL[{}],耗时:[{}]毫秒", request.getMethod() + " " + request.getRequestURI(), stopWatch.getTime());
+ KEY_CACHE.remove();
}
/**
From a964ccbd1092b159903089b682cfa0694021ef66 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90Li?=
<15040126243@163.com>
Date: Thu, 22 Aug 2024 11:19:43 +0800
Subject: [PATCH 08/12] update snailjob 1.1.1 => 1.1.2 update mapstruct-plus
1.4.3 => 1.4.4
---
pom.xml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/pom.xml b/pom.xml
index 321ea8e00..700eff319 100644
--- a/pom.xml
+++ b/pom.xml
@@ -32,8 +32,8 @@
3.34.1
2.2.7
4.3.1
- 1.1.1
- 1.4.3
+ 1.1.2
+ 1.4.4
0.2.0
1.18.34
1.76
From 457e59e61c9d7dbf4ef299c34aadd2c00fc0f1c9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90Li?=
<15040126243@163.com>
Date: Thu, 22 Aug 2024 17:53:55 +0800
Subject: [PATCH 09/12] =?UTF-8?q?fix=20=E4=BF=AE=E5=A4=8D=20=E5=A4=9A?=
=?UTF-8?q?=E7=BA=BF=E7=A8=8B=E5=AF=B9=E5=90=8C=E4=B8=80=E4=B8=AAsession?=
=?UTF-8?q?=E5=8F=91=E9=80=81ws=E6=B6=88=E6=81=AF=E6=8A=A5=E9=94=99?=
=?UTF-8?q?=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../java/org/dromara/common/websocket/utils/WebSocketUtils.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ruoyi-common/ruoyi-common-websocket/src/main/java/org/dromara/common/websocket/utils/WebSocketUtils.java b/ruoyi-common/ruoyi-common-websocket/src/main/java/org/dromara/common/websocket/utils/WebSocketUtils.java
index afe76e06d..8c4170aa1 100644
--- a/ruoyi-common/ruoyi-common-websocket/src/main/java/org/dromara/common/websocket/utils/WebSocketUtils.java
+++ b/ruoyi-common/ruoyi-common-websocket/src/main/java/org/dromara/common/websocket/utils/WebSocketUtils.java
@@ -113,7 +113,7 @@ public class WebSocketUtils {
* @param session WebSocket会话
* @param message 要发送的WebSocket消息对象
*/
- private static void sendMessage(WebSocketSession session, WebSocketMessage> message) {
+ private synchronized static void sendMessage(WebSocketSession session, WebSocketMessage> message) {
if (session == null || !session.isOpen()) {
log.warn("[send] session会话已经关闭");
} else {
From 308c22f9229dafb55e0afb441584abbac69324e7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90Li?=
<15040126243@163.com>
Date: Fri, 23 Aug 2024 10:30:29 +0800
Subject: [PATCH 10/12] =?UTF-8?q?fix=20=E4=BF=AE=E5=A4=8D=20=E4=B8=89?=
=?UTF-8?q?=E6=96=B9=E7=99=BB=E5=BD=95=E6=9E=84=E5=BB=BA=E5=8E=BB=E9=99=A4?=
=?UTF-8?q?=E6=97=A0=E7=94=A8=E4=BB=A3=E7=A0=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../java/org/dromara/common/social/utils/SocialUtils.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/ruoyi-common/ruoyi-common-social/src/main/java/org/dromara/common/social/utils/SocialUtils.java b/ruoyi-common/ruoyi-common-social/src/main/java/org/dromara/common/social/utils/SocialUtils.java
index 04f621489..9191fca77 100644
--- a/ruoyi-common/ruoyi-common-social/src/main/java/org/dromara/common/social/utils/SocialUtils.java
+++ b/ruoyi-common/ruoyi-common-social/src/main/java/org/dromara/common/social/utils/SocialUtils.java
@@ -58,9 +58,9 @@ public class SocialUtils {
case "linkedin" -> new AuthLinkedinRequest(builder.build(), STATE_CACHE);
case "microsoft" -> new AuthMicrosoftRequest(builder.build(), STATE_CACHE);
case "renren" -> new AuthRenrenRequest(builder.build(), STATE_CACHE);
- case "stack_overflow" -> new AuthStackOverflowRequest(builder.stackOverflowKey("").build(), STATE_CACHE);
+ case "stack_overflow" -> new AuthStackOverflowRequest(builder.build(), STATE_CACHE);
case "huawei" -> new AuthHuaweiRequest(builder.build(), STATE_CACHE);
- case "wechat_enterprise" -> new AuthWeChatEnterpriseQrcodeRequest(builder.agentId("").build(), STATE_CACHE);
+ case "wechat_enterprise" -> new AuthWeChatEnterpriseQrcodeRequest(builder.build(), STATE_CACHE);
case "gitlab" -> new AuthGitlabRequest(builder.build(), STATE_CACHE);
case "wechat_mp" -> new AuthWeChatMpRequest(builder.build(), STATE_CACHE);
case "aliyun" -> new AuthAliyunRequest(builder.build(), STATE_CACHE);
From eb038e91dde4ee7444a0ea4ec8c8bcd183b15c1e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90Li?=
<15040126243@163.com>
Date: Fri, 23 Aug 2024 10:52:53 +0800
Subject: [PATCH 11/12] update springboot 3.2.8 => 3.2.9
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index 700eff319..c9d055be3 100644
--- a/pom.xml
+++ b/pom.xml
@@ -14,7 +14,7 @@
5.2.1
- 3.2.8
+ 3.2.9
UTF-8
UTF-8
17
From 79aee1d3127c8be0184bc6493b08fb2ba2f1a8ae Mon Sep 17 00:00:00 2001
From: gssong <1742057357@qq.com>
Date: Sat, 24 Aug 2024 11:16:39 +0800
Subject: [PATCH 12/12] =?UTF-8?q?add=20=E6=B7=BB=E5=8A=A0=E6=8C=89?=
=?UTF-8?q?=E7=85=A7=E9=83=A8=E9=97=A8id=EF=BC=8C=E8=A7=92=E8=89=B2id?=
=?UTF-8?q?=E6=9F=A5=E8=AF=A2=E7=94=A8=E6=88=B7?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../common/core/service/UserService.java | 16 ++++++++++++++
.../service/impl/SysUserServiceImpl.java | 22 +++++++++++++++++++
2 files changed, 38 insertions(+)
diff --git a/ruoyi-common/ruoyi-common-core/src/main/java/org/dromara/common/core/service/UserService.java b/ruoyi-common/ruoyi-common-core/src/main/java/org/dromara/common/core/service/UserService.java
index 0f2878da4..43aef28cb 100644
--- a/ruoyi-common/ruoyi-common-core/src/main/java/org/dromara/common/core/service/UserService.java
+++ b/ruoyi-common/ruoyi-common-core/src/main/java/org/dromara/common/core/service/UserService.java
@@ -66,4 +66,20 @@ public interface UserService {
* @return 用户ids
*/
List selectUserIdsByRoleIds(List roleIds);
+
+ /**
+ * 通过角色ID查询用户
+ *
+ * @param roleIds 角色ids
+ * @return 用户
+ */
+ List selectUsersByRoleIds(List roleIds);
+
+ /**
+ * 通过部门ID查询用户
+ *
+ * @param deptIds 部门ids
+ * @return 用户
+ */
+ List selectUsersByDeptIds(List deptIds);
}
diff --git a/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/impl/SysUserServiceImpl.java b/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/impl/SysUserServiceImpl.java
index 6fbeab56d..254060688 100644
--- a/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/impl/SysUserServiceImpl.java
+++ b/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/impl/SysUserServiceImpl.java
@@ -647,4 +647,26 @@ public class SysUserServiceImpl implements ISysUserService, UserService {
return StreamUtils.toList(userRoles, SysUserRole::getUserId);
}
+ @Override
+ public List selectUsersByRoleIds(List roleIds) {
+ if (CollUtil.isEmpty(roleIds)) {
+ return List.of();
+ }
+ List userRoles = userRoleMapper.selectList(
+ new LambdaQueryWrapper().in(SysUserRole::getRoleId, roleIds));
+ List userIds = StreamUtils.toList(userRoles, SysUserRole::getUserId);
+ return selectListByIds(userIds);
+ }
+
+ @Override
+ public List selectUsersByDeptIds(List deptIds) {
+ if (CollUtil.isEmpty(deptIds)) {
+ return List.of();
+ }
+ List list = baseMapper.selectVoList(new LambdaQueryWrapper()
+ .select(SysUser::getUserId, SysUser::getUserName, SysUser::getNickName, SysUser::getEmail, SysUser::getPhonenumber)
+ .eq(SysUser::getStatus, UserConstants.USER_NORMAL)
+ .in(CollUtil.isNotEmpty(deptIds), SysUser::getDeptId, deptIds));
+ return BeanUtil.copyToList(list, UserDTO.class);
+ }
}