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 +
|
'}';
|
}
|
}
|