浏览代码

强制从超管激活

wangliang 2 年之前
父节点
当前提交
8290916719

+ 2 - 2
teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/AuthInfoService.java

@@ -55,7 +55,7 @@ public interface AuthInfoService {
     /**
     /**
      * 更新学校启用/禁用
      * 更新学校启用/禁用
      *
      *
-     * @param orgIdsMap
+     * @param orgCodesMap
      */
      */
-    public void updateSchoolEnable(Map<Long, Long> orgIdsMap);
+    public void updateSchoolEnable(Map<String, String> orgCodesMap);
 }
 }

+ 11 - 16
teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/impl/AuthInfoServiceImpl.java

@@ -158,21 +158,18 @@ public class AuthInfoServiceImpl implements AuthInfoService {
     public void saveAuthInfo(AppInfo appInfo, AuthEnum authEnum, byte[] file) throws Exception {
     public void saveAuthInfo(AppInfo appInfo, AuthEnum authEnum, byte[] file) throws Exception {
         List<OrgInfo> orgInfoList = solarService.getOrgList();
         List<OrgInfo> orgInfoList = solarService.getOrgList();
         List<TSAuth> tsAuthList = null;
         List<TSAuth> tsAuthList = null;
-        Set<Long> orgIdsSet = null;
-        Map<Long, Long> orgIdsMap = null;
+        Map<String, String> orgCodesMap = null;
         Set<BasicSchool> basicSchoolSet = null;
         Set<BasicSchool> basicSchoolSet = null;
         Set<SysOrg> sysOrgSet = null;
         Set<SysOrg> sysOrgSet = null;
         if (!CollectionUtils.isEmpty(orgInfoList)) {
         if (!CollectionUtils.isEmpty(orgInfoList)) {
             tsAuthList = new ArrayList<>();
             tsAuthList = new ArrayList<>();
-            orgIdsSet = new HashSet<>();
             basicSchoolSet = new HashSet<>();
             basicSchoolSet = new HashSet<>();
             sysOrgSet = new HashSet<>();
             sysOrgSet = new HashSet<>();
-            orgIdsMap = new HashMap<>();
+            orgCodesMap = new HashMap<>();
         }
         }
         boolean oss = dictionaryConfig.sysDomain().isOss();
         boolean oss = dictionaryConfig.sysDomain().isOss();
         for (OrgInfo o : orgInfoList) {
         for (OrgInfo o : orgInfoList) {
-            orgIdsSet.add(o.getId());
-            orgIdsMap.put(o.getId(), o.getId());
+            orgCodesMap.put(o.getCode(), o.getCode());
             if (authEnum == AuthEnum.OFF_LINE) {
             if (authEnum == AuthEnum.OFF_LINE) {
                 if (Objects.isNull(file)) {
                 if (Objects.isNull(file)) {
                     tsAuthList.add(new TSAuth(o.getId(), solarProperties.getLicense(), authEnum, appInfo.getControl().getExpireTime()));
                     tsAuthList.add(new TSAuth(o.getId(), solarProperties.getLicense(), authEnum, appInfo.getControl().getExpireTime()));
@@ -212,16 +209,14 @@ public class AuthInfoServiceImpl implements AuthInfoService {
                         basicSchool.setLogo(filePath);
                         basicSchool.setLogo(filePath);
                     }
                     }
                 } else {
                 } else {
-                    basicSchool.setLogo(o.getLogo());
+                    basicSchool.setLogo(o.getLogoUrl());
                 }
                 }
                 basicSchoolSet.add(basicSchool);
                 basicSchoolSet.add(basicSchool);
             } else {
             } else {
                 basicSchool.setAccessKey(o.getAccessKey());
                 basicSchool.setAccessKey(o.getAccessKey());
                 basicSchool.setAccessSecret(o.getAccessSecret());
                 basicSchool.setAccessSecret(o.getAccessSecret());
-                basicSchool.setLogo(o.getLogoUrl());
-                basicSchoolService.saveOrUpdate(basicSchool);
-                commonCacheService.updateSchoolCache(basicSchool.getId());
-                commonCacheService.updateSchoolCache(basicSchool.getCode());
+                basicSchool.setLogo(Objects.nonNull(o.getLogoUrl()) ? o.getLogoUrl() : basicSchool.getLogo());
+                basicSchoolSet.add(basicSchool);
             }
             }
 
 
             QueryWrapper<SysOrg> sysOrgQueryWrapper = new QueryWrapper<>();
             QueryWrapper<SysOrg> sysOrgQueryWrapper = new QueryWrapper<>();
@@ -232,7 +227,7 @@ public class AuthInfoServiceImpl implements AuthInfoService {
             }
             }
         }
         }
 
 
-        if (!CollectionUtils.isEmpty(tsAuthList) && !CollectionUtils.isEmpty(orgIdsSet)) {
+        if (!CollectionUtils.isEmpty(tsAuthList) && !CollectionUtils.isEmpty(orgCodesMap)) {
             tsAuthService.remove(new QueryWrapper<TSAuth>().lambda().ge(TSAuth::getId, 0L));
             tsAuthService.remove(new QueryWrapper<TSAuth>().lambda().ge(TSAuth::getId, 0L));
             tsAuthService.saveOrUpdateBatch(tsAuthList);
             tsAuthService.saveOrUpdateBatch(tsAuthList);
 
 
@@ -243,7 +238,7 @@ public class AuthInfoServiceImpl implements AuthInfoService {
             }
             }
 
 
             AuthInfoService authInfoService = SpringContextHolder.getBean(AuthInfoService.class);
             AuthInfoService authInfoService = SpringContextHolder.getBean(AuthInfoService.class);
-            authInfoService.updateSchoolEnable(orgIdsMap);
+            authInfoService.updateSchoolEnable(orgCodesMap);
 
 
             if (!CollectionUtils.isEmpty(sysOrgSet)) {
             if (!CollectionUtils.isEmpty(sysOrgSet)) {
                 sysOrgService.saveOrUpdateBatch(sysOrgSet);
                 sysOrgService.saveOrUpdateBatch(sysOrgSet);
@@ -269,13 +264,13 @@ public class AuthInfoServiceImpl implements AuthInfoService {
     /**
     /**
      * 更新学校启用/禁用
      * 更新学校启用/禁用
      *
      *
-     * @param orgIdsMap
+     * @param orgCodesMap
      */
      */
-    public void updateSchoolEnable(Map<Long, Long> orgIdsMap) {
+    public void updateSchoolEnable(Map<String, String> orgCodesMap) {
         List<BasicSchool> basicSchoolList = basicSchoolService.list();
         List<BasicSchool> basicSchoolList = basicSchoolService.list();
         if (!CollectionUtils.isEmpty(basicSchoolList)) {
         if (!CollectionUtils.isEmpty(basicSchoolList)) {
             for (BasicSchool b : basicSchoolList) {
             for (BasicSchool b : basicSchoolList) {
-                if (orgIdsMap.containsKey(b.getId())) {
+                if (orgCodesMap.containsKey(b.getCode())) {
                     b.setEnable(true);
                     b.setEnable(true);
                 } else {
                 } else {
                     b.setEnable(false);
                     b.setEnable(false);