Browse Source

教研单点登录修改

wangliang 2 years ago
parent
commit
107d7917c1

+ 13 - 1
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/SsoServiceImpl.java

@@ -26,6 +26,7 @@ import org.springframework.util.CollectionUtils;
 import javax.annotation.Resource;
 import javax.annotation.Resource;
 import java.io.IOException;
 import java.io.IOException;
 import java.util.*;
 import java.util.*;
+import java.util.stream.Collectors;
 
 
 /**
 /**
  * @Date: 2021/5/20.
  * @Date: 2021/5/20.
@@ -100,8 +101,19 @@ public class SsoServiceImpl implements SsoService {
             List<SysOrg> sysOrgList = sysOrgService.findByConnectByParentId(sysUser.getOrgId(), false, true);
             List<SysOrg> sysOrgList = sysOrgService.findByConnectByParentId(sysUser.getOrgId(), false, true);
             if (CollectionUtils.isEmpty(sysOrgList)) {
             if (CollectionUtils.isEmpty(sysOrgList)) {
                 throw ExceptionResultEnum.ERROR.exception("未找到学院信息");
                 throw ExceptionResultEnum.ERROR.exception("未找到学院信息");
+            } else {
+                List<SysOrg> sysOrgSchool = sysOrgList.stream().filter(s -> s.getType() == OrgTypeEnum.SCHOOL).collect(Collectors.toList());
+                if (!CollectionUtils.isEmpty(sysOrgSchool)) {
+                    for (SysOrg s : sysOrgList) {
+                        if (Objects.nonNull(s.getParentId()) && s.getParentId().longValue() == sysOrgSchool.get(0).getId().longValue()) {
+                            orgName = s.getName();
+                            break;
+                        }
+                    }
+                } else {
+                    throw ExceptionResultEnum.ERROR.exception("未找到顶级学校信息");
+                }
             }
             }
-            orgName = sysOrgList.get(0).getName();
         } else if (role == RoleTypeEnum.OFFICE_TEACHER && Objects.nonNull(sysUser.getOrgId())) {
         } else if (role == RoleTypeEnum.OFFICE_TEACHER && Objects.nonNull(sysUser.getOrgId())) {
             SysOrg sysOrg = commonCacheService.orgCache(sysUser.getOrgId());
             SysOrg sysOrg = commonCacheService.orgCache(sysUser.getOrgId());
             if (Objects.isNull(sysOrg)) {
             if (Objects.isNull(sysOrg)) {

+ 2 - 2
teachcloud-common/src/main/resources/mapper/SysOrgMapper.xml

@@ -8,9 +8,9 @@
             <if test="school != null and school != '' and school == 1">
             <if test="school != null and school != '' and school == 1">
                 and su.type <![CDATA[ <> ]]> 'SCHOOL'
                 and su.type <![CDATA[ <> ]]> 'SCHOOL'
             </if>
             </if>
-            <if test="college != null and college != '' and college == 1">
+            <!--<if test="college != null and college != '' and college == 1">
                 and su.type = 'COLLEGE'
                 and su.type = 'COLLEGE'
-            </if>
+            </if>-->
         </where>
         </where>
     </select>
     </select>