diff --git a/kernel-d-file/file-api/src/main/java/cn/stylefeng/roses/kernel/file/api/pojo/props/AliyunOssProperties.java b/kernel-d-file/file-api/src/main/java/cn/stylefeng/roses/kernel/file/api/pojo/props/AliyunOssProperties.java index ff00462a1..e9fa2f042 100644 --- a/kernel-d-file/file-api/src/main/java/cn/stylefeng/roses/kernel/file/api/pojo/props/AliyunOssProperties.java +++ b/kernel-d-file/file-api/src/main/java/cn/stylefeng/roses/kernel/file/api/pojo/props/AliyunOssProperties.java @@ -52,4 +52,9 @@ public class AliyunOssProperties { */ private String accessKeySecret; + /** + * 获取资源前缀是否为https + */ + private Boolean isHttps = false; + } diff --git a/kernel-d-file/file-sdk-aliyun/src/main/java/cn/stylefeng/roses/kernel/file/aliyun/AliyunFileOperator.java b/kernel-d-file/file-sdk-aliyun/src/main/java/cn/stylefeng/roses/kernel/file/aliyun/AliyunFileOperator.java index ad9a410b6..a5b98d9e9 100644 --- a/kernel-d-file/file-sdk-aliyun/src/main/java/cn/stylefeng/roses/kernel/file/aliyun/AliyunFileOperator.java +++ b/kernel-d-file/file-sdk-aliyun/src/main/java/cn/stylefeng/roses/kernel/file/aliyun/AliyunFileOperator.java @@ -32,10 +32,8 @@ import cn.stylefeng.roses.kernel.file.api.exception.FileException; import cn.stylefeng.roses.kernel.file.api.exception.enums.FileExceptionEnum; import cn.stylefeng.roses.kernel.file.api.expander.FileConfigExpander; import cn.stylefeng.roses.kernel.file.api.pojo.props.AliyunOssProperties; -import com.aliyun.oss.ClientException; -import com.aliyun.oss.OSS; -import com.aliyun.oss.OSSClientBuilder; -import com.aliyun.oss.OSSException; +import com.aliyun.oss.*; +import com.aliyun.oss.common.comm.Protocol; import com.aliyun.oss.model.CannedAccessControlList; import com.aliyun.oss.model.OSSObject; import com.aliyun.oss.model.PutObjectRequest; @@ -73,9 +71,11 @@ public class AliyunFileOperator implements FileOperatorApi { String endpoint = aliyunOssProperties.getEndPoint(); String accessKeyId = aliyunOssProperties.getAccessKeyId(); String accessKeySecret = aliyunOssProperties.getAccessKeySecret(); - + Boolean isHttps = aliyunOssProperties.getIsHttps(); + ClientBuilderConfiguration clientBuilderConfiguration = new ClientBuilderConfiguration(); + clientBuilderConfiguration.setProtocol(isHttps ? Protocol.HTTPS : Protocol.HTTP); // 创建OSSClient实例。 - ossClient = new OSSClientBuilder().build(endpoint, accessKeyId, accessKeySecret); + ossClient = new OSSClientBuilder().build(endpoint, accessKeyId, accessKeySecret, clientBuilderConfiguration); } @Override diff --git a/kernel-s-system/system-business-portal/src/main/java/cn/stylefeng/roses/kernel/sys/modular/theme/service/impl/SysThemeServiceImpl.java b/kernel-s-system/system-business-portal/src/main/java/cn/stylefeng/roses/kernel/sys/modular/theme/service/impl/SysThemeServiceImpl.java index fbc7c8375..ffff0dedc 100644 --- a/kernel-s-system/system-business-portal/src/main/java/cn/stylefeng/roses/kernel/sys/modular/theme/service/impl/SysThemeServiceImpl.java +++ b/kernel-s-system/system-business-portal/src/main/java/cn/stylefeng/roses/kernel/sys/modular/theme/service/impl/SysThemeServiceImpl.java @@ -10,6 +10,7 @@ import cn.stylefeng.roses.kernel.db.api.factory.PageResultFactory; import cn.stylefeng.roses.kernel.db.api.pojo.entity.BaseEntity; import cn.stylefeng.roses.kernel.db.api.pojo.page.PageResult; import cn.stylefeng.roses.kernel.file.api.FileInfoApi; +import cn.stylefeng.roses.kernel.file.api.expander.FileConfigExpander; import cn.stylefeng.roses.kernel.file.api.pojo.AntdvFileInfo; import cn.stylefeng.roses.kernel.file.api.pojo.request.SysFileInfoRequest; import cn.stylefeng.roses.kernel.rule.callback.ConfigUpdateCallback; @@ -247,7 +248,7 @@ public class SysThemeServiceImpl extends ServiceImpl i this.parseFileUrls(result); // 缓存系统中激活的主题 - themeCacheApi.put(ThemeConstants.THEME_GUNS_PLATFORM, result); + themeCacheApi.put(ThemeConstants.THEME_GUNS_PLATFORM, result, FileConfigExpander.getDefaultFileTimeoutSeconds()); return result; }