Skip to content

Commit

Permalink
云存储添加华为云OBS
Browse files Browse the repository at this point in the history
  • Loading branch information
李鹏军 committed Nov 23, 2023
1 parent 223e481 commit f0ae8fa
Show file tree
Hide file tree
Showing 11 changed files with 170 additions and 205 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,9 @@ public R saveConfig(@RequestBody CloudStorageConfig config) {
}else if (config.getType() == Constant.CloudService.MINIO.getValue()) {
//校验MINIO数据
ValidatorUtils.validateEntity(config, MinioGroup.class);
} else if (config.getType() == Constant.CloudService.HUAWEI.getValue()) {
//华为云OBS数据
ValidatorUtils.validateEntity(config, HuaweiGroup.class);
}

sysConfigService.updateValueByKey(KEY, JSON.toJSONString(config));
Expand Down
23 changes: 22 additions & 1 deletion platform-admin/src/main/webapp/WEB-INF/page/sys/oss.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@
<Radio label="5">
<span>MINIO</span>
</Radio>
<Radio label="6">
<span>华为云</span>
</Radio>
</Radio-group>
</Form-item>
<i-form v-if="config.type == 1" ref="formValidate" :label-width="130">
Expand Down Expand Up @@ -130,6 +133,24 @@
<i-input v-model="config.minioSecretKey" placeholder="minioSecretKey"/>
</Form-item>
</i-form>
<i-form ref="formValidate" :model="config" :rules="huaweiRuleValidate" v-if="config.type == 6"
:label-width="130">
<Form-item label="AccessKey" prop="huaweiAccessKey">
<i-input v-model="config.huaweiAccessKey" placeholder="AccessKey"/>
</Form-item>
<Form-item label="SecretKey" prop="huaweiSecretKey">
<i-input v-model="config.huaweiSecretKey" placeholder="SecretKey"/>
</Form-item>
<Form-item label="EndPoint" prop="huaweiEndPoint">
<i-input v-model="config.huaweiEndPoint" placeholder="华为云EndPoint"/>
</Form-item>
<Form-item label="BucketName" prop="huaweiBucketName">
<i-input v-model="config.huaweiBucketName" placeholder="华为云BucketName"/>
</Form-item>
<Form-item label="路径前缀" prop="huaweiPrefix">
<i-input v-model="config.huaweiPrefix" placeholder="不设置默认为空"/>
</Form-item>
</i-form>
<Form-item>
<i-button type="primary" @click="handleSubmit('formValidate')">提交</i-button>
<i-button type="warning" @click="reload" style="margin-left: 8px">返回</i-button>
Expand All @@ -141,4 +162,4 @@

