diff --git a/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/pom.xml b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/pom.xml index ea4bc61..56b7483 100644 --- a/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/pom.xml +++ b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/pom.xml @@ -227,6 +227,16 @@ <groupId>io.minio</groupId> <artifactId>minio</artifactId> <version>${minio.version}</version> + <exclusions> + <exclusion> + <artifactId>okio</artifactId> + <groupId>com.squareup.okio</groupId> + </exclusion> + <exclusion> + <artifactId>okhttp</artifactId> + <groupId>com.squareup.okhttp3</groupId> + </exclusion> + </exclusions> </dependency> <dependency> <groupId>com.google.guava</groupId> @@ -262,6 +272,10 @@ </exclusion> </exclusions> </dependency> + <dependency> + <groupId>com.squareup.okhttp3</groupId> + <artifactId>okhttp</artifactId> + </dependency> </dependencies> </project> \ No newline at end of file diff --git a/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/MinioUtil.java b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/MinioUtil.java index 37dcade..98e2263 100644 --- a/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/MinioUtil.java +++ b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/MinioUtil.java @@ -1,17 +1,14 @@ package org.jeecg.common.util; import io.minio.MinioClient; -import io.minio.errors.*; +import io.minio.errors.InvalidEndpointException; +import io.minio.errors.InvalidPortException; import lombok.extern.slf4j.Slf4j; import org.jeecg.common.util.filter.StrAttackFilter; import org.springframework.web.multipart.MultipartFile; -import org.xmlpull.v1.XmlPullParserException; -import java.io.IOException; import java.io.InputStream; import java.net.URLDecoder; -import java.security.InvalidKeyException; -import java.security.NoSuchAlgorithmException; /** * minio文件上传工具类 @@ -83,30 +80,13 @@ public class MinioUtil { String objectName = bizPath+"/"+orgName.substring(0, orgName.lastIndexOf(".")) + "_" + System.currentTimeMillis() + orgName.substring(orgName.indexOf(".")); // 使用putObject上传一个本地文件到存储桶中。 + if(objectName.startsWith("/")){ + objectName = objectName.substring(1); + } minioClient.putObject(newBucket,objectName, stream,stream.available(),"application/octet-stream"); stream.close(); file_url = minioUrl+newBucket+"/"+objectName; - }catch (IOException e){ - log.error(e.getMessage(), e); - } catch (InvalidKeyException e) { - log.error(e.getMessage(), e); - } catch (NoSuchAlgorithmException e) { - log.error(e.getMessage(), e); - } catch (NoResponseException e) { - log.error(e.getMessage(), e); - } catch (XmlPullParserException e) { - log.error(e.getMessage(), e); - } catch (InvalidArgumentException e) { - log.error(e.getMessage(), e); - } catch (RegionConflictException e) { - log.error(e.getMessage(), e); - } catch (InvalidBucketNameException e) { - log.error(e.getMessage(), e); - } catch (ErrorResponseException e) { - log.error(e.getMessage(), e); - } catch (InternalException e) { - log.error(e.getMessage(), e); - } catch (InsufficientDataException e) { + }catch (Exception e){ log.error(e.getMessage(), e); } return file_url; @@ -198,7 +178,7 @@ public class MinioUtil { * @param relativePath * @return */ - public static String upload(InputStream stream,String relativePath) throws IOException, InvalidKeyException, NoSuchAlgorithmException, InsufficientDataException, InternalException, NoResponseException, InvalidBucketNameException, XmlPullParserException, ErrorResponseException, RegionConflictException, InvalidArgumentException { + public static String upload(InputStream stream,String relativePath) throws Exception { initMinio(minioUrl, minioName,minioPass); if(minioClient.bucketExists(bucketName)) { log.info("Bucket already exists."); diff --git a/jeecg-boot/pom.xml b/jeecg-boot/pom.xml index 8ebbe52..5028330 100644 --- a/jeecg-boot/pom.xml +++ b/jeecg-boot/pom.xml @@ -34,17 +34,17 @@ <mybatis-plus.version>3.4.1</mybatis-plus.version> <druid.version>1.1.22</druid.version> <commons.version>2.6</commons.version> - <aliyun-java-sdk-dysmsapi.version>1.0.0</aliyun-java-sdk-dysmsapi.version> - <aliyun.oss.version>3.6.0</aliyun.oss.version> + <aliyun-java-sdk-dysmsapi.version>2.1.0</aliyun-java-sdk-dysmsapi.version> + <aliyun.oss.version>3.11.2</aliyun.oss.version> <shiro.version>1.6.0</shiro.version> <java-jwt.version>3.11.0</java-jwt.version> <shiro-redis.version>3.1.0</shiro-redis.version> <codegenerate.version>1.2.5</codegenerate.version> <autopoi-web.version>1.2.2</autopoi-web.version> - <minio.version>4.0.0</minio.version> + <minio.version>6.0.13</minio.version> <justauth-spring-boot-starter.version>1.3.4</justauth-spring-boot-starter.version> <dom4j.version>1.6.1</dom4j.version> - <qiniu-java-sdk.version>7.2.23</qiniu-java-sdk.version> + <qiniu-java-sdk.version>7.4.0</qiniu-java-sdk.version> <pinyin4j.version>2.5.1</pinyin4j.version> </properties> @@ -233,6 +233,11 @@ <version>${commons-beanutils.version}</version> </dependency> + <dependency> + <groupId>com.squareup.okhttp3</groupId> + <artifactId>okhttp</artifactId> + <version>4.4.1</version> + </dependency> </dependencies> </dependencyManagement>