diff --git a/Api/Ewide.Application/Service/HouseSafety/HouseMember/HouseMemberService.cs b/Api/Ewide.Application/Service/HouseSafety/HouseMember/HouseMemberService.cs index b099b03..309d93b 100644 --- a/Api/Ewide.Application/Service/HouseSafety/HouseMember/HouseMemberService.cs +++ b/Api/Ewide.Application/Service/HouseSafety/HouseMember/HouseMemberService.cs @@ -50,7 +50,7 @@ namespace Ewide.Application.Service [HttpPost("/houseMember/page")] public async Task QueryMemberPageList([FromBody] UserInput input) { - var dataScopes = await _sysUserService.GetUserDataScopeIdList(_userManager.UserId); + var dataScopes = await _userManager.GetUserAllDataScopeList(); var sql = @"SELECT SU.*, diff --git a/Api/Ewide.Application/Service/HouseSafety/HouseZone/HouseZoneService.cs b/Api/Ewide.Application/Service/HouseSafety/HouseZone/HouseZoneService.cs index 4b9d3f8..e5aac58 100644 --- a/Api/Ewide.Application/Service/HouseSafety/HouseZone/HouseZoneService.cs +++ b/Api/Ewide.Application/Service/HouseSafety/HouseZone/HouseZoneService.cs @@ -72,7 +72,7 @@ namespace Ewide.Application.Service [HttpPost("/houseZone/page")] public async Task QueryZonePageList([FromBody] PageOrgInput input) { - var dataScopeList = _sysOrgService.GetDataScopeList(await _sysOrgService.GetUserDataScopeIdList()); + var dataScopeList = _sysOrgService.GetDataScopeList(await _userManager.GetUserAllDataScopeList()); var name = !string.IsNullOrEmpty(input.Name?.Trim()); var id = !string.IsNullOrEmpty(input.Id?.Trim()); diff --git a/Api/Ewide.Core/Controller/AreaCodeController.cs b/Api/Ewide.Core/Controller/AreaCodeController.cs index 32b93f1..57908a7 100644 --- a/Api/Ewide.Core/Controller/AreaCodeController.cs +++ b/Api/Ewide.Core/Controller/AreaCodeController.cs @@ -19,8 +19,8 @@ namespace Ewide.Core.Controller public class AreaCodeController : IDynamicApiController { private readonly IAreaCodeService _areaCodeService; - private readonly ISysUserService _sysUserService; private readonly IUserManager _userManager; + private readonly ISysUserService _sysUserService; public AreaCodeController(IAreaCodeService areaCodeService, IUserManager userManager, ISysUserService sysUserService) { _areaCodeService = areaCodeService; @@ -88,8 +88,7 @@ namespace Ewide.Core.Controller List areaCodeList = null; if (!_userManager.SuperAdmin) { - var orgIdList = await _sysUserService.GetUserDataScopeIdList(_userManager.UserId); - areaCodeList = await _areaCodeService.GetAreaCodeListByOrgId(orgIdList); + areaCodeList = await _userManager.GetUserAllAreaList(); } return await _areaCodeService.GetAreaCodeTree(level, areaCodeList); } diff --git a/Api/Ewide.Core/Entity/SysNotice.cs b/Api/Ewide.Core/Entity/SysNotice.cs index 75e3d58..b7e6e80 100644 --- a/Api/Ewide.Core/Entity/SysNotice.cs +++ b/Api/Ewide.Core/Entity/SysNotice.cs @@ -59,13 +59,13 @@ namespace Ewide.Core /// 发布时间 /// [Comment("发布时间")] - public DateTime PublicTime { get; set; } + public DateTime? PublicTime { get; set; } /// /// 撤回时间 /// [Comment("撤回时间")] - public DateTime CancelTime { get; set; } + public DateTime? CancelTime { get; set; } /// /// 状态(字典 0草稿 1发布 2撤回 3删除) diff --git a/Api/Ewide.Core/Entity/SysNoticeUser.cs b/Api/Ewide.Core/Entity/SysNoticeUser.cs index 84b6b4e..0f85e54 100644 --- a/Api/Ewide.Core/Entity/SysNoticeUser.cs +++ b/Api/Ewide.Core/Entity/SysNoticeUser.cs @@ -11,7 +11,7 @@ namespace Ewide.Core /// [Table("sys_notice_user")] [Comment("通知公告用户表")] - public class SysNoticeUser : IEntity, IEntityTypeBuilder + public class SysNoticeUser : DEntityBase { /// /// 通知公告Id @@ -31,7 +31,7 @@ namespace Ewide.Core /// 阅读时间 /// [Comment("阅读时间")] - public DateTime ReadTime { get; set; } + public DateTime? ReadTime { get; set; } /// /// 状态(字典 0未读 1已读) diff --git a/Api/Ewide.Core/Entity/SysOrg.cs b/Api/Ewide.Core/Entity/SysOrg.cs index 078bc89..f0a92c5 100644 --- a/Api/Ewide.Core/Entity/SysOrg.cs +++ b/Api/Ewide.Core/Entity/SysOrg.cs @@ -1,5 +1,6 @@ using Microsoft.EntityFrameworkCore; using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using System.Xml.Serialization; @@ -29,6 +30,7 @@ namespace Ewide.Core /// 名称 /// [Comment("名称")] + [MaxLength(20)] public string Name { get; set; } /// diff --git a/Api/Ewide.Core/Ewide.Core.xml b/Api/Ewide.Core/Ewide.Core.xml index daef599..8e83b57 100644 --- a/Api/Ewide.Core/Ewide.Core.xml +++ b/Api/Ewide.Core/Ewide.Core.xml @@ -2834,6 +2834,12 @@ + + + 获取用户可以访问的区域权限 + + + OAuth配置---此结构方便拓展 @@ -5829,12 +5835,6 @@ - - - 获取用户数据范围(机构Id集合) - - - 职位参数 @@ -6156,14 +6156,6 @@ - - - 根据角色Id集合获取数据范围Id集合 - - - - - 根据角色Id获取角色名称 @@ -6185,6 +6177,13 @@ + + + 获取角色拥有区域Id集合 + + + + 租户参数 @@ -6946,13 +6945,6 @@ - - - 获取用户的数据范围Id集合 - - - - 根据机构Id集合删除对应的用户-数据范围关联信息 @@ -6986,14 +6978,6 @@ - - - 获取用户所有角色的数据范围(组织机构Id集合) - - - - - 根据角色Id删除对应的用户-角色表关联信息 @@ -7147,19 +7131,6 @@ - - - 获取用户数据范围(机构Id集合)并缓存 - - - - - - - 获取用户数据范围(机构Id集合) - - - 检查普通用户数据范围 diff --git a/Api/Ewide.Core/Manager/IUserManager.cs b/Api/Ewide.Core/Manager/IUserManager.cs index a9c9f42..e213bf9 100644 --- a/Api/Ewide.Core/Manager/IUserManager.cs +++ b/Api/Ewide.Core/Manager/IUserManager.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using System.Linq; using System.Threading.Tasks; namespace Ewide.Core @@ -21,5 +22,23 @@ namespace Ewide.Core Task> GetUserRoleIdList(); Task> GetUserRoleList(string userId); Task> GetUserRoleList(); + Task> GetLoginPermissionList(); + //获取用户额外授权的组织信息 + Task> GetUserExtraDataScopeList(); + Task> GetUserExtraDataScopeList(string userId); + //获取用户额外授权的区域信息 + Task> GetUserExtraAreaScopeList(); + Task> GetUserExtraAreaScopeList(string userId); + //获取角色额外授权的组织信息 + Task> GetRoleExtraDataScopeList(string roleId); + //获取角色额外授权的区域信息 + Task> GetRoleExtraAreaScopeList(string roleId); + Task> GetUserAllAreaList(); + Task> GetUserAllAreaList(string userId); + + //获取用户的授权范围 + Task> GetUserAllDataScopeList(); + Task> GetUserAllDataScopeList(string userId); + } } \ No newline at end of file diff --git a/Api/Ewide.Core/Manager/UserManager.cs b/Api/Ewide.Core/Manager/UserManager.cs index 6512364..a2ec008 100644 --- a/Api/Ewide.Core/Manager/UserManager.cs +++ b/Api/Ewide.Core/Manager/UserManager.cs @@ -6,6 +6,9 @@ using System.Linq; using System.Threading.Tasks; using Microsoft.EntityFrameworkCore; using System.Collections.Generic; +using Ewide.Core.Service; +using System; +using System.Data; namespace Ewide.Core { @@ -19,7 +22,15 @@ namespace Ewide.Core private readonly IRepository _sysUserRoleRep; private readonly IRepository _sysEmpRep; // 员工表 private readonly IRepository _sysOrgRep; + private readonly IRepository _sysRoleMenuRep; + private readonly IRepository _sysMenuRep; + private readonly IRepository _sysUserDataScopeRep; + private readonly IRepository _sysUserAreaRep; + private readonly IRepository _sysRoleDataRep; + private readonly IRepository _sysRoleAreaRep; + private readonly IRepository _sysAreaCodeRep; private readonly IHttpContextAccessor _httpContextAccessor; + private readonly ISysCacheService _sysCacheService; public string UserId { @@ -47,12 +58,16 @@ namespace Ewide.Core } public UserManager( + IHttpContextAccessor httpContextAccessor, + ISysCacheService sysCacheService, IRepository sysUserRep, IRepository sysRoleRep, IRepository sysUserRoleRep, IRepository sysEmpRep, IRepository sysOrgRep, - IHttpContextAccessor httpContextAccessor) + IRepository sysRoleMenuRep, + IRepository sysMenuRep, + IRepository sysUserDataScopeRep, IRepository sysUserAreaRep, IRepository sysRoleDataRep, IRepository sysRoleAreaRep, IRepository sysAreaCodeRep) { _sysUserRep = sysUserRep; _sysRoleRep = sysRoleRep; @@ -60,6 +75,14 @@ namespace Ewide.Core _sysEmpRep = sysEmpRep; _sysOrgRep = sysOrgRep; _httpContextAccessor = httpContextAccessor; + _sysCacheService = sysCacheService; + _sysRoleMenuRep = sysRoleMenuRep; + _sysMenuRep = sysMenuRep; + _sysUserDataScopeRep = sysUserDataScopeRep; + _sysUserAreaRep = sysUserAreaRep; + _sysRoleDataRep = sysRoleDataRep; + _sysRoleAreaRep = sysRoleAreaRep; + _sysAreaCodeRep = sysAreaCodeRep; } /// @@ -163,5 +186,194 @@ namespace Ewide.Core { return await GetUserRoleList(UserId); } + + public async Task> GetLoginPermissionList() + { + var permissions = await _sysCacheService.GetPermission(UserId); // 先从缓存里面读取 + if (permissions == null || permissions.Count < 1) + { + var roleIdList = await GetUserRoleIdList(); + var menuIdList = await _sysRoleMenuRep.DetachedEntities + .Where(u => roleIdList.Contains(u.SysRoleId)) + .Select(u => u.SysMenuId).ToListAsync(); + permissions = await _sysMenuRep.DetachedEntities.Where(u => menuIdList.Contains(u.Id)) + .Where(u => u.Type == (int)MenuType.FUNCTION) + .Where(u => u.Status == (int)CommonStatus.ENABLE) + .Select(u => u.Permission).ToListAsync(); +#if DEBUG +#else + await _sysCacheService.SetPermission(userId, permissions); // 缓存结果 +#endif + } + return permissions; + } + + public Task> GetUserExtraDataScopeList() + { + return GetUserExtraDataScopeList(UserId); + } + + public async Task> GetUserExtraDataScopeList(string userId) + { + return await _sysUserDataScopeRep.DetachedEntities + .Where(u => u.SysUserId == userId) + .Select(u => u.SysOrgId).ToListAsync(); + } + + public Task> GetUserExtraAreaScopeList() + { + return GetUserExtraAreaScopeList(UserId); + } + + public async Task> GetUserExtraAreaScopeList(string userId) + { + return await _sysUserAreaRep.DetachedEntities.Where(u => u.SysUserId == userId).Select(u => u.AreaCode).ToListAsync(); + } + + public Task> GetRoleExtraDataScopeList(string roleId) + { + return _sysRoleDataRep.DetachedEntities.Where(u => u.SysRoleId == roleId).Select(u => u.SysOrgId).ToListAsync(); + } + + public Task> GetRoleExtraAreaScopeList(string roleId) + { + return _sysRoleAreaRep.DetachedEntities.Where(u => u.SysRoleId == roleId).Select(u => u.AreaCode).ToListAsync(); + } + public Task> GetUserAllDataScopeList() + { + return GetUserAllDataScopeList(UserId); + } + public async Task> GetDataScopeListByDataScopeType(int dataScopeType, string orgId) + { + var orgIdList = new List(); + if (string.IsNullOrEmpty(orgId)) + return orgIdList; + + // 如果是范围类型是全部数据,则获取当前所有的组织架构Id + if (dataScopeType == (int)DataScopeType.ALL) + { + orgIdList = await _sysOrgRep.DetachedEntities.Where(u => u.Status == (int)CommonStatus.ENABLE).Select(u => u.Id).ToListAsync(); + } + // 如果范围类型是本部门及以下部门,则查询本节点和子节点集合,包含本节点 + else if (dataScopeType == (int)DataScopeType.DEPT_WITH_CHILD) + { + orgIdList = await _sysOrgRep.DetachedEntities + .Where(u => u.Pids.Contains(orgId)) + .Select(u => u.Id).ToListAsync(); + orgIdList.Add(orgId); + } + // 如果数据范围是本部门,不含子节点,则直接返回本部门 + else if (dataScopeType == (int)DataScopeType.DEPT) + { + orgIdList.Add(orgId); + } + return orgIdList; + } + + public async Task> GetUserAllDataScopeList(string userId) + { + var dataScopes = await _sysCacheService.GetDataScope(userId); // 先从缓存里面读取 + if (dataScopes != null && dataScopes.Count > 0) + { + return dataScopes; + } + var orgId = await _sysEmpRep.DetachedEntities.Where(e => e.Id == userId).Select(u => u.OrgId).SingleAsync(); + var orgAreaCode = await _sysOrgRep.Where(o => o.Id == orgId).Select(o => o.AreaCode).SingleAsync(); + //获取用户额外授权数据 + var userExtraDataScope = await (from org in _sysOrgRep.DetachedEntities + join ua in _sysUserAreaRep.DetachedEntities on org.AreaCode equals ua.AreaCode + where ua.SysUserId == userId + select org.Id).Concat(from ud in _sysUserDataScopeRep.DetachedEntities + where ud.SysUserId == userId + select ud.SysOrgId).ToListAsync(); + //获取用户所有角色 + //获取其他类型中最大的角色 + var areaScopeTypes = new[] { DataScopeType.AREA, DataScopeType.AREA_WITH_CHILD }.Cast(); + var strongerDataScopeType = (int)DataScopeType.SELF; + var strongerAreaType = (int)DataScopeType.SELF; + + //获取区域相关的角色类型中最大的区域角色 + var customDataScopeRoleIdList = new List(); + var roleList = from role in _sysRoleRep.DetachedEntities + join ur in _sysUserRoleRep.DetachedEntities on role.Id equals ur.SysRoleId + where ur.SysUserId == userId + select role; + foreach (var role in await roleList.ToListAsync()) + { + if (role.DataScopeType == (int)DataScopeType.DEFINE) + customDataScopeRoleIdList.Add(role.Id); + if ((role.DataScopeType == (int)DataScopeType.AREA || role.DataScopeType == (int)DataScopeType.AREA_WITH_CHILD) && strongerAreaType < role.DataScopeType) + { + strongerAreaType = role.DataScopeType; + } + else if (role.DataScopeType <= strongerDataScopeType) + strongerDataScopeType = role.DataScopeType; + } + // 自定义数据范围的角色对应的数据范围 + var roleDataScopeIdList = await _sysRoleDataRep.DetachedEntities.Where(rd => customDataScopeRoleIdList.Contains(rd.SysRoleId)).Select(rd => orgId).ToListAsync(); + + // 角色中拥有最大数据范围类型的数据范围 + var dataScopeIdList = await GetDataScopeListByDataScopeType(strongerDataScopeType, orgId); + //角色区域数据范围 + var areaOrgIdList = new List(); + if (strongerAreaType == (int)DataScopeType.AREA_WITH_CHILD) + areaOrgIdList = await _sysOrgRep.DetachedEntities.Where(p => p.AreaCode.StartsWith(orgAreaCode)).Select(p => p.Id).ToListAsync(); + if (strongerAreaType == (int)DataScopeType.AREA) + areaOrgIdList = await _sysOrgRep.DetachedEntities.Where(p => p.AreaCode == orgAreaCode).Select(p => p.Id).ToListAsync(); + //获取 + var scope = userExtraDataScope.Concat(roleDataScopeIdList).Concat(dataScopeIdList).Concat(areaOrgIdList).Distinct().ToList(); +#if DEBUG +#else + await _sysCacheService.SetDataScope(userId, scope); +#endif + return scope; + } + /// + /// 获取用户可以访问的区域权限 + /// + /// + public Task> GetUserAllAreaList() + { + return GetUserAllAreaList(UserId); + } + + public async Task> GetUserAllAreaList(string userId) + { + var orgId = await _sysEmpRep.DetachedEntities.Where(e => e.Id == userId).Select(u => u.OrgId).SingleAsync(); + var orgAreaCode = await _sysOrgRep.Where(o => o.Id == orgId).Select(o => o.AreaCode).SingleAsync(); + //本部门 或者 本部门区域 树结构只显示本级区域 + //本部门及以下 或者 本部门区域及以下 树结构显示本级和以下所有区域 + var extraUserArea = await GetUserExtraAreaScopeList(userId); + var roles = await _sysUserRoleRep.DetachedEntities.Include(ur => ur.SysRole).Where(ur => ur.SysUserId == userId).Select(ur => ur.SysRole).ToListAsync(); + var extraRoleArea = await _sysRoleAreaRep.DetachedEntities.Where(ra => roles.Where(r => r.DataScopeType == (int)DataScopeType.DEFINE).Select(r => r.Id).Contains(ra.SysRoleId)).Select(ra => ra.AreaCode).ToListAsync(); + var roleTypeArea = await GetUserDataScopeTypeAreaList(orgAreaCode, roles.Select(r => r.DataScopeType).ToList()); + return extraRoleArea.Concat(extraUserArea).Concat(roleTypeArea).Distinct().ToList(); + } + private async Task> GetUserDataScopeTypeAreaList(string orgAreaCode, List roleDataTypeList) + { + var areaCode = await GetCachedAreaCode(); + if (roleDataTypeList.Any(r => r == (int)DataScopeType.ALL)) + { + return areaCode.Select(a => a.Code).ToList(); + } + if (roleDataTypeList.Any(r => new[] { DataScopeType.DEPT_WITH_CHILD, DataScopeType.AREA_WITH_CHILD }.Cast().Contains(r))) + { + return areaCode.Where(a => a.Code.StartsWith(orgAreaCode)).Select(a => a.Code).ToList(); + } + if (roleDataTypeList.Any(r => new[] { DataScopeType.DEPT, DataScopeType.AREA }.Cast().Contains(r))) + { + return areaCode.Where(a => a.Code == orgAreaCode).Select(a => a.Code).ToList(); + } + return new List(); + } + private async Task> GetCachedAreaCode() + { + var areaCodeList = await _sysCacheService.GetAreaCode(); + if (areaCodeList == null || areaCodeList.Count < 1) + { + areaCodeList = await _sysAreaCodeRep.DetachedEntities.ToListAsync(); + } + return areaCodeList; + } } } \ No newline at end of file diff --git a/Api/Ewide.Core/Service/Auth/AuthService.cs b/Api/Ewide.Core/Service/Auth/AuthService.cs index fba2662..0571c5f 100644 --- a/Api/Ewide.Core/Service/Auth/AuthService.cs +++ b/Api/Ewide.Core/Service/Auth/AuthService.cs @@ -169,7 +169,7 @@ namespace Ewide.Core.Service loginOutput.Permissions = await _sysMenuService.GetLoginPermissionList(userId); // 数据范围信息(机构Id集合) - loginOutput.DataScopes = await _sysUserService.GetUserDataScopeIdList(userId); + loginOutput.DataScopes = await _userManager.GetUserAllDataScopeList(); // 具备应用信息(多系统,默认激活一个,可根据系统切换菜单),返回的结果中第一个为激活的系统 loginOutput.Apps = await _sysAppService.GetLoginApps(userId); diff --git a/Api/Ewide.Core/Service/Notice/Dto/NoticeBase.cs b/Api/Ewide.Core/Service/Notice/Dto/NoticeBase.cs index e63b789..48e1985 100644 --- a/Api/Ewide.Core/Service/Notice/Dto/NoticeBase.cs +++ b/Api/Ewide.Core/Service/Notice/Dto/NoticeBase.cs @@ -25,7 +25,7 @@ namespace Ewide.Core.Service /// /// 发布人Id /// - public long PublicUserId { get; set; } + public string PublicUserId { get; set; } /// /// 发布人姓名 @@ -35,7 +35,7 @@ namespace Ewide.Core.Service /// /// 发布机构Id /// - public long PublicOrgId { get; set; } + public string PublicOrgId { get; set; } /// /// 发布机构名称 diff --git a/Api/Ewide.Core/Service/Notice/Dto/NoticeDetailOutput.cs b/Api/Ewide.Core/Service/Notice/Dto/NoticeDetailOutput.cs index 1bee47c..032e9ac 100644 --- a/Api/Ewide.Core/Service/Notice/Dto/NoticeDetailOutput.cs +++ b/Api/Ewide.Core/Service/Notice/Dto/NoticeDetailOutput.cs @@ -39,6 +39,6 @@ namespace Ewide.Core.Service /// /// 阅读时间 /// - public DateTime ReadTime { get; set; } + public DateTime? ReadTime { get; set; } } } diff --git a/Api/Ewide.Core/Service/Notice/SysNoticeService.cs b/Api/Ewide.Core/Service/Notice/SysNoticeService.cs index 13809e5..26e20ad 100644 --- a/Api/Ewide.Core/Service/Notice/SysNoticeService.cs +++ b/Api/Ewide.Core/Service/Notice/SysNoticeService.cs @@ -61,22 +61,26 @@ namespace Ewide.Core.Service.Notice /// /// [HttpPost("/sysNotice/add")] + [UnitOfWork] public async Task AddNotice(AddNoticeInput input) { + _sysNoticeRep.EnsureTransaction(); if (input.Status != (int)NoticeStatus.DRAFT && input.Status != (int)NoticeStatus.PUBLIC) throw Oops.Oh(ErrorCode.D7000); var notice = input.Adapt(); + var id = System.Guid.NewGuid().ToString().ToLower(); + notice.Id = id; await UpdatePublicInfo(notice); // 如果是发布,则设置发布时间 if (input.Status == (int)NoticeStatus.PUBLIC) notice.PublicTime = DateTime.Now; - var newItem = await notice.InsertNowAsync(); + var newItem = await notice.InsertAsync(); // 通知到的人 var noticeUserIdList = input.NoticeUserIdList; var noticeUserStatus = (int)NoticeUserStatus.UNREAD; - await _sysNoticeUserService.Add(newItem.Entity.Id, noticeUserIdList, noticeUserStatus); + await _sysNoticeUserService.Add(id, noticeUserIdList, noticeUserStatus); } /// @@ -161,7 +165,11 @@ namespace Ewide.Core.Service.Notice await _sysNoticeUserService.Read(notice.Id, _userManager.UserId, (int)NoticeUserStatus.READ); return noticeResult; } - + [HttpGet("/sysNotice/detailById")] + public async Task GetNotice(string id) + { + return await _sysNoticeRep.FirstOrDefaultAsync(u => u.Id == id); + } /// /// 修改通知公告状态 /// diff --git a/Api/Ewide.Core/Service/Notice/SysNoticeUserService.cs b/Api/Ewide.Core/Service/Notice/SysNoticeUserService.cs index 5e86d47..845a8e3 100644 --- a/Api/Ewide.Core/Service/Notice/SysNoticeUserService.cs +++ b/Api/Ewide.Core/Service/Notice/SysNoticeUserService.cs @@ -1,9 +1,12 @@ using Furion.DatabaseAccessor; using Furion.DatabaseAccessor.Extensions; using Furion.DependencyInjection; +using Furion.DynamicApiController; +using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; using System; using System.Collections.Generic; +using System.Linq; using System.Threading.Tasks; namespace Ewide.Core.Service.Notice @@ -11,13 +14,17 @@ namespace Ewide.Core.Service.Notice /// /// 通知公告用户 /// - public class SysNoticeUserService : ISysNoticeUserService, ITransient + [ApiDescriptionSettings(Name = "NoticeUser", Order = 100)] + public class SysNoticeUserService : ISysNoticeUserService, IDynamicApiController, ITransient { private readonly IRepository _sysNoticeUserRep; // 通知公告用户表仓储 - - public SysNoticeUserService(IRepository sysNoticeUserRep) + private readonly IUserManager _userManager; + private readonly IRepository _sysNoticeRep; + public SysNoticeUserService(IRepository sysNoticeUserRep, IUserManager userManager, IRepository sysNoticeRep) { _sysNoticeUserRep = sysNoticeUserRep; + _userManager = userManager; + _sysNoticeRep = sysNoticeRep; } /// @@ -27,20 +34,32 @@ namespace Ewide.Core.Service.Notice /// /// /// - public Task Add(string noticeId, List noticeUserIdList, int noticeUserStatus) + + public async Task Add(string noticeId, List noticeUserIdList, int noticeUserStatus) { - noticeUserIdList.ForEach(u => + foreach (var u in noticeUserIdList) { - new SysNoticeUser + await new SysNoticeUser { + Id = Guid.NewGuid().ToString(), NoticeId = noticeId, UserId = u, ReadStatus = noticeUserStatus }.InsertAsync(); - }); - return Task.CompletedTask; + } } + [HttpGet("/NoticeUser/getCount")] + public async Task GetCount() + { + return await _sysNoticeUserRep.Where(u => u.UserId == _userManager.UserId && u.ReadStatus == (int)NoticeUserStatus.UNREAD).CountAsync(); + } + [HttpGet("/NoticeUser/GetNoticeInfo")] + public async Task> GetNoticeInfo() + { + var noticeIdList = await _sysNoticeUserRep.Where(u => u.UserId == _userManager.UserId && u.ReadStatus == (int)NoticeUserStatus.UNREAD).Select(p => p.NoticeId).ToListAsync(); + return await _sysNoticeRep.Where(s => noticeIdList.Contains(s.Id)).ToListAsync(); + } /// /// 更新 /// diff --git a/Api/Ewide.Core/Service/Org/ISysOrgService.cs b/Api/Ewide.Core/Service/Org/ISysOrgService.cs index e77023c..3917eb7 100644 --- a/Api/Ewide.Core/Service/Org/ISysOrgService.cs +++ b/Api/Ewide.Core/Service/Org/ISysOrgService.cs @@ -15,7 +15,6 @@ namespace Ewide.Core.Service Task GetOrgTree([FromQuery] OrgInput input); Task QueryOrgPageList([FromQuery] PageOrgInput input); Task UpdateOrg(UpdateOrgInput input); - Task> GetUserDataScopeIdList(); /// /// 根据区域信息获取单位id /// diff --git a/Api/Ewide.Core/Service/Org/SysOrgService.cs b/Api/Ewide.Core/Service/Org/SysOrgService.cs index da61185..7c15c46 100644 --- a/Api/Ewide.Core/Service/Org/SysOrgService.cs +++ b/Api/Ewide.Core/Service/Org/SysOrgService.cs @@ -51,7 +51,7 @@ namespace Ewide.Core.Service [HttpPost("/sysOrg/page")] public async Task QueryOrgPageList([FromBody] PageOrgInput input) { - var dataScopeList = GetDataScopeList(await GetUserDataScopeIdList()); + var dataScopeList = GetDataScopeList(await _userManager.GetUserAllDataScopeList()); var name = !string.IsNullOrEmpty(input.Name?.Trim()); var id = !string.IsNullOrEmpty(input.Id?.Trim()); @@ -107,7 +107,7 @@ namespace Ewide.Core.Service [HttpGet("/sysOrg/list")] public async Task> GetOrgList([FromQuery] OrgInput input) { - var dataScopeList = GetDataScopeList(await GetUserDataScopeIdList()); + var dataScopeList = GetDataScopeList(await _userManager.GetUserAllDataScopeList()); var pId = !string.IsNullOrEmpty(input.Pid?.Trim()); var orgs = await _sysOrgRep.DetachedEntities @@ -136,7 +136,7 @@ namespace Ewide.Core.Service if (input.Pid != "0" && !string.IsNullOrEmpty(input.Pid)) { // 新增组织机构的父机构不在自己的数据范围内 - var dataScopes = await GetUserDataScopeIdList(); + var dataScopes = await _userManager.GetUserAllDataScopeList(); if (dataScopes.Count < 1 || !dataScopes.Contains(input.Pid)) throw Oops.Oh(ErrorCode.D2003); } @@ -179,7 +179,7 @@ namespace Ewide.Core.Service var sysOrg = await _sysOrgRep.DetachedEntities.FirstOrDefaultAsync(u => u.Id == input.Id); // 检测数据范围能不能操作这个机构 - var dataScopes = await GetUserDataScopeIdList(); + var dataScopes = await _userManager.GetUserAllDataScopeList(); if (!_userManager.SuperAdmin && (dataScopes.Count < 1 || !dataScopes.Contains(sysOrg.Id))) throw Oops.Oh(ErrorCode.D2003); @@ -233,7 +233,7 @@ namespace Ewide.Core.Service var sysOrg = await _sysOrgRep.DetachedEntities.FirstOrDefaultAsync(u => u.Id == input.Id); // 检测数据范围能不能操作这个机构 - var dataScopes = await GetUserDataScopeIdList(); + var dataScopes = await _userManager.GetUserAllDataScopeList(); if (!_userManager.SuperAdmin && (dataScopes.Count < 1 || !dataScopes.Contains(sysOrg.Id))) throw Oops.Oh(ErrorCode.D2003); @@ -293,7 +293,7 @@ namespace Ewide.Core.Service var dataScopeList = new List(); if (!_userManager.SuperAdmin) { - var dataScopes = await GetUserDataScopeIdList(); + var dataScopes = await _userManager.GetUserAllDataScopeList(); if (dataScopes.Count < 1) return dataScopeList; dataScopeList = GetDataScopeList(dataScopes); @@ -344,17 +344,6 @@ namespace Ewide.Core.Service } return orgIdList; } - - /// - /// 获取用户数据范围(机构Id集合) - /// - /// - [NonAction] - public async Task> GetUserDataScopeIdList() - { - return await App.GetService().GetUserDataScopeIdList(); - } - public async Task> GetAreaDataScopeIdList(int dataScopeType, string orgId) { var org = await _sysOrgRep.FirstOrDefaultAsync(o => o.Id == orgId); diff --git a/Api/Ewide.Core/Service/Role/ISysRoleService.cs b/Api/Ewide.Core/Service/Role/ISysRoleService.cs index 828a2e4..c05d5e2 100644 --- a/Api/Ewide.Core/Service/Role/ISysRoleService.cs +++ b/Api/Ewide.Core/Service/Role/ISysRoleService.cs @@ -12,12 +12,12 @@ namespace Ewide.Core.Service Task GetRoleDropDown(); Task GetRoleInfo([FromQuery] QueryRoleInput input); Task GetRoleList([FromQuery] RoleInput input); - Task> GetUserDataScopeIdList(List roleIdList, string orgId); Task> GetUserRoleList(string userId); Task GrantData(GrantRoleDataInput input); Task GrantMenu(GrantRoleMenuInput input); Task> OwnData([FromQuery] QueryRoleInput input); Task> OwnMenu([FromQuery] QueryRoleInput input); + Task> OwnArea([FromQuery] QueryRoleInput input); Task QueryRolePageList([FromQuery] RoleInput input); Task UpdateRole(UpdateRoleInput input); } diff --git a/Api/Ewide.Core/Service/Role/SysRoleService.cs b/Api/Ewide.Core/Service/Role/SysRoleService.cs index 9646c1a..9df38fd 100644 --- a/Api/Ewide.Core/Service/Role/SysRoleService.cs +++ b/Api/Ewide.Core/Service/Role/SysRoleService.cs @@ -218,7 +218,7 @@ namespace Ewide.Core.Service //如果授权的角色数据范围类型为自定义,则要判断授权的数据范围是否在自己的数据范围内 if ((int)DataScopeType.DEFINE == dataScopeType) { - var dataScopes = await _sysOrgService.GetUserDataScopeIdList(); + var dataScopes = await _userManager.GetUserAllDataScopeList(); var grantOrgIdList = input.GrantOrgIdList; //要授权的数据范围列表 if (grantOrgIdList.Count > 0) { @@ -233,46 +233,6 @@ namespace Ewide.Core.Service await _sysRoleDataScopeService.GrantDataScope(input); } - /// - /// 根据角色Id集合获取数据范围Id集合 - /// - /// - /// - /// - [NonAction] - public async Task> GetUserDataScopeIdList(List roleIdList, string orgId) - { - // 定义角色中最大数据范围的类型,目前按最大范围策略来,如果你同时拥有ALL和SELF的权限,最后按ALL返回 - int strongerDataScopeType = (int)DataScopeType.SELF; - int strongerAreaType = (int)DataScopeType.SELF; - - var customDataScopeRoleIdList = new List(); - if (roleIdList != null && roleIdList.Count > 0) - { - var roles = await _sysRoleRep.DetachedEntities.Where(u => roleIdList.Contains(u.Id)).ToListAsync(); - roles.ForEach(u => - { - if (u.DataScopeType == (int)DataScopeType.DEFINE) - customDataScopeRoleIdList.Add(u.Id); - if ((u.DataScopeType == (int)DataScopeType.AREA || u.DataScopeType == (int)DataScopeType.AREA_WITH_CHILD) && strongerAreaType < u.DataScopeType) - { - strongerAreaType = u.DataScopeType; - } - else if (u.DataScopeType <= strongerDataScopeType) - strongerDataScopeType = u.DataScopeType; - }); - } - - // 自定义数据范围的角色对应的数据范围 - var roleDataScopeIdList = await _sysRoleDataScopeService.GetRoleDataScopeIdList(customDataScopeRoleIdList); - - // 角色中拥有最大数据范围类型的数据范围 - var dataScopeIdList = await _sysOrgService.GetDataScopeListByDataScopeType(strongerDataScopeType, orgId); - //角色区域数据范围 - var areaOrgIdList = await _sysOrgService.GetAreaDataScopeIdList(strongerAreaType, orgId); - return roleDataScopeIdList.Concat(dataScopeIdList).Concat(areaOrgIdList).Distinct().ToList(); //并集 - } - /// /// 根据角色Id获取角色名称 /// @@ -306,7 +266,17 @@ namespace Ewide.Core.Service [HttpGet("/sysRole/ownData")] public async Task> OwnData([FromQuery] QueryRoleInput input) { - return await _sysRoleDataScopeService.GetRoleDataScopeIdList(new List { input.Id }); + return await _userManager.GetRoleExtraDataScopeList(input.Id); + } + /// + /// 获取角色拥有区域Id集合 + /// + /// + /// + [HttpGet("/sysRole/ownArea")] + public Task> OwnArea([FromQuery] QueryRoleInput input) + { + return _userManager.GetRoleExtraAreaScopeList(input.Id); } } } diff --git a/Api/Ewide.Core/Service/User/Dto/OrgUserInput.cs b/Api/Ewide.Core/Service/User/Dto/OrgUserInput.cs new file mode 100644 index 0000000..254cf96 --- /dev/null +++ b/Api/Ewide.Core/Service/User/Dto/OrgUserInput.cs @@ -0,0 +1,6 @@ +namespace Ewide.Core.Service +{ + public class OrgUserInput + { + } +} \ No newline at end of file diff --git a/Api/Ewide.Core/Service/User/Dto/OrgUserTreeNode.cs b/Api/Ewide.Core/Service/User/Dto/OrgUserTreeNode.cs new file mode 100644 index 0000000..fa429d0 --- /dev/null +++ b/Api/Ewide.Core/Service/User/Dto/OrgUserTreeNode.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Ewide.Core.Service.User.Dto +{ + public class OrgUserTreeNode : ITreeNode + { + public string Id { get; set; } + public string ParentId { get; set; } + public string Name { get; set; } + public int Type { get; set; } + public List Children { get; set; } + public string GetId() => Id; + public string GetPid() => ParentId; + public void SetChildren(IList children) + { + Children = (List)children; + } + } +} \ No newline at end of file diff --git a/Api/Ewide.Core/Service/User/ISysUserDataScopeService.cs b/Api/Ewide.Core/Service/User/ISysUserDataScopeService.cs index e311601..975ac65 100644 --- a/Api/Ewide.Core/Service/User/ISysUserDataScopeService.cs +++ b/Api/Ewide.Core/Service/User/ISysUserDataScopeService.cs @@ -7,7 +7,6 @@ namespace Ewide.Core.Service { Task DeleteUserDataScopeListByOrgIdList(List orgIdList); Task DeleteUserDataScopeListByUserId(string userId); - Task> GetUserDataScopeIdList(string userId); Task GrantData(UpdateUserInput input); } } \ No newline at end of file diff --git a/Api/Ewide.Core/Service/User/ISysUserRoleService.cs b/Api/Ewide.Core/Service/User/ISysUserRoleService.cs index 1c35421..203fce4 100644 --- a/Api/Ewide.Core/Service/User/ISysUserRoleService.cs +++ b/Api/Ewide.Core/Service/User/ISysUserRoleService.cs @@ -7,7 +7,6 @@ namespace Ewide.Core.Service { Task DeleteUserRoleListByRoleId(string roleId); Task DeleteUserRoleListByUserId(string userId); - Task> GetUserRoleDataScopeIdList(string userId, string orgId); Task> GetUserRoleIdList(string userId); Task GrantRole(UpdateUserInput input); } diff --git a/Api/Ewide.Core/Service/User/ISysUserService.cs b/Api/Ewide.Core/Service/User/ISysUserService.cs index a3bc80d..a021e77 100644 --- a/Api/Ewide.Core/Service/User/ISysUserService.cs +++ b/Api/Ewide.Core/Service/User/ISysUserService.cs @@ -1,4 +1,5 @@ -using Microsoft.AspNetCore.Mvc; +using Ewide.Core.Service.User.Dto; +using Microsoft.AspNetCore.Mvc; using System.Collections.Generic; using System.Threading.Tasks; @@ -12,9 +13,8 @@ namespace Ewide.Core.Service Task ExportUser([FromQuery] UserInput input); Task GetUser([FromQuery] QueryUserInput input); Task GetUserById(string userId); - Task> GetUserDataScopeIdList(); - Task> GetUserDataScopeIdList(string userId); Task GetUserOwnData([FromQuery] QueryUserInput input); + Task GetUserOwnArea([FromQuery] QueryUserInput input); Task GetUserOwnRole([FromQuery] QueryUserInput input); Task GetUserSelector([FromQuery] UserInput input); Task GrantUserData(UpdateUserInput input); @@ -29,5 +29,7 @@ namespace Ewide.Core.Service Task SendCode(Usermailphone input); Task CheckBindcode(Usermailphone input); + + Task GetOrgUserTree(OrgUserInput input); } } \ No newline at end of file diff --git a/Api/Ewide.Core/Service/User/SysUserDataScopeService.cs b/Api/Ewide.Core/Service/User/SysUserDataScopeService.cs index db02381..5742c62 100644 --- a/Api/Ewide.Core/Service/User/SysUserDataScopeService.cs +++ b/Api/Ewide.Core/Service/User/SysUserDataScopeService.cs @@ -63,26 +63,6 @@ namespace Ewide.Core.Service } - /// - /// 获取用户的数据范围Id集合 - /// - /// - /// - public async Task> GetUserDataScopeIdList(string userId) - { - var areaList = await _sysUserAreaRep.DetachedEntities.Where(u => u.SysUserId == userId).Select(u => u.AreaCode).ToListAsync(); - //用户自定义的区域权限所对应的全部组织机构id - List areaDataScopeIdList = new List(); - foreach (var areaNumberCode in areaList) - { - areaDataScopeIdList.AddRange(await _sysOrgRep.DetachedEntities.Where(p => p.AreaCode.StartsWith(areaNumberCode)).Select(p => p.Id).ToListAsync()); - } //用户自定义的组织权限 - var orgIdList = await _sysUserDataScopeRep.DetachedEntities - .Where(u => u.SysUserId == userId) - .Select(u => u.SysOrgId).ToListAsync(); - return areaDataScopeIdList.Concat(orgIdList).Distinct().ToList(); - } - /// /// 根据机构Id集合删除对应的用户-数据范围关联信息 /// diff --git a/Api/Ewide.Core/Service/User/SysUserRoleService.cs b/Api/Ewide.Core/Service/User/SysUserRoleService.cs index 4d34c90..a5a22f4 100644 --- a/Api/Ewide.Core/Service/User/SysUserRoleService.cs +++ b/Api/Ewide.Core/Service/User/SysUserRoleService.cs @@ -57,23 +57,6 @@ namespace Ewide.Core.Service }); } - /// - /// 获取用户所有角色的数据范围(组织机构Id集合) - /// - /// - /// - /// - public async Task> GetUserRoleDataScopeIdList(string userId, string orgId) - { - var roleIdList = await GetUserRoleIdList(userId); - - // 获取这些角色对应的数据范围 - if (roleIdList.Count > 0) - return await _sysRoleService.GetUserDataScopeIdList(roleIdList, orgId); - - return roleIdList; - } - /// /// 根据角色Id删除对应的用户-角色表关联信息 /// diff --git a/Api/Ewide.Core/Service/User/SysUserService.cs b/Api/Ewide.Core/Service/User/SysUserService.cs index f84661f..e32a508 100644 --- a/Api/Ewide.Core/Service/User/SysUserService.cs +++ b/Api/Ewide.Core/Service/User/SysUserService.cs @@ -1,4 +1,5 @@ using Ewide.Core.Service.Role; +using Ewide.Core.Service.User.Dto; using Ewide.Core.Util; using Furion.DatabaseAccessor; using Furion.DatabaseAccessor.Extensions; @@ -25,6 +26,8 @@ namespace Ewide.Core.Service public class SysUserService : ISysUserService, IDynamicApiController, ITransient { private readonly IRepository _sysUserRep; // 用户表仓储 + private readonly IRepository _sysOrgRep; + private readonly IRepository _sysEmpRep; private readonly IUserManager _userManager; private readonly ISysCacheService _sysCacheService; private readonly ISysEmpService _sysEmpService; @@ -34,6 +37,8 @@ namespace Ewide.Core.Service private readonly ISysUserAreaService _sysUserAreaService; public SysUserService(IRepository sysUserRep, + IRepository sysOrgRep, + IRepository sysEmpRep, IUserManager userManager, IMemoryCache memoryCache, ISysCacheService sysCacheService, @@ -43,6 +48,8 @@ namespace Ewide.Core.Service ISysUserAreaService sysUserAreaService) { _sysUserRep = sysUserRep; + _sysOrgRep = sysOrgRep; + _sysEmpRep = sysEmpRep; _userManager = userManager; _iMemoryCache = memoryCache; _sysCacheService = sysCacheService; @@ -51,7 +58,7 @@ namespace Ewide.Core.Service _sysUserRoleService = sysUserRoleService; _sysUserAreaService = sysUserAreaService; } - + /// /// 分页查询用户 /// @@ -65,11 +72,10 @@ namespace Ewide.Core.Service var pid = input.SysEmpParam.OrgId; var sysEmpRep = Db.GetRepository(); - var sysOrgRep = Db.GetRepository(); - var dataScopes = await GetUserDataScopeIdList(_userManager.UserId); + var dataScopes = await _userManager.GetUserAllDataScopeList(); var users = await _sysUserRep.DetachedEntities .Join(sysEmpRep.DetachedEntities, u => u.Id, e => e.Id, (u, e) => new { u, e }) - .Join(sysOrgRep.DetachedEntities, n => n.e.OrgId, o => o.Id, (n, o) => new { n, o }) + .Join(_sysOrgRep.DetachedEntities, n => n.e.OrgId, o => o.Id, (n, o) => new { n, o }) .Where(!string.IsNullOrEmpty(searchValue), x => (x.n.u.Account.Contains(input.SearchValue) || x.n.u.Name.Contains(input.SearchValue) || x.n.u.Phone.Contains(input.SearchValue))) @@ -170,9 +176,9 @@ namespace Ewide.Core.Service if (isExist) throw Oops.Oh(ErrorCode.D1003); var user = input.Adapt(); - await user.UpdateIncludeAsync(new[] { - nameof(SysUser.Account), - nameof(SysUser.NickName), + await user.UpdateIncludeAsync(new[] { + nameof(SysUser.Account), + nameof(SysUser.NickName), nameof(SysUser.Name), nameof(SysUser.Birthday), nameof(SysUser.Sex), @@ -304,7 +310,7 @@ namespace Ewide.Core.Service [HttpGet("/sysUser/ownData")] public async Task GetUserOwnData([FromQuery] QueryUserInput input) { - return await _sysUserDataScopeService.GetUserDataScopeIdList(input.Id); + return await _userManager.GetUserExtraDataScopeList(input.Id); } /// /// 获取用户拥有区域 @@ -314,7 +320,7 @@ namespace Ewide.Core.Service [HttpGet("/sysUser/ownArea")] public async Task GetUserOwnArea([FromQuery] QueryUserInput input) { - return await _sysUserAreaService.GetUserAreaIdList(input.Id); + return await _userManager.GetUserExtraAreaScopeList(input.Id); } /// /// 重置用户密码 @@ -405,47 +411,6 @@ namespace Ewide.Core.Service await user.InsertAsync(); } - /// - /// 获取用户数据范围(机构Id集合)并缓存 - /// - /// - /// - [NonAction] - [UnitOfWork] - public async Task> GetUserDataScopeIdList(string userId) - { - var dataScopes = await _sysCacheService.GetDataScope(userId); // 先从缓存里面读取 - if (dataScopes == null || dataScopes.Count < 1) - { - var orgId = await _sysEmpService.GetEmpOrgId(userId); - - // 获取该用户对应的数据范围集合 - var userDataScopeIdListForUser = await _sysUserDataScopeService.GetUserDataScopeIdList(userId); - - // 获取该用户的角色对应的数据范围集合 - var userDataScopeIdListForRole = await _sysUserRoleService.GetUserRoleDataScopeIdList(userId, orgId); - - dataScopes = userDataScopeIdListForUser.Concat(userDataScopeIdListForRole).Distinct().ToList(); // 并集 - -#if DEBUG -#else - await _sysCacheService.SetDataScope(userId, dataScopes); // 缓存结果 -#endif - } - return dataScopes; - } - - /// - /// 获取用户数据范围(机构Id集合) - /// - /// - [NonAction] - public async Task> GetUserDataScopeIdList() - { - var userId = _userManager.UserId; - var dataScopes = await GetUserDataScopeIdList(userId); - return dataScopes; - } /// /// 检查普通用户数据范围 @@ -457,7 +422,7 @@ namespace Ewide.Core.Service // 如果当前用户不是超级管理员,则进行数据范围校验 if (!_userManager.SuperAdmin) { - var dataScopes = await GetUserDataScopeIdList(_userManager.UserId); + var dataScopes = await _userManager.GetUserAllDataScopeList(); if (dataScopes == null || (userParam.SysEmpParam.OrgId != null && !dataScopes.Contains(userParam.SysEmpParam.OrgId))) throw Oops.Oh(ErrorCode.D1013); } @@ -476,7 +441,7 @@ namespace Ewide.Core.Service var Regex_Email = @"^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$"; CodeHelper ch = new CodeHelper(_iMemoryCache); //Type为1时,给原手机号发送验证码 - if(input.Type == 1) + if (input.Type == 1) { try { @@ -486,12 +451,12 @@ namespace Ewide.Core.Service { throw Oops.Oh(ErrorCode.D1018); } - + } //Type为2时,给原邮箱发送验证码 - else if(input.Type == 2) + else if (input.Type == 2) { - if(new Regex(@"^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$").IsMatch(_userManager.User.Email)) + if (new Regex(@"^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$").IsMatch(_userManager.User.Email)) { try { @@ -508,20 +473,20 @@ namespace Ewide.Core.Service else { //通过正则判断绑定类型 - if(new Regex(Regex_phone).IsMatch(input.Target)) + if (new Regex(Regex_phone).IsMatch(input.Target)) { try { - + ch.SendSmscode(input.Target, Smscode_Key); return true; } - catch(Exception e) + catch (Exception e) { throw Oops.Oh(ErrorCode.D1018); } } - if(new Regex(Regex_Email).IsMatch(input.Target)) + if (new Regex(Regex_Email).IsMatch(input.Target)) { try { @@ -550,7 +515,7 @@ namespace Ewide.Core.Service var Regex_Email = @"^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$"; var user = await _sysUserRep.FirstOrDefaultAsync(u => u.Id == _userManager.UserId); CodeHelper ch = new CodeHelper(_iMemoryCache); - if(input.Type == 1) + if (input.Type == 1) { if (ch.Checkcode(_userManager.User.Phone, input.Orgcode, Orgcode_Key)) { @@ -558,9 +523,9 @@ namespace Ewide.Core.Service }; throw Oops.Oh("验证错误"); } - else if(input.Type == 2) + else if (input.Type == 2) { - if(ch.Checkcode(_userManager.User.Email, input.Orgcode, Orgcode_Key)) + if (ch.Checkcode(_userManager.User.Email, input.Orgcode, Orgcode_Key)) { return true; } @@ -569,11 +534,11 @@ namespace Ewide.Core.Service else { //为第一次绑定 - if(string.IsNullOrEmpty(_userManager.User.Phone) && string.IsNullOrEmpty(_userManager.User.Email)) + if (string.IsNullOrEmpty(_userManager.User.Phone) && string.IsNullOrEmpty(_userManager.User.Email)) { - if(new Regex(Regex_phone).IsMatch(input.Target)) + if (new Regex(Regex_phone).IsMatch(input.Target)) { - if (ch.Checkcode(input.Target,input.Code, Smscode_Key)) + if (ch.Checkcode(input.Target, input.Code, Smscode_Key)) { try { @@ -590,7 +555,7 @@ namespace Ewide.Core.Service } throw Oops.Oh("验证码失效"); } - if(new Regex(Regex_Email).IsMatch(input.Target)) + if (new Regex(Regex_Email).IsMatch(input.Target)) { if (ch.Checkcode(input.Target, input.Code, Mailcode_Key)) { @@ -659,7 +624,19 @@ namespace Ewide.Core.Service } throw Oops.Oh("验证码失效"); } - } + } + } + + [HttpPost("/sysUser/GetOrgUserTree")] + public async Task GetOrgUserTree(OrgUserInput input) + { + var list = await (from u in _sysUserRep.DetachedEntities + join e in _sysEmpRep.DetachedEntities on u.Id equals e.Id + select new OrgUserTreeNode { Id = u.Id, ParentId = e.OrgId, Type = 1, Name = u.Name }).Union( + from o in _sysOrgRep.DetachedEntities + select new OrgUserTreeNode { Id = o.Id, ParentId = o.Pid, Type = 0, Name = o.Name }).ToListAsync(); + + return new TreeBuildUtil(new TreeBuildSetting { AddEmptyChildren = false }).DoTreeBuild(list); } } } diff --git a/Api/Ewide.Core/Util/TreeBuildUtil.cs b/Api/Ewide.Core/Util/TreeBuildUtil.cs index 155bb81..b199517 100644 --- a/Api/Ewide.Core/Util/TreeBuildUtil.cs +++ b/Api/Ewide.Core/Util/TreeBuildUtil.cs @@ -27,6 +27,10 @@ namespace Ewide.Core /// void SetChildren(IList children); } + public class TreeBuildSetting + { + public bool AddEmptyChildren { get; set; } = true; + } /// /// 递归工具类,用于遍历有父子关系的节点,例如菜单树,字典树等等 @@ -34,10 +38,15 @@ namespace Ewide.Core /// public class TreeBuildUtil where T : ITreeNode { + TreeBuildSetting _setting; + public TreeBuildUtil(TreeBuildSetting setting = null) + { + _setting = setting ?? new TreeBuildSetting(); + } /// /// 顶级节点的父节点Id(默认0) /// - private readonly List _rootParentIds = new List {string.Empty,Guid.Empty.ToString() }; + private readonly List _rootParentIds = new List { string.Empty, Guid.Empty.ToString() }; /// /// 构造树节点 @@ -59,7 +68,8 @@ namespace Ewide.Core if (results.Count < 1) { var ids = new List(); - nodes.ForEach(u => { + nodes.ForEach(u => + { ids.Add(u.GetId()); }); @@ -89,7 +99,10 @@ namespace Ewide.Core }); nodeSubLists.ForEach(u => BuildChildNodes(totalNodes, u, new List())); childNodeLists.AddRange(nodeSubLists); - node.SetChildren(childNodeLists); + if (childNodeLists.Count > 0 || _setting.AddEmptyChildren) + { + node.SetChildren(childNodeLists); + } } } } diff --git a/Api/Ewide.Web.Core/Handlers/JwtHandler.cs b/Api/Ewide.Web.Core/Handlers/JwtHandler.cs index 443afe6..2e0bf42 100644 --- a/Api/Ewide.Web.Core/Handlers/JwtHandler.cs +++ b/Api/Ewide.Web.Core/Handlers/JwtHandler.cs @@ -69,7 +69,7 @@ namespace Ewide.Web.Core if (defalutRoute.Contains(routeName)) return true; // 获取用户权限集合(按钮或API接口) - var permissionList = await App.GetService().GetLoginPermissionList(userManager.UserId); + var permissionList = await userManager.GetLoginPermissionList(); // 检查授权 return permissionList.Contains(routeName); diff --git a/Api/Ewide.sln b/Api/Ewide.sln index c48a622..bb1280d 100644 --- a/Api/Ewide.sln +++ b/Api/Ewide.sln @@ -15,7 +15,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ewide.Database.Migrations", EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ewide.Web.Entry", "Ewide.Web.Entry\Ewide.Web.Entry.csproj", "{9826E365-EEE9-4721-A738-B02AB64D47E5}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ewide.Test", "Ewide.Test\Ewide.Test.csproj", "{DECE4796-6B13-4607-9C27-C1FE093D4DC8}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ewide.Test", "Ewide.Test\Ewide.Test.csproj", "{DECE4796-6B13-4607-9C27-C1FE093D4DC8}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/web-react/package.json b/web-react/package.json index 3a99c4e..04d6bff 100644 --- a/web-react/package.json +++ b/web-react/package.json @@ -9,6 +9,7 @@ "@testing-library/user-event": "^12.1.10", "antd": "^4.16.2", "axios": "^0.21.1", + "braft-editor": "^2.3.9", "craco-less": "^1.17.1", "crypto-js": "^4.0.0", "echarts": "^5.1.2", diff --git a/web-react/src/common/api/requests/sys/noticeManage.js b/web-react/src/common/api/requests/sys/noticeManage.js index d04aeed..5b9e1fb 100644 --- a/web-react/src/common/api/requests/sys/noticeManage.js +++ b/web-react/src/common/api/requests/sys/noticeManage.js @@ -4,37 +4,44 @@ const urls = { */ sysNoticePage: ['/sysNotice/page', 'post'], - /** * 添加系统通知公告 */ sysNoticeAdd: ['/sysNotice/add', 'post'], - /** * 编辑系统通知公告 */ sysNoticeEdit: ['/sysNotice/edit', 'post'], - /** * 删除系统通知公告 */ sysNoticeDelete: ['/sysNotice/delete', 'post'], - /** * 通知公告详情 */ sysNoticeDetail: ['/sysNotice/detail', 'get'], - /** * 修改状态 */ sysNoticeChangeStatus: ['/sysNotice/changeStatus', 'post'], + /** + * 获取Notice总数 + */ + sysNoticeGetCount: ['/NoticeUser/getCount', 'get'], + /** + * 获取Notice详细 + */ + sysNoticeInfo: ['/NoticeUser/GetNoticeInfo', 'get'], + /** + * 获取Notice详细ByID + */ + sysNoticeShow: ['/sysNotice/detailById', 'get'], } -export default urls \ No newline at end of file +export default urls diff --git a/web-react/src/components/form/braft-editor/index.jsx b/web-react/src/components/form/braft-editor/index.jsx new file mode 100644 index 0000000..d6d09b0 --- /dev/null +++ b/web-react/src/components/form/braft-editor/index.jsx @@ -0,0 +1,56 @@ +import React, { Component } from 'react' +import { Col, Input, InputNumber, Row } from 'antd' +import { AntIcon } from 'components' +import BraftEditor from 'braft-editor' +import 'braft-editor/dist/index.css' + +export default class index extends Component { + state = { + editorState: BraftEditor.createEditorState(this.props.value), // 设置编辑器初始内容 + outputHTML: '

', + } + /** + * mount后回调 + */ + componentDidMount() { + // 3秒后更改编辑器内容 + setTimeout(this.setEditorContentAsync, 2000) + } + componentWillUnmount() { + this.isLivinig = false + } + handleChange = editorState => { + const outputHTML = editorState.toHTML() + + const { onChange } = this.props + + this.setState({ + editorState: editorState, + outputHTML, + }) + + onChange && onChange(outputHTML) + } + + setEditorContentAsync = () => { + const { placeholder, value, onChange } = this.props + this.isLivinig && + this.setState({ + editorState: BraftEditor.createEditorState(value), + }) + } + render() { + const { editorState, outputHTML } = this.state + + //localStorage.setItem('props', JSON.stringify(this.props)) + const controls = ['bold', 'italic', 'underline', 'text-color', 'separator', 'media'] + return ( + + ) + } +} diff --git a/web-react/src/components/index.js b/web-react/src/components/index.js index 6ed3ee0..a47dac5 100644 --- a/web-react/src/components/index.js +++ b/web-react/src/components/index.js @@ -12,4 +12,5 @@ export { default as PhotoPreview } from './photo-preview' export { default as QueryList } from './query-list' export { default as QueryTable } from './query-table' export { default as QueryTableActions } from './query-table-actions' -export { default as QueryTreeLayout } from './query-tree-layout' \ No newline at end of file +export { default as QueryTreeLayout } from './query-tree-layout' +export { default as BraftEditor } from './form/braft-editor' diff --git a/web-react/src/pages/system/notice/form.jsx b/web-react/src/pages/system/notice/form.jsx new file mode 100644 index 0000000..2635ba1 --- /dev/null +++ b/web-react/src/pages/system/notice/form.jsx @@ -0,0 +1,146 @@ +import React, { Component } from 'react' +import { Form, Spin, Input, Radio, Select } from 'antd' +import { api } from 'common/api' +import { AntIcon, BraftEditor } from 'components' +import getDictData from 'util/dic' +import { cloneDeep } from 'lodash' +// import BraftEditor from 'braft-editor' +// import 'braft-editor/dist/index.css' +const initialValues = {} + +export default class form extends Component { + state = { + // 加载状态 + loading: true, + options: { + userList: [], + }, + codes: { + noticeType: [], + noticeStatus: [], + }, + } + + // 表单实例 + form = React.createRef() + + // 初始化数据 + record = {} + + /** + * mount后回调 + */ + componentDidMount() { + this.props.created && this.props.created(this) + this.isLivinig = true + // 3秒后更改编辑器内容 + } + + /** + * 填充数据 + * 可以在设置this.record之后对其作出数据结构调整 + * [异步,必要] + * @param {*} params + */ + async fillData(params) { + //#region 从后端转换成前段所需格式,也可以在此处调用获取详细数据接口 + if (params.id) { + this.record = (await api.sysNoticeDetail({ id: params.id })).data + } + const { + data: { items: userList }, + } = await this.onLoadUser() + const codes = await getDictData('notice_status', 'notice_type') + //#endregion + this.form.current.setFieldsValue(this.record) + + this.setState({ + loading: false, + options: { + userList, + }, + codes, + }) + } + async onLoadUser() { + const data = await api.getUserPage() + return data + } + /** + * 获取数据 + * 可以对postData进行数据结构调整 + * [异步,必要] + * @returns + */ + async getData() { + const form = this.form.current + + const valid = await form.validateFields() + if (valid) { + const postData = form.getFieldsValue() + if (this.record) { + postData.id = this.record.id + } + //#region 从前段转换后端所需格式 + //#endregion + return postData + } + } + + //#region 自定义方法 + //#endregion + + render() { + const { options, codes } = this.state + + return ( +
+ }> +
+ + + + + + {codes.noticeType.map(item => ( + + {item.value} + + ))} + + + + + + + + + +
+
+
+ ) + } +} diff --git a/web-react/src/pages/system/notice/index.jsx b/web-react/src/pages/system/notice/index.jsx new file mode 100644 index 0000000..5a94045 --- /dev/null +++ b/web-react/src/pages/system/notice/index.jsx @@ -0,0 +1,277 @@ +import React, { Component } from 'react' +import { Button, Card, Form, Input, message as Message, Popconfirm, Select } from 'antd' +import { AntIcon, Auth, Container, ModalForm, QueryTable, QueryTableActions } from 'components' +import { api } from 'common/api' +import auth from 'components/authorized/handler' +import { isEqual } from 'lodash' +import getDictData from 'util/dic' +import { toCamelCase } from 'util/format' +import FormBody from './form' + +/** + * 注释段[\/**\/]为必须要改 + */ + +/** + * 配置页面所需接口函数 + */ +const apiAction = { + page: api.sysNoticePage, + add: api.sysNoticeAdd, + edit: api.sysNoticeEdit, + delete: api.sysNoticeDelete, + Detail: api.sysNoticeDetail, + Status: api.sysNoticeChangeStatus, +} + +/** + * 用于弹窗标题 + * [必要] + */ +const name = '啥玩意' + +/** + * 统一配置权限标识 + * [必要] + */ +const authName = '/**/' + +export default class index extends Component { + state = { + codes: { + noticeStatus: [], + noticeType: [], + }, + } + + // 表格实例 + table = React.createRef() + + // 新增窗口实例 + addForm = React.createRef() + // 编辑窗口实例 + editForm = React.createRef() + + columns = [ + { + title: '标题', + dataIndex: 'title', + }, + { + title: '类型', + dataIndex: 'type', + render: text => this.bindCodeValue(text, 'notice_type'), + }, + { + title: '状态', + dataIndex: 'status', + render: text => this.bindCodeValue(text, 'notice_status'), + }, + ] + + /** + * 构造函数,在渲染前动态添加操作字段等 + * @param {*} props + */ + constructor(props) { + super(props) + + const flag = auth({ [authName]: [['edit'], ['delete']] }) + + if (flag) { + this.columns.push({ + title: '操作', + width: 150, + dataIndex: 'actions', + render: (text, record) => ( + + + this.onOpen(this.editForm, record.id)}>编辑 + + + this.onDelete(record.id)} + > + 删除 + + + + ), + }) + } + } + + /** + * 阻止外部组件引发的渲染,提升性能 + * 可自行添加渲染条件 + * [必要] + * @param {*} props + * @param {*} state + * @returns + */ + shouldComponentUpdate(props, state) { + return !isEqual(this.state, state) + } + + /** + * 加载字典数据,之后开始加载表格数据 + * 如果必须要加载字典数据,可直接对表格设置autoLoad=true + */ + componentDidMount() { + const { onLoading, onLoadData } = this.table.current + onLoading() + getDictData('notice_status', 'notice_type').then(codes => { + this.setState({ codes }, () => { + onLoadData() + }) + }) + } + + /** + * 调用加载数据接口,可在调用前对query进行处理 + * [异步,必要] + * @param {*} params + * @param {*} query + * @returns + */ + loadData = async (params, query) => { + const { data } = await apiAction.page({ + ...params, + ...query, + }) + return data + } + + /** + * 绑定字典数据 + * @param {*} code + * @param {*} name + * @returns + */ + bindCodeValue(code, name) { + name = toCamelCase(name) + const codes = this.state.codes[name] + if (codes) { + const c = codes.find(p => p.code == code) + if (c) { + return c.value + } + } + return null + } + + /** + * 打开新增/编辑弹窗 + * @param {*} modal + * @param {*} id + */ + onOpen(modal, id) { + modal.current.open({ + id, + }) + } + + /** + * 对表格上的操作进行统一处理 + * [异步] + * @param {*} action + * @param {*} successMessage + */ + async onAction(action, successMessage) { + const { onLoading, onLoaded, onReloadData } = this.table.current + onLoading() + try { + if (action) { + await action + } + if (successMessage) { + Message.success(successMessage) + } + onReloadData() + } catch { + onLoaded() + } + } + + /** + * 删除 + * @param {*} id + */ + onDelete(id) { + this.onAction(apiAction.delete({ id }), '删除成功') + } + + //#region 自定义方法 + //#endregion + + render() { + const { codes } = this.state + return ( + +
+ + + + + + + + + + } + operator={ + + + + } + /> + + + + this.table.current.onReloadData()} + > + + + + + + this.table.current.onReloadData()} + > + + + +
+ ) + } +} diff --git a/web-react/src/views/main/_layout/header/index.jsx b/web-react/src/views/main/_layout/header/index.jsx index 796d6f1..e289d28 100644 --- a/web-react/src/views/main/_layout/header/index.jsx +++ b/web-react/src/views/main/_layout/header/index.jsx @@ -1,16 +1,23 @@ -import React, { Component } from 'react' -import { Layout, Badge } from 'antd' +import React, { Component, useState } from 'react' +import { Layout, Badge, Popover, Menu, Modal } from 'antd' import { AntIcon, Container } from 'components' import Logo from '../logo' import User from './user' import Search from './search' import store from 'store' +import { api } from 'common/api' const { getState, subscribe, dispatch } = store export default class index extends Component { state = { ...getState('layout'), + notice: { + count: 0, + data: [], + }, + modalVisible: false, + currentNotice: {}, } constructor(props) { @@ -21,6 +28,10 @@ export default class index extends Component { }) } + componentDidMount() { + this.loadNotice() + } + componentWillUnmount() { this.unsubscribe() } @@ -32,9 +43,27 @@ export default class index extends Component { }) } - render() { - const { allowSiderCollapsed, theme } = this.state + async loadNotice() { + const { data } = await api.sysNoticeGetCount() + const items = await api.sysNoticeInfo() + this.setState({ + notice: { + count: data, + data: items.data, + }, + }) + } + async showDetail(params, visible) { + this.setState({ currentNotice: params }) + if (visible) { + this.setState({ modalVisible: visible }) + } else { + this.setState({ modalVisible: visible }) + } + } + render() { + const { allowSiderCollapsed, notice, currentNotice } = this.state return ( @@ -57,26 +86,51 @@ export default class index extends Component { > - - - - - - { - dispatch({ - type: 'SET_THEME', - theme: { dark: 'default', default: 'dark' }[theme], - }) - window.location.reload() - }} + + + {notice.data.map(item => ( + this.showDetail(item, true)} + key={item.id} + > + {item.title} + + ))} + + } > -
-
-
-
- + + + + + + + this.showDetail(false)} + onCancel={() => this.showDetail(false)} + style={{ zIndex: 1000 }} + > +
+
+
+
+ 发布人:{currentNotice.createdUserName} + {' '} + 发布时间:{currentNotice.createdTime} +
+
+
diff --git a/web-react/yarn.lock b/web-react/yarn.lock index 62e133f..963891e 100644 --- a/web-react/yarn.lock +++ b/web-react/yarn.lock @@ -1191,6 +1191,13 @@ dependencies: regenerator-runtime "^0.13.4" +"@babel/runtime@^7.0.0": + version "7.14.6" + resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.14.6.tgz#535203bc0892efc7dec60bdc27b2ecf6e409062d" + integrity sha512-/PCB2uJ7oM44tz8YhC4Z/6PeOKXp4K588f+5M3clr1M4zbqztlo0XEfJ2LEzj/FgwfgGcIdl8n7YYjTCI0BYwg== + dependencies: + regenerator-runtime "^0.13.4" + "@babel/runtime@^7.1.2", "@babel/runtime@^7.10.1", "@babel/runtime@^7.10.2", "@babel/runtime@^7.10.4", "@babel/runtime@^7.11.1", "@babel/runtime@^7.11.2", "@babel/runtime@^7.12.1", "@babel/runtime@^7.12.5", "@babel/runtime@^7.5.5", "@babel/runtime@^7.7.2", "@babel/runtime@^7.8.4", "@babel/runtime@^7.9.2": version "7.14.5" resolved "https://registry.nlark.com/@babel/runtime/download/@babel/runtime-7.14.5.tgz?cache=0&sync_timestamp=1623280395479&other_urls=https%3A%2F%2Fregistry.nlark.com%2F%40babel%2Fruntime%2Fdownload%2F%40babel%2Fruntime-7.14.5.tgz#665450911c6031af38f81db530f387ec04cd9a98" @@ -2996,6 +3003,39 @@ braces@^3.0.1, braces@~3.0.2: dependencies: fill-range "^7.0.1" +braft-convert@^2.3.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/braft-convert/-/braft-convert-2.3.0.tgz#27d5905136c334903d083b7a2352a72045627888" + integrity sha512-5km+dLHk8iYDv2iEYDrDQ2ld/ZoUx66QLql0qdm5PqZEcNXc8dBHGLORfzeu3iMw1jLeAiHxtdY5+ypuIhczVg== + dependencies: + draft-convert "^2.0.0" + draft-js "^0.10.3" + +braft-editor@^2.3.9: + version "2.3.9" + resolved "https://registry.yarnpkg.com/braft-editor/-/braft-editor-2.3.9.tgz#fd2b8e23ea71191016579a1ed8231d16ad8f5b4a" + integrity sha512-mqdPk/zI2dhFK8tW/A4Qj/AkkARLh5L/niNw+iif5wFqb6zh15rMlrShgz1nWO/QXyAKr8XtDgxiBbR0zWwtRg== + dependencies: + "@babel/runtime" "^7.0.0" + braft-convert "^2.3.0" + braft-finder "^0.0.19" + braft-utils "^3.0.8" + draft-convert "^2.0.0" + draft-js "^0.10.3" + draft-js-multidecorators "^1.0.0" + draftjs-utils "^0.9.4" + immutable "~3.7.4" + +braft-finder@^0.0.19: + version "0.0.19" + resolved "https://registry.yarnpkg.com/braft-finder/-/braft-finder-0.0.19.tgz#c324d82526ed3476a93de86cc9b407f4e188bc8d" + integrity sha512-0kzI6/KbomJJhYX1hpjn4edCKhblyUyWdUrsgBmOrwy0vrj+pPkm69+Uf8Uj6KGAULM6LF0ooC++p7fqUGgFHw== + +braft-utils@^3.0.8: + version "3.0.12" + resolved "https://registry.yarnpkg.com/braft-utils/-/braft-utils-3.0.12.tgz#2b755ce1d8397d96b627b6767f74d07f25729d85" + integrity sha512-O2cKysURNC4HSEMKgNmQ2RluwcrxvYrztlEmyPN5SzktiNX3vaLFQoo0Ez3PlIhvjaGrIBSIT2Oyh2N6mn6TFg== + brorand@^1.0.1, brorand@^1.1.0: version "1.1.0" resolved "https://registry.npm.taobao.org/brorand/download/brorand-1.1.0.tgz#12c25efe40a45e3c323eb8675a0a0ce57b22371f" @@ -3676,6 +3716,11 @@ core-js-pure@^3.14.0: resolved "https://registry.nlark.com/core-js-pure/download/core-js-pure-3.14.0.tgz#72bcfacba74a65ffce04bf94ae91d966e80ee553" integrity sha1-crz6y6dKZf/OBL+UrpHZZugO5VM= +core-js@^1.0.0: + version "1.2.7" + resolved "https://registry.yarnpkg.com/core-js/-/core-js-1.2.7.tgz#652294c14651db28fa93bd2d5ff2983a4f08c636" + integrity sha1-ZSKUwUZR2yj6k70tX/KYOk8IxjY= + core-js@^2.4.0: version "2.6.12" resolved "https://registry.nlark.com/core-js/download/core-js-2.6.12.tgz#d9333dfa7b065e347cc5682219d6f690859cc2ec" @@ -4410,6 +4455,36 @@ dotenv@8.2.0: resolved "https://registry.nlark.com/dotenv/download/dotenv-8.2.0.tgz#97e619259ada750eea3e4ea3e26bceea5424b16a" integrity sha1-l+YZJZradQ7qPk6j4mvO6lQksWo= +draft-convert@^2.0.0: + version "2.1.11" + resolved "https://registry.yarnpkg.com/draft-convert/-/draft-convert-2.1.11.tgz#09797151ac7ed9c8f7898d116ba9f36869997bdf" + integrity sha512-8jLuhXmx5h5jiGi7thqdqV8O3aOmT7D5Q4OvCmT5tJWyMXWhKcJCktgqnwvEVGrHGxYJwfkfU4F/3fhGP2Dljw== + dependencies: + "@babel/runtime" "^7.5.5" + immutable "~3.7.4" + invariant "^2.2.1" + +draft-js-multidecorators@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/draft-js-multidecorators/-/draft-js-multidecorators-1.0.0.tgz#6c4be8d7b78dd2b966ee51ee6cc179b9b535e612" + integrity sha1-bEvo17eN0rlm7lHubMF5ubU15hI= + dependencies: + immutable "*" + +draft-js@^0.10.3: + version "0.10.5" + resolved "https://registry.yarnpkg.com/draft-js/-/draft-js-0.10.5.tgz#bfa9beb018fe0533dbb08d6675c371a6b08fa742" + integrity sha512-LE6jSCV9nkPhfVX2ggcRLA4FKs6zWq9ceuO/88BpXdNCS7mjRTgs0NsV6piUCJX9YxMsB9An33wnkMmU2sD2Zg== + dependencies: + fbjs "^0.8.15" + immutable "~3.7.4" + object-assign "^4.1.0" + +draftjs-utils@^0.9.4: + version "0.9.4" + resolved "https://registry.yarnpkg.com/draftjs-utils/-/draftjs-utils-0.9.4.tgz#976c61aa133dbbbfedd65ae1dd6627d7b98c6f08" + integrity sha512-KYjABSbGpJrwrwmxVj5UhfV37MF/p0QRxKIyL+/+QOaJ8J9z1FBKxkblThbpR0nJi9lxPQWGg+gh+v0dAsSCCg== + duplexer@^0.1.1: version "0.1.2" resolved "https://registry.npm.taobao.org/duplexer/download/duplexer-0.1.2.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fduplexer%2Fdownload%2Fduplexer-0.1.2.tgz#3abe43aef3835f8ae077d136ddce0f276b0400e6" @@ -4496,6 +4571,13 @@ encodeurl@~1.0.2: resolved "https://registry.nlark.com/encodeurl/download/encodeurl-1.0.2.tgz#ad3ff4c86ec2d029322f5a02c3a9a606c95b3f59" integrity sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k= +encoding@^0.1.11: + version "0.1.13" + resolved "https://registry.yarnpkg.com/encoding/-/encoding-0.1.13.tgz#56574afdd791f54a8e9b2785c0582a2d26210fa9" + integrity sha512-ETBauow1T35Y/WZMkio9jiM0Z5xjHHmJ4XmjZOq1l/dXz3lr2sRn87nJy20RupqSh1F2m3HHPSp8ShIPQJrJ3A== + dependencies: + iconv-lite "^0.6.2" + end-of-stream@^1.0.0, end-of-stream@^1.1.0: version "1.4.4" resolved "https://registry.nlark.com/end-of-stream/download/end-of-stream-1.4.4.tgz#5ae64a5f45057baf3626ec14da0ca5e4b2431eb0" @@ -5120,6 +5202,19 @@ fbjs-css-vars@^1.0.0: resolved "https://registry.npm.taobao.org/fbjs-css-vars/download/fbjs-css-vars-1.0.2.tgz#216551136ae02fe255932c3ec8775f18e2c078b8" integrity sha1-IWVRE2rgL+JVkyw+yHdfGOLAeLg= +fbjs@^0.8.15: + version "0.8.17" + resolved "https://registry.yarnpkg.com/fbjs/-/fbjs-0.8.17.tgz#c4d598ead6949112653d6588b01a5cdcd9f90fdd" + integrity sha1-xNWY6taUkRJlPWWIsBpc3Nn5D90= + dependencies: + core-js "^1.0.0" + isomorphic-fetch "^2.1.1" + loose-envify "^1.0.0" + object-assign "^4.1.0" + promise "^7.1.1" + setimmediate "^1.0.5" + ua-parser-js "^0.7.18" + fbjs@^3.0.0: version "3.0.0" resolved "https://registry.npm.taobao.org/fbjs/download/fbjs-3.0.0.tgz?cache=0&sync_timestamp=1602048886093&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Ffbjs%2Fdownload%2Ffbjs-3.0.0.tgz#0907067fb3f57a78f45d95f1eacffcacd623c165" @@ -5856,6 +5951,13 @@ iconv-lite@0.4.24: dependencies: safer-buffer ">= 2.1.2 < 3" +iconv-lite@^0.6.2: + version "0.6.3" + resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.6.3.tgz#a52f80bf38da1952eb5c681790719871a1a72501" + integrity sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw== + dependencies: + safer-buffer ">= 2.1.2 < 3.0.0" + icss-utils@^4.0.0, icss-utils@^4.1.1: version "4.1.1" resolved "https://registry.nlark.com/icss-utils/download/icss-utils-4.1.1.tgz#21170b53789ee27447c2f47dd683081403f9a467" @@ -5900,6 +6002,16 @@ immer@8.0.1: resolved "https://registry.nlark.com/immer/download/immer-8.0.1.tgz?cache=0&sync_timestamp=1623232631798&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fimmer%2Fdownload%2Fimmer-8.0.1.tgz#9c73db683e2b3975c424fb0572af5889877ae656" integrity sha1-nHPbaD4rOXXEJPsFcq9YiYd65lY= +immutable@*: + version "3.8.2" + resolved "https://registry.yarnpkg.com/immutable/-/immutable-3.8.2.tgz#c2439951455bb39913daf281376f1530e104adf3" + integrity sha1-wkOZUUVbs5kT2vKBN28VMOEErfM= + +immutable@~3.7.4: + version "3.7.6" + resolved "https://registry.yarnpkg.com/immutable/-/immutable-3.7.6.tgz#13b4d3cb12befa15482a26fe1b2ebae640071e4b" + integrity sha1-E7TTyxK++hVIKib+Gy665kAHHks= + import-cwd@^2.0.0: version "2.1.0" resolved "https://registry.nlark.com/import-cwd/download/import-cwd-2.1.0.tgz#aa6cf36e722761285cb371ec6519f53e2435b0a9" @@ -6011,6 +6123,13 @@ internal-slot@^1.0.3: has "^1.0.3" side-channel "^1.0.4" +invariant@^2.2.1: + version "2.2.4" + resolved "https://registry.yarnpkg.com/invariant/-/invariant-2.2.4.tgz#610f3c92c9359ce1db616e538008d23ff35158e6" + integrity sha512-phJfQVBuaJM5raOpJjSfkiD6BpbCE4Ns//LaXl6wGYtUBY83nWS6Rf9tXm2e8VaK60JEjYldbPif/A2B1C2gNA== + dependencies: + loose-envify "^1.0.0" + ip-regex@^2.1.0: version "2.1.0" resolved "https://registry.nlark.com/ip-regex/download/ip-regex-2.1.0.tgz?cache=0&sync_timestamp=1618846943469&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fip-regex%2Fdownload%2Fip-regex-2.1.0.tgz#fa78bf5d2e6913c911ce9f819ee5146bb6d844e9" @@ -6318,7 +6437,7 @@ is-root@2.1.0: resolved "https://registry.npm.taobao.org/is-root/download/is-root-2.1.0.tgz?cache=0&sync_timestamp=1617783382597&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fis-root%2Fdownload%2Fis-root-2.1.0.tgz#809e18129cf1129644302a4f8544035d51984a9c" integrity sha1-gJ4YEpzxEpZEMCpPhUQDXVGYSpw= -is-stream@^1.1.0: +is-stream@^1.0.1, is-stream@^1.1.0: version "1.1.0" resolved "https://registry.npm.taobao.org/is-stream/download/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44" integrity sha1-EtSj3U5o4Lec6428hBc66A2RykQ= @@ -6394,6 +6513,14 @@ isobject@^3.0.0, isobject@^3.0.1: resolved "https://registry.nlark.com/isobject/download/isobject-3.0.1.tgz#4e431e92b11a9731636aa1f9c8d1ccbcfdab78df" integrity sha1-TkMekrEalzFjaqH5yNHMvP2reN8= +isomorphic-fetch@^2.1.1: + version "2.2.1" + resolved "https://registry.yarnpkg.com/isomorphic-fetch/-/isomorphic-fetch-2.2.1.tgz#611ae1acf14f5e81f729507472819fe9733558a9" + integrity sha1-YRrhrPFPXoH3KVB0coGf6XM1WKk= + dependencies: + node-fetch "^1.0.1" + whatwg-fetch ">=0.10.0" + istanbul-lib-coverage@^3.0.0: version "3.0.0" resolved "https://registry.npm.taobao.org/istanbul-lib-coverage/download/istanbul-lib-coverage-3.0.0.tgz#f5944a37c70b550b02a78a5c3b2055b280cec8ec" @@ -7719,6 +7846,14 @@ node-fetch@2.6.1: resolved "https://registry.nlark.com/node-fetch/download/node-fetch-2.6.1.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fnode-fetch%2Fdownload%2Fnode-fetch-2.6.1.tgz#045bd323631f76ed2e2b55573394416b639a0052" integrity sha1-BFvTI2Mfdu0uK1VXM5RBa2OaAFI= +node-fetch@^1.0.1: + version "1.7.3" + resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-1.7.3.tgz#980f6f72d85211a5347c6b2bc18c5b84c3eb47ef" + integrity sha512-NhZ4CsKx7cYm2vSrBAr2PvFOe6sWDf0UYLRqA6svUYg7+/TSfVAu49jYC4BvQ4Sms9SZgdqGBgroqfDhJdTyKQ== + dependencies: + encoding "^0.1.11" + is-stream "^1.0.1" + node-forge@^0.10.0: version "0.10.0" resolved "https://registry.npm.taobao.org/node-forge/download/node-forge-0.10.0.tgz?cache=0&sync_timestamp=1599010726129&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fnode-forge%2Fdownload%2Fnode-forge-0.10.0.tgz#32dea2afb3e9926f02ee5ce8794902691a676bf3" @@ -10340,7 +10475,7 @@ safe-regex@^1.1.0: dependencies: ret "~0.1.10" -"safer-buffer@>= 2.1.2 < 3", safer-buffer@^2.1.0: +"safer-buffer@>= 2.1.2 < 3", "safer-buffer@>= 2.1.2 < 3.0.0", safer-buffer@^2.1.0: version "2.1.2" resolved "https://registry.nlark.com/safer-buffer/download/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" integrity sha1-RPoWGwGHuVSd2Eu5GAL5vYOFzWo= @@ -11972,7 +12107,7 @@ whatwg-encoding@^1.0.5: dependencies: iconv-lite "0.4.24" -whatwg-fetch@^3.4.1: +whatwg-fetch@>=0.10.0, whatwg-fetch@^3.4.1: version "3.6.2" resolved "https://registry.nlark.com/whatwg-fetch/download/whatwg-fetch-3.6.2.tgz#dced24f37f2624ed0281725d51d0e2e3fe677f8c" integrity sha1-3O0k838mJO0CgXJdUdDi4/5nf4w=