feat: guava缓存/登录拦截器
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
package com.landaiqing.subject.infra.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Classname UserInfo
|
||||
* @BelongsProject: qing-yu-club
|
||||
* @BelongsPackage: com.landaiqing.subject.infra.entity
|
||||
* @Author: landaiqing
|
||||
* @CreateTime: 2024-03-03 20:13
|
||||
* @Description: TODO
|
||||
* @Version: 1.0
|
||||
*/
|
||||
@Data
|
||||
public class UserInfo {
|
||||
private String userName;
|
||||
|
||||
private String nickName;
|
||||
}
|
@@ -0,0 +1,39 @@
|
||||
package com.landaiqing.subject.infra.rpc;
|
||||
|
||||
import com.landaiqing.auth.api.UserFeignService;
|
||||
import com.landaiqing.auth.entity.AuthUserDTO;
|
||||
import com.landaiqing.auth.entity.Result;
|
||||
import com.landaiqing.subject.infra.entity.UserInfo;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* @Classname UserRpc
|
||||
* @BelongsProject: qing-yu-club
|
||||
* @BelongsPackage: com.landaiqing.subject.infra.rpc
|
||||
* @Author: landaiqing
|
||||
* @CreateTime: 2024-03-03 20:11
|
||||
* @Description: TODO
|
||||
* @Version: 1.0
|
||||
*/
|
||||
@Component
|
||||
public class UserRpc {
|
||||
@Resource
|
||||
private UserFeignService userFeignService;
|
||||
|
||||
public UserInfo getUserInfo(String userName) {
|
||||
AuthUserDTO authUserDTO = new AuthUserDTO();
|
||||
authUserDTO.setUserName(userName);
|
||||
Result<AuthUserDTO> result = userFeignService.getUserInfo(authUserDTO);
|
||||
UserInfo userInfo = new UserInfo();
|
||||
if (!result.getSuccess()) {
|
||||
return userInfo;
|
||||
|
||||
}
|
||||
AuthUserDTO data = result.getData();
|
||||
userInfo.setUserName(data.getUserName());
|
||||
userInfo.setNickName(data.getNickName());
|
||||
return userInfo;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user