dcs 7 месяцев назад
Родитель
Сommit
64e4a4e27b

+ 11 - 11
virgo.core/src/main/java/com/bosshand/virgo/core/service/MgrUserService.java

@@ -260,6 +260,8 @@ public class MgrUserService {
 
 		long userId = user.getId();
 
+		List<MgrOrganizationProject> listAll = new ArrayList<>();
+
 		List<MgrUserRole> userRoles = mgrUserRoleDao.getUserRoles(userId);
 		if (userRoles != null && userRoles.size() > 0) {
 			for (MgrUserRole mgrUserRole : userRoles) {
@@ -277,9 +279,10 @@ public class MgrUserService {
 					}
 				}
 				List<MgrOrganizationProject> list = mgrOrganizationProjectDao.get(mgrUserRole.getOrganizationId(), userId);
-				if (list != null & list.size() > 0) {
+				if (list != null && list.size() > 0) {
 					for (MgrOrganizationProject mop : list) {
 						projectIds.add(mop.getProjectId());
+						listAll.add(mop);
 					}
 				}
 			}
@@ -298,16 +301,13 @@ public class MgrUserService {
 				}
 			}
 
-			for (MgrUserRole mgrUserRole : userRoles) {
-				List<MgrOrganizationProject> list = mgrOrganizationProjectDao.get(mgrUserRole.getOrganizationId(), userId);
-				if (list != null & list.size() > 0) {
-					for (MgrOrganizationProject mop : list) {
-						map.forEach((key, value) -> {
-							if (mop.getProjectId() == key) {
-								value.add(convert(mop.getIdentityId()));
-							}
-						});
-					}
+			if (listAll.size() > 0) {
+				for (MgrOrganizationProject mop : listAll) {
+					map.forEach((key, value) -> {
+						if (mop.getProjectId() == key) {
+							value.add(convert(mop.getIdentityId()));
+						}
+					});
 				}
 			}
 		}