1. 备份代码
This commit is contained in:
parent
00e6ddcd98
commit
5f00cf75b2
|
@ -33,3 +33,4 @@ build/
|
||||||
.vscode/
|
.vscode/
|
||||||
/logs/
|
/logs/
|
||||||
**/git.properties
|
**/git.properties
|
||||||
|
**/logs/*.log
|
||||||
|
|
|
@ -37,7 +37,7 @@ public class JwtUtils {
|
||||||
private JwtConfigure jwtConfigure;
|
private JwtConfigure jwtConfigure;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private UserDataBaseService userService;
|
private UserDataBaseService userDbService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets head value.
|
* Gets head value.
|
||||||
|
@ -100,7 +100,7 @@ public class JwtUtils {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取用户的权限等信息
|
// 获取用户的权限等信息
|
||||||
User user = userService.getAccountUserByUid(uid);
|
User user = userDbService.getAccountUserByUid(uid);
|
||||||
|
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
throw new CommonAuthException(ErrorCode.ERR_TOKENNOTFOUND);
|
throw new CommonAuthException(ErrorCode.ERR_TOKENNOTFOUND);
|
||||||
|
|
|
@ -23,7 +23,7 @@ import org.springframework.stereotype.Service;
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class AuthUsersCacheServiceImpl implements AuthUsersService {
|
public class AuthUsersCacheServiceImpl implements AuthUsersService {
|
||||||
@Resource
|
@Resource
|
||||||
private UserDataBaseService userService;
|
private UserDataBaseService userDbService;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private RoleMapper roleMapper;
|
private RoleMapper roleMapper;
|
||||||
|
@ -31,7 +31,7 @@ public class AuthUsersCacheServiceImpl implements AuthUsersService {
|
||||||
@Override
|
@Override
|
||||||
@Cacheable(value = "AUTH_CACHE", key = "'user'+#username", sync = true)
|
@Cacheable(value = "AUTH_CACHE", key = "'user'+#username", sync = true)
|
||||||
public AuthAccountUser getAuthAccountByUserName(String username) {
|
public AuthAccountUser getAuthAccountByUserName(String username) {
|
||||||
User user = userService.getAccountUserByName(username);
|
User user = userDbService.getAccountUserByName(username);
|
||||||
|
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -63,12 +63,6 @@
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
<resources>
|
|
||||||
<resource>
|
|
||||||
<directory>${project.basedir}/config</directory>
|
|
||||||
<filtering>true</filtering>
|
|
||||||
</resource>
|
|
||||||
</resources>
|
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
@ -80,11 +74,6 @@
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-surefire-plugin</artifactId>
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
<configuration>
|
|
||||||
<dependenciesToScan>
|
|
||||||
<dependency>com.cf.cs:cs-base</dependency>
|
|
||||||
</dependenciesToScan>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
|
|
|
@ -46,7 +46,7 @@ public class OperationLogDataBaseServiceImpl extends ServiceImpl<OperationLogMap
|
||||||
private ServerProperties serverProperties;
|
private ServerProperties serverProperties;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private UserDataBaseService userService;
|
private UserDataBaseService userDbService;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private OperationLogMapper operationLogMapper;
|
private OperationLogMapper operationLogMapper;
|
||||||
|
@ -153,8 +153,8 @@ public class OperationLogDataBaseServiceImpl extends ServiceImpl<OperationLogMap
|
||||||
if (HelperUtils.stringNotEmptyOrNull(username)) {
|
if (HelperUtils.stringNotEmptyOrNull(username)) {
|
||||||
if (userName != null && !userName.isEmpty()) {
|
if (userName != null && !userName.isEmpty()) {
|
||||||
List<Long> idArray = userName.stream()
|
List<Long> idArray = userName.stream()
|
||||||
.filter(k -> userService.getAccountUserByName(k) != null)
|
.filter(k -> userDbService.getAccountUserByName(k) != null)
|
||||||
.map(k -> userService.getAccountUserByName(k).getId())
|
.map(k -> userDbService.getAccountUserByName(k).getId())
|
||||||
.toList();
|
.toList();
|
||||||
|
|
||||||
wrapper = new QueryWrapper().select(OPERATION_LOG.ALL_COLUMNS)
|
wrapper = new QueryWrapper().select(OPERATION_LOG.ALL_COLUMNS)
|
||||||
|
|
|
@ -34,7 +34,7 @@ import static com.cf.cs.database.pojo.entity.table.UserTableDef.USER;
|
||||||
* @author makejava @163.com
|
* @author makejava @163.com
|
||||||
* @since 2023 -12-19 17:35:26
|
* @since 2023 -12-19 17:35:26
|
||||||
*/
|
*/
|
||||||
@Service("userService")
|
@Service
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class UserDataBaseServiceImpl extends ServiceImpl<UserMapper, User> implements UserDataBaseService {
|
public class UserDataBaseServiceImpl extends ServiceImpl<UserMapper, User> implements UserDataBaseService {
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,7 @@ public class PermissionManagerApi {
|
||||||
private UserPermissionService userPermissionService;
|
private UserPermissionService userPermissionService;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private UserDataBaseService userService;
|
private UserDataBaseService userDbService;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private AuthUsersService authUsersService;
|
private AuthUsersService authUsersService;
|
||||||
|
@ -72,7 +72,7 @@ public class PermissionManagerApi {
|
||||||
return ProtocolResp.result(UserResPermInfoResp.builder()
|
return ProtocolResp.result(UserResPermInfoResp.builder()
|
||||||
.userId(au.getUid())
|
.userId(au.getUid())
|
||||||
.username(au.getUsername())
|
.username(au.getUsername())
|
||||||
.resPermission(userService.getCurrentUserResourcePerm())
|
.resPermission(userDbService.getCurrentUserResourcePerm())
|
||||||
.build());
|
.build());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,7 +90,7 @@ public class PermissionManagerApi {
|
||||||
List<String> validate = HelperUtils.validate(mr, ValidGroups.ProtocolCommonValid.class, ValidGroups.OperationLogReqValid.class);
|
List<String> validate = HelperUtils.validate(mr, ValidGroups.ProtocolCommonValid.class, ValidGroups.OperationLogReqValid.class);
|
||||||
// 如果校验通过,validate为空;否则,validate包含未校验通过项
|
// 如果校验通过,validate为空;否则,validate包含未校验通过项
|
||||||
if (validate.isEmpty()) {
|
if (validate.isEmpty()) {
|
||||||
User user = userService.getAccountUserByUid(mr.getMsgContent().getUid());
|
User user = userDbService.getAccountUserByUid(mr.getMsgContent().getUid());
|
||||||
|
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
return ProtocolResp.result(ErrorCode.ERR_USERNOTFOUND);
|
return ProtocolResp.result(ErrorCode.ERR_USERNOTFOUND);
|
||||||
|
@ -99,7 +99,7 @@ public class PermissionManagerApi {
|
||||||
return ProtocolResp.result(UserResPermInfoResp.builder()
|
return ProtocolResp.result(UserResPermInfoResp.builder()
|
||||||
.userId(user.getUid())
|
.userId(user.getUid())
|
||||||
.username(user.getUsername())
|
.username(user.getUsername())
|
||||||
.resPermission(userService.getUserResourcePerm(user.getId()))
|
.resPermission(userDbService.getUserResourcePerm(user.getId()))
|
||||||
.build());
|
.build());
|
||||||
} else {
|
} else {
|
||||||
return ProtocolResp.result(ErrorCode.ERR_PARAMEXCEPTION, ErrorCode.ERR_PARAMEXCEPTION.getHttpCode(),
|
return ProtocolResp.result(ErrorCode.ERR_PARAMEXCEPTION, ErrorCode.ERR_PARAMEXCEPTION.getHttpCode(),
|
||||||
|
|
|
@ -30,7 +30,7 @@ import static com.cf.cs.database.pojo.entity.table.UserTableDef.USER;
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class UserServiceImpl implements UserService {
|
public class UserServiceImpl implements UserService {
|
||||||
@Resource
|
@Resource
|
||||||
private UserDataBaseService userDataBaseService;
|
private UserDataBaseService userDbService;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private RoleMapper roleMapper;
|
private RoleMapper roleMapper;
|
||||||
|
@ -51,7 +51,7 @@ public class UserServiceImpl implements UserService {
|
||||||
throw new CommonErrorCodeException(ErrorCode.ERR_USER_ROLE_NOTEXISTS);
|
throw new CommonErrorCodeException(ErrorCode.ERR_USER_ROLE_NOTEXISTS);
|
||||||
}
|
}
|
||||||
|
|
||||||
User user = userDataBaseService.getAccountUserByName(username);
|
User user = userDbService.getAccountUserByName(username);
|
||||||
|
|
||||||
if (user != null) {
|
if (user != null) {
|
||||||
log.error("User {} is exists.", username);
|
log.error("User {} is exists.", username);
|
||||||
|
@ -65,7 +65,7 @@ public class UserServiceImpl implements UserService {
|
||||||
throw new CommonErrorCodeException(ErrorCode.ERR_TOKENNOTFOUND);
|
throw new CommonErrorCodeException(ErrorCode.ERR_TOKENNOTFOUND);
|
||||||
}
|
}
|
||||||
|
|
||||||
User logUser = userDataBaseService.getAccountUserByName(loginUsername);
|
User logUser = userDbService.getAccountUserByName(loginUsername);
|
||||||
|
|
||||||
if (logUser == null) {
|
if (logUser == null) {
|
||||||
log.error("Login User({}) is not exists.", loginUsername);
|
log.error("Login User({}) is not exists.", loginUsername);
|
||||||
|
@ -86,7 +86,7 @@ public class UserServiceImpl implements UserService {
|
||||||
throw new CommonErrorCodeException(ErrorCode.ERR_DATABASE);
|
throw new CommonErrorCodeException(ErrorCode.ERR_DATABASE);
|
||||||
}
|
}
|
||||||
|
|
||||||
newUser = userDataBaseService.getAccountUserByName(username);
|
newUser = userDbService.getAccountUserByName(username);
|
||||||
|
|
||||||
BCryptPasswordEncoder encoder = new BCryptPasswordEncoder();
|
BCryptPasswordEncoder encoder = new BCryptPasswordEncoder();
|
||||||
UserCredential uc = new UserCredential();
|
UserCredential uc = new UserCredential();
|
||||||
|
@ -105,7 +105,7 @@ public class UserServiceImpl implements UserService {
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void removeUser(String uid) {
|
public void removeUser(String uid) {
|
||||||
User user = userDataBaseService.getAccountUserByUid(uid);
|
User user = userDbService.getAccountUserByUid(uid);
|
||||||
|
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
log.error("Login User({}) is not exists.", uid);
|
log.error("Login User({}) is not exists.", uid);
|
||||||
|
|
Loading…
Reference in New Issue