ソースを参照

3.4.1 qmth-boot升级为1.0.5

xiaofei 9 ヶ月 前
コミット
e775c1283f

+ 5 - 0
distributed-print/install/nginx/teachcloud.conf

@@ -14,6 +14,11 @@ server {
                 add_header Access-Control-Allow-Origin *;
                 add_header Access-Control-Allow-Origin *;
         }
         }
 
 
+        location /fss/ {
+                alias ../../teachcloud/static/;
+                add_header Access-Control-Allow-Origin *;
+        }
+
         location /mark/ {
         location /mark/ {
                 alias  ../../teachcloud/web/mark/;
                 alias  ../../teachcloud/web/mark/;
                 index  index.html index.htm;
                 index  index.html index.htm;

+ 1 - 1
pom.xml

@@ -24,7 +24,7 @@
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
         <maven.compiler.source>1.8</maven.compiler.source>
         <maven.compiler.source>1.8</maven.compiler.source>
         <maven.compiler.target>1.8</maven.compiler.target>
         <maven.compiler.target>1.8</maven.compiler.target>
-        <qmth.boot.version>1.0.4</qmth.boot.version>
+        <qmth.boot.version>1.0.5</qmth.boot.version>
 <!--        <swagger2.version>2.9.2</swagger2.version>-->
 <!--        <swagger2.version>2.9.2</swagger2.version>-->
         <knife4j.version>2.0.7</knife4j.version>
         <knife4j.version>2.0.7</knife4j.version>
         <fastjson.version>1.2.68</fastjson.version>
         <fastjson.version>1.2.68</fastjson.version>

+ 17 - 19
teachcloud-common/src/main/java/com/qmth/teachcloud/common/util/FileStoreUtil.java

@@ -1,12 +1,10 @@
 package com.qmth.teachcloud.common.util;
 package com.qmth.teachcloud.common.util;
 
 
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.JSONObject;
-import com.qmth.boot.core.fss.service.FileService;
+import com.qmth.boot.core.fss.service.FileStoreService;
 import com.qmth.boot.core.fss.store.FileStore;
 import com.qmth.boot.core.fss.store.FileStore;
 import com.qmth.teachcloud.common.config.DictionaryConfig;
 import com.qmth.teachcloud.common.config.DictionaryConfig;
-import com.qmth.teachcloud.common.contant.SpringContextHolder;
 import com.qmth.teachcloud.common.contant.SystemConstant;
 import com.qmth.teachcloud.common.contant.SystemConstant;
-import com.qmth.teachcloud.common.domain.FssDomain;
 import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
 import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
 import com.qmth.teachcloud.common.enums.LocalCatalogEnum;
 import com.qmth.teachcloud.common.enums.LocalCatalogEnum;
 import com.qmth.teachcloud.common.enums.UploadFileEnum;
 import com.qmth.teachcloud.common.enums.UploadFileEnum;
@@ -36,7 +34,7 @@ public class FileStoreUtil {
     private final static Logger log = LoggerFactory.getLogger(FileStoreUtil.class);
     private final static Logger log = LoggerFactory.getLogger(FileStoreUtil.class);
 
 
     @Resource
     @Resource
-    private FileService fileService;
+    private FileStoreService fileStoreService;
 
 
     @Resource
     @Resource
     private DictionaryConfig dictionaryConfig;
     private DictionaryConfig dictionaryConfig;
@@ -75,7 +73,7 @@ public class FileStoreUtil {
                 break;
                 break;
         }
         }
         dirName = dirName.replaceAll(configPath, "");
         dirName = dirName.replaceAll(configPath, "");
-        fileService.getFileStore(catalogType.getType()).write(dirName, inputStream, md5);
+        fileStoreService.getFileStore(catalogType.getType()).write(dirName, inputStream, md5);
         log.info("dirName:{}", dirName);
         log.info("dirName:{}", dirName);
     }
     }
 
 
