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

@@ -0,0 +1,98 @@
package com.ruoyi.jarvis.config;
import com.ruoyi.common.utils.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
/**
* 金山文档开放平台(个人云)配置
*
* @see <a href="https://developer.kdocs.cn">developer.kdocs.cn</a>
*/
@Configuration
@Component
@ConfigurationProperties(prefix = "kdocs")
public class KdocsCloudConfig {
private static final Logger log = LoggerFactory.getLogger(KdocsCloudConfig.class);
/** API 与授权页主机,默认 https://developer.kdocs.cn */
private String apiHost = "https://developer.kdocs.cn";
/** 应用 app_id */
private String appId;
/** 应用 app_key */
private String appKey;
/** OAuth 回调地址(须在开发者后台登记) */
private String redirectUri;
/**
* 授权 scope逗号分隔。
* 参考https://developer.kdocs.cn/server/guide/permission.html
*/
private String scope = "user_basic,access_personal_files,edit_personal_files";
@PostConstruct
public void init() {
log.info("Kdocs 配置加载 - apiHost: {}, redirectUri: {}, appId: {}",
apiHost,
redirectUri,
appId != null && appId.length() > 8 ? appId.substring(0, 8) + "..." : appId);
if (StringUtils.isBlank(appId)) {
log.warn("kdocs.app-id 未配置,请在 application.yml 中填写金山文档开放平台应用信息");
}
if (StringUtils.isBlank(appKey)) {
log.warn("kdocs.app-key 未配置");
}
if (StringUtils.isBlank(redirectUri)) {
log.warn("kdocs.redirect-uri 未配置");
}
}
public String getApiHost() {
return apiHost;
}
public void setApiHost(String apiHost) {
this.apiHost = apiHost;
}
public String getAppId() {
return appId;
}
public void setAppId(String appId) {
this.appId = appId;
}
public String getAppKey() {
return appKey;
}
public void setAppKey(String appKey) {
this.appKey = appKey;
}
public String getRedirectUri() {
return redirectUri;
}
public void setRedirectUri(String redirectUri) {
this.redirectUri = redirectUri;
}
public String getScope() {
return scope;
}
public void setScope(String scope) {
this.scope = scope;
}
}