Эх сурвалжийг харах

fileStore私有域客户端文件访问时长

wangliang 2 жил өмнө
parent
commit
8466bde946

+ 11 - 11
distributed-print/src/main/resources/application.properties

@@ -53,27 +53,27 @@ spring.activiti.history-level=audit
 #com.qmth.fss.private.server=https://oss-file.qmth.com.cn/teachcloud-print-dev-private
 
 #com.qmth.fss.public.config=oss://LTAI4Fi8jVRYT49QBXU9x5QX:97aBLBfkQR5mzCiQa82yWLAH57eUd8@teachcloud-test.oss-cn-shenzhen.aliyuncs.com
-#com.qmth.fss.public.server=https://teachcloud-test.oss-cn-shenzhen.aliyuncs.com
+#com.qmth.fss.public.server=https://oss-cn-shenzhen.aliyuncs.com
 #com.qmth.fss.private.config=oss://LTAI4Fi8jVRYT49QBXU9x5QX:97aBLBfkQR5mzCiQa82yWLAH57eUd8@teachcloud-test.oss-cn-shenzhen.aliyuncs.com
-#com.qmth.fss.private.server=https://teachcloud-test.oss-cn-shenzhen.aliyuncs.com
+#com.qmth.fss.private.server=https://oss-cn-shenzhen.aliyuncs.com
 
-#com.qmth.fss.public.config=../static/
-#com.qmth.fss.public.server=/static/
-#com.qmth.fss.private.config=../static/
-#com.qmth.fss.private.server=/static/
+com.qmth.fss.public.config=../static/
+com.qmth.fss.public.server=/static/
+com.qmth.fss.private.config=../static/
+com.qmth.fss.private.server=/static/
 
 #com.qmth.fss.public.config=/Users/king/git/static
 #com.qmth.fss.public.server=http://127.0.0.1:7001
 #com.qmth.fss.private.config=/Users/king/git/static
 #com.qmth.fss.private.server=http://127.0.0.1:7001
 
-com.qmth.fss.public.config=/Users/king/Downloads/file-temp
-com.qmth.fss.public.server=/file-temp/
-com.qmth.fss.private.config=/Users/king/Downloads/pdf-temp
-com.qmth.fss.private.server=/pdf-temp/
+#com.qmth.fss.public.config=/Users/king/Downloads/file-temp
+#com.qmth.fss.public.server=/file-temp/
+#com.qmth.fss.private.config=/Users/king/Downloads/pdf-temp
+#com.qmth.fss.private.server=/pdf-temp/
 
 #\u7CFB\u7EDF\u914D\u7F6E
-sys.config.oss=false
+sys.config.oss=true
 sys.config.htmlToPdfUrl=/usr/local/bin/wkhtmltopdf
 sys.config.serverUpload=
 spring.resources.static-locations=file:${sys.config.serverUpload},classpath:/META-INF/resources/,classpath:/resources/

+ 6 - 8
teachcloud-common/src/main/java/com/qmth/teachcloud/common/util/FileStoreUtil.java

@@ -212,15 +212,14 @@ public class FileStoreUtil {
         String server = null;
         if ("public".equals(type)) {
             server = dictionaryConfig.fssPublicDomain().getServer();
-            return server + "/" + objectPath;
+            return server + SystemConstant.ORG_SPLIT + objectPath;
         } else if ("private".equals(type)) {
             Boolean oss = dictionaryConfig.sysDomain().isOss();
-            if (Objects.nonNull(oss) && oss && dictionaryConfig.fssPrivateDomain().getConfig().startsWith("oss:") &&
-                    (dictionaryConfig.fssPrivateDomain().getServer().startsWith("http:") || dictionaryConfig.fssPrivateDomain().getServer().startsWith("https:"))) {
+            if (Objects.nonNull(oss) && oss) {
                 FileStore fileStore = fileService.getFileStore(type);
                 return fileStore.getPresignedUrl(objectPath, Duration.ofMinutes(5L));
             } else {
-                return dictionaryConfig.fssPrivateDomain().getServer() + "/" + objectPath;
+                return dictionaryConfig.fssPrivateDomain().getServer() + SystemConstant.ORG_SPLIT + objectPath;
             }
         } else {
             throw ExceptionResultEnum.ERROR.exception("文件存储store类型不存在");
@@ -238,11 +237,10 @@ public class FileStoreUtil {
         String server = null;
         if ("public".equals(type)) {
             server = dictionaryConfig.fssPublicDomain().getServer();
-            return server + "/" + objectPath;
+            return server + SystemConstant.ORG_SPLIT + objectPath;
         } else if ("private".equals(type)) {
             Boolean oss = dictionaryConfig.sysDomain().isOss();
-            if (Objects.nonNull(oss) && oss && dictionaryConfig.fssPrivateDomain().getConfig().startsWith("oss:") &&
-                    (dictionaryConfig.fssPrivateDomain().getServer().startsWith("http:") || dictionaryConfig.fssPrivateDomain().getServer().startsWith("https:"))) {
+            if (Objects.nonNull(oss) && oss) {
                 FileStore fileStore = fileService.getFileStore(type);
                 if(isExpire) {
                     return fileStore.getPresignedUrl(objectPath, Duration.ofMinutes(5L));
@@ -250,7 +248,7 @@ public class FileStoreUtil {
                     return fileStore.getPresignedUrl(objectPath, Duration.ofMinutes(300L));
                 }
             } else {
-                return dictionaryConfig.fssPrivateDomain().getServer() + "/" + objectPath;
+                return dictionaryConfig.fssPrivateDomain().getServer() + SystemConstant.ORG_SPLIT + objectPath;
             }
         } else {
             throw ExceptionResultEnum.ERROR.exception("文件存储store类型不存在");

+ 2 - 2
teachcloud-task/src/main/resources/application.properties

@@ -54,9 +54,9 @@ spring.activiti.history-level=audit
 #com.qmth.fss.private.server=http://oss-file.qmth.com.cn/teachcloud-print-dev-private
 
 #com.qmth.fss.public.config=oss://LTAI4Fi8jVRYT49QBXU9x5QX:97aBLBfkQR5mzCiQa82yWLAH57eUd8@teachcloud-test.oss-cn-shenzhen.aliyuncs.com
-#com.qmth.fss.public.server=https://teachcloud-test.oss-cn-shenzhen.aliyuncs.com
+#com.qmth.fss.public.server=https://oss-cn-shenzhen.aliyuncs.com
 #com.qmth.fss.private.config=oss://LTAI4Fi8jVRYT49QBXU9x5QX:97aBLBfkQR5mzCiQa82yWLAH57eUd8@teachcloud-test.oss-cn-shenzhen.aliyuncs.com
-#com.qmth.fss.private.server=https://teachcloud-test.oss-cn-shenzhen.aliyuncs.com
+#com.qmth.fss.private.server=https://oss-cn-shenzhen.aliyuncs.com
 
 #com.qmth.fss.public.config=../static/
 #com.qmth.fss.public.server=/static/