|
@@ -22,6 +22,7 @@ using GxPress.Repository.Interface.WorkFlow;
|
|
|
using GxPress.EnumConst;
|
|
|
using GxPress.Request.App.Flow;
|
|
|
using GxPress.Repository.Interface.WaitHandle;
|
|
|
+using GxPress.Request.AddressBookGroup;
|
|
|
|
|
|
namespace GxPress.Service.Implement
|
|
|
{
|
|
@@ -343,7 +344,62 @@ namespace GxPress.Service.Implement
|
|
|
result.WaitHandleUFinishCount = await waitHandleRepository.GetUFinishAsync(userId);
|
|
|
return result;
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
+ /// <summary>
|
|
|
+ /// 获取用户的通讯录
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="userId"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public async Task<UserLinkResult> GetUserLinkResultAsync(int userId)
|
|
|
+ {
|
|
|
+ //获取用户
|
|
|
+ var user = await _userRepository.GetAsync(userId);
|
|
|
+ //单位通讯录
|
|
|
+ var userLinkResult = new List<UserLinkModelResult>();
|
|
|
+ if (user.DepartmentId > 0)
|
|
|
+ {
|
|
|
+ var departments = await _departmentRepository.GetAllAsync(Q.Where(nameof(Entity.Department.ParentId), 0));
|
|
|
+ var userLinkModelAttributeResult = new List<UserLinkModelAttributeResult>();
|
|
|
+ foreach (var item in departments)
|
|
|
+ userLinkModelAttributeResult.Add(new UserLinkModelAttributeResult { Id = item.Id, Name = item.Name });
|
|
|
+ userLinkResult.Add(new UserLinkModelResult
|
|
|
+ {
|
|
|
+ TypeId = 1,
|
|
|
+ Name = "单位通讯录",
|
|
|
+ Items = userLinkModelAttributeResult
|
|
|
+ });
|
|
|
+ }
|
|
|
+ //系统通讯录
|
|
|
+ userLinkResult.Add(
|
|
|
+ new UserLinkModelResult
|
|
|
+ {
|
|
|
+ TypeId = 2,
|
|
|
+ Name = "系统通讯录",
|
|
|
+ Items = new List<UserLinkModelAttributeResult>{
|
|
|
+ new UserLinkModelAttributeResult{Id=0,Name="我的小组",TypeValue=1},
|
|
|
+ new UserLinkModelAttributeResult{Id=0,Name="我的群聊",TypeValue=2},
|
|
|
+ new UserLinkModelAttributeResult{Id=0,Name="我的课程",TypeValue=3}
|
|
|
+ }
|
|
|
+ }
|
|
|
+ );
|
|
|
+ //自建通讯录
|
|
|
+ var addressBookGroupList = await _addressBookGroupRepository.GetAddressBookGroupListAsync(
|
|
|
+ new AddressBookGroupSearchRequest { ParendId = 0, UserId = userId });
|
|
|
+ var systemLinkModelAttributeResults = new List<UserLinkModelAttributeResult>();
|
|
|
+ foreach (var item in addressBookGroupList)
|
|
|
+ systemLinkModelAttributeResults.Add(new UserLinkModelAttributeResult { Id = item.Id, Name = item.GroupName });
|
|
|
+ userLinkResult.Add(
|
|
|
+ new UserLinkModelResult
|
|
|
+ {
|
|
|
+ TypeId = 3,
|
|
|
+ Name = "自建通讯录",
|
|
|
+ Items = systemLinkModelAttributeResults
|
|
|
+ }
|
|
|
+ );
|
|
|
+ var result = new UserLinkResult()
|
|
|
+ {
|
|
|
+ Items = userLinkResult
|
|
|
+ };
|
|
|
+ return result;
|
|
|
+ }
|
|
|
}
|
|
|
}
|