框架调整

This commit is contained in:
attiya 2025-12-23 16:13:00 +08:00
parent b62dba7be0
commit e6d5a0ed1d

View File

@ -16,10 +16,11 @@ import java.util.TimeZone;
public class EbikeTenantFactory implements TenantFactory {
public Object[] getTenantIds() {
try {
if (StpUtil.isLogin()) {
RequestAttributes attributes = RequestContextHolder.getRequestAttributes();
if (attributes != null) {
Object attribute = attributes.getAttribute("tenantId", RequestAttributes.SCOPE_REQUEST);
if (attribute != null) {
String id = (String) StpUtil.getLoginId();
Object object = StpUtil.getSessionByLoginId(id).get(id);
ObjectMapper objectMapper = new ObjectMapper()
@ -35,7 +36,10 @@ public class EbikeTenantFactory implements TenantFactory {
break;
}
}
long tenantId = Long.parseLong(attribute.toString());
long tenantId = 0;
if (attribute != null) {
tenantId = Long.parseLong(attribute.toString());
}
//系统管理员
if (isSysAdmin) {
return null;
@ -46,5 +50,9 @@ public class EbikeTenantFactory implements TenantFactory {
}
return null;
} catch (Exception e) {
return null;
}
}
}