mirror of https://gitee.com/xiaonuobase/snowy
【修复】升级MINIO版本,解决项目中的jar包依赖冲突
parent
ad0f7a8811
commit
e680edf65d
|
@ -94,6 +94,18 @@
|
||||||
<groupId>io.springfox</groupId>
|
<groupId>io.springfox</groupId>
|
||||||
<artifactId>springfox-schema</artifactId>
|
<artifactId>springfox-schema</artifactId>
|
||||||
</exclusion>
|
</exclusion>
|
||||||
|
<exclusion>
|
||||||
|
<artifactId>asm</artifactId>
|
||||||
|
<groupId>org.ow2.asm</groupId>
|
||||||
|
</exclusion>
|
||||||
|
<exclusion>
|
||||||
|
<artifactId>guava</artifactId>
|
||||||
|
<groupId>com.google.guava</groupId>
|
||||||
|
</exclusion>
|
||||||
|
<exclusion>
|
||||||
|
<artifactId>fastjson</artifactId>
|
||||||
|
<groupId>com.alibaba</groupId>
|
||||||
|
</exclusion>
|
||||||
</exclusions>
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
@ -157,6 +169,20 @@
|
||||||
<groupId>cn.afterturn</groupId>
|
<groupId>cn.afterturn</groupId>
|
||||||
<artifactId>easypoi-spring-boot-starter</artifactId>
|
<artifactId>easypoi-spring-boot-starter</artifactId>
|
||||||
<version>${easypoi.version}</version>
|
<version>${easypoi.version}</version>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<artifactId>commons-compress</artifactId>
|
||||||
|
<groupId>org.apache.commons</groupId>
|
||||||
|
</exclusion>
|
||||||
|
<exclusion>
|
||||||
|
<artifactId>guava</artifactId>
|
||||||
|
<groupId>com.google.guava</groupId>
|
||||||
|
</exclusion>
|
||||||
|
<exclusion>
|
||||||
|
<artifactId>javassist</artifactId>
|
||||||
|
<groupId>org.javassist</groupId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- sm-crypto -->
|
<!-- sm-crypto -->
|
||||||
|
@ -165,5 +191,12 @@
|
||||||
<artifactId>sm-crypto</artifactId>
|
<artifactId>sm-crypto</artifactId>
|
||||||
<version>${smcrypto.version}</version>
|
<version>${smcrypto.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- okhttp3 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.squareup.okhttp3</groupId>
|
||||||
|
<artifactId>okhttp</artifactId>
|
||||||
|
<version>${okhttp3.version}</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
<ten.sdk.ses.version>3.1.455</ten.sdk.ses.version>
|
<ten.sdk.ses.version>3.1.455</ten.sdk.ses.version>
|
||||||
<ten.sdk.sms.version>3.1.455</ten.sdk.sms.version>
|
<ten.sdk.sms.version>3.1.455</ten.sdk.sms.version>
|
||||||
<ali.oss.version>3.14.0</ali.oss.version>
|
<ali.oss.version>3.14.0</ali.oss.version>
|
||||||
<minio.version>3.0.12</minio.version>
|
<minio.version>8.5.2</minio.version>
|
||||||
<javax.mail.version>1.6.2</javax.mail.version>
|
<javax.mail.version>1.6.2</javax.mail.version>
|
||||||
<aliyun.sdk.dm.version>3.3.1</aliyun.sdk.dm.version>
|
<aliyun.sdk.dm.version>3.3.1</aliyun.sdk.dm.version>
|
||||||
<aliyun.sdk.ecs.version>3.1.0</aliyun.sdk.ecs.version>
|
<aliyun.sdk.ecs.version>3.1.0</aliyun.sdk.ecs.version>
|
||||||
|
@ -40,6 +40,12 @@
|
||||||
<groupId>com.qcloud</groupId>
|
<groupId>com.qcloud</groupId>
|
||||||
<artifactId>cos_api</artifactId>
|
<artifactId>cos_api</artifactId>
|
||||||
<version>${ten.cos.version}</version>
|
<version>${ten.cos.version}</version>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<artifactId>tencentcloud-sdk-java-common</artifactId>
|
||||||
|
<groupId>com.tencentcloudapi</groupId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!--阿里云上传文件客户端-->
|
<!--阿里云上传文件客户端-->
|
||||||
|
@ -54,6 +60,16 @@
|
||||||
<groupId>io.minio</groupId>
|
<groupId>io.minio</groupId>
|
||||||
<artifactId>minio</artifactId>
|
<artifactId>minio</artifactId>
|
||||||
<version>${minio.version}</version>
|
<version>${minio.version}</version>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<artifactId>okhttp</artifactId>
|
||||||
|
<groupId>com.squareup.okhttp3</groupId>
|
||||||
|
</exclusion>
|
||||||
|
<exclusion>
|
||||||
|
<artifactId>bcprov-jdk15on</artifactId>
|
||||||
|
<groupId>org.bouncycastle</groupId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!--java邮件发送-->
|
<!--java邮件发送-->
|
||||||
|
@ -68,6 +84,12 @@
|
||||||
<groupId>com.aliyun</groupId>
|
<groupId>com.aliyun</groupId>
|
||||||
<artifactId>aliyun-java-sdk-dm</artifactId>
|
<artifactId>aliyun-java-sdk-dm</artifactId>
|
||||||
<version>${aliyun.sdk.dm.version}</version>
|
<version>${aliyun.sdk.dm.version}</version>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<artifactId>javax.mail</artifactId>
|
||||||
|
<groupId>com.sun.mail</groupId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- 腾讯云邮件发送 -->
|
<!-- 腾讯云邮件发送 -->
|
||||||
|
@ -75,6 +97,20 @@
|
||||||
<groupId>com.tencentcloudapi</groupId>
|
<groupId>com.tencentcloudapi</groupId>
|
||||||
<artifactId>tencentcloud-sdk-java-ses</artifactId>
|
<artifactId>tencentcloud-sdk-java-ses</artifactId>
|
||||||
<version>${ten.sdk.ses.version}</version>
|
<version>${ten.sdk.ses.version}</version>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<artifactId>okhttp</artifactId>
|
||||||
|
<groupId>com.squareup.okhttp</groupId>
|
||||||
|
</exclusion>
|
||||||
|
<exclusion>
|
||||||
|
<artifactId>logging-interceptor</artifactId>
|
||||||
|
<groupId>com.squareup.okhttp</groupId>
|
||||||
|
</exclusion>
|
||||||
|
<exclusion>
|
||||||
|
<artifactId>okio</artifactId>
|
||||||
|
<groupId>com.squareup.okio</groupId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!--阿里云短信发送-->
|
<!--阿里云短信发送-->
|
||||||
|
@ -82,6 +118,20 @@
|
||||||
<groupId>com.aliyun</groupId>
|
<groupId>com.aliyun</groupId>
|
||||||
<artifactId>dysmsapi20170525</artifactId>
|
<artifactId>dysmsapi20170525</artifactId>
|
||||||
<version>${aliyun.sdk.dysmsapi.version}</version>
|
<version>${aliyun.sdk.dysmsapi.version}</version>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<artifactId>okhttp</artifactId>
|
||||||
|
<groupId>com.squareup.okhttp3</groupId>
|
||||||
|
</exclusion>
|
||||||
|
<exclusion>
|
||||||
|
<artifactId>bcprov-jdk15on</artifactId>
|
||||||
|
<groupId>org.bouncycastle</groupId>
|
||||||
|
</exclusion>
|
||||||
|
<exclusion>
|
||||||
|
<artifactId>org.jacoco.agent</artifactId>
|
||||||
|
<groupId>org.jacoco</groupId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!--腾讯云短信发送-->
|
<!--腾讯云短信发送-->
|
||||||
|
|
|
@ -240,7 +240,7 @@ public class DevFileAliyunUtil {
|
||||||
byteArrayInputStream = new ByteArrayInputStream(bytes);
|
byteArrayInputStream = new ByteArrayInputStream(bytes);
|
||||||
ObjectMetadata objectMetadata = new ObjectMetadata();
|
ObjectMetadata objectMetadata = new ObjectMetadata();
|
||||||
objectMetadata.setContentType(getFileContentType(key));
|
objectMetadata.setContentType(getFileContentType(key));
|
||||||
client.putObject(bucketName, key, new ByteArrayInputStream(bytes), objectMetadata);
|
client.putObject(bucketName, key, byteArrayInputStream, objectMetadata);
|
||||||
} catch (OSSException | ClientException e) {
|
} catch (OSSException | ClientException e) {
|
||||||
throw new CommonException(e.getMessage());
|
throw new CommonException(e.getMessage());
|
||||||
} finally {
|
} finally {
|
||||||
|
|
|
@ -18,11 +18,11 @@ import cn.hutool.core.io.IoUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.hutool.extra.spring.SpringUtil;
|
import cn.hutool.extra.spring.SpringUtil;
|
||||||
import io.minio.MinioClient;
|
import cn.hutool.json.JSONArray;
|
||||||
import io.minio.errors.InvalidEndpointException;
|
import cn.hutool.json.JSONObject;
|
||||||
import io.minio.errors.InvalidPortException;
|
import cn.hutool.json.JSONUtil;
|
||||||
|
import io.minio.*;
|
||||||
import io.minio.http.Method;
|
import io.minio.http.Method;
|
||||||
import io.minio.policy.PolicyType;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
import vip.xiaonuo.common.exception.CommonException;
|
import vip.xiaonuo.common.exception.CommonException;
|
||||||
|
@ -90,11 +90,7 @@ public class DevFileMinIoUtil {
|
||||||
throw new CommonException("MINIO文件操作客户端未正确配置:defaultBucketName为空");
|
throw new CommonException("MINIO文件操作客户端未正确配置:defaultBucketName为空");
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
client = MinioClient.builder().endpoint(endpoint).credentials(accessKey, secretKey).build();
|
||||||
client = new MinioClient(endpoint, accessKey, secretKey);
|
|
||||||
} catch (InvalidEndpointException | InvalidPortException e) {
|
|
||||||
throw new CommonException(e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -139,7 +135,8 @@ public class DevFileMinIoUtil {
|
||||||
public static boolean doesBucketExist(String bucketName) {
|
public static boolean doesBucketExist(String bucketName) {
|
||||||
try {
|
try {
|
||||||
initClient();
|
initClient();
|
||||||
client.bucketExists(bucketName);
|
BucketExistsArgs bucketExistsArgs = BucketExistsArgs.builder().bucket(bucketName).build();
|
||||||
|
client.bucketExists(bucketExistsArgs);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new CommonException(e.getMessage());
|
throw new CommonException(e.getMessage());
|
||||||
}
|
}
|
||||||
|
@ -170,7 +167,8 @@ public class DevFileMinIoUtil {
|
||||||
public static boolean isExistingFile(String bucketName, String key) {
|
public static boolean isExistingFile(String bucketName, String key) {
|
||||||
try {
|
try {
|
||||||
initClient();
|
initClient();
|
||||||
InputStream object = client.getObject(bucketName, key);
|
GetObjectArgs getObjectArgs = GetObjectArgs.builder().bucket(bucketName).object(key).build();
|
||||||
|
InputStream object = client.getObject(getObjectArgs);
|
||||||
return !ObjectUtil.isEmpty(object);
|
return !ObjectUtil.isEmpty(object);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -229,7 +227,9 @@ public class DevFileMinIoUtil {
|
||||||
try {
|
try {
|
||||||
initClient();
|
initClient();
|
||||||
byteArrayInputStream = new ByteArrayInputStream(bytes);
|
byteArrayInputStream = new ByteArrayInputStream(bytes);
|
||||||
client.putObject(bucketName, key, new ByteArrayInputStream(bytes), bytes.length, getFileContentType(key));
|
PutObjectArgs putObjectArgs = PutObjectArgs.builder().bucket(bucketName).object(key)
|
||||||
|
.contentType(getFileContentType(key)).stream(byteArrayInputStream, bytes.length, -1).build();
|
||||||
|
client.putObject(putObjectArgs);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new CommonException(e.getMessage());
|
throw new CommonException(e.getMessage());
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -249,7 +249,9 @@ public class DevFileMinIoUtil {
|
||||||
public static void storageFile(String bucketName, String key, InputStream inputStream) {
|
public static void storageFile(String bucketName, String key, InputStream inputStream) {
|
||||||
try {
|
try {
|
||||||
initClient();
|
initClient();
|
||||||
client.putObject(bucketName, key, inputStream, inputStream.available(), getFileContentType(key));
|
PutObjectArgs putObjectArgs = PutObjectArgs.builder().bucket(bucketName).object(key)
|
||||||
|
.contentType(getFileContentType(key)).stream(inputStream, inputStream.available(), -1).build();
|
||||||
|
client.putObject(putObjectArgs);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new CommonException(e.getMessage());
|
throw new CommonException(e.getMessage());
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -328,7 +330,8 @@ public class DevFileMinIoUtil {
|
||||||
public static byte[] getFileBytes(String bucketName, String key) {
|
public static byte[] getFileBytes(String bucketName, String key) {
|
||||||
try {
|
try {
|
||||||
initClient();
|
initClient();
|
||||||
InputStream inputStream = client.getObject(bucketName, key);
|
GetObjectArgs getObjectArgs = GetObjectArgs.builder().bucket(bucketName).object(key).build();
|
||||||
|
InputStream inputStream = client.getObject(getObjectArgs);
|
||||||
return IoUtil.readBytes(inputStream);
|
return IoUtil.readBytes(inputStream);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new CommonException(e.getMessage());
|
throw new CommonException(e.getMessage());
|
||||||
|
@ -339,20 +342,30 @@ public class DevFileMinIoUtil {
|
||||||
* 设置文件访问权限管理
|
* 设置文件访问权限管理
|
||||||
*
|
*
|
||||||
* @param bucketName 桶名称
|
* @param bucketName 桶名称
|
||||||
* @param key 唯一标示id,例如a.txt, doc/a.txt
|
* @param key 唯一标示id,例如a.txt, doc/a.txt
|
||||||
* @param devFileBucketAuthEnum 文件权限
|
* @param devFileBucketAuthEnum 文件权限
|
||||||
* @author xuyuxiang
|
* @author xuyuxiang
|
||||||
* @date 2022/1/5 23:24
|
* @date 2022/1/5 23:24
|
||||||
*/
|
*/
|
||||||
public static void setFileAcl(String bucketName, String key, DevFileBucketAuthEnum devFileBucketAuthEnum) {
|
public static void setFileAcl(String bucketName, String key, DevFileBucketAuthEnum devFileBucketAuthEnum) {
|
||||||
try {
|
try {
|
||||||
if (devFileBucketAuthEnum.equals(DevFileBucketAuthEnum.PRIVATE)) {
|
JSONObject configObject = JSONUtil.createObj().set("Version", "2012-10-17");
|
||||||
client.setBucketPolicy(bucketName, key, PolicyType.NONE);
|
JSONArray statementArray = JSONUtil.createArray();
|
||||||
} else if (devFileBucketAuthEnum.equals(DevFileBucketAuthEnum.PUBLIC_READ)) {
|
JSONArray actionArray = JSONUtil.createArray();
|
||||||
client.setBucketPolicy(bucketName, key, PolicyType.READ_ONLY);
|
if (devFileBucketAuthEnum.equals(DevFileBucketAuthEnum.PUBLIC_READ)) {
|
||||||
} else if (devFileBucketAuthEnum.equals(DevFileBucketAuthEnum.PUBLIC_READ_WRITE)) {
|
actionArray.put("s3:GetObject");
|
||||||
client.setBucketPolicy(bucketName, key, PolicyType.READ_WRITE);
|
} else {
|
||||||
|
actionArray.put("s3:GetObject");
|
||||||
|
actionArray.put("s3:PutObject");
|
||||||
}
|
}
|
||||||
|
JSONObject statementObject = JSONUtil.createObj();
|
||||||
|
statementObject.set("Effect", "Allow").set("Principal", JSONUtil.createObj().set("AWS", JSONUtil.createArray().put("*")))
|
||||||
|
.set("Action", actionArray).set("Resource", JSONUtil.createArray().put("arn:aws:s3:::" + bucketName + "/*"));
|
||||||
|
statementArray.put(statementObject);
|
||||||
|
configObject.set("Statement", statementArray);
|
||||||
|
String config = JSONUtil.toJsonStr(configObject);
|
||||||
|
SetBucketPolicyArgs setBucketPolicyArgs = SetBucketPolicyArgs.builder().bucket(bucketName).config(config).build();
|
||||||
|
client.setBucketPolicy(setBucketPolicyArgs);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new CommonException(e.getMessage());
|
throw new CommonException(e.getMessage());
|
||||||
}
|
}
|
||||||
|
@ -371,7 +384,9 @@ public class DevFileMinIoUtil {
|
||||||
public static void copyFile(String originBucketName, String originFileKey, String newBucketName, String newFileKey) {
|
public static void copyFile(String originBucketName, String originFileKey, String newBucketName, String newFileKey) {
|
||||||
try {
|
try {
|
||||||
initClient();
|
initClient();
|
||||||
client.copyObject(originBucketName, originFileKey, newBucketName, newFileKey);
|
CopySource copySource = CopySource.builder().bucket(originBucketName).object(originFileKey).build();
|
||||||
|
CopyObjectArgs copyObjectArgs = CopyObjectArgs.builder().source(copySource).bucket(newBucketName).object(newFileKey).build();
|
||||||
|
client.copyObject(copyObjectArgs);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new CommonException(e.getMessage());
|
throw new CommonException(e.getMessage());
|
||||||
}
|
}
|
||||||
|
@ -389,7 +404,9 @@ public class DevFileMinIoUtil {
|
||||||
public static String getFileAuthUrl(String bucketName, String key, Long timeoutMillis) {
|
public static String getFileAuthUrl(String bucketName, String key, Long timeoutMillis) {
|
||||||
try {
|
try {
|
||||||
initClient();
|
initClient();
|
||||||
return client.getPresignedObjectUrl(Method.GET, bucketName, key, timeoutMillis.intValue(), null);
|
GetPresignedObjectUrlArgs getPresignedObjectUrlArgs = GetPresignedObjectUrlArgs.builder().bucket(bucketName)
|
||||||
|
.object(key).method(Method.GET).expiry(timeoutMillis.intValue()).build();
|
||||||
|
return client.getPresignedObjectUrl(getPresignedObjectUrlArgs);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new CommonException(e.getMessage());
|
throw new CommonException(e.getMessage());
|
||||||
}
|
}
|
||||||
|
@ -423,7 +440,8 @@ public class DevFileMinIoUtil {
|
||||||
*/
|
*/
|
||||||
public static void deleteFile(String bucketName, String key) {
|
public static void deleteFile(String bucketName, String key) {
|
||||||
try {
|
try {
|
||||||
client.removeObject(bucketName, key);
|
RemoveObjectArgs removeObjectArgs = RemoveObjectArgs.builder().bucket(bucketName).object(key).build();
|
||||||
|
client.removeObject(removeObjectArgs);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new CommonException(e.getMessage());
|
throw new CommonException(e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
|
@ -271,7 +271,7 @@ public class DevFileTencentUtil {
|
||||||
byteArrayInputStream = new ByteArrayInputStream(bytes);
|
byteArrayInputStream = new ByteArrayInputStream(bytes);
|
||||||
ObjectMetadata objectMetadata = new ObjectMetadata();
|
ObjectMetadata objectMetadata = new ObjectMetadata();
|
||||||
objectMetadata.setContentType(getFileContentType(key));
|
objectMetadata.setContentType(getFileContentType(key));
|
||||||
client.putObject(bucketName, key, new ByteArrayInputStream(bytes), objectMetadata);
|
client.putObject(bucketName, key, byteArrayInputStream, objectMetadata);
|
||||||
} catch (CosClientException e) {
|
} catch (CosClientException e) {
|
||||||
throw new CommonException(e.getMessage());
|
throw new CommonException(e.getMessage());
|
||||||
} finally {
|
} finally {
|
||||||
|
|
|
@ -15,8 +15,8 @@
|
||||||
<description>主启动模块</description>
|
<description>主启动模块</description>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
|
<okhttp3.version>4.9.3</okhttp3.version>
|
||||||
<junit.version>4.13.2</junit.version>
|
<junit.version>4.13.2</junit.version>
|
||||||
<lombok.versin>1.18.22</lombok.versin>
|
|
||||||
<dynamic.datasource.version>3.5.1</dynamic.datasource.version>
|
<dynamic.datasource.version>3.5.1</dynamic.datasource.version>
|
||||||
<mysql.connector.java.version>8.0.28</mysql.connector.java.version>
|
<mysql.connector.java.version>8.0.28</mysql.connector.java.version>
|
||||||
<oracle.connector.java.version>21.5.0.0</oracle.connector.java.version>
|
<oracle.connector.java.version>21.5.0.0</oracle.connector.java.version>
|
||||||
|
|
Loading…
Reference in New Issue