This commit is contained in:
2025-11-05 23:01:15 +08:00
parent 79a954a91f
commit 97f97f35b1
3 changed files with 73 additions and 3 deletions

View File

@@ -1,7 +1,12 @@
package com.ruoyi.jarvis.config;
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;
/**
* 腾讯文档开放平台配置
@@ -9,9 +14,12 @@ import org.springframework.context.annotation.Configuration;
* @author system
*/
@Configuration
@Component
@ConfigurationProperties(prefix = "tencent.doc")
public class TencentDocConfig {
private static final Logger log = LoggerFactory.getLogger(TencentDocConfig.class);
/** 应用ID */
private String appId;
@@ -32,6 +40,27 @@ public class TencentDocConfig {
/** 刷新Token地址 */
private String refreshTokenUrl = "https://docs.qq.com/oauth/v2/token";
/**
* 配置初始化后验证
*/
@PostConstruct
public void init() {
log.info("腾讯文档配置加载 - appId: {}, redirectUri: {}, apiBaseUrl: {}",
appId != null && appId.length() > 10 ? appId.substring(0, 10) + "..." : (appId != null ? appId : "null"),
redirectUri != null ? redirectUri : "null",
apiBaseUrl);
if (appId == null || appId.trim().isEmpty()) {
log.warn("腾讯文档应用ID未配置请检查application-dev.yml中的tencent.doc.app-id");
}
if (appSecret == null || appSecret.trim().isEmpty()) {
log.warn("腾讯文档应用密钥未配置请检查application-dev.yml中的tencent.doc.app-secret");
}
if (redirectUri == null || redirectUri.trim().isEmpty()) {
log.warn("腾讯文档回调地址未配置请检查application-dev.yml中的tencent.doc.redirect-uri");
}
}
public String getAppId() {
return appId;