From 4957532ff604a720da438511e20213709839d174 Mon Sep 17 00:00:00 2001 From: jay <75509151@qq.com> Date: Mon, 17 Jun 2024 19:11:41 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E7=A6=81=E7=94=A8=E7=A7=9F=E6=88=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tenant/aspect/TenantFilterAspect.java | 3 +- .../web/interceptor/TenantInterceptor.java | 122 +++++++++--------- 2 files changed, 63 insertions(+), 62 deletions(-) diff --git a/iot-common-tenant/src/main/java/cc/iotkit/common/tenant/aspect/TenantFilterAspect.java b/iot-common-tenant/src/main/java/cc/iotkit/common/tenant/aspect/TenantFilterAspect.java index 2854be7..dc1f614 100755 --- a/iot-common-tenant/src/main/java/cc/iotkit/common/tenant/aspect/TenantFilterAspect.java +++ b/iot-common-tenant/src/main/java/cc/iotkit/common/tenant/aspect/TenantFilterAspect.java @@ -49,7 +49,8 @@ public class TenantFilterAspect { @AfterReturning(pointcut = "openSession()", returning = "session") public void afterOpenSession(Object session) { - if(TenantHelper.isIgnore()){ + // 租户管理需要商业版 + if(!TenantHelper.isEnable() || TenantHelper.isIgnore()){ return; } if (session instanceof Session) { diff --git a/iot-common-web/src/main/java/cc/iotkit/common/web/interceptor/TenantInterceptor.java b/iot-common-web/src/main/java/cc/iotkit/common/web/interceptor/TenantInterceptor.java index 8bbdc84..68fe115 100755 --- a/iot-common-web/src/main/java/cc/iotkit/common/web/interceptor/TenantInterceptor.java +++ b/iot-common-web/src/main/java/cc/iotkit/common/web/interceptor/TenantInterceptor.java @@ -1,61 +1,61 @@ -/* - * - * * | Licensed 未经许可不能去掉「OPENIITA」相关版权 - * * +---------------------------------------------------------------------- - * * | Author: xw2sy@163.com - * * +---------------------------------------------------------------------- - * - * Copyright [2024] [OPENIITA] - * - * 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 - * - * http://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 cc.iotkit.common.web.interceptor; - -import cn.dev33.satoken.context.SaHolder; -import org.springframework.web.servlet.HandlerInterceptor; -import org.springframework.web.servlet.ModelAndView; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -/** - * 新增租户拦截器,拦截请求头中的租户id - * - * @author Tiger Chen - * created on 2023/7/15 14:26 - */ - - -public class TenantInterceptor implements HandlerInterceptor { - - public static final String TENANT_ID = "Tenant-Id"; - - @Override - public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) { - if (request.getHeader(TENANT_ID) != null) { - Long tenantId = Long.valueOf(request.getHeader(TENANT_ID)); - SaHolder.getStorage().set("tenantId", tenantId); - } - return true; - } - - @Override - public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception { - } - - @Override - public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception { - } -} +///* +// * +// * * | Licensed 未经许可不能去掉「OPENIITA」相关版权 +// * * +---------------------------------------------------------------------- +// * * | Author: xw2sy@163.com +// * * +---------------------------------------------------------------------- +// * +// * Copyright [2024] [OPENIITA] +// * +// * 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 +// * +// * http://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 cc.iotkit.common.web.interceptor; +// +//import cn.dev33.satoken.context.SaHolder; +//import org.springframework.web.servlet.HandlerInterceptor; +//import org.springframework.web.servlet.ModelAndView; +// +//import javax.servlet.http.HttpServletRequest; +//import javax.servlet.http.HttpServletResponse; +// +///** +// * 新增租户拦截器,拦截请求头中的租户id +// * +// * @author Tiger Chen +// * created on 2023/7/15 14:26 +// */ +// +// +//public class TenantInterceptor implements HandlerInterceptor { +// +// public static final String TENANT_ID = "Tenant-Id"; +// +// @Override +// public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) { +// if (request.getHeader(TENANT_ID) != null) { +// Long tenantId = Long.valueOf(request.getHeader(TENANT_ID)); +// SaHolder.getStorage().set("tenantId", tenantId); +// } +// return true; +// } +// +// @Override +// public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception { +// } +// +// @Override +// public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception { +// } +//}