Kaynağa Gözat

路径修改

wangliang 3 yıl önce
ebeveyn
işleme
b0842efb7d

+ 6 - 1
distributed-print/src/main/java/com/qmth/distributed/print/api/SysController.java

@@ -379,7 +379,12 @@ public class SysController {
             if (Objects.nonNull(basicSchool.getLogo()) && (!basicSchool.getLogo().startsWith("http") || !basicSchool.getLogo().startsWith("https"))) {
                 String hostUrl = SystemConstant.getLocalFileHost(dictionaryConfig.sysDomain().getFileHost());
                 String filePath = SystemConstant.getLocalFilePath(hostUrl, basicSchool.getLogo());
-                String url = hostUrl + File.separator + filePath;
+                String url = null;
+                if (filePath.startsWith("/")) {
+                    url = hostUrl + filePath;
+                } else {
+                    url = hostUrl + File.separator + filePath;
+                }
                 map.put(SystemConstant.LOGO, url);
             } else {
                 map.put(SystemConstant.LOGO, basicSchool.getLogo());

+ 15 - 3
teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/impl/AttachmentCommonServiceImpl.java

@@ -63,7 +63,11 @@ public class AttachmentCommonServiceImpl implements AttachmentCommonService {
         if (Objects.equals(attachmentType, SystemConstant.LOCAL)) {
             String hostUrl = SystemConstant.getLocalFileHost(dictionaryConfig.sysDomain().getFileHost());
             filePath = SystemConstant.getLocalFilePath(hostUrl, filePath);
-            url = hostUrl + File.separator + filePath;
+            if (filePath.startsWith("/")) {
+                url = hostUrl + filePath;
+            } else {
+                url = hostUrl + File.separator + filePath;
+            }
         } else {
             url = fileStoreUtil.getPrivateUrl(filePath, uploadFileEnum.getFssType());
         }
@@ -88,7 +92,11 @@ public class AttachmentCommonServiceImpl implements AttachmentCommonService {
         if (Objects.equals(type, SystemConstant.LOCAL)) {
             String hostUrl = SystemConstant.getLocalFileHost(dictionaryConfig.sysDomain().getFileHost());
             path = SystemConstant.getLocalFilePath(hostUrl, path);
-            pathUrl = hostUrl + File.separator + path;
+            if (path.startsWith("/")) {
+                pathUrl = hostUrl + path;
+            } else {
+                pathUrl = hostUrl + File.separator + path;
+            }
         } else {
             pathUrl = fileStoreUtil.getPrivateUrl(path, fileStoreUtil.getUploadEnumByPath(path).getFssType());
 
@@ -121,7 +129,11 @@ public class AttachmentCommonServiceImpl implements AttachmentCommonService {
         if (Objects.equals(attachmentType, SystemConstant.LOCAL)) {
             String hostUrl = SystemConstant.getLocalFileHost(dictionaryConfig.sysDomain().getFileHost());
             filePath = SystemConstant.getLocalFilePath(hostUrl, filePath);
-            pathUrl = hostUrl + File.separator + filePath;
+            if (filePath.startsWith("/")) {
+                pathUrl = hostUrl + filePath;
+            } else {
+                pathUrl = hostUrl + File.separator + filePath;
+            }
         } else {
             pathUrl = fileStoreUtil.getPrivateUrl(filePath, uploadFileEnum.getFssType());
         }

+ 15 - 3
teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/impl/TeachcloudCommonServiceImpl.java

@@ -591,7 +591,11 @@ public class TeachcloudCommonServiceImpl implements TeachcloudCommonService {
         if (Objects.equals(attachmentType, SystemConstant.LOCAL)) {
             String hostUrl = SystemConstant.getLocalFileHost(dictionaryConfig.sysDomain().getFileHost());
             filePath = SystemConstant.getLocalFilePath(hostUrl, filePath);
-            url = hostUrl + File.separator + filePath;
+            if (filePath.startsWith("/")) {
+                url = hostUrl + filePath;
+            } else {
+                url = hostUrl + File.separator + filePath;
+            }
         } else {
             url = fileStoreUtil.getPrivateUrl(filePath, uploadFileEnum.getFssType());
         }
@@ -615,7 +619,11 @@ public class TeachcloudCommonServiceImpl implements TeachcloudCommonService {
         if (Objects.equals(type, SystemConstant.LOCAL)) {
             String hostUrl = SystemConstant.getLocalFileHost(dictionaryConfig.sysDomain().getFileHost());
             path = SystemConstant.getLocalFilePath(hostUrl, path);
-            pathUrl = hostUrl + File.separator + path;
+            if (path.startsWith("/")) {
+                pathUrl = hostUrl + path;
+            } else {
+                pathUrl = hostUrl + File.separator + path;
+            }
         } else {
             if (isExpire) {
                 pathUrl = fileStoreUtil.getPrivateUrl(path, fileStoreUtil.getUploadEnumByPath(path).getFssType());
@@ -652,7 +660,11 @@ public class TeachcloudCommonServiceImpl implements TeachcloudCommonService {
         if (Objects.equals(attachmentType, SystemConstant.LOCAL)) {
             String hostUrl = SystemConstant.getLocalFileHost(dictionaryConfig.sysDomain().getFileHost());
             filePath = SystemConstant.getLocalFilePath(hostUrl, filePath);
-            pathUrl = hostUrl + File.separator + filePath;
+            if (filePath.startsWith("/")) {
+                pathUrl = hostUrl + filePath;
+            } else {
+                pathUrl = hostUrl + File.separator + filePath;
+            }
         } else {
             pathUrl = fileStoreUtil.getPrivateUrl(filePath, uploadFileEnum.getFssType());
         }

+ 6 - 1
teachcloud-report/src/main/java/com/qmth/teachcloud/report/api/SysController.java

@@ -234,7 +234,12 @@ public class SysController {
             if (Objects.nonNull(basicSchool.getLogo()) && (!basicSchool.getLogo().startsWith("http") || !basicSchool.getLogo().startsWith("https"))) {
                 String hostUrl = SystemConstant.getLocalFileHost(dictionaryConfig.sysDomain().getFileHost());
                 String filePath = SystemConstant.getLocalFilePath(hostUrl, basicSchool.getLogo());
-                String url = hostUrl + File.separator + filePath;
+                String url = null;
+                if (filePath.startsWith("/")) {
+                    url = hostUrl + filePath;
+                } else {
+                    url = hostUrl + File.separator + filePath;
+                }
                 map.put(SystemConstant.LOGO, url);
             } else {
                 map.put(SystemConstant.LOGO, basicSchool.getLogo());