Commit cba7030d054f173df53c715781418ebdeb397255

Authored by zhangdaiscott
1 parent c26b0638

--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
jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/pom.xml
@@ -227,6 +227,16 @@ @@ -227,6 +227,16 @@
227 <groupId>io.minio</groupId> 227 <groupId>io.minio</groupId>
228 <artifactId>minio</artifactId> 228 <artifactId>minio</artifactId>
229 <version>${minio.version}</version> 229 <version>${minio.version}</version>
  230 + <exclusions>
  231 + <exclusion>
  232 + <artifactId>okio</artifactId>
  233 + <groupId>com.squareup.okio</groupId>
  234 + </exclusion>
  235 + <exclusion>
  236 + <artifactId>okhttp</artifactId>
  237 + <groupId>com.squareup.okhttp3</groupId>
  238 + </exclusion>
  239 + </exclusions>
230 </dependency> 240 </dependency>
231 <dependency> 241 <dependency>
232 <groupId>com.google.guava</groupId> 242 <groupId>com.google.guava</groupId>
@@ -262,6 +272,10 @@ @@ -262,6 +272,10 @@
262 </exclusion> 272 </exclusion>
263 </exclusions> 273 </exclusions>
264 </dependency> 274 </dependency>
  275 + <dependency>
  276 + <groupId>com.squareup.okhttp3</groupId>
  277 + <artifactId>okhttp</artifactId>
  278 + </dependency>
265 </dependencies> 279 </dependencies>
266 280
267 </project> 281 </project>
268 \ No newline at end of file 282 \ No newline at end of file
jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/MinioUtil.java
1 package org.jeecg.common.util; 1 package org.jeecg.common.util;
2 2
3 import io.minio.MinioClient; 3 import io.minio.MinioClient;
4 -import io.minio.errors.*; 4 +import io.minio.errors.InvalidEndpointException;
  5 +import io.minio.errors.InvalidPortException;
