From c61812996ad7275e1b2733d555c4824b1c8595c2 Mon Sep 17 00:00:00 2001 From: wxd <123@qq.com> Date: Tue, 30 Apr 2024 01:18:00 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=A8=E6=88=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AbpUserDepartmentAppService.cs | 27 +++++++++++-------- .../ItemTypes/ItemTypeAppService.cs | 2 +- .../MyUser/MyUserAppService.cs | 9 +++++++ 3 files changed, 26 insertions(+), 12 deletions(-) diff --git a/src/Shentun.Peis.Application/AbpUserDepartments/AbpUserDepartmentAppService.cs b/src/Shentun.Peis.Application/AbpUserDepartments/AbpUserDepartmentAppService.cs index fc9f8a5..d4b9942 100644 --- a/src/Shentun.Peis.Application/AbpUserDepartments/AbpUserDepartmentAppService.cs +++ b/src/Shentun.Peis.Application/AbpUserDepartments/AbpUserDepartmentAppService.cs @@ -40,25 +40,30 @@ namespace Shentun.Peis.AbpUserDepartments public async Task CreateManyAsync(Guid UserId, List OrganizationUnitIds) { - if (UserId == Guid.Empty || !OrganizationUnitIds.Any()) + if (UserId == Guid.Empty) { throw new UserFriendlyException($"请求参数有误"); } await _abpUserDepartmentRepository.DeleteAsync(d => d.UserId == UserId, true); - List entlist = new List(); - foreach (var org in OrganizationUnitIds) + + if (OrganizationUnitIds.Any()) { - var ent = new AbpUserDepartment + + List entlist = new List(); + 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 /// /// 用户ID /// - [HttpGet("api/app/abpuserdepartment/getuserdepartment")] + [HttpGet("api/app/abpuserdepartment/getuserdepartment")] public async Task> GetUserDepartmentAsync(Guid UserId) { List guids = new List(); diff --git a/src/Shentun.Peis.Application/ItemTypes/ItemTypeAppService.cs b/src/Shentun.Peis.Application/ItemTypes/ItemTypeAppService.cs index 08634bd..99ceca5 100644 --- a/src/Shentun.Peis.Application/ItemTypes/ItemTypeAppService.cs +++ b/src/Shentun.Peis.Application/ItemTypes/ItemTypeAppService.cs @@ -111,7 +111,7 @@ namespace Shentun.Peis.ItemTypes public async Task> 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, diff --git a/src/Shentun.Peis.Application/MyUser/MyUserAppService.cs b/src/Shentun.Peis.Application/MyUser/MyUserAppService.cs index 2e0beff..067ffa0 100644 --- a/src/Shentun.Peis.Application/MyUser/MyUserAppService.cs +++ b/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);