|
|
|
@ -15,6 +15,7 @@ using Shentun.Peis.OrganizationUnits; |
|
|
|
using Shentun.Peis.Permissions; |
|
|
|
using Shentun.Peis.RegisterCheckPictures; |
|
|
|
using Shentun.Peis.Sexs; |
|
|
|
using Shentun.Peis.SysParmValues; |
|
|
|
using Shentun.Utilities; |
|
|
|
using SqlSugar; |
|
|
|
using System; |
|
|
|
@ -55,6 +56,7 @@ namespace Shentun.Peis.MyUser |
|
|
|
private readonly IRepository<IdentityUser, Guid> _identityUserRepository; |
|
|
|
private readonly IdentityUserManager _userManager; |
|
|
|
private readonly IIdentityUserRepository _userRepository; |
|
|
|
private readonly IRepository<IdentityUserRole> _identityUserRoleRepository; |
|
|
|
private readonly IOptions<IdentityOptions> _identityOptions; |
|
|
|
private readonly IPasswordHasher<IdentityUser> _passwordHasher; |
|
|
|
private readonly IStringEncryptionService _stringEncryptionService; |
|
|
|
@ -66,6 +68,8 @@ namespace Shentun.Peis.MyUser |
|
|
|
private readonly CurrentUser _currentUser; |
|
|
|
private readonly IDistributedCache<IdentityUser, Guid> _userCache; |
|
|
|
private readonly IIdentityRoleRepository _roleRepository; |
|
|
|
private readonly SysParmValueManager _sysParmValueManager; |
|
|
|
|
|
|
|
|
|
|
|
public MyUserAppService( |
|
|
|
IRepository<IdentityUser, Guid> identityUserRepository, |
|
|
|
@ -81,7 +85,9 @@ namespace Shentun.Peis.MyUser |
|
|
|
IConfiguration configuration, |
|
|
|
IRepository<IdentityUserOrganizationUnit> identityUserOrganizationUnitRepository, |
|
|
|
CurrentUser currentUser, |
|
|
|
IDistributedCache<IdentityUser, Guid> userCache) |
|
|
|
IDistributedCache<IdentityUser, Guid> userCache, |
|
|
|
SysParmValueManager sysParmValueManager, |
|
|
|
IRepository<IdentityUserRole> identityUserRoleRepository) |
|
|
|
{ |
|
|
|
this._identityUserRepository = identityUserRepository; |
|
|
|
this._userManager = userManager; |
|
|
|
@ -97,6 +103,8 @@ namespace Shentun.Peis.MyUser |
|
|
|
this._currentUser = currentUser; |
|
|
|
_roleRepository = roleRepository; |
|
|
|
_userCache = userCache; |
|
|
|
_sysParmValueManager = sysParmValueManager; |
|
|
|
_identityUserRoleRepository = identityUserRoleRepository; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -348,6 +356,39 @@ namespace Shentun.Peis.MyUser |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 根据业务员角色获取用户列表 业务员角色id配置系统参数,可以多个
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="input"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
[HttpPost("api/identity/users/GetUserListBySaleRole")] |
|
|
|
public async Task<List<ListByOperatorTypeDto>> GetUserListBySaleRoleAsync(GetUserListBySaleRoleInputDto input) |
|
|
|
{ |
|
|
|
var roleSysParmId = await _sysParmValueManager.GetSysParmValueAsync(Guid.Empty, input.RoleSysParmId); |
|
|
|
if (string.IsNullOrWhiteSpace(roleSysParmId)) |
|
|
|
{ |
|
|
|
throw new UserFriendlyException("系统参数中未找到角色Id"); |
|
|
|
} |
|
|
|
List<string> roleIds = roleSysParmId.Split(",", StringSplitOptions.RemoveEmptyEntries).ToList(); |
|
|
|
|
|
|
|
var identityUserList = (from identityUser in await _identityUserRepository.GetQueryableAsync() |
|
|
|
join identityUserRole in await _identityUserRoleRepository.GetQueryableAsync() on identityUser.Id equals identityUserRole.UserId |
|
|
|
where roleIds.Contains(identityUserRole.RoleId.ToString()) |
|
|
|
select identityUser).ToList().Distinct().ToList(); |
|
|
|
|
|
|
|
|
|
|
|
var entlistDto = identityUserList.Select(s => new ListByOperatorTypeDto |
|
|
|
{ |
|
|
|
Id = s.Id, |
|
|
|
SimpleCode = LanguageConverter.GetPYSimpleCode(s.Surname), |
|
|
|
Surname = s.Surname, |
|
|
|
UserName = s.UserName |
|
|
|
}).ToList(); |
|
|
|
|
|
|
|
return entlistDto; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 修改
|
|
|
|
|