Browse Source

加入系统授权配置

wangliang 3 years ago
parent
commit
7a2d28b74f

+ 12 - 6
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/AuthInfoServiceImpl.java

@@ -95,8 +95,12 @@ public class AuthInfoServiceImpl implements AuthInfoService {
     @Transactional
     protected void saveAuthInfo(AppInfo appInfo, AuthEnum authEnum) {
         List<OrgInfo> orgInfoList = solarService.getOrgList();
-        List<TSAuth> tsAuthList = new ArrayList<>();
-        Set<Long> orgIdsSet = new HashSet<>();
+        List<TSAuth> tsAuthList = null;
+        Set<Long> orgIdsSet = null;
+        if (Objects.nonNull(orgInfoList) && orgInfoList.size() > 0) {
+            tsAuthList = new ArrayList<>();
+            orgIdsSet = new HashSet<>();
+        }
         for (OrgInfo o : orgInfoList) {
             orgIdsSet.add(o.getId());
             if (authEnum == AuthEnum.OFF_LINE) {
@@ -106,9 +110,11 @@ public class AuthInfoServiceImpl implements AuthInfoService {
             }
             commonCacheService.updateAuthInfoCache(o.getId());
         }
-        QueryWrapper<TSAuth> tsAuthQueryWrapper = new QueryWrapper<>();
-        tsAuthQueryWrapper.lambda().in(TSAuth::getSchoolId, orgIdsSet);
-        tsAuthService.remove(tsAuthQueryWrapper);
-        tsAuthService.saveOrUpdateBatch(tsAuthList);
+        if (Objects.nonNull(tsAuthList) && tsAuthList.size() > 0 && Objects.nonNull(orgIdsSet) && orgIdsSet.size() > 0) {
+            QueryWrapper<TSAuth> tsAuthQueryWrapper = new QueryWrapper<>();
+            tsAuthQueryWrapper.lambda().in(TSAuth::getSchoolId, orgIdsSet);
+            tsAuthService.remove(tsAuthQueryWrapper);
+            tsAuthService.saveOrUpdateBatch(tsAuthList);
+        }
     }
 }