Browse Source

Merge branch 'dev_v3.1.0' of http://git.qmth.com.cn/wangliang/distributed-print-service into dev_v3.1.0

xiaof 3 years ago
parent
commit
f2d969066e

+ 14 - 8
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/SsoServiceImpl.java

@@ -24,10 +24,7 @@ import org.springframework.util.CollectionUtils;
 
 import javax.annotation.Resource;
 import java.io.IOException;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Optional;
+import java.util.*;
 
 /**
  * @Date: 2021/5/20.
@@ -98,15 +95,24 @@ public class SsoServiceImpl implements SsoService {
     public Map<String, Object> analysisLogin(String loginName, RoleTypeEnum role, String orgName, String realName, String mobileNumber, Boolean enable, String returnUrl) throws IOException {
         SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
         BasicSchool basicSchool = commonCacheService.schoolCache(sysUser.getSchoolId());
-        List<SysOrg> sysOrgList = sysOrgService.findByConnectByParentId(sysUser.getOrgId(), false, true);
-        if (CollectionUtils.isEmpty(sysOrgList)) {
-            throw ExceptionResultEnum.ERROR.exception("未找到学院信息");
+        if (role == RoleTypeEnum.PRESIDENT || role == RoleTypeEnum.TEACHER) {
+            List<SysOrg> sysOrgList = sysOrgService.findByConnectByParentId(sysUser.getOrgId(), false, true);
+            if (CollectionUtils.isEmpty(sysOrgList)) {
+                throw ExceptionResultEnum.ERROR.exception("未找到学院信息");
+            }
+            orgName = sysOrgList.get(0).getName();
+        } else if (role == RoleTypeEnum.OFFICE_TEACHER && Objects.nonNull(sysUser.getOrgId())) {
+            SysOrg sysOrg = commonCacheService.orgCache(sysUser.getOrgId());
+            if (Objects.isNull(sysOrg)) {
+                throw ExceptionResultEnum.ERROR.exception("未找到学校信息");
+            }
+            orgName = sysOrg.getName();
         }
 
         Map<String, Object> map = new HashMap<>();
         map.computeIfAbsent("loginName", v -> loginName);
         map.computeIfAbsent("role", v -> role);
-        map.computeIfAbsent("orgName", v -> sysOrgList.get(0).getName());
+        map.put("orgName", orgName);
         map.computeIfAbsent("realName", v -> realName);
         map.computeIfAbsent("mobileNumber", v -> mobileNumber);
         map.computeIfAbsent("returnUrl", v -> returnUrl);

+ 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());
         }

+ 1 - 0
teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/impl/AuthInfoServiceImpl.java

@@ -127,6 +127,7 @@ public class AuthInfoServiceImpl implements AuthInfoService {
         if (Objects.nonNull(code)) {
             AuthOrgInfoDto authOrgInfoDto = commonCacheService.authInfoCache(code);
             if (Objects.isNull(authOrgInfoDto) || (Objects.nonNull(authOrgInfoDto) && authOrgInfoDto.getControl().hasExpired())) {
+                //TODO因授权文件失败暂时开发去掉
                 throw ExceptionResultEnum.AUTH_INFO_ERROR.exception();
             }
         }

+ 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());