|
@@ -260,8 +260,6 @@ 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) {
|
|
@@ -278,15 +276,7 @@ public class MgrUserService {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- List<MgrOrganizationProject> list = mgrOrganizationProjectDao.get(mgrUserRole.getOrganizationId(), userId);
|
|
|
- if (list != null && list.size() > 0) {
|
|
|
- for (MgrOrganizationProject mop : list) {
|
|
|
- projectIds.add(mop.getProjectId());
|
|
|
- listAll.add(mop);
|
|
|
- }
|
|
|
- }
|
|
|
}
|
|
|
-
|
|
|
if (projectIds.size() > 0) {
|
|
|
for (MgrUserRole mgrUserRole : userRoles) {
|
|
|
for (Long projectId : projectIds) {
|
|
@@ -300,33 +290,32 @@ public class MgrUserService {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- if (listAll.size() > 0) {
|
|
|
- for (MgrOrganizationProject mop : listAll) {
|
|
|
- map.forEach((key, value) -> {
|
|
|
- if (mop.getProjectId() == key) {
|
|
|
- value.add(convert(mop.getIdentityId()));
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
}
|
|
|
+ // 身份
|
|
|
+ List<MgrOrganizationProject> list = mgrOrganizationProjectDao.getUserProject(userId);
|
|
|
+ Map<Long, Set<JSONObject>> longSetMap = addSet(map, list);
|
|
|
|
|
|
// 关联公司
|
|
|
List<MgrOrganizationProject> bindOrganizationList = mgrOrganizationProjectDao.getBindOrganizationId(user.getLastOrganizationId());
|
|
|
- if (bindOrganizationList != null && bindOrganizationList.size() > 0) {
|
|
|
- for (MgrOrganizationProject bind : bindOrganizationList) {
|
|
|
- if (map.containsKey(bind.getProjectId())) {
|
|
|
- Set<JSONObject> jsonObjects = map.get(bind.getProjectId());
|
|
|
- jsonObjects.add(convert(bind.getIdentityId()));
|
|
|
+ Map<Long, Set<JSONObject>> longSetMap1 = addSet(longSetMap, bindOrganizationList);
|
|
|
+
|
|
|
+ System.err.println(longSetMap1.toString());
|
|
|
+ return longSetMap1;
|
|
|
+ }
|
|
|
+
|
|
|
+ private Map<Long, Set<JSONObject>> addSet(Map<Long, Set<JSONObject>> map, List<MgrOrganizationProject> list) {
|
|
|
+ if (list.size() > 0) {
|
|
|
+ for (MgrOrganizationProject mop : list) {
|
|
|
+ if (map.containsKey(mop.getProjectId())) {
|
|
|
+ Set<JSONObject> jsonObjects = map.get(mop.getProjectId());
|
|
|
+ jsonObjects.add(convert(mop.getIdentityId()));
|
|
|
} else {
|
|
|
Set<JSONObject> identityList = new HashSet<>();
|
|
|
- identityList.add(convert(bind.getIdentityId()));
|
|
|
- map.put(bind.getProjectId(), identityList);
|
|
|
+ identityList.add(convert(mop.getIdentityId()));
|
|
|
+ map.put(mop.getProjectId(), identityList);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
return map;
|
|
|
}
|
|
|
|