5 import lombok.extern.slf4j.Slf4j; 6 import lombok.extern.slf4j.Slf4j;
6 import org.jeecg.common.util.filter.StrAttackFilter; 7 import org.jeecg.common.util.filter.StrAttackFilter;
7 import org.springframework.web.multipart.MultipartFile; 8 import org.springframework.web.multipart.MultipartFile;
8 -import org.xmlpull.v1.XmlPullParserException;  
9 9
10 -import java.io.IOException;  
11 import java.io.InputStream; 10 import java.io.InputStream;
12 import java.net.URLDecoder; 11 import java.net.URLDecoder;
13 -import java.security.InvalidKeyException;  
14 -import java.security.NoSuchAlgorithmException;  
15 12
16 /** 13 /**
17 * minio文件上传工具类 14 * minio文件上传工具类
@@ -83,30 +80,13 @@ public class MinioUtil { @@ -83,30 +80,13 @@ public class MinioUtil {
83 String objectName = bizPath+"/"+orgName.substring(0, orgName.lastIndexOf(".")) + "_" + System.currentTimeMillis() + orgName.substring(orgName.indexOf(".")); 80 String objectName = bizPath+"/"+orgName.substring(0, orgName.lastIndexOf(".")) + "_" + System.currentTimeMillis() + orgName.substring(orgName.indexOf("."));
84 81
85 // 使用putObject上传一个本地文件到存储桶中。 82 // 使用putObject上传一个本地文件到存储桶中。
  83 + if(objectName.startsWith("/")){
  84 + objectName = objectName.substring(1);
  85 + }
86 minioClient.putObject(newBucket,objectName, stream,stream.available(),"application/octet-stream"); 86 minioClient.putObject(newBucket,objectName, stream,stream.available(),"application/octet-stream");
87 stream.close(); 87 stream.close();
88 file_url = minioUrl+newBucket+"/"+objectName; 88 file_url = minioUrl+newBucket+"/"+objectName;
89 - }catch (IOException e){  
90 - log.error(e.getMessage(), e);  
91 - } catch (InvalidKeyException e) {  
92 - log.error(e.getMessage(), e);  
93 - } catch (NoSuchAlgorithmException e) {  
94 - log.error(e.getMessage(), e);  
95 - } catch (NoResponseException e) {  
96 - log.error(e.getMessage(), e);  
97 - } catch (XmlPullParserException e) {  
98 - log.error(e.getMessage(), e);  
99 - } catch (InvalidArgumentException e) {  
100 - log.error(e.getMessage(), e);  
101 - } catch (RegionConflictException e) {  
102 - log.error(e.getMessage(), e);  
103 - } catch (InvalidBucketNameException e) {  
104 - log.error(e.getMessage(), e);  
105 - } catch (ErrorResponseException e) {  
106 - log.error(e.getMessage(), e);  
107 - } catch (InternalException e) {  
108 - log.error(e.getMessage(), e);  
109 - } catch (InsufficientDataException e) { 89 + }catch (Exception e){
110 log.error(e.getMessage(), e); 90 log.error(e.getMessage(), e);
111 } 91 }
112 return file_url; 92 return file_url;
@@ -198,7 +178,7 @@ public class MinioUtil { @@ -198,7 +178,7 @@ public class MinioUtil {
198 * @param relativePath 178 * @param relativePath
199 * @return 179 * @return
200 */ 180 */
201 - public static String upload(InputStream stream,String relativePath) throws IOException, InvalidKeyException, NoSuchAlgorithmException, InsufficientDataException, InternalException, NoResponseException, InvalidBucketNameException, XmlPullParserException, ErrorResponseException, RegionConflictException, InvalidArgumentException { 181 + public static String upload(InputStream stream,String relativePath) throws Exception {
202 initMinio(minioUrl, minioName,minioPass); 182 initMinio(minioUrl, minioName,minioPass);
203 if(minioClient.bucketExists(bucketName)) { 183 if(minioClient.bucketExists(bucketName)) {
204 log.info("Bucket already exists."); 184 log.info("Bucket already exists.");
jeecg-boot/pom.xml
@@ -34,17 +34,17 @@ @@ -34,17 +34,17 @@
34 <mybatis-plus.version>3.4.1</mybatis-plus.version> 34 <mybatis-plus.version>3.4.1</mybatis-plus.version>
35 <druid.version>1.1.22</druid.version> 35 <druid.version>1.1.22</druid.version>
36 <commons.version>2.6</commons.version> 36 <commons.version>2.6</commons.version>
37 - <aliyun-java-sdk-dysmsapi.version>1.0.0</aliyun-java-sdk-dysmsapi.version>  
38 - <aliyun.oss.version>3.6.0</aliyun.oss.version> 37 + <aliyun-java-sdk-dysmsapi.version>2.1.0</aliyun-java-sdk-dysmsapi.version>
  38 + <aliyun.oss.version>3.11.2</aliyun.oss.version>
39 <shiro.version>1.6.0</shiro.version> 39 <shiro.version>1.6.0</shiro.version>
40 <java-jwt.version>3.11.0</java-jwt.version> 40 <java-jwt.version>3.11.0</java-jwt.version>
41 <shiro-redis.version>3.1.0</shiro-redis.version> 41 <shiro-redis.version>3.1.0</shiro-redis.version>
42 <codegenerate.version>1.2.5</codegenerate.version> 42 <codegenerate.version>1.2.5</codegenerate.version>
43 <autopoi-web.version>1.2.2</autopoi-web.version> 43 <autopoi-web.version>1.2.2</autopoi-web.version>
44 - <minio.version>4.0.0</minio.version> 44 + <minio.version>6.0.13</minio.version>
45 <justauth-spring-boot-starter.version>1.3.4</justauth-spring-boot-starter.version> 45 <justauth-spring-boot-starter.version>1.3.4</justauth-spring-boot-starter.version>
46 <dom4j.version>1.6.1</dom4j.version> 46 <dom4j.version>1.6.1</dom4j.version>
47 - <qiniu-java-sdk.version>7.2.23</qiniu-java-sdk.version> 47 + <qiniu-java-sdk.version>7.4.0</qiniu-java-sdk.version>
48 <pinyin4j.version>2.5.1</pinyin4j.version> 48 <pinyin4j.version>2.5.1</pinyin4j.version>
49 </properties> 49 </properties>
50 50
@@ -233,6 +233,11 @@ @@ -233,6 +233,11 @@
233 <version>${commons-beanutils.version}</version> 233 <version>${commons-beanutils.version}</version>
234 </dependency> 234 </dependency>
235 235
  236 + <dependency>
  237 + <groupId>com.squareup.okhttp3</groupId>
  238 + <artifactId>okhttp</artifactId>
  239 + <version>4.4.1</version>
  240 + </dependency>
236 </dependencies> 241 </dependencies>
237 </dependencyManagement> 242 </dependencyManagement>
238 243