v3.4.6
This commit is contained in:
@@ -11,6 +11,7 @@ using JNPF.JsonSerialization;
|
||||
using JNPF.LinqBuilder;
|
||||
using JNPF.Systems.Entitys.Dto.Organize;
|
||||
using JNPF.Systems.Entitys.Dto.SysConfig;
|
||||
using JNPF.Systems.Entitys.Dto.User;
|
||||
using JNPF.Systems.Entitys.Permission;
|
||||
using JNPF.Systems.Entitys.System;
|
||||
using JNPF.Systems.Interfaces.Permission;
|
||||
@@ -215,13 +216,16 @@ public class OrganizeService : IOrganizeService, IDynamicApiController, ITransie
|
||||
var pItems = treeList.Select(x => x.organizeIds.FirstOrDefault()).Distinct().ToList();
|
||||
pItems.ForEach(item =>
|
||||
{
|
||||
var addItem = orgTree.Find(x => x.Id.Equals(item)).Adapt<OrganizeSelectorOutput>();
|
||||
if (addItem.type != null && addItem.type.Equals("company")) addItem.icon = "icon-ym icon-ym-tree-organization3";
|
||||
addItem.fullName = orgTree.FirstOrDefault(x => x.Id.Equals(addItem.id))?.Description;
|
||||
addItem.organize = addItem.fullName;
|
||||
addItem.organizeIds = addItem.organizeIdTree.Split(",").ToList();
|
||||
addItem.disabled = true;
|
||||
if (!treeList.Any(x => x.id.Equals(addItem.id))) treeList.Add(addItem);
|
||||
if (treeList.Select(x => x.id).Contains(item))
|
||||
{
|
||||
var addItem = orgTree.Find(x => x.Id.Equals(item)).Adapt<OrganizeSelectorOutput>();
|
||||
if (addItem.type != null && addItem.type.Equals("company")) addItem.icon = "icon-ym icon-ym-tree-organization3";
|
||||
addItem.fullName = orgTree.FirstOrDefault(x => x.Id.Equals(addItem.id))?.Description;
|
||||
addItem.organize = addItem.fullName;
|
||||
addItem.organizeIds = addItem.organizeIdTree.Split(",").ToList();
|
||||
addItem.disabled = true;
|
||||
if (!treeList.Any(x => x.id.Equals(addItem.id))) treeList.Add(addItem);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -282,6 +286,23 @@ public class OrganizeService : IOrganizeService, IDynamicApiController, ITransie
|
||||
|
||||
#region POST
|
||||
|
||||
/// <summary>
|
||||
/// 根据组织Id List 获取当前所属组织(部门).
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost("getDefaultCurrentValueDepartmentId")]
|
||||
public async Task<dynamic> GetDefaultCurrentValueDepartmentId([FromBody] GetDefaultCurrentValueInput input)
|
||||
{
|
||||
var depId = _repository.AsSugarClient().Queryable<UserEntity>().Where(x => x.Id.Equals(_userManager.UserId)).Select(x => x.OrganizeId).First();
|
||||
|
||||
if (input.DepartIds == null || !input.DepartIds.Any()) return new { departmentId = depId };
|
||||
var userRelationList = _repository.AsSugarClient().Queryable<UserRelationEntity>().Where(x => input.DepartIds.Contains(x.ObjectId))
|
||||
.Select(x => x.UserId).ToList();
|
||||
|
||||
if (userRelationList.Contains(_userManager.UserId)) return new { userId = depId };
|
||||
else return new { departmentId = string.Empty };
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 通过部门id获取部门列表.
|
||||
/// </summary>
|
||||
@@ -295,19 +316,19 @@ public class OrganizeService : IOrganizeService, IDynamicApiController, ITransie
|
||||
queryWhere = queryWhere.And(x => x.DeleteMark == null);
|
||||
List<OrganizeListOutput>? data = await _repository.AsQueryable().Where(queryWhere)
|
||||
.WhereIF(input.keyword.IsNotEmptyOrNull(), a => a.FullName.Contains(input.keyword) || a.EnCode.Contains(input.keyword)).Select(a => new OrganizeListOutput
|
||||
{
|
||||
id = a.Id,
|
||||
organizeIdTree = a.OrganizeIdTree,
|
||||
type = a.Category,
|
||||
parentId = a.ParentId,
|
||||
lastFullName = a.FullName,
|
||||
fullName = a.FullName,
|
||||
enabledMark = a.EnabledMark,
|
||||
creatorTime = a.CreatorTime,
|
||||
icon = a.Category.Equals("company") ? "icon-ym icon-ym-tree-organization3" : "icon-ym icon-ym-tree-department1",
|
||||
sortCode = a.SortCode,
|
||||
isLeaf = true
|
||||
}).ToListAsync();
|
||||
{
|
||||
id = a.Id,
|
||||
organizeIdTree = a.OrganizeIdTree,
|
||||
type = a.Category,
|
||||
parentId = a.ParentId,
|
||||
lastFullName = a.FullName,
|
||||
fullName = a.FullName,
|
||||
enabledMark = a.EnabledMark,
|
||||
creatorTime = a.CreatorTime,
|
||||
icon = a.Category.Equals("company") ? "icon-ym icon-ym-tree-organization3" : "icon-ym icon-ym-tree-department1",
|
||||
sortCode = a.SortCode,
|
||||
isLeaf = true
|
||||
}).ToListAsync();
|
||||
|
||||
// 获取所有组织
|
||||
List<OrganizeEntity>? allOrgList = GetOrgListTreeName();
|
||||
@@ -398,7 +419,7 @@ public class OrganizeService : IOrganizeService, IDynamicApiController, ITransie
|
||||
});
|
||||
});
|
||||
|
||||
if (adminlist.Any()) await _repository.AsSugarClient().Insertable(adminlist).CallEntityMethod(m => m.Create()).ExecuteReturnEntityAsync();
|
||||
if(adminlist.Any()) await _repository.AsSugarClient().Insertable(adminlist).CallEntityMethod(m => m.Create()).ExecuteReturnEntityAsync();
|
||||
#endregion
|
||||
|
||||
#region 第三方同步
|
||||
|
||||
Reference in New Issue
Block a user