aliyun-plugin
diff --git a/pigx-common/pigx-common-minio/pom.xml b/pigx-common/pigx-common-minio/pom.xml
deleted file mode 100755
index 6112d949d..000000000
--- a/pigx-common/pigx-common-minio/pom.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-
-
- 4.0.0
-
- com.pig4cloud
- pigx-common
- 3.9.0-SNAPSHOT
-
-
- pigx-common-minio
- jar
-
- pigx 文件系统依赖
-
-
-
- io.minio
- minio
- ${minio.version}
-
-
-
\ No newline at end of file
diff --git a/pigx-common/pigx-common-minio/src/main/java/com/pig4cloud/pigx/common/minio/MinioAutoConfiguration.java b/pigx-common/pigx-common-minio/src/main/java/com/pig4cloud/pigx/common/minio/MinioAutoConfiguration.java
deleted file mode 100755
index a5552f012..000000000
--- a/pigx-common/pigx-common-minio/src/main/java/com/pig4cloud/pigx/common/minio/MinioAutoConfiguration.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (c) 2018-2025, lengleng All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * Neither the name of the pig4cloud.com developer nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- * Author: lengleng (wangiegie@gmail.com)
- */
-
-package com.pig4cloud.pigx.common.minio;
-
-import com.pig4cloud.pigx.common.minio.http.MinioEndpoint;
-import com.pig4cloud.pigx.common.minio.service.MinioTemplate;
-import lombok.AllArgsConstructor;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
-import org.springframework.boot.context.properties.EnableConfigurationProperties;
-import org.springframework.context.annotation.Bean;
-
-/**
- * minio 自动配置类
- *
- * @author lengleng
- */
-@AllArgsConstructor
-@EnableConfigurationProperties({MinioProperties.class})
-public class MinioAutoConfiguration {
- private final MinioProperties properties;
-
- @Bean
- @ConditionalOnMissingBean(MinioTemplate.class)
- @ConditionalOnProperty(name = "minio.url")
- MinioTemplate template() {
- return new MinioTemplate(
- properties.getUrl(),
- properties.getAccessKey(),
- properties.getSecretKey()
- );
- }
-
-
- @Bean
- @ConditionalOnProperty(name = "minio.endpoint.enable", havingValue = "true")
- public MinioEndpoint minioEndpoint(MinioTemplate template) {
- return new MinioEndpoint(template);
- }
-
-}
diff --git a/pigx-common/pigx-common-minio/src/main/java/com/pig4cloud/pigx/common/minio/MinioProperties.java b/pigx-common/pigx-common-minio/src/main/java/com/pig4cloud/pigx/common/minio/MinioProperties.java
deleted file mode 100755
index dc9029c92..000000000
--- a/pigx-common/pigx-common-minio/src/main/java/com/pig4cloud/pigx/common/minio/MinioProperties.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (c) 2018-2025, lengleng All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * Neither the name of the pig4cloud.com developer nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- * Author: lengleng (wangiegie@gmail.com)
- */
-
-package com.pig4cloud.pigx.common.minio;
-
-import lombok.Data;
-import org.springframework.boot.context.properties.ConfigurationProperties;
-
-/**
- * minio 配置信息
- *
- * @author lengleng
- */
-@Data
-@ConfigurationProperties(prefix = "minio")
-public class MinioProperties {
- /**
- * minio 服务地址 http://ip:port
- */
- private String url;
-
- /**
- * 用户名
- */
- private String accessKey;
-
- /**
- * 密码
- */
- private String secretKey;
-
-}
diff --git a/pigx-common/pigx-common-minio/src/main/java/com/pig4cloud/pigx/common/minio/http/MinioEndpoint.java b/pigx-common/pigx-common-minio/src/main/java/com/pig4cloud/pigx/common/minio/http/MinioEndpoint.java
deleted file mode 100755
index 1bf3155b0..000000000
--- a/pigx-common/pigx-common-minio/src/main/java/com/pig4cloud/pigx/common/minio/http/MinioEndpoint.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * Copyright (c) 2018-2025, lengleng All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * Neither the name of the pig4cloud.com developer nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- * Author: lengleng (wangiegie@gmail.com)
- */
-
-package com.pig4cloud.pigx.common.minio.http;
-
-import com.pig4cloud.pigx.common.minio.service.MinioTemplate;
-import com.pig4cloud.pigx.common.minio.vo.MinioItem;
-import com.pig4cloud.pigx.common.minio.vo.MinioObject;
-import io.minio.messages.Bucket;
-import lombok.AllArgsConstructor;
-import lombok.SneakyThrows;
-import org.springframework.http.HttpStatus;
-import org.springframework.web.bind.annotation.*;
-import org.springframework.web.multipart.MultipartFile;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * minio 对外提供服务端点
- *
- * @author lengleng
- *
- * minio.endpoint.enable
- */
-@RestController
-@AllArgsConstructor
-@RequestMapping("${minio.endpoint.name:/minio}")
-public class MinioEndpoint {
- private final MinioTemplate template;
-
- /**
- * Bucket Endpoints
- */
- @SneakyThrows
- @PostMapping("/bucket/{bucketName}")
- public Bucket createBucker(@PathVariable String bucketName) {
-
- template.createBucket(bucketName);
- return template.getBucket(bucketName).get();
-
- }
-
- @SneakyThrows
- @GetMapping("/bucket")
- public List getBuckets() {
- return template.getAllBuckets();
- }
-
- @SneakyThrows
- @GetMapping("/bucket/{bucketName}")
- public Bucket getBucket(@PathVariable String bucketName) {
- return template.getBucket(bucketName).orElseThrow(() -> new IllegalArgumentException("Bucket Name not found!"));
- }
-
- @SneakyThrows
- @DeleteMapping("/bucket/{bucketName}")
- @ResponseStatus(HttpStatus.ACCEPTED)
- public void deleteBucket(@PathVariable String bucketName) {
- template.removeBucket(bucketName);
- }
-
- /**
- * Object Endpoints
- */
- @SneakyThrows
- @PostMapping("/object/{bucketName}")
- public MinioObject createObject(@RequestBody MultipartFile object, @PathVariable String bucketName) {
- String name = object.getOriginalFilename();
- template.putObject(bucketName, name, object.getInputStream(), object.getSize(), object.getContentType());
- return new MinioObject(template.getObjectInfo(bucketName, name));
-
- }
-
- @SneakyThrows
- @PostMapping("/object/{bucketName}/{objectName}")
- public MinioObject createObject(@RequestBody MultipartFile object, @PathVariable String bucketName, @PathVariable String objectName) {
- template.putObject(bucketName, objectName, object.getInputStream(), object.getSize(), object.getContentType());
- return new MinioObject(template.getObjectInfo(bucketName, objectName));
-
- }
-
- @SneakyThrows
- @GetMapping("/object/{bucketName}/{objectName}")
- public List filterObject(@PathVariable String bucketName, @PathVariable String objectName) {
-
- return template.getAllObjectsByPrefix(bucketName, objectName, true);
-
- }
-
- @SneakyThrows
- @GetMapping("/object/{bucketName}/{objectName}/{expires}")
- public Map getObject(@PathVariable String bucketName, @PathVariable String objectName, @PathVariable Integer expires) {
- Map responseBody = new HashMap<>(8);
- // Put Object info
- responseBody.put("bucket", bucketName);
- responseBody.put("object", objectName);
- responseBody.put("url", template.getObjectURL(bucketName, objectName, expires));
- responseBody.put("expires", expires);
- return responseBody;
- }
-
- @SneakyThrows
- @ResponseStatus(HttpStatus.ACCEPTED)
- @DeleteMapping("/object/{bucketName}/{objectName}/")
- public void deleteObject(@PathVariable String bucketName, @PathVariable String objectName) {
-
- template.removeObject(bucketName, objectName);
- }
-
-
-}
diff --git a/pigx-common/pigx-common-minio/src/main/java/com/pig4cloud/pigx/common/minio/service/MinioTemplate.java b/pigx-common/pigx-common-minio/src/main/java/com/pig4cloud/pigx/common/minio/service/MinioTemplate.java
deleted file mode 100755
index 2653a433e..000000000
--- a/pigx-common/pigx-common-minio/src/main/java/com/pig4cloud/pigx/common/minio/service/MinioTemplate.java
+++ /dev/null
@@ -1,187 +0,0 @@
-/*
- * Copyright (c) 2018-2025, lengleng All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * Neither the name of the pig4cloud.com developer nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- * Author: lengleng (wangiegie@gmail.com)
- */
-
-package com.pig4cloud.pigx.common.minio.service;
-
-import com.pig4cloud.pigx.common.minio.vo.MinioItem;
-import io.minio.MinioClient;
-import io.minio.ObjectStat;
-import io.minio.Result;
-import io.minio.messages.Bucket;
-import io.minio.messages.Item;
-import lombok.RequiredArgsConstructor;
-import lombok.SneakyThrows;
-import org.springframework.beans.factory.InitializingBean;
-import org.springframework.util.Assert;
-
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Optional;
-
-/**
- * minio 交互类
- *
- * @author lengleng
- */
-@RequiredArgsConstructor
-public class MinioTemplate implements InitializingBean {
- private final String endpoint;
- private final String accessKey;
- private final String secretKey;
- private MinioClient client;
-
- /**
- * 创建bucket
- *
- * @param bucketName bucket名称
- */
- @SneakyThrows
- public void createBucket(String bucketName) {
- if (!client.bucketExists(bucketName)) {
- client.makeBucket(bucketName);
- }
- }
-
- /**
- * 获取全部bucket
- *
- * https://docs.minio.io/cn/java-client-api-reference.html#listBuckets
- */
- @SneakyThrows
- public List getAllBuckets() {
- return client.listBuckets();
- }
-
- /**
- * @param bucketName bucket名称
- */
- @SneakyThrows
- public Optional getBucket(String bucketName) {
- return client.listBuckets().stream().filter(b -> b.name().equals(bucketName)).findFirst();
- }
-
- /**
- * @param bucketName bucket名称
- */
- @SneakyThrows
- public void removeBucket(String bucketName) {
- client.removeBucket(bucketName);
- }
-
- /**
- * 根据文件前置查询文件
- *
- * @param bucketName bucket名称
- * @param prefix 前缀
- * @param recursive 是否递归查询
- * @return MinioItem 列表
- */
- @SneakyThrows
- public List getAllObjectsByPrefix(String bucketName, String prefix, boolean recursive) {
- List objectList = new ArrayList<>();
- Iterable> objectsIterator = client
- .listObjects(bucketName, prefix, recursive);
-
- for (Result- itemResult : objectsIterator) {
- objectList.add(new MinioItem(itemResult.get()));
- }
- return objectList;
- }
-
- /**
- * 获取文件外链
- *
- * @param bucketName bucket名称
- * @param objectName 文件名称
- * @param expires 过期时间 <=7
- * @return url
- */
- @SneakyThrows
- public String getObjectURL(String bucketName, String objectName, Integer expires) {
- return client.presignedGetObject(bucketName, objectName, expires);
- }
-
- /**
- * 获取文件
- *
- * @param bucketName bucket名称
- * @param objectName 文件名称
- * @return 二进制流
- */
- @SneakyThrows
- public InputStream getObject(String bucketName, String objectName) {
- return client.getObject(bucketName, objectName);
- }
-
- /**
- * 上传文件
- *
- * @param bucketName bucket名称
- * @param objectName 文件名称
- * @param stream 文件流
- * @throws Exception https://docs.minio.io/cn/java-client-api-reference.html#putObject
- */
- public void putObject(String bucketName, String objectName, InputStream stream) throws Exception {
- client.putObject(bucketName, objectName, stream, (long) stream.available(), null, null, "application/octet-stream");
- }
-
- /**
- * 上传文件
- *
- * @param bucketName bucket名称
- * @param objectName 文件名称
- * @param stream 文件流
- * @param size 大小
- * @param contextType 类型
- * @throws Exception https://docs.minio.io/cn/java-client-api-reference.html#putObject
- */
- public void putObject(String bucketName, String objectName, InputStream stream, long size, String contextType) throws Exception {
- client.putObject(bucketName, objectName, stream, size, null, null, contextType);
- }
-
- /**
- * 获取文件信息
- *
- * @param bucketName bucket名称
- * @param objectName 文件名称
- * @throws Exception https://docs.minio.io/cn/java-client-api-reference.html#statObject
- */
- public ObjectStat getObjectInfo(String bucketName, String objectName) throws Exception {
- return client.statObject(bucketName, objectName);
- }
-
- /**
- * 删除文件
- *
- * @param bucketName bucket名称
- * @param objectName 文件名称
- * @throws Exception https://docs.minio.io/cn/java-client-api-reference.html#removeObject
- */
- public void removeObject(String bucketName, String objectName) throws Exception {
- client.removeObject(bucketName, objectName);
- }
-
- @Override
- public void afterPropertiesSet() throws Exception {
- Assert.hasText(endpoint, "Minio url 为空");
- Assert.hasText(accessKey, "Minio accessKey为空");
- Assert.hasText(secretKey, "Minio secretKey为空");
- this.client = new MinioClient(endpoint, accessKey, secretKey);
- }
-
-}
diff --git a/pigx-common/pigx-common-minio/src/main/java/com/pig4cloud/pigx/common/minio/vo/MinioItem.java b/pigx-common/pigx-common-minio/src/main/java/com/pig4cloud/pigx/common/minio/vo/MinioItem.java
deleted file mode 100755
index e8cfd7a9c..000000000
--- a/pigx-common/pigx-common-minio/src/main/java/com/pig4cloud/pigx/common/minio/vo/MinioItem.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (c) 2018-2025, lengleng All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * Neither the name of the pig4cloud.com developer nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- * Author: lengleng (wangiegie@gmail.com)
- */
-
-package com.pig4cloud.pigx.common.minio.vo;
-
-import io.minio.messages.Item;
-import io.minio.messages.Owner;
-import lombok.AllArgsConstructor;
-import lombok.Data;
-
-import java.util.Date;
-
-/**
- * minio 桶中的对象信息
- *
- * @author lengleng
- */
-@Data
-@AllArgsConstructor
-public class MinioItem {
-
- private String objectName;
- private Date lastModified;
- private String etag;
- private Long size;
- private String storageClass;
- private Owner owner;
- private String type;
-
- public MinioItem(Item item) {
- this.objectName = item.objectName();
- this.lastModified = item.lastModified();
- this.etag = item.etag();
- this.size = (long) item.size();
- this.storageClass = item.storageClass();
- this.owner = item.owner();
- this.type = item.isDir() ? "directory" : "file";
- }
-}
diff --git a/pigx-common/pigx-common-minio/src/main/java/com/pig4cloud/pigx/common/minio/vo/MinioObject.java b/pigx-common/pigx-common-minio/src/main/java/com/pig4cloud/pigx/common/minio/vo/MinioObject.java
deleted file mode 100755
index f44fad595..000000000
--- a/pigx-common/pigx-common-minio/src/main/java/com/pig4cloud/pigx/common/minio/vo/MinioObject.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright (c) 2018-2025, lengleng All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * Neither the name of the pig4cloud.com developer nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- * Author: lengleng (wangiegie@gmail.com)
- */
-
-package com.pig4cloud.pigx.common.minio.vo;
-
-import io.minio.ObjectStat;
-import lombok.AllArgsConstructor;
-import lombok.Data;
-
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
-
-
-/**
- * 存储对象的元数据
- *
- * @author lengleng
- */
-@Data
-@AllArgsConstructor
-public class MinioObject {
- private String bucketName;
- private String name;
- private Date createdTime;
- private Long length;
- private String etag;
- private String contentType;
- private Map> httpHeaders;
-
- public MinioObject(ObjectStat os) {
- this.bucketName = os.bucketName();
- this.name = os.name();
- this.createdTime = os.createdTime();
- this.length = os.length();
- this.etag = os.etag();
- this.contentType = os.contentType();
- this.httpHeaders = os.httpHeaders();
- }
-
-}
diff --git a/pigx-common/pigx-common-minio/src/main/resources/META-INF/spring.factories b/pigx-common/pigx-common-minio/src/main/resources/META-INF/spring.factories
deleted file mode 100755
index 454c5f082..000000000
--- a/pigx-common/pigx-common-minio/src/main/resources/META-INF/spring.factories
+++ /dev/null
@@ -1,2 +0,0 @@
-org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
- com.pig4cloud.pigx.common.minio.MinioAutoConfiguration
\ No newline at end of file
diff --git a/pigx-common/pigx-common-aws/pom.xml b/pigx-common/pigx-common-oss/pom.xml
similarity index 73%
rename from pigx-common/pigx-common-aws/pom.xml
rename to pigx-common/pigx-common-oss/pom.xml
index 8dbea393c..aaca8fbb6 100755
--- a/pigx-common/pigx-common-aws/pom.xml
+++ b/pigx-common/pigx-common-oss/pom.xml
@@ -1,6 +1,6 @@
-
4.0.0
@@ -9,7 +9,7 @@
3.9.0-SNAPSHOT
- pigx-common-aws
+ pigx-common-oss
jar
pigx 文件系统依赖
@@ -18,7 +18,7 @@
com.amazonaws
aws-java-sdk-s3
- 1.11.543
+ ${aws.version}
\ No newline at end of file
diff --git a/pigx-common/pigx-common-aws/src/main/java/com/pig4cloud/pigx/common/aws/AwsAutoConfiguration.java b/pigx-common/pigx-common-oss/src/main/java/com/pig4cloud/pigx/common/oss/OssAutoConfiguration.java
similarity index 73%
rename from pigx-common/pigx-common-aws/src/main/java/com/pig4cloud/pigx/common/aws/AwsAutoConfiguration.java
rename to pigx-common/pigx-common-oss/src/main/java/com/pig4cloud/pigx/common/oss/OssAutoConfiguration.java
index 6e79c5d37..e147164d1 100755
--- a/pigx-common/pigx-common-aws/src/main/java/com/pig4cloud/pigx/common/aws/AwsAutoConfiguration.java
+++ b/pigx-common/pigx-common-oss/src/main/java/com/pig4cloud/pigx/common/oss/OssAutoConfiguration.java
@@ -15,10 +15,10 @@
* Author: lengleng (wangiegie@gmail.com)
*/
-package com.pig4cloud.pigx.common.aws;
+package com.pig4cloud.pigx.common.oss;
-import com.pig4cloud.pigx.common.aws.http.AwsEndpoint;
-import com.pig4cloud.pigx.common.aws.service.AwsTemplate;
+import com.pig4cloud.pigx.common.oss.http.OssEndpoint;
+import com.pig4cloud.pigx.common.oss.service.OssTemplate;
import lombok.AllArgsConstructor;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
@@ -32,21 +32,21 @@ import org.springframework.context.annotation.Bean;
* @author 858695266
*/
@AllArgsConstructor
-@EnableConfigurationProperties({AwsProperties.class})
-public class AwsAutoConfiguration {
- private final AwsProperties properties;
+@EnableConfigurationProperties({OssProperties.class})
+public class OssAutoConfiguration {
+ private final OssProperties properties;
@Bean
- @ConditionalOnMissingBean(AwsTemplate.class)
+ @ConditionalOnMissingBean(OssTemplate.class)
@ConditionalOnProperty(name = "oss.endpoint")
- AwsTemplate awsTemplate() {
- return new AwsTemplate(properties);
+ OssTemplate awsTemplate() {
+ return new OssTemplate(properties);
}
@Bean
@ConditionalOnProperty(name = "oss.enable", havingValue = "true")
- public AwsEndpoint awsEndpoint(AwsTemplate template) {
- return new AwsEndpoint(template);
+ public OssEndpoint awsEndpoint(OssTemplate template) {
+ return new OssEndpoint(template);
}
}
diff --git a/pigx-common/pigx-common-aws/src/main/java/com/pig4cloud/pigx/common/aws/AwsProperties.java b/pigx-common/pigx-common-oss/src/main/java/com/pig4cloud/pigx/common/oss/OssProperties.java
similarity index 85%
rename from pigx-common/pigx-common-aws/src/main/java/com/pig4cloud/pigx/common/aws/AwsProperties.java
rename to pigx-common/pigx-common-oss/src/main/java/com/pig4cloud/pigx/common/oss/OssProperties.java
index 9425bfbbe..a5a37f930 100755
--- a/pigx-common/pigx-common-aws/src/main/java/com/pig4cloud/pigx/common/aws/AwsProperties.java
+++ b/pigx-common/pigx-common-oss/src/main/java/com/pig4cloud/pigx/common/oss/OssProperties.java
@@ -15,7 +15,7 @@
* Author: lengleng (wangiegie@gmail.com)
*/
-package com.pig4cloud.pigx.common.aws;
+package com.pig4cloud.pigx.common.oss;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
@@ -27,19 +27,19 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
* @author 858695266
* 配置文件添加:
* oss:
- * enable: true
- * endpoint: http://127.0.0.1:9000
- * access-key: lengleng
- * secret-key: lengleng
- * bucket-name: lengleng
- * region:
- * custom-domain: https://oss.xxx.com/lengleng
- *
+ * enable: true
+ * endpoint: http://127.0.0.1:9000
+ * access-key: lengleng
+ * secret-key: lengleng
+ * bucket-name: lengleng
+ * region:
+ * custom-domain: https://oss.xxx.com/lengleng
+ *
* bucket 设置公共读权限
*/
@Data
@ConfigurationProperties(prefix = "oss")
-public class AwsProperties {
+public class OssProperties {
/**
* 对象存储服务的URL
*/
diff --git a/pigx-common/pigx-common-aws/src/main/java/com/pig4cloud/pigx/common/aws/http/AwsEndpoint.java b/pigx-common/pigx-common-oss/src/main/java/com/pig4cloud/pigx/common/oss/http/OssEndpoint.java
similarity index 96%
rename from pigx-common/pigx-common-aws/src/main/java/com/pig4cloud/pigx/common/aws/http/AwsEndpoint.java
rename to pigx-common/pigx-common-oss/src/main/java/com/pig4cloud/pigx/common/oss/http/OssEndpoint.java
index 9123bf8c9..b92be556f 100755
--- a/pigx-common/pigx-common-aws/src/main/java/com/pig4cloud/pigx/common/aws/http/AwsEndpoint.java
+++ b/pigx-common/pigx-common-oss/src/main/java/com/pig4cloud/pigx/common/oss/http/OssEndpoint.java
@@ -15,12 +15,12 @@
* Author: lengleng (wangiegie@gmail.com)
*/
-package com.pig4cloud.pigx.common.aws.http;
+package com.pig4cloud.pigx.common.oss.http;
import com.amazonaws.services.s3.model.Bucket;
import com.amazonaws.services.s3.model.S3Object;
import com.amazonaws.services.s3.model.S3ObjectSummary;
-import com.pig4cloud.pigx.common.aws.service.AwsTemplate;
+import com.pig4cloud.pigx.common.oss.service.OssTemplate;
import lombok.AllArgsConstructor;
import lombok.SneakyThrows;
import org.springframework.http.HttpStatus;
@@ -42,8 +42,8 @@ import java.util.Map;
@RestController
@AllArgsConstructor
@RequestMapping("/aws")
-public class AwsEndpoint {
- private final AwsTemplate template;
+public class OssEndpoint {
+ private final OssTemplate template;
/**
* Bucket Endpoints
diff --git a/pigx-common/pigx-common-aws/src/main/java/com/pig4cloud/pigx/common/aws/service/AwsTemplate.java b/pigx-common/pigx-common-oss/src/main/java/com/pig4cloud/pigx/common/oss/service/OssTemplate.java
similarity index 97%
rename from pigx-common/pigx-common-aws/src/main/java/com/pig4cloud/pigx/common/aws/service/AwsTemplate.java
rename to pigx-common/pigx-common-oss/src/main/java/com/pig4cloud/pigx/common/oss/service/OssTemplate.java
index 245e2466e..d06526b36 100755
--- a/pigx-common/pigx-common-aws/src/main/java/com/pig4cloud/pigx/common/aws/service/AwsTemplate.java
+++ b/pigx-common/pigx-common-oss/src/main/java/com/pig4cloud/pigx/common/oss/service/OssTemplate.java
@@ -15,7 +15,7 @@
* Author: lengleng (wangiegie@gmail.com)
*/
-package com.pig4cloud.pigx.common.aws.service;
+package com.pig4cloud.pigx.common.oss.service;
import com.amazonaws.ClientConfiguration;
import com.amazonaws.auth.AWSCredentials;
@@ -27,7 +27,7 @@ import com.amazonaws.services.s3.AmazonS3;
import com.amazonaws.services.s3.AmazonS3Client;
import com.amazonaws.services.s3.model.*;
import com.amazonaws.util.IOUtils;
-import com.pig4cloud.pigx.common.aws.AwsProperties;
+import com.pig4cloud.pigx.common.oss.OssProperties;
import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
import org.springframework.beans.factory.InitializingBean;
@@ -48,8 +48,8 @@ import java.util.*;
* @since 1.0
*/
@RequiredArgsConstructor
-public class AwsTemplate implements InitializingBean {
- private final AwsProperties ossProperties;
+public class OssTemplate implements InitializingBean {
+ private final OssProperties ossProperties;
private AmazonS3 amazonS3;
@@ -115,8 +115,8 @@ public class AwsTemplate implements InitializingBean {
* @param bucketName bucket名称
* @param objectName 文件名称
* @param expires 过期时间 <=7
- * @see AmazonS3#generatePresignedUrl(String bucketName, String key, Date expiration)
* @return url
+ * @see AmazonS3#generatePresignedUrl(String bucketName, String key, Date expiration)
*/
@SneakyThrows
public String getObjectURL(String bucketName, String objectName, Integer expires) {
@@ -133,8 +133,8 @@ public class AwsTemplate implements InitializingBean {
*
* @param bucketName bucket名称
* @param objectName 文件名称
- * @see AWS API Documentation
* @return 二进制流
+ * @see AWS API Documentation
*/
@SneakyThrows
public InputStream getObject(String bucketName, String objectName) {
@@ -161,8 +161,8 @@ public class AwsTemplate implements InitializingBean {
* @param stream 文件流
* @param size 大小
* @param contextType 类型
- * @see AWS API Documentation
* @throws Exception
+ * @see AWS API Documentation
*/
public PutObjectResult putObject(String bucketName, String objectName, InputStream stream, long size, String contextType) throws Exception {
// String fileName = getFileName(objectName);
@@ -181,8 +181,8 @@ public class AwsTemplate implements InitializingBean {
*
* @param bucketName bucket名称
* @param objectName 文件名称
- * @see AWS API Documentation
* @throws Exception
+ * @see AWS API Documentation
*/
public S3Object getObjectInfo(String bucketName, String objectName) throws Exception {
return amazonS3.getObject(bucketName, objectName);
@@ -193,8 +193,8 @@ public class AwsTemplate implements InitializingBean {
*
* @param bucketName bucket名称
* @param objectName 文件名称
- * @see AWS API Documentation
* @throws Exception
+ * @see AWS API Documentation
*/
public void removeObject(String bucketName, String objectName) throws Exception {
amazonS3.deleteObject(bucketName, objectName);
diff --git a/pigx-common/pigx-common-aws/src/main/resources/META-INF/spring.factories b/pigx-common/pigx-common-oss/src/main/resources/META-INF/spring.factories
similarity index 55%
rename from pigx-common/pigx-common-aws/src/main/resources/META-INF/spring.factories
rename to pigx-common/pigx-common-oss/src/main/resources/META-INF/spring.factories
index 062b7741c..94331536e 100755
--- a/pigx-common/pigx-common-aws/src/main/resources/META-INF/spring.factories
+++ b/pigx-common/pigx-common-oss/src/main/resources/META-INF/spring.factories
@@ -1,2 +1,2 @@
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
- com.pig4cloud.pigx.common.aws.AwsAutoConfiguration
\ No newline at end of file
+ com.pig4cloud.pigx.common.oss.OssAutoConfiguration
\ No newline at end of file
diff --git a/pigx-common/pom.xml b/pigx-common/pom.xml
index f884bf244..e410e3de7 100644
--- a/pigx-common/pom.xml
+++ b/pigx-common/pom.xml
@@ -42,8 +42,7 @@
pigx-common-gray
pigx-common-job
pigx-common-log
- pigx-common-minio
- pigx-common-aws
+ pigx-common-oss
pigx-common-security
pigx-common-sentinel
pigx-common-sequence
diff --git a/pigx-upms/pigx-upms-biz/pom.xml b/pigx-upms/pigx-upms-biz/pom.xml
index 20c48f7e2..9a393e6ba 100644
--- a/pigx-upms/pigx-upms-biz/pom.xml
+++ b/pigx-upms/pigx-upms-biz/pom.xml
@@ -55,7 +55,7 @@
com.pig4cloud
- pigx-common-aws
+ pigx-common-oss
diff --git a/pigx-upms/pigx-upms-biz/src/main/java/com/pig4cloud/pigx/admin/service/impl/SysFileServiceImpl.java b/pigx-upms/pigx-upms-biz/src/main/java/com/pig4cloud/pigx/admin/service/impl/SysFileServiceImpl.java
index 4ea061ebf..fa1f942da 100644
--- a/pigx-upms/pigx-upms-biz/src/main/java/com/pig4cloud/pigx/admin/service/impl/SysFileServiceImpl.java
+++ b/pigx-upms/pigx-upms-biz/src/main/java/com/pig4cloud/pigx/admin/service/impl/SysFileServiceImpl.java
@@ -24,10 +24,9 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.pig4cloud.pigx.admin.api.entity.SysFile;
import com.pig4cloud.pigx.admin.mapper.SysFileMapper;
import com.pig4cloud.pigx.admin.service.SysFileService;
-import com.pig4cloud.pigx.common.aws.AwsProperties;
-import com.pig4cloud.pigx.common.aws.service.AwsTemplate;
-import com.pig4cloud.pigx.common.core.constant.CommonConstants;
import com.pig4cloud.pigx.common.core.util.R;
+import com.pig4cloud.pigx.common.oss.OssProperties;
+import com.pig4cloud.pigx.common.oss.service.OssTemplate;
import com.pig4cloud.pigx.common.security.util.SecurityUtils;
import lombok.AllArgsConstructor;
import lombok.SneakyThrows;
@@ -51,8 +50,8 @@ import java.util.Map;
@Service
@AllArgsConstructor
public class SysFileServiceImpl extends ServiceImpl implements SysFileService {
- private final AwsTemplate minioTemplate;
- private final AwsProperties awsProperties;
+ private final OssProperties ossProperties;
+ private final OssTemplate minioTemplate;
/**
@@ -65,12 +64,12 @@ public class SysFileServiceImpl extends ServiceImpl impl
public R uploadFile(MultipartFile file) {
String fileName = IdUtil.simpleUUID() + StrUtil.DOT + FileUtil.extName(file.getOriginalFilename());
Map resultMap = new HashMap<>(4);
- resultMap.put("bucketName", awsProperties.getBucketName());
+ resultMap.put("bucketName", ossProperties.getBucketName());
resultMap.put("fileName", fileName);
- resultMap.put("url", String.format("/admin/sys-file/%s/%s", awsProperties.getBucketName(), fileName));
+ resultMap.put("url", String.format("/admin/sys-file/%s/%s", ossProperties.getBucketName(), fileName));
try {
- minioTemplate.putObject(awsProperties.getBucketName(), fileName, file.getInputStream());
+ minioTemplate.putObject(ossProperties.getBucketName(), fileName, file.getInputStream());
//文件管理数据记录,收集管理追踪文件
fileLog(file, fileName);
} catch (Exception e) {
@@ -109,7 +108,7 @@ public class SysFileServiceImpl extends ServiceImpl impl
@Transactional(rollbackFor = Exception.class)
public Boolean deleteFile(Long id) {
SysFile file = this.getById(id);
- minioTemplate.removeObject(awsProperties.getBucketName(), file.getFileName());
+ minioTemplate.removeObject(ossProperties.getBucketName(), file.getFileName());
return this.removeById(id);
}
@@ -127,7 +126,7 @@ public class SysFileServiceImpl extends ServiceImpl impl
sysFile.setOriginal(original);
sysFile.setFileSize(file.getSize());
sysFile.setType(FileUtil.extName(original));
- sysFile.setBucketName(awsProperties.getBucketName());
+ sysFile.setBucketName(ossProperties.getBucketName());
sysFile.setCreateUser(SecurityUtils.getUser().getUsername());
this.save(sysFile);
}
diff --git a/pom.xml b/pom.xml
index 4d1a60c5d..534bcb5b9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -48,7 +48,6 @@
4.1.0
2.1.1
2.11.4
- 6.0.13
1.11.543
2.2.0
5.22.0