This commit is contained in:
van
2026-03-23 17:04:37 +08:00
parent 458b84f913
commit 9bb7cfc7fb
24 changed files with 1055 additions and 3405 deletions

View File

@@ -3,39 +3,33 @@ package com.ruoyi.jarvis.domain.dto;
import java.io.Serializable;
/**
* WPS365 Token信息
*
* @author system
* 金山文档 OAuth 令牌 Redis
*/
public class WPS365TokenInfo implements Serializable {
public class KdocsTokenInfo implements Serializable {
private static final long serialVersionUID = 1L;
/** 访问令牌 */
private String accessToken;
/** 刷新令牌 */
private String refreshToken;
/** 令牌类型 */
private String tokenType;
/** 过期时间(秒) */
private Integer expiresIn;
/** 作用域 */
private String scope;
/** 用户ID */
/** 本系统用于关联 Redis 的用户标识,通常取金山 open_id */
private String userId;
/** 创建时间戳(毫秒) */
private Long createTime;
public WPS365TokenInfo() {
public KdocsTokenInfo() {
this.createTime = System.currentTimeMillis();
}
public boolean isExpired() {
if (expiresIn == null || createTime == null) {
return true;
}
long expireTime = createTime + (expiresIn * 1000L);
return System.currentTimeMillis() >= (expireTime - 5 * 60 * 1000L);
}
public String getAccessToken() {
return accessToken;
}
@@ -91,18 +85,4 @@ public class WPS365TokenInfo implements Serializable {
public void setCreateTime(Long createTime) {
this.createTime = createTime;
}
/**
* 检查token是否过期
*/
public boolean isExpired() {
if (expiresIn == null || createTime == null) {
return true;
}
long currentTime = System.currentTimeMillis();
long expireTime = createTime + (expiresIn * 1000L);
// 提前5分钟认为过期留出刷新时间
return currentTime >= (expireTime - 5 * 60 * 1000);
}
}