Browse Source

用户

bjmzak
wxd 2 years ago
parent
commit
c61812996a
  1. 27
      src/Shentun.Peis.Application/AbpUserDepartments/AbpUserDepartmentAppService.cs
  2. 2
      src/Shentun.Peis.Application/ItemTypes/ItemTypeAppService.cs
  3. 9
      src/Shentun.Peis.Application/MyUser/MyUserAppService.cs

27
src/Shentun.Peis.Application/AbpUserDepartments/AbpUserDepartmentAppService.cs

@ -40,25 +40,30 @@ namespace Shentun.Peis.AbpUserDepartments
public async Task CreateManyAsync(Guid UserId, List<Guid> OrganizationUnitIds)
{
if (UserId == Guid.Empty || !OrganizationUnitIds.Any())
if (UserId == Guid.Empty)
{
throw new UserFriendlyException($"请求参数有误");
}
await _abpUserDepartmentRepository.DeleteAsync(d => d.UserId == UserId, true);
List<AbpUserDepartment> entlist = new List<AbpUserDepartment>();
foreach (var org in OrganizationUnitIds)
if (OrganizationUnitIds.Any())
{
var ent = new AbpUserDepartment
List<AbpUserDepartment> entlist = new List<AbpUserDepartment>();
foreach (var org in OrganizationUnitIds)
{
UserId = UserId,
OrganizationUnitId = org
};
entlist.Add(ent);
}
var ent = new AbpUserDepartment
{
UserId = UserId,
OrganizationUnitId = org
};
entlist.Add(ent);
}
await _abpUserDepartmentRepository.InsertManyAsync(entlist, true);
await _abpUserDepartmentRepository.InsertManyAsync(entlist, true);
}
}
@ -67,7 +72,7 @@ namespace Shentun.Peis.AbpUserDepartments
/// </summary>
/// <param name="UserId">用户ID</param>
/// <returns></returns>
[HttpGet("api/app/abpuserdepartment/getuserdepartment")]
[HttpGet("api/app/abpuserdepartment/getuserdepartment")]
public async Task<List<Guid>> GetUserDepartmentAsync(Guid UserId)
{
List<Guid> guids = new List<Guid>();

2
src/Shentun.Peis.Application/ItemTypes/ItemTypeAppService.cs

@ -111,7 +111,7 @@ namespace Shentun.Peis.ItemTypes
public async Task<List<TreeChildViewDto>> GetByCodeAllAsync()
{
var dataList = await Repository.GetListAsync();
var items = from p in dataList
var items = from p in dataList.OrderBy(o => o.DisplayOrder)
select new TreeChildViewDto()
{
Id = p.Id,

9
src/Shentun.Peis.Application/MyUser/MyUserAppService.cs

@ -355,6 +355,15 @@ namespace Shentun.Peis.MyUser
var organizationUnitList = await _organizationUnitRepository.GetListAsync();
var PeisId = await _peisOrganizationUnitManager.GetPeisIdAsync(organizationUnitList, user.Id);
if (user.IsActive == false)
{
throw new UserFriendlyException("账号已被禁用");
}
if (user.LockoutEnabled == true)
{
throw new UserFriendlyException("账号已被锁定");
}
TokenResponse token = await RequestAuthServerLoginByPasswordAsync(input.UserName, input.PassWord);

Loading…
Cancel
Save