feat: fix bugs

This commit is contained in:
2025-03-31 13:39:22 +08:00
parent 337cc6b8f2
commit 0e9da0de20
5 changed files with 16 additions and 4 deletions

View File

@@ -32,7 +32,7 @@ public class UserInfoUtil<T> {
if (date.getTime() > expireData.getTime()) { if (date.getTime() > expireData.getTime()) {
return null; return null;
} }
return (T) shiroService.findByUserId(ftToken.getUserId()); return (T) shiroService.findByUserId(String.valueOf(ftToken.getUserId()));
} }
/** /**

View File

@@ -80,7 +80,7 @@ public class CustomRealm extends AuthorizingRealm {
} else { } else {
//1. 根据accessToken查询用户信息 //1. 根据accessToken查询用户信息
FtToken tokenEntity = shiroService.findByToken(accessToken); FtToken tokenEntity = shiroService.findByToken(accessToken);
userId = tokenEntity.getUserId(); userId = String.valueOf(tokenEntity.getUserId());
//2. token失效 //2. token失效
if (tokenEntity.getExpireTime().getTime() < System.currentTimeMillis()) { if (tokenEntity.getExpireTime().getTime() < System.currentTimeMillis()) {
throw new IncorrectCredentialsException("token失效请重新登录"); throw new IncorrectCredentialsException("token失效请重新登录");

View File

@@ -29,7 +29,7 @@ public class FtToken implements Serializable {
private String token; private String token;
private String userId; private Integer userId;
private Date updateTime; private Date updateTime;

View File

@@ -160,7 +160,7 @@ public class ShiroServiceImpl implements ShiroService {
Map<String, Object> map = baseMapper.selectOneByCondition("FT_TOKEN", condition); Map<String, Object> map = baseMapper.selectOneByCondition("FT_TOKEN", condition);
osToken.setToken((String) map.get("TOKEN")); osToken.setToken((String) map.get("TOKEN"));
osToken.setTokenId((String) map.get("TOKEN_ID")); osToken.setTokenId((String) map.get("TOKEN_ID"));
osToken.setUserId((String) map.get("USER_ID")); osToken.setUserId((Integer) map.get("USER_ID"));
osToken.setExpireTime((Date) map.get("EXPIRE_TIME")); osToken.setExpireTime((Date) map.get("EXPIRE_TIME"));
osToken.setUpdateTime((Date) map.get("UPDATE_TIME")); osToken.setUpdateTime((Date) map.get("UPDATE_TIME"));
return osToken; return osToken;

View File

@@ -229,4 +229,16 @@
</properties> </properties>
</profile> </profile>
</profiles> </profiles>
<distributionManagement>
<repository>
<id>releases</id>
<name>Releases</name>
<url>http://192.168.0.123:8081/repository/maven-releases/</url>
</repository>
<snapshotRepository>
<id>snapshots</id>
<name>Snapshot</name>
<url>http://192.168.0.123:8081/repository/maven-snapshots/</url>
</snapshotRepository>
</distributionManagement>
</project> </project>