<script src="${rc.contextPath}/js/sys/oss.js?_${date.systemTime}"></script>
</body>
</html>
</html>
19 changes: 18 additions & 1 deletion platform-admin/src/main/webapp/js/sys/oss.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ var vm = new Vue({
aliyunAccessKeySecret: [
{required: true, message: '阿里云AccessKeySecret不能为空', trigger: 'blur'}
],
aliyunEndPoint: [
{required: true, message: '阿里云EndPoint不能为空', trigger: 'blur'}
],
aliyunBucketName: [
{required: true, message: '阿里云BucketName不能为空', trigger: 'blur'}
]
Expand Down Expand Up @@ -100,6 +103,20 @@ var vm = new Vue({
minioSecretKey: [
{required: true, message: '密码不能为空', trigger: 'blur'}
]
},
huaweiRuleValidate: {
huaweiAccessKey: [
{required: true, message: '华为云AccessKey不能为空', trigger: 'blur'}
],
huaweiSecretKey: [
{required: true, message: '华为云SecretKey不能为空', trigger: 'blur'}
],
huaweiEndPoint: [
{required: true, message: '华为云EndPoint不能为空', trigger: 'blur'}
],
huaweiBucketName: [
{required: true, message: '华为云BucketName不能为空', trigger: 'blur'}
]
}
},
created: function () {
Expand Down Expand Up @@ -190,4 +207,4 @@ var vm = new Vue({
handleResetForm(this, name);
}
}
});
});
6 changes: 6 additions & 0 deletions platform-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@
<artifactId>minio</artifactId>
<version>${minio-version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.huaweicloud/esdk-obs-java-bundle -->
<dependency>
<groupId>com.huaweicloud</groupId>
<artifactId>esdk-obs-java-bundle</artifactId>
<version>${huaweicloud.obs}</version>
</dependency>

<!-- httpclient -->
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import java.util.UUID;

/**
* 云存储(支持七牛、阿里云、腾讯云、又拍云)
* 云存储(支持七牛、阿里云、腾讯云、MINIO、华为云)
*
* @author lipengjun
* @email [email protected]
Expand Down
220 changes: 19 additions & 201 deletions platform-common/src/main/java/com/platform/oss/CloudStorageConfig.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.platform.oss;

import com.platform.validator.group.*;
import lombok.Data;
import org.hibernate.validator.constraints.NotBlank;
import org.hibernate.validator.constraints.Range;
import org.hibernate.validator.constraints.URL;
Expand All @@ -15,11 +16,12 @@
* @email [email protected]
* @date 2017-03-25 16:12
*/
@Data
public class CloudStorageConfig implements Serializable {
private static final long serialVersionUID = 1L;

//类型 1:七牛 2:阿里云 3:腾讯云 4:服务器存储 5: MINIO
@Range(min = 1, max = 5, message = "类型错误")
//类型 1:七牛 2:阿里云 3:腾讯云 4:服务器存储 5: MINIO 6:华为云
@Range(min = 1, max = 6, message = "类型错误")
private Integer type;

//七牛绑定的域名
Expand Down Expand Up @@ -94,203 +96,19 @@ public class CloudStorageConfig implements Serializable {
@NotBlank(message = "minio的BucketName不能为空", groups = MinioGroup.class)
private String minioBucketName;

public Integer getType() {
return type;
}

public void setType(Integer type) {
this.type = type;
}

public String getQiniuDomain() {
return qiniuDomain;
}

public void setQiniuDomain(String qiniuDomain) {
this.qiniuDomain = qiniuDomain;
}

public String getQiniuAccessKey() {
return qiniuAccessKey;
}

public void setQiniuAccessKey(String qiniuAccessKey) {
this.qiniuAccessKey = qiniuAccessKey;
}

public String getQiniuSecretKey() {
return qiniuSecretKey;
}

public void setQiniuSecretKey(String qiniuSecretKey) {
this.qiniuSecretKey = qiniuSecretKey;
}

public String getQiniuBucketName() {
return qiniuBucketName;
}

public void setQiniuBucketName(String qiniuBucketName) {
this.qiniuBucketName = qiniuBucketName;
}

public String getQiniuPrefix() {
return qiniuPrefix;
}

public void setQiniuPrefix(String qiniuPrefix) {
this.qiniuPrefix = qiniuPrefix;
}

public String getAliyunDomain() {
return aliyunDomain;
}

public void setAliyunDomain(String aliyunDomain) {
this.aliyunDomain = aliyunDomain;
}

public String getAliyunPrefix() {
return aliyunPrefix;
}

public void setAliyunPrefix(String aliyunPrefix) {
this.aliyunPrefix = aliyunPrefix;
}

public String getAliyunEndPoint() {
return aliyunEndPoint;
}

public void setAliyunEndPoint(String aliyunEndPoint) {
this.aliyunEndPoint = aliyunEndPoint;
}

public String getAliyunAccessKeyId() {
return aliyunAccessKeyId;
}

public void setAliyunAccessKeyId(String aliyunAccessKeyId) {
this.aliyunAccessKeyId = aliyunAccessKeyId;
}

public String getAliyunAccessKeySecret() {
return aliyunAccessKeySecret;
}

public void setAliyunAccessKeySecret(String aliyunAccessKeySecret) {
this.aliyunAccessKeySecret = aliyunAccessKeySecret;
}

public String getAliyunBucketName() {
return aliyunBucketName;
}

public void setAliyunBucketName(String aliyunBucketName) {
this.aliyunBucketName = aliyunBucketName;
}

public String getQcloudDomain() {
return qcloudDomain;
}

public void setQcloudDomain(String qcloudDomain) {
this.qcloudDomain = qcloudDomain;
}

public String getQcloudPrefix() {
return qcloudPrefix;
}

public void setQcloudPrefix(String qcloudPrefix) {
this.qcloudPrefix = qcloudPrefix;
}

public Integer getQcloudAppId() {
return qcloudAppId;
}

public void setQcloudAppId(Integer qcloudAppId) {
this.qcloudAppId = qcloudAppId;
}

public String getQcloudSecretId() {
return qcloudSecretId;
}

public void setQcloudSecretId(String qcloudSecretId) {
this.qcloudSecretId = qcloudSecretId;
}

public String getQcloudSecretKey() {
return qcloudSecretKey;
}

public void setQcloudSecretKey(String qcloudSecretKey) {
this.qcloudSecretKey = qcloudSecretKey;
}

public String getQcloudBucketName() {
return qcloudBucketName;
}

public void setQcloudBucketName(String qcloudBucketName) {
this.qcloudBucketName = qcloudBucketName;
}

public String getQcloudRegion() {
return qcloudRegion;
}

public void setQcloudRegion(String qcloudRegion) {
this.qcloudRegion = qcloudRegion;
}

public String getDiskPath() {
return diskPath;
}

public void setDiskPath(String diskPath) {
this.diskPath = diskPath;
}

public String getProxyServer() {
return proxyServer;
}

public void setProxyServer(String proxyServer) {
this.proxyServer = proxyServer;
}

public String getMinioAccessKey() {
return minioAccessKey;
}

public void setMinioAccessKey(String minioAccessKey) {
this.minioAccessKey = minioAccessKey;
}

public String getMinioSecretKey() {
return minioSecretKey;
}

public void setMinioSecretKey(String minioSecretKey) {
this.minioSecretKey = minioSecretKey;
}

public String getMinioUrl() {
return minioUrl;
}

public void setMinioUrl(String minioUrl) {
this.minioUrl = minioUrl;
}

public String getMinioBucketName() {
return minioBucketName;
}

public void setMinioBucketName(String minioBucketName) {
this.minioBucketName = minioBucketName;
}
/**
* 华为云
*/
@NotBlank(message = "访问密钥AK不能为空", groups = HuaweiGroup.class)
private String huaweiAccessKey;
@NotBlank(message = "访问密钥SK不能为空", groups = HuaweiGroup.class)
private String huaweiSecretKey;
@NotBlank(message = "华为云EndPoint不能为空", groups = HuaweiGroup.class)
private String huaweiEndPoint;
@NotBlank(message = "BucketName不能为空", groups = HuaweiGroup.class)
private String huaweiBucketName;
/**
* 华为云路径前缀
*/
private String huaweiPrefix;
}
Loading

0 comments on commit f0ae8fa

Please sign in to comment.