Commit 06e9b3829527df927970d104615c670cf3d0b38b
1 parent
3fdf355bc5
Exists in
master
and in
1 other branch
bug fix
Showing 1 changed file with 25 additions and 3 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/UsersController.java
View file @
06e9b38
... | ... | @@ -171,11 +171,16 @@ |
171 | 171 | |
172 | 172 | |
173 | 173 | List<Users> users = usersService.queryUsers2(usersQuery); |
174 | - | |
174 | + List<Organization> organizations = null; | |
175 | 175 | //设置用户角色信息 |
176 | 176 | for(Users user : users) { |
177 | + organizations = new ArrayList<>(); | |
178 | + Organization organization = organizationService.getOrganization(user.getOrgId()); | |
179 | + user.setOrganization(organization); | |
180 | + organizations.add(organization); | |
181 | + user.setOrganizations(organizations); | |
182 | + | |
177 | 183 | user.setRoles(this.getUserRoles(user.getId())); |
178 | - user.setOrganization(organizationService.getOrganization(user.getOrgId())); | |
179 | 184 | user.setDepartmentses(departmentsService.getDepartments(user.getDeptId())); |
180 | 185 | } |
181 | 186 | |
... | ... | @@ -369,6 +374,24 @@ |
369 | 374 | } |
370 | 375 | } |
371 | 376 | |
377 | + | |
378 | + List<Organization> organizations = new ArrayList<>(); | |
379 | + if(null != users.getOrgId() && new Integer(1).equals(users.getType())) { //普通用户 | |
380 | + organizations.add(organizationService.getOrganization(users.getOrgId())); | |
381 | + } else if(new Integer(0).equals(users.getType())) { //管理员 | |
382 | + List<Organization> list2 =accessPermissionFacade.findAccessPerminssionByUserId(users.getId()); | |
383 | + if(CollectionUtils.isNotEmpty(list2)){ | |
384 | + for(Organization organization:list2){ | |
385 | + organizations.add(organization); | |
386 | + } | |
387 | + } | |
388 | + } else if(new Integer(2).equals(users.getType())) {//超级管理员 | |
389 | + OrganizationQuery organizationQuery = new OrganizationQuery(); | |
390 | + organizationQuery.setYn(YnEnums.YES.getId()); | |
391 | + organizations = organizationService.queryOrganization(organizationQuery); | |
392 | + } | |
393 | + | |
394 | + users.setOrganizations(organizations); | |
372 | 395 | Map<String, Object> map = new HashMap<>(); |
373 | 396 | map.put("user", users); |
374 | 397 | map.put("roles", roles); |
... | ... | @@ -376,7 +399,6 @@ |
376 | 399 | |
377 | 400 | ResultUtils.buildSuccessResultAndWrite(response, map); |
378 | 401 | } |
379 | - | |
380 | 402 | |
381 | 403 | /** |
382 | 404 | * 获取 用户角色信息 |