diff --git a/src/Shentun.Peis.Application.Contracts/MyUser/GetUserListBySaleRoleInputDto.cs b/src/Shentun.Peis.Application.Contracts/MyUser/GetUserListBySaleRoleInputDto.cs new file mode 100644 index 00000000..43b6bf70 --- /dev/null +++ b/src/Shentun.Peis.Application.Contracts/MyUser/GetUserListBySaleRoleInputDto.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Shentun.Peis.MyUser +{ + public class GetUserListBySaleRoleInputDto + { + /// + /// 角色对应的系统参数Id + /// + public string RoleSysParmId { get; set; } = "sale_role_id"; + } +} diff --git a/src/Shentun.Peis.Application/MyUser/MyUserAppService.cs b/src/Shentun.Peis.Application/MyUser/MyUserAppService.cs index e6a23347..361f075a 100644 --- a/src/Shentun.Peis.Application/MyUser/MyUserAppService.cs +++ b/src/Shentun.Peis.Application/MyUser/MyUserAppService.cs @@ -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 _identityUserRepository; private readonly IdentityUserManager _userManager; private readonly IIdentityUserRepository _userRepository; + private readonly IRepository _identityUserRoleRepository; private readonly IOptions _identityOptions; private readonly IPasswordHasher _passwordHasher; private readonly IStringEncryptionService _stringEncryptionService; @@ -66,6 +68,8 @@ namespace Shentun.Peis.MyUser private readonly CurrentUser _currentUser; private readonly IDistributedCache _userCache; private readonly IIdentityRoleRepository _roleRepository; + private readonly SysParmValueManager _sysParmValueManager; + public MyUserAppService( IRepository identityUserRepository, @@ -81,7 +85,9 @@ namespace Shentun.Peis.MyUser IConfiguration configuration, IRepository identityUserOrganizationUnitRepository, CurrentUser currentUser, - IDistributedCache userCache) + IDistributedCache userCache, + SysParmValueManager sysParmValueManager, + IRepository 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 } + /// + /// 根据业务员角色获取用户列表 业务员角色id配置系统参数,可以多个 + /// + /// + /// + [HttpPost("api/identity/users/GetUserListBySaleRole")] + public async Task> GetUserListBySaleRoleAsync(GetUserListBySaleRoleInputDto input) + { + var roleSysParmId = await _sysParmValueManager.GetSysParmValueAsync(Guid.Empty, input.RoleSysParmId); + if (string.IsNullOrWhiteSpace(roleSysParmId)) + { + throw new UserFriendlyException("系统参数中未找到角色Id"); + } + List 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; + } + + /// /// 修改 diff --git a/src/Shentun.Peis.EntityFrameworkCore/EntityFrameworkCore/PeisDbContext.cs b/src/Shentun.Peis.EntityFrameworkCore/EntityFrameworkCore/PeisDbContext.cs index 74a11fc2..67d4913b 100644 --- a/src/Shentun.Peis.EntityFrameworkCore/EntityFrameworkCore/PeisDbContext.cs +++ b/src/Shentun.Peis.EntityFrameworkCore/EntityFrameworkCore/PeisDbContext.cs @@ -112,7 +112,7 @@ public class PeisDbContext : //public DbSet identityUserClaims { get; set; } - //public DbSet identityUserRoles { get; set; } + public DbSet identityUserRoles { get; set; } //public DbSet identityUserLogins { get; set; } diff --git a/src/Shentun.Peis.HttpApi.Host/Schedulers/SyncPatientRegisterReportInterfaceWorker.cs b/src/Shentun.Peis.HttpApi.Host/Schedulers/SyncPatientRegisterReportInterfaceWorker.cs index 2038bb4e..53460d21 100644 --- a/src/Shentun.Peis.HttpApi.Host/Schedulers/SyncPatientRegisterReportInterfaceWorker.cs +++ b/src/Shentun.Peis.HttpApi.Host/Schedulers/SyncPatientRegisterReportInterfaceWorker.cs @@ -34,7 +34,6 @@ namespace Shentun.Peis.Schedulers } - public class SyncPatientRegisterReportInterfaceWorker : ThirdInterfaceWorkerBase, ISyncPatientRegisterReportInterfaceWorker { private static long i; diff --git a/src/Shentun.Peis.HttpApi.Host/appsettings.json b/src/Shentun.Peis.HttpApi.Host/appsettings.json index 13a2b6b8..e7d94dcc 100644 --- a/src/Shentun.Peis.HttpApi.Host/appsettings.json +++ b/src/Shentun.Peis.HttpApi.Host/appsettings.json @@ -5,10 +5,10 @@ "CorsOrigins": "https://*.Peis.com,http://localhost:4200,http://localhost:9530,http://192.168.1.108:9530,http://localhost:8080,http://localhost:8081,http://192.168.0.3:9531", "RedirectAllowedUrls": "http://localhost:9530", "SelfUser": "admin", - "SelfPassword": "Shentun!@#qwe123", + "SelfPassword": "St123", //"SelfPassword": "654321", "LisUser": "admin", - "LisPassword": "Shentun!@#qwe123" + "LisPassword": "St123" //"LisPassword": "654321" }, "ConnectionStrings": {