李昊 4 rokov pred
rodič
commit
17802add44

+ 45 - 1
gx_api/GxPress/Api/GxPress.Api/WebControllers/UserController.cs

@@ -13,10 +13,16 @@ using GxPress.Common.Validation;
 using GxPress.Entity;
 using GxPress.EnumConst;
 using GxPress.Repository.Interface;
+using GxPress.Request.AddressBookGroup;
+using GxPress.Request.AddressBookGroupUser;
 using GxPress.Request.App.User;
+using GxPress.Request.Department;
 using GxPress.Request.User;
+using GxPress.Result.AddressBook;
+using GxPress.Result.AddressBookGroupUser;
 using GxPress.Result.App.FileLibrary;
 using GxPress.Result.App.User;
+using GxPress.Result.Department;
 using GxPress.Result.User;
 using GxPress.Service.Interface;
 using Microsoft.AspNetCore.Authorization;
@@ -44,9 +50,11 @@ namespace GxPress.Api.WebControllers
         private readonly IFileLibraryRepository fileLibraryRepository;
         private readonly IDistributedCache _cache;
         private readonly IUserLoginRepository userLoginRepository;
+        private readonly IAddressBookGroupRepository addressBookGroupRepository;
+        private readonly IAddressBookGroupUserRepository _addressBookGroupUserRepository;
         public UserController(IUserRepository userRepository, IOptions<JwtOptions> jwtOptions,
             ILogger<UserController> logger, IDepartmentRepository departmentRepository, ILoginContext loginContext,
-            IUserService userService, IFileLibraryRepository fileLibraryRepository, IDistributedCache cache, IUserLoginRepository userLoginRepository)
+            IUserService userService, IFileLibraryRepository fileLibraryRepository, IDistributedCache cache, IUserLoginRepository userLoginRepository, IAddressBookGroupRepository addressBookGroupRepository, IAddressBookGroupUserRepository _addressBookGroupUserRepository)
         {
             _userRepository = userRepository;
             _departmentRepository = departmentRepository;
@@ -57,6 +65,8 @@ namespace GxPress.Api.WebControllers
             this.fileLibraryRepository = fileLibraryRepository;
             _cache = cache;
             this.userLoginRepository = userLoginRepository;
+            this.addressBookGroupRepository = addressBookGroupRepository;
+            this._addressBookGroupUserRepository = _addressBookGroupUserRepository;
         }
         /// <summary>
         /// 登录
@@ -395,5 +405,39 @@ namespace GxPress.Api.WebControllers
         {
             return await fileLibraryRepository.GetFileLibraryByUserIdAsync(_loginContext.AccountId);
         }
+        /// <summary>
+        /// 获取用户通讯录组
+        /// </summary>
+        /// <returns></returns>
+        [HttpPost("list-group")]
+        public async Task<AddressBookListResult> GetAddressBookList()
+        {
+            var request = new AddressBookListRequest { UserId = _loginContext.AccountId };
+            return await addressBookGroupRepository.GetAddressBookListAsync(request);
+        }
+
+        /// <summary>
+        /// 获取自建用户
+        /// </summary>
+        /// <param name="request"></param>
+        /// <returns></returns>
+        [HttpPost("list")]
+        public async Task<AddressBookGroupUserListResult> GetAddressBookGroupUserList(
+            AddressBookGroupUserSearchRequest request)
+        {
+            var userId = _loginContext.AccountId;
+            return await _addressBookGroupUserRepository.GetAddressBookGroupUserListAsync(request, userId);
+        }
+
+        /// <summary>
+        /// 根据部门ID获取成员以及下级部门
+        /// </summary>
+        /// <param name="request"></param>
+        /// <returns></returns>
+        [HttpPost("user-list")]
+        public async Task<DepartmentUserResult> GetDepartmentUserResult(DepartmentUserRequest request)
+        {
+            return await _departmentRepository.GetDepartmentUserResultAsync(request);
+        }
     }
 }

+ 6 - 2
gx_api/GxPress/Api/GxPress.Api/WebControllers/WebGroupController.cs

@@ -4,9 +4,11 @@ using GxPress.Auth;
 using GxPress.Common.Page;
 using GxPress.Repository.Interface;
 using GxPress.Repository.Interface.Group;
+using GxPress.Request.AddressBookGroup;
 using GxPress.Request.App.Group;
 using GxPress.Request.App.GroupUser;
 using GxPress.Request.App.Topic;
+using GxPress.Result.AddressBook;
 using GxPress.Result.App.Group;
 using GxPress.Result.App.GroupUser;
 using GxPress.Result.App.Topic;
@@ -26,7 +28,6 @@ namespace GxPress.Api.WebControllers
     [Authorize]
     public class WebGroupController : Controller
     {
-
         private readonly IGroupRepository _groupRepository;
         private readonly IGroupUserRepository _groupUserRepository;
         private readonly IGroupFolderRepository _groupFolderRepository;
@@ -35,6 +36,7 @@ namespace GxPress.Api.WebControllers
         private readonly ITopicRepository _topicRepository;
         private readonly ITopicService _topicService;
         private readonly IGroupCategroyRepository groupCategroyRepository;
+       
         public WebGroupController(IGroupRepository groupRepository,
             IGroupFolderRepository groupFolderRepository, IGroupUserRepository groupUserRepository,
             ILoginContext loginContext, IGroupService groupService, ITopicRepository topicRepository, ITopicService topicService, IGroupCategroyRepository groupCategroyRepository)
@@ -92,7 +94,7 @@ namespace GxPress.Api.WebControllers
             return await groupCategroyRepository.GetAllAsync(parentId);
         }
 
-         /// <summary>
+        /// <summary>
         /// 删除小组成员
         /// </summary>
         /// <param name="request"></param>
@@ -228,5 +230,7 @@ namespace GxPress.Api.WebControllers
         {
             return await _groupRepository.SearchGroupUserAsync(request);
         }
+
+      
     }
 }