不限制租户用户数量

This commit is contained in:
chenbowen
2025-12-01 10:20:21 +08:00
parent 6ab387cba0
commit e9542acd27
2 changed files with 17 additions and 18 deletions

View File

@@ -34,9 +34,9 @@ import com.zt.plat.module.system.service.dept.PostService;
import com.zt.plat.module.system.service.permission.PermissionService;
import com.zt.plat.module.system.service.tenant.TenantService;
import com.zt.plat.module.system.service.userdept.UserDeptService;
import org.apache.seata.spring.annotation.GlobalTransactional;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.apache.seata.spring.annotation.GlobalTransactional;
import org.springframework.context.annotation.Lazy;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Service;
@@ -46,7 +46,6 @@ import org.springframework.util.DigestUtils;
import java.nio.charset.StandardCharsets;
import java.time.LocalDateTime;
import java.util.*;
import java.util.Locale;
import java.util.stream.Collectors;
import static com.zt.plat.framework.common.exception.util.ServiceExceptionUtil.exception;
@@ -107,7 +106,7 @@ public class AdminUserServiceImpl implements AdminUserService {
tenantService.handleTenantInfo(tenant -> {
long count = userMapper.selectCount();
if (count >= tenant.getAccountCount()) {
throw exception(USER_COUNT_MAX, tenant.getAccountCount());
// throw exception(USER_COUNT_MAX, tenant.getAccountCount());
}
});
// 1.2 校验正确性
@@ -156,7 +155,7 @@ public class AdminUserServiceImpl implements AdminUserService {
tenantService.handleTenantInfo(tenant -> {
long count = userMapper.selectCount();
if (count >= tenant.getAccountCount()) {
throw exception(USER_COUNT_MAX, tenant.getAccountCount());
// throw exception(USER_COUNT_MAX, tenant.getAccountCount());
}
});
// 1.3 校验正确性

View File

@@ -139,20 +139,20 @@ public class AdminUserServiceImplTest extends BaseDbUnitTest {
assertEquals(2L, userPosts.get(1).getPostId());
}
@Test
public void testCreatUser_max() {
// 准备参数
UserSaveReqVO reqVO = randomPojo(UserSaveReqVO.class).setUserSource(null);
// mock 账户额度不足
TenantDO tenant = randomPojo(TenantDO.class, o -> o.setAccountCount(-1));
doNothing().when(tenantService).handleTenantInfo(argThat(handler -> {
handler.handle(tenant);
return true;
}));
// 调用,并断言异常
assertServiceException(() -> userService.createUser(reqVO), USER_COUNT_MAX, -1);
}
// @Test
// public void testCreatUser_max() {
// // 准备参数
// UserSaveReqVO reqVO = randomPojo(UserSaveReqVO.class).setUserSource(null);
// // mock 账户额度不足
// TenantDO tenant = randomPojo(TenantDO.class, o -> o.setAccountCount(-1));
// doNothing().when(tenantService).handleTenantInfo(argThat(handler -> {
// handler.handle(tenant);
// return true;
// }));
//
// // 调用,并断言异常
// assertServiceException(() -> userService.createUser(reqVO), USER_COUNT_MAX, -1);
// }
@Test
public void testUpdateUser_success() {