wlzboy
2026-03-19 c5ac97682e3b4ca748541ace97cb37a2295bd81e
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
package com.ruoyi.system.config;
 
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
 
/**
 * OCR服务配置类
 * 用于管理阿里云OCR服务的相关配置
 */
@Component
@ConfigurationProperties(prefix = "ali.ocr")
public class OCRConfig {
 
    /**
     * AccessKey ID
     */
    private String accessKeyId;
 
    /**
     * AccessKey Secret
     */
    private String accessKeySecret;
 
    /**
     * OCR服务端点
     */
    private String endpoint = "ocr-api.cn-hangzhou.aliyuncs.com";
 
    /**
     * 连接超时时间(毫秒)
     */
    private Integer connectTimeout = 10000;
 
    /**
     * 读取超时时间(毫秒)
     */
    private Integer readTimeout = 30000;
 
    // Getter 和 Setter 方法
    public String getAccessKeyId() {
        return accessKeyId;
    }
 
    public void setAccessKeyId(String accessKeyId) {
        this.accessKeyId = accessKeyId;
    }
 
    public String getAccessKeySecret() {
        return accessKeySecret;
    }
 
    public void setAccessKeySecret(String accessKeySecret) {
        this.accessKeySecret = accessKeySecret;
    }
 
    public String getEndpoint() {
        return endpoint;
    }
 
    public void setEndpoint(String endpoint) {
        this.endpoint = endpoint;
    }
 
    public Integer getConnectTimeout() {
        return connectTimeout;
    }
 
    public void setConnectTimeout(Integer connectTimeout) {
        this.connectTimeout = connectTimeout;
    }
 
    public Integer getReadTimeout() {
        return readTimeout;
    }
 
    public void setReadTimeout(Integer readTimeout) {
        this.readTimeout = readTimeout;
    }
 
    /**
     * 验证配置是否完整
     * @return 配置是否完整
     */
    public boolean isValid() {
        return accessKeyId != null && !accessKeyId.trim().isEmpty() &&
               accessKeySecret != null && !accessKeySecret.trim().isEmpty();
    }
 
    @Override
    public String toString() {
        return "OCRConfig{" +
                "accessKeyId='" + (accessKeyId != null ? "***" : "null") + '\'' +
                ", endpoint='" + endpoint + '\'' +
                ", connectTimeout=" + connectTimeout +
                ", readTimeout=" + readTimeout +
                '}';
    }
}