@@ -88,7 +86,7 @@ public class FileStoreUtil {
      */
      */
     public void ossUpload(String dirName, InputStream inputStream, String md5, String type) throws Exception {
     public void ossUpload(String dirName, InputStream inputStream, String md5, String type) throws Exception {
         log.info("ossUpload is come in");
         log.info("ossUpload is come in");
-        fileService.getFileStore(type).write(dirName, inputStream, md5);
+        fileStoreService.getFileStore(type).write(dirName, inputStream, md5);
         log.info("dirName:{}", dirName);
         log.info("dirName:{}", dirName);
     }
     }
 
 
@@ -113,7 +111,7 @@ public class FileStoreUtil {
 //                break;
 //                break;
 //        }
 //        }
 //        dirName = dirName.replaceAll(configPath, "");
 //        dirName = dirName.replaceAll(configPath, "");
-//        fileService.getFileStore(catalogType.getType()).write(dirName, inputStream, md5);
+//        fileStoreService.getFileStore(catalogType.getType()).write(dirName, inputStream, md5);
 //        log.info("dirName:{}", dirName);
 //        log.info("dirName:{}", dirName);
 //    }
 //    }
 
 
@@ -139,7 +137,7 @@ public class FileStoreUtil {
      */
      */
     public void ossUpload(String dirName, File file, String md5, String type) throws Exception {
     public void ossUpload(String dirName, File file, String md5, String type) throws Exception {
         log.info("ossUpload is come in");
         log.info("ossUpload is come in");
-        fileService.getFileStore(type).write(dirName, new FileInputStream(file), md5);
+        fileStoreService.getFileStore(type).write(dirName, new FileInputStream(file), md5);
         log.info("dirName:{}", dirName);
         log.info("dirName:{}", dirName);
     }
     }
 
 
@@ -152,7 +150,7 @@ public class FileStoreUtil {
      */
      */
     public void ossUpload(String dirName, String content, String type) throws Exception {
     public void ossUpload(String dirName, String content, String type) throws Exception {
         log.info("ossUpload is come in");
         log.info("ossUpload is come in");
-        fileService.getFileStore(type).write(dirName, new ByteArrayInputStream(content.getBytes()), DigestUtils.md5Hex(new ByteArrayInputStream(content.getBytes())));
+        fileStoreService.getFileStore(type).write(dirName, new ByteArrayInputStream(content.getBytes()), DigestUtils.md5Hex(new ByteArrayInputStream(content.getBytes())));
         log.info("dirName:{}", dirName);
         log.info("dirName:{}", dirName);
     }
     }
 
 
@@ -166,7 +164,7 @@ public class FileStoreUtil {
      */
      */
     public File ossDownload(String dirName, String localPath, String type) throws Exception {
     public File ossDownload(String dirName, String localPath, String type) throws Exception {
         log.info("ossDownload is come in");
         log.info("ossDownload is come in");
-        return this.saveLocal(fileService.getFileStore(type).read(dirName), localPath);
+        return this.saveLocal(fileStoreService.getFileStore(type).read(dirName), localPath);
     }
     }
 
 
     /**
     /**
@@ -179,7 +177,7 @@ public class FileStoreUtil {
      */
      */
     public File ossDownload(String dirName, File localFile, String type) throws Exception {
     public File ossDownload(String dirName, File localFile, String type) throws Exception {
         log.info("ossDownload is come in");
         log.info("ossDownload is come in");
-        InputStream inputStream = fileService.getFileStore(type).read(dirName);
+        InputStream inputStream = fileStoreService.getFileStore(type).read(dirName);
         FileUtils.copyInputStreamToFile(inputStream, localFile);
         FileUtils.copyInputStreamToFile(inputStream, localFile);
         return localFile;
         return localFile;
     }
     }
@@ -193,7 +191,7 @@ public class FileStoreUtil {
      */
      */
     public byte[] ossDownload(String objectName, String type) throws Exception {
     public byte[] ossDownload(String objectName, String type) throws Exception {
         log.info("oss Download is come in");
         log.info("oss Download is come in");
-        return IOUtils.toByteArray(fileService.getFileStore(type).read(objectName));
+        return IOUtils.toByteArray(fileStoreService.getFileStore(type).read(objectName));
     }
     }
 
 
     /**
     /**
@@ -205,7 +203,7 @@ public class FileStoreUtil {
      */
      */
     public InputStream ossDownloadIs(String objectName, String type) throws Exception {
     public InputStream ossDownloadIs(String objectName, String type) throws Exception {
         log.info("oss Download is come in");
         log.info("oss Download is come in");
-        return fileService.getFileStore(type).read(objectName);
+        return fileStoreService.getFileStore(type).read(objectName);
     }
     }
 
 
     /**
     /**
@@ -223,8 +221,8 @@ public class FileStoreUtil {
         } else if ("private".equals(type)) {
         } else if ("private".equals(type)) {
             Boolean oss = dictionaryConfig.sysDomain().isOss();
             Boolean oss = dictionaryConfig.sysDomain().isOss();
             if (Objects.nonNull(oss) && oss) {
             if (Objects.nonNull(oss) && oss) {
-                FileStore fileStore = fileService.getFileStore(type);
-                return fileStore.getPresignedUrl(objectPath, Duration.ofMinutes(5L));
+                FileStore fileStore = fileStoreService.getFileStore(type);
+                return fileStore.getServerUrl(objectPath, Duration.ofMinutes(5L));
             } else {
             } else {
                 if (objectPath.startsWith(SystemConstant.ORG_SPLIT)) {
                 if (objectPath.startsWith(SystemConstant.ORG_SPLIT)) {
                     return dictionaryConfig.fssPrivateDomain().getServer() + objectPath;
                     return dictionaryConfig.fssPrivateDomain().getServer() + objectPath;
@@ -252,7 +250,7 @@ public class FileStoreUtil {
         } else if ("private".equals(type)) {
         } else if ("private".equals(type)) {
             Boolean oss = dictionaryConfig.sysDomain().isOss();
             Boolean oss = dictionaryConfig.sysDomain().isOss();
             if (Objects.nonNull(oss) && oss) {
             if (Objects.nonNull(oss) && oss) {
-                FileStore fileStore = fileService.getFileStore(type);
+                FileStore fileStore = fileStoreService.getFileStore(type);
                 return fileStore.getServer() + SystemConstant.ORG_SPLIT;
                 return fileStore.getServer() + SystemConstant.ORG_SPLIT;
             } else {
             } else {
                 if (objectPath.startsWith(SystemConstant.ORG_SPLIT)) {
                 if (objectPath.startsWith(SystemConstant.ORG_SPLIT)) {
@@ -281,11 +279,11 @@ public class FileStoreUtil {
         } else if ("private".equals(type)) {
         } else if ("private".equals(type)) {
             Boolean oss = dictionaryConfig.sysDomain().isOss();
             Boolean oss = dictionaryConfig.sysDomain().isOss();
             if (Objects.nonNull(oss) && oss) {
             if (Objects.nonNull(oss) && oss) {
-                FileStore fileStore = fileService.getFileStore(type);
+                FileStore fileStore = fileStoreService.getFileStore(type);
                 if (isExpire) {
                 if (isExpire) {
-                    return fileStore.getPresignedUrl(objectPath, Duration.ofMinutes(5L));
+                    return fileStore.getServerUrl(objectPath, Duration.ofMinutes(5L));
                 } else {
                 } else {
-                    return fileStore.getPresignedUrl(objectPath, Duration.ofMinutes(300L));
+                    return fileStore.getServerUrl(objectPath, Duration.ofMinutes(300L));
                 }
                 }
             } else {
             } else {
                 return dictionaryConfig.fssPrivateDomain().getServer() + SystemConstant.ORG_SPLIT + objectPath;
                 return dictionaryConfig.fssPrivateDomain().getServer() + SystemConstant.ORG_SPLIT + objectPath;

+ 13 - 13
teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/utils/FileStoreUtils.java

@@ -1,7 +1,7 @@
 package com.qmth.teachcloud.mark.utils;
 package com.qmth.teachcloud.mark.utils;
 
 
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSON;
-import com.qmth.boot.core.fss.service.FileService;
+import com.qmth.boot.core.fss.service.FileStoreService;
 import com.qmth.boot.core.fss.store.FileStore;
 import com.qmth.boot.core.fss.store.FileStore;
 import com.qmth.teachcloud.common.bean.vo.FilePathVo;
 import com.qmth.teachcloud.common.bean.vo.FilePathVo;
 import com.qmth.teachcloud.common.config.DictionaryConfig;
 import com.qmth.teachcloud.common.config.DictionaryConfig;
@@ -35,7 +35,7 @@ public class FileStoreUtils {
     private final static Logger log = LoggerFactory.getLogger(FileStoreUtils.class);
     private final static Logger log = LoggerFactory.getLogger(FileStoreUtils.class);
 
 
     @Resource
     @Resource
-    private FileService fileService;
+    private FileStoreService fileStoreService;
 
 
     @Resource
     @Resource
     private DictionaryConfig dictionaryConfig;
     private DictionaryConfig dictionaryConfig;
@@ -74,7 +74,7 @@ public class FileStoreUtils {
                 break;
                 break;
         }
         }
         dirName = dirName.replaceAll(configPath, "");
         dirName = dirName.replaceAll(configPath, "");
-        fileService.getFileStore(catalogType.getType()).write(dirName, inputStream, md5);
+        fileStoreService.getFileStore(catalogType.getType()).write(dirName, inputStream, md5);
         log.info("dirName:{}", dirName);
         log.info("dirName:{}", dirName);
     }
     }
 
 
@@ -89,7 +89,7 @@ public class FileStoreUtils {
         log.info("ossUpload is come in");
         log.info("ossUpload is come in");
         FssDomain fssDomain = getFssDomain(fssType);
         FssDomain fssDomain = getFssDomain(fssType);
         dirName = dirName.replaceAll(fssDomain.getConfig(), "");
         dirName = dirName.replaceAll(fssDomain.getConfig(), "");
-        fileService.getFileStore(fssType).write(dirName, inputStream, md5);
+        fileStoreService.getFileStore(fssType).write(dirName, inputStream, md5);
         log.info("dirName:{}", dirName);
         log.info("dirName:{}", dirName);
     }
     }
 
 
@@ -102,7 +102,7 @@ public class FileStoreUtils {
      */
      */
     public void ossUpload(String dirName, InputStream inputStream, String md5, String fssType) throws Exception {
     public void ossUpload(String dirName, InputStream inputStream, String md5, String fssType) throws Exception {
         log.info("ossUpload is come in");
         log.info("ossUpload is come in");
-        fileService.getFileStore(fssType).write(dirName, inputStream, md5);
+        fileStoreService.getFileStore(fssType).write(dirName, inputStream, md5);
         log.info("dirName:{}", dirName);
         log.info("dirName:{}", dirName);
     }
     }
 
 
@@ -116,7 +116,7 @@ public class FileStoreUtils {
      */
      */
     public void ossUpload(String dirName, File file, String md5, String type) throws Exception {
     public void ossUpload(String dirName, File file, String md5, String type) throws Exception {
         log.info("ossUpload is come in");
         log.info("ossUpload is come in");
-        fileService.getFileStore(type).write(dirName, new FileInputStream(file), md5);
+        fileStoreService.getFileStore(type).write(dirName, new FileInputStream(file), md5);
         log.info("dirName:{}", dirName);
         log.info("dirName:{}", dirName);
     }
     }
 
 
@@ -129,7 +129,7 @@ public class FileStoreUtils {
      */
      */
     public void ossUpload(String dirName, String content, String type) throws Exception {
     public void ossUpload(String dirName, String content, String type) throws Exception {
         log.info("ossUpload is come in");
         log.info("ossUpload is come in");
-        fileService.getFileStore(type).write(dirName, new ByteArrayInputStream(content.getBytes()), DigestUtils.md5Hex(new ByteArrayInputStream(content.getBytes())));
+        fileStoreService.getFileStore(type).write(dirName, new ByteArrayInputStream(content.getBytes()), DigestUtils.md5Hex(new ByteArrayInputStream(content.getBytes())));
         log.info("dirName:{}", dirName);
         log.info("dirName:{}", dirName);
     }
     }
 
 
@@ -143,7 +143,7 @@ public class FileStoreUtils {
      */
      */
     public File ossDownload(String dirName, String localPath, String type) throws Exception {
     public File ossDownload(String dirName, String localPath, String type) throws Exception {
         log.info("ossDownload is come in");
         log.info("ossDownload is come in");
-        return this.saveLocal(fileService.getFileStore(type).read(dirName), localPath);
+        return this.saveLocal(fileStoreService.getFileStore(type).read(dirName), localPath);
     }
     }
 
 
     /**
     /**
@@ -156,7 +156,7 @@ public class FileStoreUtils {
      */
      */
     public File ossDownload(String dirName, File localFile, String type) throws Exception {
     public File ossDownload(String dirName, File localFile, String type) throws Exception {
         log.info("ossDownload is come in");
         log.info("ossDownload is come in");
-        InputStream inputStream = fileService.getFileStore(type).read(dirName);
+        InputStream inputStream = fileStoreService.getFileStore(type).read(dirName);
         FileUtils.copyInputStreamToFile(inputStream, localFile);
         FileUtils.copyInputStreamToFile(inputStream, localFile);
         return localFile;
         return localFile;
     }
     }
@@ -170,7 +170,7 @@ public class FileStoreUtils {
      */
      */
     public byte[] ossDownload(String objectName, String type) throws Exception {
     public byte[] ossDownload(String objectName, String type) throws Exception {
         log.info("oss Download is come in");
         log.info("oss Download is come in");
-        return IOUtils.toByteArray(fileService.getFileStore(type).read(objectName));
+        return IOUtils.toByteArray(fileStoreService.getFileStore(type).read(objectName));
     }
     }
 
 
     /**
     /**
@@ -182,7 +182,7 @@ public class FileStoreUtils {
      */
      */
     public InputStream ossDownloadIs(String objectName, String type) throws Exception {
     public InputStream ossDownloadIs(String objectName, String type) throws Exception {
         log.info("oss Download is come in");
         log.info("oss Download is come in");
-        return fileService.getFileStore(type).read(objectName);
+        return fileStoreService.getFileStore(type).read(objectName);
     }
     }
 
 
     /**
     /**
@@ -201,8 +201,8 @@ public class FileStoreUtils {
         } else if ("private".equals(fssType)) {
         } else if ("private".equals(fssType)) {
             Boolean oss = dictionaryConfig.sysDomain().isOss();
             Boolean oss = dictionaryConfig.sysDomain().isOss();
             if (Objects.nonNull(oss) && oss) {
             if (Objects.nonNull(oss) && oss) {
-                FileStore fileStore = fileService.getFileStore(fssType);
-                return fileStore.getPresignedUrl(objectPath, Duration.ofMinutes(5L));
+                FileStore fileStore = fileStoreService.getFileStore(fssType);
+                return fileStore.getServerUrl(objectPath, Duration.ofMinutes(5L));
             } else {
             } else {
                 return fssDomain.getServer() + SystemConstant.ORG_SPLIT + objectPath;
                 return fssDomain.getServer() + SystemConstant.ORG_SPLIT + objectPath;
             }
             }