build: continew-starter 2.13.0 => 2.13.1

1.DataPermissionUserContextProvider 相关命名调整,以避免和 Admin 内类名冲突
DataPermissionUserContextProvider => DataPermissionUserDataProvider
UserContext => UserData
RoleContext => RoleData
2.引入 crane4j 依赖及填充处理(Starter 为了扩展性,移除了此依赖及相关处理)
3.API 替换
3.1SpringUtil.getBean(TenantHandler.class) => TenantUtils
3.2JakartaServletUtil.write => ServletUtils.writeJSON
3.3tenantExtensionProperties.isEnabled() => TenantContextHolder.isTenantEnabled()
4.Starter 内部修复
4.1FastExcel POI 版本冲突导致的导出报错
4.2EnumValue 校验支持了 BaseEnum
This commit is contained in:
2025-07-17 22:29:09 +08:00
parent 7e9a950694
commit 6136797588
16 changed files with 72 additions and 59 deletions

View File

@@ -17,7 +17,6 @@
package top.continew.admin.tenant.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.hutool.extra.spring.SpringUtil;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
@@ -42,7 +41,7 @@ import top.continew.starter.core.util.ExceptionUtils;
import top.continew.starter.core.util.validation.ValidationUtils;
import top.continew.starter.extension.crud.annotation.CrudRequestMapping;
import top.continew.starter.extension.crud.enums.Api;
import top.continew.starter.extension.tenant.TenantHandler;
import top.continew.starter.extension.tenant.util.TenantUtils;
/**
* 租户管理 API
@@ -65,7 +64,7 @@ public class TenantController extends BaseController<TenantService, TenantResp,
public void updateAdminUserPwd(@Valid @RequestBody TenantAdminUserPwdUpdateReq req, @PathVariable Long id) {
TenantDO tenant = baseService.getById(id);
String encryptPassword = req.getPassword();
SpringUtil.getBean(TenantHandler.class).execute(id, () -> {
TenantUtils.execute(id, () -> {
UserDO user = userService.getById(tenant.getAdminUser());
String password = ExceptionUtils.exToNull(() -> SecureUtils.decryptByRsaPrivateKey(encryptPassword));
ValidationUtils.throwIfNull(password, "新密码解密失败");

View File

@@ -19,7 +19,6 @@ package top.continew.admin.tenant.handler;
import cn.dev33.satoken.stp.StpUtil;
import cn.hutool.core.collection.ListUtil;
import cn.hutool.core.util.ReUtil;
import cn.hutool.extra.spring.SpringUtil;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.RequiredArgsConstructor;
@@ -51,7 +50,7 @@ import top.continew.starter.cache.redisson.util.RedisUtils;
import top.continew.starter.core.util.ExceptionUtils;
import top.continew.starter.core.util.validation.ValidationUtils;
import top.continew.starter.extension.crud.model.entity.BaseIdDO;
import top.continew.starter.extension.tenant.TenantHandler;
import top.continew.starter.extension.tenant.util.TenantUtils;
import java.time.LocalDateTime;
import java.util.List;
@@ -90,7 +89,7 @@ public class TenantDataHandlerForSystem implements TenantDataHandler {
@Transactional(rollbackFor = Exception.class)
public void init(TenantReq tenant) {
Long tenantId = tenant.getId();
SpringUtil.getBean(TenantHandler.class).execute(tenantId, () -> {
TenantUtils.execute(tenantId, () -> {
// 初始化部门
Long deptId = this.initDeptData(tenant);
// 初始化菜单

View File

@@ -17,7 +17,6 @@
package top.continew.admin.tenant.service.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.extra.spring.SpringUtil;
import com.alicp.jetcache.anno.Cached;
import lombok.RequiredArgsConstructor;
import me.ahoo.cosid.provider.IdGeneratorProvider;
@@ -40,8 +39,8 @@ import top.continew.admin.tenant.service.PackageService;
import top.continew.admin.tenant.service.TenantService;
import top.continew.starter.cache.redisson.util.RedisUtils;
import top.continew.starter.core.util.validation.CheckUtils;
import top.continew.starter.extension.tenant.TenantHandler;
import top.continew.starter.extension.tenant.autoconfigure.TenantProperties;
import top.continew.starter.extension.tenant.util.TenantUtils;
import java.io.Serializable;
import java.time.LocalDateTime;
@@ -103,7 +102,7 @@ public class TenantServiceImpl extends BaseServiceImpl<TenantMapper, TenantDO, T
public void beforeDelete(List<Long> ids) {
// 在租户中执行数据清除
for (Long id : ids) {
SpringUtil.getBean(TenantHandler.class).execute(id, tenantDataHandler::clear);
TenantUtils.execute(id, tenantDataHandler::clear);
}
}
@@ -153,7 +152,7 @@ public class TenantServiceImpl extends BaseServiceImpl<TenantMapper, TenantDO, T
deleteMenuIds.removeAll(newMenuIds);
if (CollUtil.isNotEmpty(deleteMenuIds)) {
List<MenuDO> deleteMenus = menuService.listByIds(deleteMenuIds);
tenantIdList.forEach(tenantId -> SpringUtil.getBean(TenantHandler.class).execute(tenantId, () -> menuService
tenantIdList.forEach(tenantId -> TenantUtils.execute(tenantId, () -> menuService
.deleteTenantMenus(deleteMenus)));
}
// 如果有新增的菜单则绑定了套餐的租户对应的菜单也会新增
@@ -163,7 +162,7 @@ public class TenantServiceImpl extends BaseServiceImpl<TenantMapper, TenantDO, T
List<MenuDO> addMenus = menuService.listByIds(addMenuIds);
for (MenuDO addMenu : addMenus) {
MenuDO parentMenu = addMenu.getParentId() != 0 ? menuService.getById(addMenu.getParentId()) : null;
tenantIdList.forEach(tenantId -> SpringUtil.getBean(TenantHandler.class).execute(tenantId, () -> menuService
tenantIdList.forEach(tenantId -> TenantUtils.execute(tenantId, () -> menuService
.addTenantMenu(addMenu, parentMenu)));
}
}