提交 1fd0b5d4 编写于 作者: JEECG低代码平台's avatar JEECG低代码平台

--date:20201226--for:--升级aliyun短信依赖、aliyun.oss云存储依赖、minio依赖、qiniu云依赖、justauth授权登录okhttp冲突问题----

jeecg-boot-base/jeecg-boot-base-core/org/jeecg/common/util/MinioUtil.java
jeecg-boot-base/jeecg-boot-base-core/pom.xml
pom.xml
上级 693d86cf
...@@ -227,6 +227,16 @@ ...@@ -227,6 +227,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>okio</artifactId>
<groupId>com.squareup.okio</groupId>
</exclusion>
<exclusion>
<artifactId>okhttp</artifactId>
<groupId>com.squareup.okhttp3</groupId>
</exclusion>
</exclusions>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.google.guava</groupId> <groupId>com.google.guava</groupId>
...@@ -262,6 +272,10 @@ ...@@ -262,6 +272,10 @@
</exclusion> </exclusion>
</exclusions> </exclusions>
</dependency> </dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
</dependency>
</dependencies> </dependencies>
</project> </project>
\ No newline at end of file
package org.jeecg.common.util; package org.jeecg.common.util;
import io.minio.MinioClient; import io.minio.MinioClient;
import io.minio.errors.*; import io.minio.errors.InvalidEndpointException;
import io.minio.errors.InvalidPortException;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.util.filter.StrAttackFilter; import org.jeecg.common.util.filter.StrAttackFilter;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import org.xmlpull.v1.XmlPullParserException;
import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.net.URLDecoder; import java.net.URLDecoder;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
/** /**
* minio文件上传工具类 * minio文件上传工具类
...@@ -83,30 +80,13 @@ public class MinioUtil { ...@@ -83,30 +80,13 @@ public class MinioUtil {
String objectName = bizPath+"/"+orgName.substring(0, orgName.lastIndexOf(".")) + "_" + System.currentTimeMillis() + orgName.substring(orgName.indexOf(".")); String objectName = bizPath+"/"+orgName.substring(0, orgName.lastIndexOf(".")) + "_" + System.currentTimeMillis() + orgName.substring(orgName.indexOf("."));
// 使用putObject上传一个本地文件到存储桶中。 // 使用putObject上传一个本地文件到存储桶中。
if(objectName.startsWith("/")){
objectName = objectName.substring(1);
}
minioClient.putObject(newBucket,objectName, stream,stream.available(),"application/octet-stream"); minioClient.putObject(newBucket,objectName, stream,stream.available(),"application/octet-stream");
stream.close(); stream.close();
file_url = minioUrl+newBucket+"/"+objectName; file_url = minioUrl+newBucket+"/"+objectName;
}catch (IOException e){ }catch (Exception 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) {
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
} }
return file_url; return file_url;
...@@ -198,7 +178,7 @@ public class MinioUtil { ...@@ -198,7 +178,7 @@ public class MinioUtil {
* @param relativePath * @param relativePath
* @return * @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); initMinio(minioUrl, minioName,minioPass);
if(minioClient.bucketExists(bucketName)) { if(minioClient.bucketExists(bucketName)) {
log.info("Bucket already exists."); log.info("Bucket already exists.");
......
...@@ -34,17 +34,17 @@ ...@@ -34,17 +34,17 @@
<mybatis-plus.version>3.4.1</mybatis-plus.version> <mybatis-plus.version>3.4.1</mybatis-plus.version>
<druid.version>1.1.22</druid.version> <druid.version>1.1.22</druid.version>
<commons.version>2.6</commons.version> <commons.version>2.6</commons.version>
<aliyun-java-sdk-dysmsapi.version>1.0.0</aliyun-java-sdk-dysmsapi.version> <aliyun-java-sdk-dysmsapi.version>2.1.0</aliyun-java-sdk-dysmsapi.version>
<aliyun.oss.version>3.6.0</aliyun.oss.version> <aliyun.oss.version>3.11.2</aliyun.oss.version>
<shiro.version>1.6.0</shiro.version> <shiro.version>1.6.0</shiro.version>
<java-jwt.version>3.11.0</java-jwt.version> <java-jwt.version>3.11.0</java-jwt.version>
<shiro-redis.version>3.1.0</shiro-redis.version> <shiro-redis.version>3.1.0</shiro-redis.version>
<codegenerate.version>1.2.5</codegenerate.version> <codegenerate.version>1.2.5</codegenerate.version>
<autopoi-web.version>1.2.2</autopoi-web.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> <justauth-spring-boot-starter.version>1.3.4</justauth-spring-boot-starter.version>
<dom4j.version>1.6.1</dom4j.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> <pinyin4j.version>2.5.1</pinyin4j.version>
</properties> </properties>
...@@ -233,6 +233,11 @@ ...@@ -233,6 +233,11 @@
<version>${commons-beanutils.version}</version> <version>${commons-beanutils.version}</version>
</dependency> </dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>4.4.1</version>
</dependency>
</dependencies> </dependencies>
</dependencyManagement> </dependencyManagement>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册