From 3e82dc1ca1b64b8217b6dad7c1be73f6a9c2c37c Mon Sep 17 00:00:00 2001 From: VampireAchao Date: Wed, 1 Nov 2023 22:48:03 +0800 Subject: [PATCH 1/3] [Improve] Improve streampark-console system package module service query method name base on [3.1 Naming Style] --- .../console/core/aspect/ConsoleAspect.java | 4 ++-- .../system/authentication/ShiroRealm.java | 4 ++-- .../system/controller/AccessTokenController.java | 2 +- .../system/controller/MemberController.java | 8 ++++---- .../system/controller/MenuController.java | 4 ++-- .../system/controller/RoleController.java | 6 +++--- .../system/controller/TeamController.java | 4 ++-- .../system/controller/UserController.java | 8 ++++---- .../system/security/impl/AuthenticatorImpl.java | 6 +++--- .../system/service/AccessTokenService.java | 2 +- .../console/system/service/MemberService.java | 10 +++++----- .../console/system/service/MenuService.java | 8 ++++---- .../console/system/service/RoleMenuServie.java | 2 +- .../console/system/service/RoleService.java | 4 ++-- .../console/system/service/TeamService.java | 6 +++--- .../console/system/service/UserService.java | 10 +++++----- .../service/impl/AccessTokenServiceImpl.java | 2 +- .../system/service/impl/MemberServiceImpl.java | 16 ++++++++-------- .../system/service/impl/MenuServiceImpl.java | 10 +++++----- .../system/service/impl/RoleMenuServiceImpl.java | 2 +- .../system/service/impl/RoleServiceImpl.java | 6 +++--- .../system/service/impl/TeamServiceImpl.java | 8 ++++---- .../system/service/impl/UserServiceImpl.java | 16 ++++++++-------- .../core/service/AccessTokenServiceTest.java | 6 +++--- 24 files changed, 77 insertions(+), 77 deletions(-) diff --git a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/aspect/ConsoleAspect.java b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/aspect/ConsoleAspect.java index c500c61d0d..51b72c0452 100644 --- a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/aspect/ConsoleAspect.java +++ b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/aspect/ConsoleAspect.java @@ -126,14 +126,14 @@ public RestResponse permissionAction(ProceedingJoinPoint joinPoint) throws Throw break; case TEAM: ApiAlertException.throwIfTrue( - memberService.findByUserName(paramId, currentUser.getUsername()) == null, + memberService.getByTeamIdUserName(paramId, currentUser.getUsername()) == null, "Permission denied, only user belongs to this team can access this permission"); break; case APP: Application app = applicationManageService.getById(paramId); ApiAlertException.throwIfTrue(app == null, "Invalid operation, application is null"); ApiAlertException.throwIfTrue( - memberService.findByUserName(app.getTeamId(), currentUser.getUsername()) == null, + memberService.getByTeamIdUserName(app.getTeamId(), currentUser.getUsername()) == null, "Permission denied, only user belongs to this team can access this permission"); break; default: diff --git a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/authentication/ShiroRealm.java b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/authentication/ShiroRealm.java index 98e22a313b..b86e7f1a4d 100644 --- a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/authentication/ShiroRealm.java +++ b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/authentication/ShiroRealm.java @@ -63,7 +63,7 @@ protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection token) { SimpleAuthorizationInfo simpleAuthorizationInfo = new SimpleAuthorizationInfo(); // Get user permission set - Set permissionSet = userService.getPermissions(userId, null); + Set permissionSet = userService.listPermissionsByUserIdTeamId(userId, null); simpleAuthorizationInfo.setStringPermissions(permissionSet); return simpleAuthorizationInfo; } @@ -85,7 +85,7 @@ protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken authent throw new AuthenticationException("Token verification failed"); } // Query user information by username - User user = userService.findByName(username); + User user = userService.getByName(username); if (user == null) { throw new AuthenticationException("ERROR Incorrect username or password!"); diff --git a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/controller/AccessTokenController.java b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/controller/AccessTokenController.java index 7deea1c235..446a3a8afa 100644 --- a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/controller/AccessTokenController.java +++ b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/controller/AccessTokenController.java @@ -117,7 +117,7 @@ public RestResponse verifyToken() { @RequiresPermissions("token:view") public RestResponse tokensList( RestRequest restRequest, @Parameter(hidden = true) AccessToken accessToken) { - IPage accessTokens = accessTokenService.findAccessTokens(accessToken, restRequest); + IPage accessTokens = accessTokenService.getPage(accessToken, restRequest); return RestResponse.success(accessTokens); } diff --git a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/controller/MemberController.java b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/controller/MemberController.java index 809e1689d8..6e7a3efe4d 100644 --- a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/controller/MemberController.java +++ b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/controller/MemberController.java @@ -57,28 +57,28 @@ public class MemberController { @Operation(summary = "List members") @PostMapping("list") public RestResponse memberList(RestRequest restRequest, Member member) { - IPage userList = memberService.findUsers(member, restRequest); + IPage userList = memberService.getPage(member, restRequest); return RestResponse.success(userList); } @Operation(summary = "List candidate users") @PostMapping("candidateUsers") public RestResponse candidateUsers(Long teamId) { - List userList = memberService.findCandidateUsers(teamId); + List userList = memberService.listUsersNotInTeam(teamId); return RestResponse.success(userList); } @Operation(summary = "List teams") @PostMapping("teams") public RestResponse listTeams(Long userId) { - List teamList = memberService.findUserTeams(userId); + List teamList = memberService.listTeamsByUserId(userId); return RestResponse.success(teamList); } @Operation(summary = "Check the username") @PostMapping("check/user") public RestResponse check(@NotBlank(message = "{required}") Long teamId, String userName) { - Member result = this.memberService.findByUserName(teamId, userName); + Member result = this.memberService.getByTeamIdUserName(teamId, userName); return RestResponse.success(result == null); } diff --git a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/controller/MenuController.java b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/controller/MenuController.java index 372fd111ef..31b4773c38 100644 --- a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/controller/MenuController.java +++ b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/controller/MenuController.java @@ -53,7 +53,7 @@ public class MenuController { public RestResponse getUserRouters(Long teamId) { // TODO The teamId is required, get routers should be called after choose teamId. List> routers = - this.menuService.getUserRouters(commonService.getUserId(), teamId); + this.menuService.listRoutersByUserIdTeamId(commonService.getUserId(), teamId); return RestResponse.success(routers); } @@ -61,7 +61,7 @@ public RestResponse getUserRouters(Long teamId) { @PostMapping("list") @RequiresPermissions("menu:view") public RestResponse menuList(Menu menu) { - Map maps = this.menuService.findMenus(menu); + Map maps = this.menuService.listMenuMap(menu); return RestResponse.success(maps); } } diff --git a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/controller/RoleController.java b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/controller/RoleController.java index 7c639782d8..e87ec81cee 100644 --- a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/controller/RoleController.java +++ b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/controller/RoleController.java @@ -58,21 +58,21 @@ public class RoleController { @PostMapping("list") @RequiresPermissions("role:view") public RestResponse roleList(RestRequest restRequest, Role role) { - IPage roleList = roleService.findRoles(role, restRequest); + IPage roleList = roleService.getPage(role, restRequest); return RestResponse.success(roleList); } @Operation(summary = "Check the role name") @PostMapping("check/name") public RestResponse checkRoleName(@NotBlank(message = "{required}") String roleName) { - Role result = this.roleService.findByName(roleName); + Role result = this.roleService.getByName(roleName); return RestResponse.success(result == null); } @Operation(summary = "List role menus") @PostMapping("menu") public RestResponse getRoleMenus(@NotBlank(message = "{required}") String roleId) { - List list = this.roleMenuServie.getByRoleId(roleId); + List list = this.roleMenuServie.listByRoleId(roleId); List roleMenus = list.stream() .map(roleMenu -> String.valueOf(roleMenu.getMenuId())) diff --git a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/controller/TeamController.java b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/controller/TeamController.java index 86736b9e6d..49d6569e15 100644 --- a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/controller/TeamController.java +++ b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/controller/TeamController.java @@ -51,14 +51,14 @@ public class TeamController { @Operation(summary = "List teams") @PostMapping("list") public RestResponse teamList(RestRequest restRequest, Team team) { - IPage teamList = teamService.findTeams(team, restRequest); + IPage teamList = teamService.getPage(team, restRequest); return RestResponse.success(teamList); } @Operation(summary = "Check the team name") @PostMapping("check/name") public RestResponse checkTeamName(@NotBlank(message = "{required}") String teamName) { - Team result = this.teamService.findByName(teamName); + Team result = this.teamService.getByName(teamName); return RestResponse.success(result == null); } diff --git a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/controller/UserController.java b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/controller/UserController.java index 4608157fd4..9455cd4575 100644 --- a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/controller/UserController.java +++ b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/controller/UserController.java @@ -69,7 +69,7 @@ public class UserController { value = {"user:view", "app:view"}, logical = Logical.OR) public RestResponse userList(RestRequest restRequest, User user) { - IPage userList = userService.findUserDetail(user, restRequest); + IPage userList = userService.getPage(user, restRequest); return RestResponse.success(userList); } @@ -100,14 +100,14 @@ public RestResponse transferResource(Long userId, Long targetUserId) { @Operation(summary = "List without token users") @PostMapping("getNoTokenUser") public RestResponse getNoTokenUser() { - List userList = this.userService.getNoTokenUser(); + List userList = this.userService.listNoTokenUser(); return RestResponse.success(userList); } @Operation(summary = "Check the username") @PostMapping("check/name") public RestResponse checkUserName(@NotBlank(message = "{required}") String username) { - boolean result = this.userService.findByName(username) == null; + boolean result = this.userService.getByName(username) == null; return RestResponse.success(result); } @@ -161,7 +161,7 @@ public RestResponse setTeam(Long teamId) { @Operation(summary = "List the team users") @PostMapping("appOwners") public RestResponse appOwners(Long teamId) { - List userList = userService.findByAppOwner(teamId); + List userList = userService.listByAppOwner(teamId); userList.forEach(User::dataMasking); return RestResponse.success(userList); } diff --git a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/security/impl/AuthenticatorImpl.java b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/security/impl/AuthenticatorImpl.java index 50c9616a39..b7c48d3429 100644 --- a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/security/impl/AuthenticatorImpl.java +++ b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/security/impl/AuthenticatorImpl.java @@ -58,7 +58,7 @@ public User authenticate(String username, String password, String loginType) thr } private User passwordAuthenticate(String username, String password) { - User user = usersService.findByName(username); + User user = usersService.getByName(username); ApiAlertException.throwIfNull(user, String.format("User [%s] does not exist", username)); @@ -81,7 +81,7 @@ private User ldapAuthenticate(String username, String password) throws Exception return null; } // check if user exist - User user = usersService.findByName(username); + User user = usersService.getByName(username); if (user != null) { ApiAlertException.throwIfTrue( @@ -95,7 +95,7 @@ private User ldapAuthenticate(String username, String password) throws Exception private User ssoAuthenticate(String username) throws Exception { // check if user exist - User user = usersService.findByName(username); + User user = usersService.getByName(username); if (user != null) { ApiAlertException.throwIfTrue( diff --git a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/AccessTokenService.java b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/AccessTokenService.java index 1eaed5cc0d..b264e36c2b 100644 --- a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/AccessTokenService.java +++ b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/AccessTokenService.java @@ -32,7 +32,7 @@ RestResponse generateToken(Long userId, String expireTime, String description) boolean deleteToken(Long id); - IPage findAccessTokens(AccessToken tokenParam, RestRequest request); + IPage getPage(AccessToken tokenParam, RestRequest request); boolean checkTokenEffective(Long userId, String token); diff --git a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/MemberService.java b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/MemberService.java index 34ff96ca08..5a52450932 100644 --- a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/MemberService.java +++ b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/MemberService.java @@ -35,15 +35,15 @@ public interface MemberService extends IService { void deleteByTeamId(Long teamId); - IPage findUsers(Member member, RestRequest request); + IPage getPage(Member member, RestRequest request); - List findCandidateUsers(Long teamId); + List listUsersNotInTeam(Long teamId); - List findUserTeams(Long userId); + List listTeamsByUserId(Long userId); - Member findByUserName(Long teamId, String userName); + Member getByTeamIdUserName(Long teamId, String userName); - List findUserIdsByRoleId(Long roleId); + List listUserIdsByRoleId(Long roleId); void createMember(Member member); diff --git a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/MenuService.java b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/MenuService.java index 261f4eb49b..9784bcc93c 100644 --- a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/MenuService.java +++ b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/MenuService.java @@ -34,11 +34,11 @@ public interface MenuService extends IService { * @param teamId team id. If it's null, will find permissions from all teams. * @return permissions */ - List findUserPermissions(Long userId, Long teamId); + List listPermissionsByUserIdTeamId(Long userId, Long teamId); - List findUserMenus(Long userId, Long teamId); + List listMenusByUserIdTeamId(Long userId, Long teamId); - Map findMenus(Menu menu); + Map listMenuMap(Menu menu); - List> getUserRouters(Long userId, Long teamId); + List> listRoutersByUserIdTeamId(Long userId, Long teamId); } diff --git a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/RoleMenuServie.java b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/RoleMenuServie.java index a23b28d9d2..957dd05036 100644 --- a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/RoleMenuServie.java +++ b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/RoleMenuServie.java @@ -29,5 +29,5 @@ public interface RoleMenuServie extends IService { void deleteByMenuId(String[] menuIds); - List getByRoleId(String roleId); + List listByRoleId(String roleId); } diff --git a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/RoleService.java b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/RoleService.java index 8e1fd216b5..0cbc63004a 100644 --- a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/RoleService.java +++ b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/RoleService.java @@ -25,9 +25,9 @@ public interface RoleService extends IService { - IPage findRoles(Role role, RestRequest request); + IPage getPage(Role role, RestRequest request); - Role findByName(String roleName); + Role getByName(String roleName); void createRole(Role role); diff --git a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/TeamService.java b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/TeamService.java index 212a9ee4ab..a4903d0ef8 100644 --- a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/TeamService.java +++ b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/TeamService.java @@ -27,9 +27,9 @@ public interface TeamService extends IService { - IPage findTeams(Team team, RestRequest request); + IPage getPage(Team team, RestRequest request); - Team findByName(String teamName); + Team getByName(String teamName); void createTeam(Team team); @@ -37,5 +37,5 @@ public interface TeamService extends IService { void updateTeam(Team team); - List findUserTeams(Long userId); + List listByUserId(Long userId); } diff --git a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/UserService.java b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/UserService.java index b1709acdad..5d2e8fafc8 100644 --- a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/UserService.java +++ b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/UserService.java @@ -39,7 +39,7 @@ public interface UserService extends IService { * @param username username * @return user */ - User findByName(String username); + User getByName(String username); /** * find uer detail, contains basic info, role, department @@ -48,7 +48,7 @@ public interface UserService extends IService { * @param restRequest queryRequest * @return IPage */ - IPage findUserDetail(User user, RestRequest restRequest); + IPage getPage(User user, RestRequest restRequest); /** * update login time @@ -94,9 +94,9 @@ public interface UserService extends IService { * @param teamId team id. If it's null, will find permissions from all teams. * @return permissions */ - Set getPermissions(Long userId, @Nullable Long teamId); + Set listPermissionsByUserIdTeamId(Long userId, @Nullable Long teamId); - List getNoTokenUser(); + List listNoTokenUser(); void setLastTeam(Long teamId, Long userId); @@ -106,7 +106,7 @@ public interface UserService extends IService { void fillInTeam(User user); - List findByAppOwner(Long teamId); + List listByAppOwner(Long teamId); Map generateFrontendUserInfo(User user, Long teamId, JWTToken token); diff --git a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/impl/AccessTokenServiceImpl.java b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/impl/AccessTokenServiceImpl.java index 45f239c6d8..df86ffee79 100644 --- a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/impl/AccessTokenServiceImpl.java +++ b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/impl/AccessTokenServiceImpl.java @@ -87,7 +87,7 @@ public boolean deleteToken(Long id) { } @Override - public IPage findAccessTokens(AccessToken tokenParam, RestRequest request) { + public IPage getPage(AccessToken tokenParam, RestRequest request) { Page page = new MybatisPager().getDefaultPage(request); this.baseMapper.selectPage(page, tokenParam); List records = page.getRecords(); diff --git a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/impl/MemberServiceImpl.java b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/impl/MemberServiceImpl.java index dba05949fd..b33c923d06 100644 --- a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/impl/MemberServiceImpl.java +++ b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/impl/MemberServiceImpl.java @@ -74,7 +74,7 @@ public void deleteByTeamId(Long teamId) { } @Override - public IPage findUsers(Member member, RestRequest request) { + public IPage getPage(Member member, RestRequest request) { ApiAlertException.throwIfNull(member.getTeamId(), "The team id is required."); Page page = new Page<>(); page.setCurrent(request.getPageNum()); @@ -83,18 +83,18 @@ public IPage findUsers(Member member, RestRequest request) { } @Override - public List findCandidateUsers(Long teamId) { + public List listUsersNotInTeam(Long teamId) { return baseMapper.selectUsersNotInTeam(teamId); } @Override - public List findUserTeams(Long userId) { - return teamService.findUserTeams(userId); + public List listTeamsByUserId(Long userId) { + return teamService.listByUserId(userId); } @Override - public Member findByUserName(Long teamId, String userName) { - User user = userService.findByName(userName); + public Member getByTeamIdUserName(Long teamId, String userName) { + User user = userService.getByName(userName); if (user == null) { return null; } @@ -111,7 +111,7 @@ private Member findByUserId(Long teamId, Long userId) { } @Override - public List findUserIdsByRoleId(Long roleId) { + public List listUserIdsByRoleId(Long roleId) { LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper().eq(Member::getRoleId, roleId); List list = baseMapper.selectList(queryWrapper); @@ -121,7 +121,7 @@ public List findUserIdsByRoleId(Long roleId) { @Override public void createMember(Member member) { User user = - Optional.ofNullable(userService.findByName(member.getUserName())) + Optional.ofNullable(userService.getByName(member.getUserName())) .orElseThrow( () -> new ApiAlertException( diff --git a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/impl/MenuServiceImpl.java b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/impl/MenuServiceImpl.java index 197ed20b4b..16551f29d6 100644 --- a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/impl/MenuServiceImpl.java +++ b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/impl/MenuServiceImpl.java @@ -60,7 +60,7 @@ public class MenuServiceImpl extends ServiceImpl implements Me @Autowired private RoleMenuServie roleMenuServie; @Override - public List findUserPermissions(Long userId, Long teamId) { + public List listPermissionsByUserIdTeamId(Long userId, Long teamId) { User user = Optional.ofNullable(userService.getById(userId)) .orElseThrow( @@ -75,7 +75,7 @@ public List findUserPermissions(Long userId, Long teamId) { } @Override - public List findUserMenus(Long userId, Long teamId) { + public List listMenusByUserIdTeamId(Long userId, Long teamId) { User user = Optional.ofNullable(userService.getById(userId)) .orElseThrow( @@ -92,7 +92,7 @@ public List findUserMenus(Long userId, Long teamId) { } @Override - public Map findMenus(Menu menu) { + public Map listMenuMap(Menu menu) { Map result = new HashMap<>(16); try { LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); @@ -128,10 +128,10 @@ public Map findMenus(Menu menu) { } @Override - public List> getUserRouters(Long userId, Long teamId) { + public List> listRoutersByUserIdTeamId(Long userId, Long teamId) { List> routes = new ArrayList<>(); // The query type is the menu type - List menus = this.findUserMenus(userId, teamId); + List menus = this.listMenusByUserIdTeamId(userId, teamId); menus.forEach( menu -> { VueRouter route = new VueRouter<>(); diff --git a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/impl/RoleMenuServiceImpl.java b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/impl/RoleMenuServiceImpl.java index e09a0b2a0e..c35f1369b9 100644 --- a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/impl/RoleMenuServiceImpl.java +++ b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/impl/RoleMenuServiceImpl.java @@ -53,7 +53,7 @@ public void deleteByMenuId(String[] menuIds) { } @Override - public List getByRoleId(String roleId) { + public List listByRoleId(String roleId) { LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper().eq(RoleMenu::getRoleId, roleId); return baseMapper.selectList(queryWrapper); diff --git a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/impl/RoleServiceImpl.java b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/impl/RoleServiceImpl.java index 81ac223263..244cf6acba 100644 --- a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/impl/RoleServiceImpl.java +++ b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/impl/RoleServiceImpl.java @@ -59,7 +59,7 @@ public class RoleServiceImpl extends ServiceImpl implements Ro @Autowired private RoleMenuServie roleMenuService; @Override - public IPage findRoles(Role role, RestRequest request) { + public IPage getPage(Role role, RestRequest request) { Page page = new Page<>(); page.setCurrent(request.getPageNum()); page.setSize(request.getPageSize()); @@ -67,7 +67,7 @@ public IPage findRoles(Role role, RestRequest request) { } @Override - public Role findByName(String roleName) { + public Role getByName(String roleName) { return baseMapper.selectOne(new LambdaQueryWrapper().eq(Role::getRoleName, roleName)); } @@ -88,7 +88,7 @@ public void deleteRole(Long roleId) { () -> new ApiAlertException( String.format("Role id [%s] not found. Delete role failed.", roleId))); - List userIdsByRoleId = memberService.findUserIdsByRoleId(roleId); + List userIdsByRoleId = memberService.listUserIdsByRoleId(roleId); ApiAlertException.throwIfFalse( CollectionUtils.isEmpty(userIdsByRoleId), String.format( diff --git a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/impl/TeamServiceImpl.java b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/impl/TeamServiceImpl.java index cf140f3d70..3d0bb708e1 100644 --- a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/impl/TeamServiceImpl.java +++ b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/impl/TeamServiceImpl.java @@ -63,7 +63,7 @@ public class TeamServiceImpl extends ServiceImpl implements Te @Autowired private CommonService commonService; @Override - public IPage findTeams(Team team, RestRequest request) { + public IPage getPage(Team team, RestRequest request) { Page page = new Page<>(); page.setCurrent(request.getPageNum()); page.setSize(request.getPageSize()); @@ -71,7 +71,7 @@ public IPage findTeams(Team team, RestRequest request) { } @Override - public Team findByName(String teamName) { + public Team getByName(String teamName) { LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper().eq(Team::getTeamName, teamName); return baseMapper.selectOne(queryWrapper); @@ -79,7 +79,7 @@ public Team findByName(String teamName) { @Override public void createTeam(Team team) { - Team existedTeam = findByName(team.getTeamName()); + Team existedTeam = getByName(team.getTeamName()); ApiAlertException.throwIfFalse( existedTeam == null, String.format( @@ -135,7 +135,7 @@ public void updateTeam(Team team) { } @Override - public List findUserTeams(Long userId) { + public List listByUserId(Long userId) { User user = Optional.ofNullable(userService.getById(userId)) .orElseThrow( diff --git a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/impl/UserServiceImpl.java b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/impl/UserServiceImpl.java index f3253d05cf..ab432775f7 100644 --- a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/impl/UserServiceImpl.java +++ b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/impl/UserServiceImpl.java @@ -82,14 +82,14 @@ public class UserServiceImpl extends ServiceImpl implements Us @Autowired private ShiroProperties shiroProperties; @Override - public User findByName(String username) { + public User getByName(String username) { LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper().eq(User::getUsername, username); return baseMapper.selectOne(queryWrapper); } @Override - public IPage findUserDetail(User user, RestRequest request) { + public IPage getPage(User user, RestRequest request) { Page page = new Page<>(); page.setCurrent(request.getPageNum()); page.setSize(request.getPageSize()); @@ -180,13 +180,13 @@ public String resetPassword(String username) { } @Override - public Set getPermissions(Long userId, @Nullable Long teamId) { - List userPermissions = this.menuService.findUserPermissions(userId, teamId); + public Set listPermissionsByUserIdTeamId(Long userId, @Nullable Long teamId) { + List userPermissions = this.menuService.listPermissionsByUserIdTeamId(userId, teamId); return new HashSet<>(userPermissions); } @Override - public List getNoTokenUser() { + public List listNoTokenUser() { List users = this.baseMapper.selectNoTokenUsers(); if (!users.isEmpty()) { users.forEach(User::dataMasking); @@ -220,7 +220,7 @@ public void clearLastTeam(Long teamId) { @Override public void fillInTeam(User user) { if (user.getLastTeamId() == null) { - List teams = memberService.findUserTeams(user.getUserId()); + List teams = memberService.listTeamsByUserId(user.getUserId()); ApiAlertException.throwIfTrue( CollectionUtils.isEmpty(teams), @@ -235,7 +235,7 @@ public void fillInTeam(User user) { } @Override - public List findByAppOwner(Long teamId) { + public List listByAppOwner(Long teamId) { return baseMapper.selectUsersByAppOwner(teamId); } @@ -261,7 +261,7 @@ public Map generateFrontendUserInfo(User user, Long teamId, JWTT userInfo.put("user", user); // 3) permissions - Set permissions = this.getPermissions(user.getUserId(), teamId); + Set permissions = this.listPermissionsByUserIdTeamId(user.getUserId(), teamId); userInfo.put("permissions", permissions); return userInfo; diff --git a/streampark-console/streampark-console-service/src/test/java/org/apache/streampark/console/core/service/AccessTokenServiceTest.java b/streampark-console/streampark-console-service/src/test/java/org/apache/streampark/console/core/service/AccessTokenServiceTest.java index f20d7fb801..4044f53032 100644 --- a/streampark-console/streampark-console-service/src/test/java/org/apache/streampark/console/core/service/AccessTokenServiceTest.java +++ b/streampark-console/streampark-console-service/src/test/java/org/apache/streampark/console/core/service/AccessTokenServiceTest.java @@ -55,18 +55,18 @@ void testCrudToken() throws Exception { String username = JWTUtil.getUserName(jwtToken.getToken()); Assertions.assertNotNull(username); Assertions.assertEquals("admin", username); - User user = userService.findByName(username); + User user = userService.getByName(username); Assertions.assertNotNull(user); Assertions.assertTrue(JWTUtil.verify(jwtToken.getToken(), username)); // list AccessToken mockToken1 = new AccessToken(); mockToken1.setUserId(100000L); - IPage tokens1 = accessTokenService.findAccessTokens(mockToken1, new RestRequest()); + IPage tokens1 = accessTokenService.getPage(mockToken1, new RestRequest()); Assertions.assertEquals(1, tokens1.getRecords().size()); AccessToken mockToken2 = new AccessToken(); mockToken2.setUserId(100001L); - IPage tokens2 = accessTokenService.findAccessTokens(mockToken2, new RestRequest()); + IPage tokens2 = accessTokenService.getPage(mockToken2, new RestRequest()); Assertions.assertTrue(tokens2.getRecords().isEmpty()); // toggle From 8abd62c8d049e0179bdc8b9645ad00430c46e0c3 Mon Sep 17 00:00:00 2001 From: VampireAchao Date: Thu, 2 Nov 2023 08:56:56 +0800 Subject: [PATCH 2/3] [Improve] short part method name --- .../console/system/authentication/ShiroRealm.java | 2 +- .../console/system/controller/MenuController.java | 3 +-- .../streampark/console/system/service/MenuService.java | 6 +++--- .../streampark/console/system/service/UserService.java | 2 +- .../console/system/service/impl/MenuServiceImpl.java | 8 ++++---- .../console/system/service/impl/UserServiceImpl.java | 6 +++--- 6 files changed, 13 insertions(+), 14 deletions(-) diff --git a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/authentication/ShiroRealm.java b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/authentication/ShiroRealm.java index b86e7f1a4d..11c1d11ff1 100644 --- a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/authentication/ShiroRealm.java +++ b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/authentication/ShiroRealm.java @@ -63,7 +63,7 @@ protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection token) { SimpleAuthorizationInfo simpleAuthorizationInfo = new SimpleAuthorizationInfo(); // Get user permission set - Set permissionSet = userService.listPermissionsByUserIdTeamId(userId, null); + Set permissionSet = userService.listPermissions(userId, null); simpleAuthorizationInfo.setStringPermissions(permissionSet); return simpleAuthorizationInfo; } diff --git a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/controller/MenuController.java b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/controller/MenuController.java index 31b4773c38..58e2ea8fe4 100644 --- a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/controller/MenuController.java +++ b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/controller/MenuController.java @@ -52,8 +52,7 @@ public class MenuController { @PostMapping("router") public RestResponse getUserRouters(Long teamId) { // TODO The teamId is required, get routers should be called after choose teamId. - List> routers = - this.menuService.listRoutersByUserIdTeamId(commonService.getUserId(), teamId); + List> routers = this.menuService.listRouters(commonService.getUserId(), teamId); return RestResponse.success(routers); } diff --git a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/MenuService.java b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/MenuService.java index 9784bcc93c..3bb5319a35 100644 --- a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/MenuService.java +++ b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/MenuService.java @@ -34,11 +34,11 @@ public interface MenuService extends IService { * @param teamId team id. If it's null, will find permissions from all teams. * @return permissions */ - List listPermissionsByUserIdTeamId(Long userId, Long teamId); + List listPermissions(Long userId, Long teamId); - List listMenusByUserIdTeamId(Long userId, Long teamId); + List listMenus(Long userId, Long teamId); Map listMenuMap(Menu menu); - List> listRoutersByUserIdTeamId(Long userId, Long teamId); + List> listRouters(Long userId, Long teamId); } diff --git a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/UserService.java b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/UserService.java index 5d2e8fafc8..5da54c1430 100644 --- a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/UserService.java +++ b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/UserService.java @@ -94,7 +94,7 @@ public interface UserService extends IService { * @param teamId team id. If it's null, will find permissions from all teams. * @return permissions */ - Set listPermissionsByUserIdTeamId(Long userId, @Nullable Long teamId); + Set listPermissions(Long userId, @Nullable Long teamId); List listNoTokenUser(); diff --git a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/impl/MenuServiceImpl.java b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/impl/MenuServiceImpl.java index 16551f29d6..0e1f711c85 100644 --- a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/impl/MenuServiceImpl.java +++ b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/impl/MenuServiceImpl.java @@ -60,7 +60,7 @@ public class MenuServiceImpl extends ServiceImpl implements Me @Autowired private RoleMenuServie roleMenuServie; @Override - public List listPermissionsByUserIdTeamId(Long userId, Long teamId) { + public List listPermissions(Long userId, Long teamId) { User user = Optional.ofNullable(userService.getById(userId)) .orElseThrow( @@ -75,7 +75,7 @@ public List listPermissionsByUserIdTeamId(Long userId, Long teamId) { } @Override - public List listMenusByUserIdTeamId(Long userId, Long teamId) { + public List listMenus(Long userId, Long teamId) { User user = Optional.ofNullable(userService.getById(userId)) .orElseThrow( @@ -128,10 +128,10 @@ public Map listMenuMap(Menu menu) { } @Override - public List> listRoutersByUserIdTeamId(Long userId, Long teamId) { + public List> listRouters(Long userId, Long teamId) { List> routes = new ArrayList<>(); // The query type is the menu type - List menus = this.listMenusByUserIdTeamId(userId, teamId); + List menus = this.listMenus(userId, teamId); menus.forEach( menu -> { VueRouter route = new VueRouter<>(); diff --git a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/impl/UserServiceImpl.java b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/impl/UserServiceImpl.java index ab432775f7..25e6f9c445 100644 --- a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/impl/UserServiceImpl.java +++ b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/impl/UserServiceImpl.java @@ -180,8 +180,8 @@ public String resetPassword(String username) { } @Override - public Set listPermissionsByUserIdTeamId(Long userId, @Nullable Long teamId) { - List userPermissions = this.menuService.listPermissionsByUserIdTeamId(userId, teamId); + public Set listPermissions(Long userId, @Nullable Long teamId) { + List userPermissions = this.menuService.listPermissions(userId, teamId); return new HashSet<>(userPermissions); } @@ -261,7 +261,7 @@ public Map generateFrontendUserInfo(User user, Long teamId, JWTT userInfo.put("user", user); // 3) permissions - Set permissions = this.listPermissionsByUserIdTeamId(user.getUserId(), teamId); + Set permissions = this.listPermissions(user.getUserId(), teamId); userInfo.put("permissions", permissions); return userInfo; From 4c91bf9a28141b72b99491a8eedf18a154847569 Mon Sep 17 00:00:00 2001 From: VampireAchao Date: Thu, 2 Nov 2023 08:59:02 +0800 Subject: [PATCH 3/3] [Improve] optimize some method name --- .../console/system/authentication/ShiroRealm.java | 2 +- .../console/system/controller/UserController.java | 4 ++-- .../console/system/security/impl/AuthenticatorImpl.java | 6 +++--- .../streampark/console/system/service/UserService.java | 4 ++-- .../console/system/service/impl/MemberServiceImpl.java | 4 ++-- .../console/system/service/impl/UserServiceImpl.java | 4 ++-- .../console/core/service/AccessTokenServiceTest.java | 2 +- 7 files changed, 13 insertions(+), 13 deletions(-) diff --git a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/authentication/ShiroRealm.java b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/authentication/ShiroRealm.java index 11c1d11ff1..41e7f05867 100644 --- a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/authentication/ShiroRealm.java +++ b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/authentication/ShiroRealm.java @@ -85,7 +85,7 @@ protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken authent throw new AuthenticationException("Token verification failed"); } // Query user information by username - User user = userService.getByName(username); + User user = userService.getByUsername(username); if (user == null) { throw new AuthenticationException("ERROR Incorrect username or password!"); diff --git a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/controller/UserController.java b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/controller/UserController.java index 9455cd4575..0d15b02c7d 100644 --- a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/controller/UserController.java +++ b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/controller/UserController.java @@ -107,7 +107,7 @@ public RestResponse getNoTokenUser() { @Operation(summary = "Check the username") @PostMapping("check/name") public RestResponse checkUserName(@NotBlank(message = "{required}") String username) { - boolean result = this.userService.getByName(username) == null; + boolean result = this.userService.getByUsername(username) == null; return RestResponse.success(result); } @@ -161,7 +161,7 @@ public RestResponse setTeam(Long teamId) { @Operation(summary = "List the team users") @PostMapping("appOwners") public RestResponse appOwners(Long teamId) { - List userList = userService.listByAppOwner(teamId); + List userList = userService.listByTeamId(teamId); userList.forEach(User::dataMasking); return RestResponse.success(userList); } diff --git a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/security/impl/AuthenticatorImpl.java b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/security/impl/AuthenticatorImpl.java index b7c48d3429..c72dc9e794 100644 --- a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/security/impl/AuthenticatorImpl.java +++ b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/security/impl/AuthenticatorImpl.java @@ -58,7 +58,7 @@ public User authenticate(String username, String password, String loginType) thr } private User passwordAuthenticate(String username, String password) { - User user = usersService.getByName(username); + User user = usersService.getByUsername(username); ApiAlertException.throwIfNull(user, String.format("User [%s] does not exist", username)); @@ -81,7 +81,7 @@ private User ldapAuthenticate(String username, String password) throws Exception return null; } // check if user exist - User user = usersService.getByName(username); + User user = usersService.getByUsername(username); if (user != null) { ApiAlertException.throwIfTrue( @@ -95,7 +95,7 @@ private User ldapAuthenticate(String username, String password) throws Exception private User ssoAuthenticate(String username) throws Exception { // check if user exist - User user = usersService.getByName(username); + User user = usersService.getByUsername(username); if (user != null) { ApiAlertException.throwIfTrue( diff --git a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/UserService.java b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/UserService.java index 5da54c1430..713d65cd06 100644 --- a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/UserService.java +++ b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/UserService.java @@ -39,7 +39,7 @@ public interface UserService extends IService { * @param username username * @return user */ - User getByName(String username); + User getByUsername(String username); /** * find uer detail, contains basic info, role, department @@ -106,7 +106,7 @@ public interface UserService extends IService { void fillInTeam(User user); - List listByAppOwner(Long teamId); + List listByTeamId(Long teamId); Map generateFrontendUserInfo(User user, Long teamId, JWTToken token); diff --git a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/impl/MemberServiceImpl.java b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/impl/MemberServiceImpl.java index b33c923d06..086fd9dc36 100644 --- a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/impl/MemberServiceImpl.java +++ b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/impl/MemberServiceImpl.java @@ -94,7 +94,7 @@ public List listTeamsByUserId(Long userId) { @Override public Member getByTeamIdUserName(Long teamId, String userName) { - User user = userService.getByName(userName); + User user = userService.getByUsername(userName); if (user == null) { return null; } @@ -121,7 +121,7 @@ public List listUserIdsByRoleId(Long roleId) { @Override public void createMember(Member member) { User user = - Optional.ofNullable(userService.getByName(member.getUserName())) + Optional.ofNullable(userService.getByUsername(member.getUserName())) .orElseThrow( () -> new ApiAlertException( diff --git a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/impl/UserServiceImpl.java b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/impl/UserServiceImpl.java index 25e6f9c445..78e70d275d 100644 --- a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/impl/UserServiceImpl.java +++ b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/impl/UserServiceImpl.java @@ -82,7 +82,7 @@ public class UserServiceImpl extends ServiceImpl implements Us @Autowired private ShiroProperties shiroProperties; @Override - public User getByName(String username) { + public User getByUsername(String username) { LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper().eq(User::getUsername, username); return baseMapper.selectOne(queryWrapper); @@ -235,7 +235,7 @@ public void fillInTeam(User user) { } @Override - public List listByAppOwner(Long teamId) { + public List listByTeamId(Long teamId) { return baseMapper.selectUsersByAppOwner(teamId); } diff --git a/streampark-console/streampark-console-service/src/test/java/org/apache/streampark/console/core/service/AccessTokenServiceTest.java b/streampark-console/streampark-console-service/src/test/java/org/apache/streampark/console/core/service/AccessTokenServiceTest.java index 4044f53032..4520ad47d8 100644 --- a/streampark-console/streampark-console-service/src/test/java/org/apache/streampark/console/core/service/AccessTokenServiceTest.java +++ b/streampark-console/streampark-console-service/src/test/java/org/apache/streampark/console/core/service/AccessTokenServiceTest.java @@ -55,7 +55,7 @@ void testCrudToken() throws Exception { String username = JWTUtil.getUserName(jwtToken.getToken()); Assertions.assertNotNull(username); Assertions.assertEquals("admin", username); - User user = userService.getByName(username); + User user = userService.getByUsername(username); Assertions.assertNotNull(user); Assertions.assertTrue(JWTUtil.verify(jwtToken.getToken(), username));