wlzboy
2026-01-24 b2bd9fb71ee17d0ec73429f03dc87c87a0a38325
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
package com.ruoyi.system.config;
 
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
 
/**
 * 百度OCR服务配置类
 * 用于管理百度AI开放平台OCR服务的相关配置
 */
@Component
@ConfigurationProperties(prefix = "baidu.ocr")
public class BaiduOCRConfig {
 
    /**
     * App ID
     */
    private String appId;
 
    /**
     * API Key
     */
    private String apiKey;
 
    /**
     * Secret Key
     */
    private String secretKey;
 
    // Getter 和 Setter 方法
    public String getAppId() {
        return appId;
    }
 
    public void setAppId(String appId) {
        this.appId = appId;
    }
 
    public String getApiKey() {
        return apiKey;
    }
 
    public void setApiKey(String apiKey) {
        this.apiKey = apiKey;
    }
 
    public String getSecretKey() {
        return secretKey;
    }
 
    public void setSecretKey(String secretKey) {
        this.secretKey = secretKey;
    }
 
    /**
     * 验证配置是否完整
     * @return 配置是否完整
     */
    public boolean isValid() {
        return appId != null && !appId.trim().isEmpty() &&
               apiKey != null && !apiKey.trim().isEmpty() &&
               secretKey != null && !secretKey.trim().isEmpty();
    }
 
    @Override
    public String toString() {
        return "BaiduOCRConfig{" +
                "appId='" + (appId != null ? "***" : "null") + '\'' +
                ", apiKey='" + (apiKey != null ? "***" : "null") + '\'' +
                ", secretKey='" + (secretKey != null ? "***" : "null") + '\'' +
                '}';
    }
}