Commit 42effaf3d4c76d47de729b8045267e62e6221f14

Authored by 云中非
1 parent 48476695

fix: 设备分配客户,可选用户不匹配问题

... ... @@ -73,20 +73,7 @@ public class UserOrganizationMappingServiceImpl implements UserOrganizationMappi
73 73 batchInsert(userId, organizationIds);
74 74 }
75 75
76   - @Override
77   - public List<String> getUserIdsByOrganizationId(String organizationId) {
78   - if (StringUtils.isAllEmpty(organizationId)) {
79   - throw new YtDataValidationException(ErrorMessage.INTERNAL_ERROR.getMessage());
80   - }
81   - return userOrganizationMappingMapper
82   - .selectList(
83   - new QueryWrapper<UserOrganizationMapping>()
84   - .lambda()
85   - .eq(UserOrganizationMapping::getOrganizationId, organizationId))
86   - .stream()
87   - .map(UserOrganizationMapping::getUserId)
88   - .collect(Collectors.toList());
89   - }
  76 +
90 77
91 78 @Override
92 79 public List<String> getOrganizationIdsByUserId(String userId) {
... ...
... ... @@ -521,7 +521,7 @@ public class YtUserServiceImpl extends AbstractBaseService<UserMapper, User>
521 521 if (group == null || !group.getTenantId().equals(tenantId)) {
522 522 return Optional.empty();
523 523 }
524   - List<String> userIds = userOrganizationMappingService.getUserIdsByOrganizationId(group.getId());
  524 + List<String> userIds = userOrganizationMappingService.getUserIdByOrganizationIds(group.getId());
525 525 List<User> users = baseMapper.selectBatchIds(userIds);
526 526 return Optional.ofNullable(ReflectUtils.sourceToTarget(users, UserDTO.class));
527 527 }
... ... @@ -590,7 +590,7 @@ public class YtUserServiceImpl extends AbstractBaseService<UserMapper, User>
590 590 }
591 591 if (isTenantAdmin) {
592 592 List<String> userList =
593   - userOrganizationMappingService.getUserIdsByOrganizationId(organizationId);
  593 + userOrganizationMappingService.getUserIdByOrganizationIds(tenantId,organizationId);
594 594 if (null != userList && userList.size() > FastIotConstants.MagicNumber.ZERO) {
595 595 return baseMapper.getMyCustomers(tenantId, EntityId.NULL_UUID.toString(), userList);
596 596 }
... ...
... ... @@ -22,13 +22,7 @@ public interface UserOrganizationMappingService {
22 22 void addOrUpdateUserOrganizationMapping(
23 23 String userId, List<String> organizationIds, boolean isUpdate);
24 24
25   - /**
26   - * 根据组织ID查询其用户ID列表
27   - *
28   - * @param organizationId 组织ID
29   - * @return 用户ID集合
30   - */
31   - List<String> getUserIdsByOrganizationId(String organizationId);
  25 +
32 26
33 27 /**
34 28 * 根据用户ID查询其所拥有的组织ID列表
... ...