Explorar o código

3.2.2-学校管理logo更新

xiaof %!s(int64=2) %!d(string=hai) anos
pai
achega
223b39752c

+ 4 - 4
teachcloud-common/src/main/java/com/qmth/teachcloud/common/contant/SystemConstant.java

@@ -898,10 +898,10 @@ public class SystemConstant {
         if (oss) {
             url = dictionaryConfig.fssPublicDomain().getServer() + File.separator + basicSchool.getLogo();
         } else {
-            if (Objects.nonNull(dictionaryConfig.fssLocalFileDomain()) && !StringUtils.isBlank(dictionaryConfig.fssLocalFileDomain().getServer())) {
-                String hostUrl = dictionaryConfig.fssLocalFileDomain().getServer();
+            if (Objects.nonNull(dictionaryConfig.fssPublicDomain()) && !StringUtils.isBlank(dictionaryConfig.fssPublicDomain().getServer())) {
+                String hostUrl = dictionaryConfig.fssPublicDomain().getServer();
                 hostUrl = hostUrl.replace(SystemConstant.PATH_MATCH, basicSchool.getCode());
-                String filePath = SystemConstant.getLocalFilePath(hostUrl, basicSchool.getLogo());
+                String filePath = SystemConstant.getLocalFilePath(basicSchool.getLogo());
                 if (filePath.startsWith(SystemConstant.ORG_SPLIT)) {
                     url = hostUrl + filePath;
                 } else {
@@ -909,7 +909,7 @@ public class SystemConstant {
                 }
             } else {
                 String logo = basicSchool.getLogo();
-                if(logo.startsWith(dictionaryConfig.fssLocalFileDomain().getConfig())){
+                if(logo.startsWith(dictionaryConfig.fssPublicDomain().getConfig())){
                     url = logo;
                 } else {
                     url = dictionaryConfig.fssPublicDomain().getServer() + File.separator + logo;

+ 4 - 11
teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/impl/BasicSchoolServiceImpl.java

@@ -44,14 +44,7 @@ public class BasicSchoolServiceImpl extends ServiceImpl<BasicSchoolMapper, Basic
 
     @Override
     public List<SchoolDto> listSchool() {
-        List<SchoolDto> schoolDtos = this.baseMapper.listSchool();
-        for (SchoolDto schoolDto : schoolDtos) {
-            String logo = schoolDto.getLogo();
-            if(StringUtils.isNotBlank(logo) && logo.startsWith("file")){
-                schoolDto.setLogo(Base64Util.imageToBase64(new File(logo)));
-            }
-        }
-        return schoolDtos;
+        return this.baseMapper.listSchool();
     }
 
     @Override
@@ -63,8 +56,8 @@ public class BasicSchoolServiceImpl extends ServiceImpl<BasicSchoolMapper, Basic
         if (logo != null) {
             boolean oss = dictionaryConfig.sysDomain().isOss();
             StringJoiner stringJoiner = new StringJoiner("");
-            if (!oss && Objects.nonNull(dictionaryConfig.fssLocalFileDomain()) && !StringUtils.isBlank(dictionaryConfig.fssLocalFileDomain().getConfig())) {
-                stringJoiner.add(dictionaryConfig.fssLocalFileDomain().getConfig());
+            if (!oss && Objects.nonNull(dictionaryConfig.fssPublicDomain()) && !StringUtils.isBlank(dictionaryConfig.fssPublicDomain().getConfig())) {
+                stringJoiner.add(dictionaryConfig.fssPublicDomain().getConfig());
             }
             stringJoiner = SystemConstant.getDirName(stringJoiner, UploadFileEnum.FILE, true);
 
@@ -76,7 +69,7 @@ public class BasicSchoolServiceImpl extends ServiceImpl<BasicSchoolMapper, Basic
 
                 dirName = stringJoiner + SystemConstant.getNanoId() + "." + FilenameUtils.getExtension(fileTemp.getPath());
                 String jpgFileMd5 = DigestUtils.md5Hex(new FileInputStream(fileTemp));
-                if (!oss && Objects.nonNull(dictionaryConfig.fssLocalFileDomain()) && !StringUtils.isBlank(dictionaryConfig.fssLocalFileDomain().getServer())) {
+                if (!oss && Objects.nonNull(dictionaryConfig.fssPublicDomain()) && !StringUtils.isBlank(dictionaryConfig.fssPublicDomain().getServer())) {
 //                    File file = new File(dirName);
 //                    if(!file.exists()){
 //                        file.getParentFile().mkdirs();