From 5f00cf75b2a01e9bc666d8c1c9a7a364294163b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E6=98=95?= Date: Mon, 11 Mar 2024 14:46:47 +0800 Subject: [PATCH] =?UTF-8?q?1.=20=E5=A4=87=E4=BB=BD=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + .../java/com/cf/cs/authentication/misc/JwtUtils.java | 4 ++-- .../service/impl/AuthUsersCacheServiceImpl.java | 4 ++-- cs-database/pom.xml | 11 ----------- .../service/impl/OperationLogDataBaseServiceImpl.java | 6 +++--- .../service/impl/UserDataBaseServiceImpl.java | 2 +- .../cs/restful/controller/PermissionManagerApi.java | 8 ++++---- .../cf/cs/restful/service/impl/UserServiceImpl.java | 10 +++++----- 8 files changed, 18 insertions(+), 28 deletions(-) diff --git a/.gitignore b/.gitignore index 23621d0..8a6ebe1 100644 --- a/.gitignore +++ b/.gitignore @@ -33,3 +33,4 @@ build/ .vscode/ /logs/ **/git.properties +**/logs/*.log diff --git a/cs-authentication/src/main/java/com/cf/cs/authentication/misc/JwtUtils.java b/cs-authentication/src/main/java/com/cf/cs/authentication/misc/JwtUtils.java index b58ba82..10470fa 100644 --- a/cs-authentication/src/main/java/com/cf/cs/authentication/misc/JwtUtils.java +++ b/cs-authentication/src/main/java/com/cf/cs/authentication/misc/JwtUtils.java @@ -37,7 +37,7 @@ public class JwtUtils { private JwtConfigure jwtConfigure; @Resource - private UserDataBaseService userService; + private UserDataBaseService userDbService; /** * Gets head value. @@ -100,7 +100,7 @@ public class JwtUtils { } // 获取用户的权限等信息 - User user = userService.getAccountUserByUid(uid); + User user = userDbService.getAccountUserByUid(uid); if (user == null) { throw new CommonAuthException(ErrorCode.ERR_TOKENNOTFOUND); diff --git a/cs-authentication/src/main/java/com/cf/cs/authentication/service/impl/AuthUsersCacheServiceImpl.java b/cs-authentication/src/main/java/com/cf/cs/authentication/service/impl/AuthUsersCacheServiceImpl.java index 3fb97d6..8202f0e 100644 --- a/cs-authentication/src/main/java/com/cf/cs/authentication/service/impl/AuthUsersCacheServiceImpl.java +++ b/cs-authentication/src/main/java/com/cf/cs/authentication/service/impl/AuthUsersCacheServiceImpl.java @@ -23,7 +23,7 @@ import org.springframework.stereotype.Service; @Slf4j public class AuthUsersCacheServiceImpl implements AuthUsersService { @Resource - private UserDataBaseService userService; + private UserDataBaseService userDbService; @Resource private RoleMapper roleMapper; @@ -31,7 +31,7 @@ public class AuthUsersCacheServiceImpl implements AuthUsersService { @Override @Cacheable(value = "AUTH_CACHE", key = "'user'+#username", sync = true) public AuthAccountUser getAuthAccountByUserName(String username) { - User user = userService.getAccountUserByName(username); + User user = userDbService.getAccountUserByName(username); if (user == null) { return null; diff --git a/cs-database/pom.xml b/cs-database/pom.xml index ab4cd43..6079d70 100644 --- a/cs-database/pom.xml +++ b/cs-database/pom.xml @@ -63,12 +63,6 @@ - - - ${project.basedir}/config - true - - org.springframework.boot @@ -80,11 +74,6 @@ org.apache.maven.plugins maven-surefire-plugin - - - com.cf.cs:cs-base - - diff --git a/cs-database/src/main/java/com/cf/cs/database/service/impl/OperationLogDataBaseServiceImpl.java b/cs-database/src/main/java/com/cf/cs/database/service/impl/OperationLogDataBaseServiceImpl.java index 43b7746..fe9a475 100644 --- a/cs-database/src/main/java/com/cf/cs/database/service/impl/OperationLogDataBaseServiceImpl.java +++ b/cs-database/src/main/java/com/cf/cs/database/service/impl/OperationLogDataBaseServiceImpl.java @@ -46,7 +46,7 @@ public class OperationLogDataBaseServiceImpl extends ServiceImpl idArray = userName.stream() - .filter(k -> userService.getAccountUserByName(k) != null) - .map(k -> userService.getAccountUserByName(k).getId()) + .filter(k -> userDbService.getAccountUserByName(k) != null) + .map(k -> userDbService.getAccountUserByName(k).getId()) .toList(); wrapper = new QueryWrapper().select(OPERATION_LOG.ALL_COLUMNS) diff --git a/cs-database/src/main/java/com/cf/cs/database/service/impl/UserDataBaseServiceImpl.java b/cs-database/src/main/java/com/cf/cs/database/service/impl/UserDataBaseServiceImpl.java index 2ea13b7..4320899 100644 --- a/cs-database/src/main/java/com/cf/cs/database/service/impl/UserDataBaseServiceImpl.java +++ b/cs-database/src/main/java/com/cf/cs/database/service/impl/UserDataBaseServiceImpl.java @@ -34,7 +34,7 @@ import static com.cf.cs.database.pojo.entity.table.UserTableDef.USER; * @author makejava @163.com * @since 2023 -12-19 17:35:26 */ -@Service("userService") +@Service @Slf4j public class UserDataBaseServiceImpl extends ServiceImpl implements UserDataBaseService { diff --git a/cs-restful/src/main/java/com/cf/cs/restful/controller/PermissionManagerApi.java b/cs-restful/src/main/java/com/cf/cs/restful/controller/PermissionManagerApi.java index ed72daa..ff3605c 100644 --- a/cs-restful/src/main/java/com/cf/cs/restful/controller/PermissionManagerApi.java +++ b/cs-restful/src/main/java/com/cf/cs/restful/controller/PermissionManagerApi.java @@ -49,7 +49,7 @@ public class PermissionManagerApi { private UserPermissionService userPermissionService; @Resource - private UserDataBaseService userService; + private UserDataBaseService userDbService; @Resource private AuthUsersService authUsersService; @@ -72,7 +72,7 @@ public class PermissionManagerApi { return ProtocolResp.result(UserResPermInfoResp.builder() .userId(au.getUid()) .username(au.getUsername()) - .resPermission(userService.getCurrentUserResourcePerm()) + .resPermission(userDbService.getCurrentUserResourcePerm()) .build()); } @@ -90,7 +90,7 @@ public class PermissionManagerApi { List validate = HelperUtils.validate(mr, ValidGroups.ProtocolCommonValid.class, ValidGroups.OperationLogReqValid.class); // 如果校验通过,validate为空;否则,validate包含未校验通过项 if (validate.isEmpty()) { - User user = userService.getAccountUserByUid(mr.getMsgContent().getUid()); + User user = userDbService.getAccountUserByUid(mr.getMsgContent().getUid()); if (user == null) { return ProtocolResp.result(ErrorCode.ERR_USERNOTFOUND); @@ -99,7 +99,7 @@ public class PermissionManagerApi { return ProtocolResp.result(UserResPermInfoResp.builder() .userId(user.getUid()) .username(user.getUsername()) - .resPermission(userService.getUserResourcePerm(user.getId())) + .resPermission(userDbService.getUserResourcePerm(user.getId())) .build()); } else { return ProtocolResp.result(ErrorCode.ERR_PARAMEXCEPTION, ErrorCode.ERR_PARAMEXCEPTION.getHttpCode(), diff --git a/cs-restful/src/main/java/com/cf/cs/restful/service/impl/UserServiceImpl.java b/cs-restful/src/main/java/com/cf/cs/restful/service/impl/UserServiceImpl.java index 0ef8103..0e5511e 100644 --- a/cs-restful/src/main/java/com/cf/cs/restful/service/impl/UserServiceImpl.java +++ b/cs-restful/src/main/java/com/cf/cs/restful/service/impl/UserServiceImpl.java @@ -30,7 +30,7 @@ import static com.cf.cs.database.pojo.entity.table.UserTableDef.USER; @Slf4j public class UserServiceImpl implements UserService { @Resource - private UserDataBaseService userDataBaseService; + private UserDataBaseService userDbService; @Resource private RoleMapper roleMapper; @@ -51,7 +51,7 @@ public class UserServiceImpl implements UserService { throw new CommonErrorCodeException(ErrorCode.ERR_USER_ROLE_NOTEXISTS); } - User user = userDataBaseService.getAccountUserByName(username); + User user = userDbService.getAccountUserByName(username); if (user != null) { log.error("User {} is exists.", username); @@ -65,7 +65,7 @@ public class UserServiceImpl implements UserService { throw new CommonErrorCodeException(ErrorCode.ERR_TOKENNOTFOUND); } - User logUser = userDataBaseService.getAccountUserByName(loginUsername); + User logUser = userDbService.getAccountUserByName(loginUsername); if (logUser == null) { log.error("Login User({}) is not exists.", loginUsername); @@ -86,7 +86,7 @@ public class UserServiceImpl implements UserService { throw new CommonErrorCodeException(ErrorCode.ERR_DATABASE); } - newUser = userDataBaseService.getAccountUserByName(username); + newUser = userDbService.getAccountUserByName(username); BCryptPasswordEncoder encoder = new BCryptPasswordEncoder(); UserCredential uc = new UserCredential(); @@ -105,7 +105,7 @@ public class UserServiceImpl implements UserService { @Override @Transactional(rollbackFor = Exception.class) public void removeUser(String uid) { - User user = userDataBaseService.getAccountUserByUid(uid); + User user = userDbService.getAccountUserByUid(uid); if (user == null) { log.error("Login User({}) is not exists.", uid);