feat:全基础流程跑通

This commit is contained in:
橙子
2023-04-15 22:44:33 +08:00
parent 9b1a978cb5
commit 1655870d4d
151 changed files with 3120 additions and 209 deletions

View File

@@ -2,7 +2,7 @@
using Yi.Framework.Infrastructure.Ddd.Repositories;
using Yi.Framework.Infrastructure.Exceptions;
using Yi.Framework.Infrastructure.Helper;
using Yi.Furion.Core.Rbac.ConstClasses;
using Yi.Furion.Core.Rbac.Consts;
using Yi.Furion.Core.Rbac.Dtos;
using Yi.Furion.Core.Rbac.Entities;

View File

@@ -1,15 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Yi.Furion.Application.Rbac.Dtos.Account
{
public class CaptchaImageDto
{
public string Code { get; set; } = string.Empty;
public Guid Uuid { get; set; } = Guid.Empty;
public byte[] Img { get; set; }
}
}

View File

@@ -1,18 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Yi.Furion.Application.Rbac.Dtos.Account
{
public class LoginInputVo
{
public string UserName { get; set; } = string.Empty;
public string Password { get; set; } = string.Empty;
public string Uuid { get; set; }
public string Code { get; set; }
}
}

View File

@@ -1,13 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Yi.Furion.Application.Rbac.Dtos.Account
{
public class PhoneCaptchaImageDto
{
public string Phone { get; set; }
}
}

View File

@@ -1,39 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Yi.Furion.Application.Rbac.Dtos.Account
{
public class RegisterDto
{
//电话号码根据code的表示来获取
/// <summary>
/// 账号
/// </summary>
public string UserName { get; set; } = string.Empty;
/// <summary>
/// 密码
/// </summary>
public string Password { get; set; } = string.Empty;
/// <summary>
/// 唯一标识码
/// </summary>
public string Uuid { get; set; }
/// <summary>
/// 电话
/// </summary>
public long Phone { get; set; }
/// <summary>
/// 验证码
/// </summary>
public string Code { get; set; }
}
}

View File

@@ -1,13 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Yi.Furion.Application.Rbac.Dtos.Account
{
public class RestPasswordDto
{
public string Password = string.Empty;
}
}

View File

@@ -1,13 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Yi.Furion.Application.Rbac.Dtos.Account
{
public class UpdateIconDto
{
public string Icon { get; set; }
}
}

View File

@@ -1,14 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Yi.Furion.Application.Rbac.Dtos.Account
{
public class UpdatePasswordDto
{
public string NewPassword { get; set; } = string.Empty;
public string OldPassword { get; set; } = string.Empty;
}
}

View File

@@ -1,24 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Yi.Furion.Application.Rbac.Dtos.Dept
{
/// <summary>
/// Dept输入创建对象
/// </summary>
public class DeptCreateInputVo
{
public long Id { get; set; }
public DateTime CreationTime { get; set; } = DateTime.Now;
public long? CreatorId { get; set; }
public bool State { get; set; }
public string DeptName { get; set; } = string.Empty;
public string DeptCode { get; set; } = string.Empty;
public string Leader { get; set; }
public long ParentId { get; set; }
public string Remark { get; set; }
}
}

View File

@@ -1,14 +0,0 @@
using Yi.Framework.Infrastructure.Ddd.Dtos;
namespace Yi.Furion.Application.Rbac.Dtos.Dept
{
public class DeptGetListInputVo : PagedAllResultRequestDto
{
public long Id { get; set; }
public bool? State { get; set; }
public string DeptName { get; set; }
public string DeptCode { get; set; }
public string Leader { get; set; }
}
}

View File

@@ -1,19 +0,0 @@
using Yi.Framework.Infrastructure.Ddd.Dtos.Abstract;
namespace Yi.Furion.Application.Rbac.Dtos.Dept
{
public class DeptGetListOutputDto : IEntityDto<long>
{
public long Id { get; set; }
public DateTime CreationTime { get; set; } = DateTime.Now;
public long? CreatorId { get; set; }
public bool State { get; set; }
public string DeptName { get; set; } = string.Empty;
public string DeptCode { get; set; } = string.Empty;
public string Leader { get; set; }
public long ParentId { get; set; }
public string Remark { get; set; }
public int OrderNum { get; set; }
}
}

View File

@@ -1,20 +0,0 @@
using Yi.Framework.Infrastructure.Ddd.Dtos.Abstract;
namespace Yi.Furion.Application.Rbac.Dtos.Dept
{
public class DeptGetOutputDto : IEntityDto<long>
{
public long Id { get; set; }
public bool State { get; set; }
public string DeptName { get; set; } = string.Empty;
public string DeptCode { get; set; } = string.Empty;
public string Leader { get; set; }
public string Remark { get; set; }
public long? deptId { get; set; }
public int OrderNum { get; set; }
public long ParentId { get; set; }
}
}

View File

@@ -1,21 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Yi.Furion.Application.Rbac.Dtos.Dept
{
public class DeptUpdateInputVo
{
public long Id { get; set; }
public DateTime CreationTime { get; set; } = DateTime.Now;
public long? CreatorId { get; set; }
public bool State { get; set; }
public string DeptName { get; set; } = string.Empty;
public string DeptCode { get; set; } = string.Empty;
public string Leader { get; set; }
public long ParentId { get; set; }
public string Remark { get; set; }
}
}

View File

@@ -1,27 +0,0 @@
using Yi.Furion.Core.Rbac.EnumClasses;
namespace Yi.Furion.Application.Rbac.Dtos.Menu
{
/// <summary>
/// Menu输入创建对象
/// </summary>
public class MenuCreateInputVo
{
public long Id { get; set; }
public DateTime CreationTime { get; set; } = DateTime.Now;
public long? CreatorId { get; set; }
public bool State { get; set; }
public string MenuName { get; set; } = string.Empty;
public MenuTypeEnum MenuType { get; set; } = MenuTypeEnum.Menu;
public string PermissionCode { get; set; }
public long ParentId { get; set; }
public string MenuIcon { get; set; }
public string Router { get; set; }
public bool IsLink { get; set; }
public bool IsCache { get; set; }
public bool IsShow { get; set; } = true;
public string Remark { get; set; }
public string Component { get; set; }
public string Query { get; set; }
}
}

View File

@@ -1,12 +0,0 @@
using Yi.Framework.Infrastructure.Ddd.Dtos;
namespace Yi.Furion.Application.Rbac.Dtos.Menu
{
public class MenuGetListInputVo : PagedAndSortedResultRequestDto
{
public bool? State { get; set; }
public string MenuName { get; set; }
}
}

View File

@@ -1,28 +0,0 @@
using Yi.Framework.Infrastructure.Ddd.Dtos.Abstract;
using Yi.Furion.Core.Rbac.EnumClasses;
namespace Yi.Furion.Application.Rbac.Dtos.Menu
{
public class MenuGetListOutputDto : IEntityDto<long>
{
public long Id { get; set; }
public DateTime CreationTime { get; set; } = DateTime.Now;
public long? CreatorId { get; set; }
public bool State { get; set; }
public string MenuName { get; set; } = string.Empty;
public MenuTypeEnum MenuType { get; set; } = MenuTypeEnum.Menu;
public string PermissionCode { get; set; }
public long ParentId { get; set; }
public string MenuIcon { get; set; }
public string Router { get; set; }
public bool IsLink { get; set; }
public bool IsCache { get; set; }
public bool IsShow { get; set; } = true;
public string Remark { get; set; }
public string Component { get; set; }
public string Query { get; set; }
public int OrderNum { get; set; }
//public List<MenuEntity>? Children { get; set; }
}
}

View File

@@ -1,29 +0,0 @@
using Yi.Framework.Infrastructure.Ddd.Dtos.Abstract;
using Yi.Furion.Core.Rbac.EnumClasses;
namespace Yi.Furion.Application.Rbac.Dtos.Menu
{
public class MenuGetOutputDto : IEntityDto<long>
{
public long Id { get; set; }
public DateTime CreationTime { get; set; } = DateTime.Now;
public long? CreatorId { get; set; }
public bool State { get; set; }
public string MenuName { get; set; } = string.Empty;
public MenuTypeEnum MenuType { get; set; } = MenuTypeEnum.Menu;
public string PermissionCode { get; set; }
public long ParentId { get; set; }
public string MenuIcon { get; set; }
public string Router { get; set; }
public bool IsLink { get; set; }
public bool IsCache { get; set; }
public bool IsShow { get; set; } = true;
public string Remark { get; set; }
public string Component { get; set; }
public string Query { get; set; }
public int OrderNum { get; set; }
//public List<MenuEntity>? Children { get; set; }
}
}

View File

@@ -1,25 +0,0 @@
using Yi.Furion.Core.Rbac.EnumClasses;
namespace Yi.Furion.Application.Rbac.Dtos.Menu
{
public class MenuUpdateInputVo
{
public long Id { get; set; }
public DateTime CreationTime { get; set; } = DateTime.Now;
public long? CreatorId { get; set; }
public bool State { get; set; }
public string MenuName { get; set; } = string.Empty;
public MenuTypeEnum MenuType { get; set; } = MenuTypeEnum.Menu;
public string PermissionCode { get; set; }
public long ParentId { get; set; }
public string MenuIcon { get; set; }
public string Router { get; set; }
public bool IsLink { get; set; }
public bool IsCache { get; set; }
public bool IsShow { get; set; } = true;
public string Remark { get; set; }
public string Component { get; set; }
public string Query { get; set; }
//public List<MenuEntity>? Children { get; set; }
}
}

View File

@@ -1,22 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Yi.Furion.Application.Rbac.Dtos.Post
{
/// <summary>
/// Post输入创建对象
/// </summary>
public class PostCreateInputVo
{
public long Id { get; set; }
public DateTime CreationTime { get; set; } = DateTime.Now;
public long? CreatorId { get; set; }
public bool State { get; set; }
public string PostCode { get; set; } = string.Empty;
public string PostName { get; set; } = string.Empty;
public string Remark { get; set; }
}
}

View File

@@ -1,11 +0,0 @@
using Yi.Framework.Infrastructure.Ddd.Dtos;
namespace Yi.Furion.Application.Rbac.Dtos.Post
{
public class PostGetListInputVo : PagedAndSortedResultRequestDto
{
public bool? State { get; set; }
//public string? PostCode { get; set; }=string.Empty;
public string PostName { get; set; } = string.Empty;
}
}

View File

@@ -1,16 +0,0 @@
using Yi.Framework.Infrastructure.Ddd.Dtos.Abstract;
namespace Yi.Furion.Application.Rbac.Dtos.Post
{
public class PostGetListOutputDto : IEntityDto<long>
{
public long Id { get; set; }
public DateTime CreationTime { get; set; } = DateTime.Now;
public bool State { get; set; }
public string PostCode { get; set; } = string.Empty;
public string PostName { get; set; } = string.Empty;
public string Remark { get; set; }
public int OrderNum { get; set; }
}
}

View File

@@ -1,17 +0,0 @@
using Yi.Framework.Infrastructure.Ddd.Dtos.Abstract;
namespace Yi.Furion.Application.Rbac.Dtos.Post
{
public class PostGetOutputDto : IEntityDto<long>
{
public long Id { get; set; }
public DateTime CreationTime { get; set; } = DateTime.Now;
public long? CreatorId { get; set; }
public bool State { get; set; }
public string PostCode { get; set; } = string.Empty;
public string PostName { get; set; } = string.Empty;
public string Remark { get; set; }
public int OrderNum { get; set; }
}
}

View File

@@ -1,13 +0,0 @@
namespace Yi.Furion.Application.Rbac.Dtos.Post
{
public class PostUpdateInputVo
{
public long Id { get; set; }
public DateTime CreationTime { get; set; } = DateTime.Now;
public long? CreatorId { get; set; }
public bool State { get; set; }
public string PostCode { get; set; } = string.Empty;
public string PostName { get; set; } = string.Empty;
public string Remark { get; set; }
}
}

View File

@@ -1,22 +0,0 @@
using Yi.Furion.Core.Rbac.EnumClasses;
namespace Yi.Furion.Application.Rbac.Dtos.Role
{
/// <summary>
/// Role输入创建对象
/// </summary>
public class RoleCreateInputVo
{
public string RoleName { get; set; }
public string RoleCode { get; set; }
public string Remark { get; set; }
public DataScopeEnum DataScope { get; set; } = DataScopeEnum.ALL;
public bool State { get; set; } = true;
public int OrderNum { get; set; }
public List<long> DeptIds { get; set; }
public List<long> MenuIds { get; set; }
}
}

View File

@@ -1,12 +0,0 @@
using Yi.Framework.Infrastructure.Ddd.Dtos;
namespace Yi.Furion.Application.Rbac.Dtos.Role
{
public class RoleGetListInputVo : PagedAllResultRequestDto
{
public string RoleName { get; set; }
public string RoleCode { get; set; }
public bool? State { get; set; }
}
}

View File

@@ -1,19 +0,0 @@
using Yi.Framework.Infrastructure.Ddd.Dtos.Abstract;
using Yi.Furion.Core.Rbac.EnumClasses;
namespace Yi.Furion.Application.Rbac.Dtos.Role
{
public class RoleGetListOutputDto : IEntityDto<long>
{
public long Id { get; set; }
public DateTime CreationTime { get; set; } = DateTime.Now;
public long? CreatorId { get; set; }
public string RoleName { get; set; }
public string RoleCode { get; set; }
public string Remark { get; set; }
public DataScopeEnum DataScope { get; set; } = DataScopeEnum.ALL;
public bool State { get; set; }
public int OrderNum { get; set; }
}
}

View File

@@ -1,19 +0,0 @@
using Yi.Framework.Infrastructure.Ddd.Dtos.Abstract;
using Yi.Furion.Core.Rbac.EnumClasses;
namespace Yi.Furion.Application.Rbac.Dtos.Role
{
public class RoleGetOutputDto : IEntityDto<long>
{
public long Id { get; set; }
public DateTime CreationTime { get; set; } = DateTime.Now;
public long? CreatorId { get; set; }
public string RoleName { get; set; }
public string RoleCode { get; set; }
public string Remark { get; set; }
public DataScopeEnum DataScope { get; set; } = DataScopeEnum.ALL;
public bool State { get; set; }
public int OrderNum { get; set; }
}
}

View File

@@ -1,19 +0,0 @@
using Yi.Furion.Core.Rbac.EnumClasses;
namespace Yi.Furion.Application.Rbac.Dtos.Role
{
public class RoleUpdateInputVo
{
public string RoleName { get; set; }
public string RoleCode { get; set; }
public string Remark { get; set; }
public DataScopeEnum DataScope { get; set; } = DataScopeEnum.ALL;
public bool State { get; set; }
public int OrderNum { get; set; }
public List<long> DeptIds { get; set; }
public List<long> MenuIds { get; set; }
}
}

View File

@@ -1,17 +0,0 @@
using Yi.Furion.Core.Rbac.EnumClasses;
namespace Yi.Furion.Application.Rbac.Dtos.User
{
public class ProfileUpdateInputVo
{
public string Name { get; set; }
public int? Age { get; set; }
public string Nick { get; set; }
public string Email { get; set; }
public string Address { get; set; }
public long? Phone { get; set; }
public string Introduction { get; set; }
public string Remark { get; set; }
public SexEnum? Sex { get; set; }
}
}

View File

@@ -1,27 +0,0 @@
using Yi.Furion.Core.Rbac.EnumClasses;
namespace Yi.Furion.Application.Rbac.Dtos.User
{
/// <summary>
/// User输入创建对象
/// </summary>
public class UserCreateInputVo
{
public string Name { get; set; }
public int? Age { get; set; }
public string UserName { get; set; } = string.Empty;
public string Password { get; set; } = string.Empty;
public string Icon { get; set; }
public string Nick { get; set; }
public string Email { get; set; }
public string Address { get; set; }
public long? Phone { get; set; }
public string Introduction { get; set; }
public string Remark { get; set; }
public SexEnum Sex { get; set; } = SexEnum.Unknown;
public List<long> RoleIds { get; set; }
public List<long> PostIds { get; set; }
public long? DeptId { get; set; }
public bool State { get; set; } = true;
}
}

View File

@@ -1,18 +0,0 @@
using Yi.Framework.Infrastructure.Ddd.Dtos;
namespace Yi.Furion.Application.Rbac.Dtos.User
{
public class UserGetListInputVo : PagedAllResultRequestDto
{
public string Name { get; set; }
public string UserName { get; set; }
public long? Phone { get; set; }
public bool? State { get; set; }
public long? DeptId { get; set; }
public string Ids { get; set; }
}
}

View File

@@ -1,30 +0,0 @@
using Yi.Framework.Infrastructure.Ddd.Dtos.Abstract;
using Yi.Furion.Core.Rbac.EnumClasses;
namespace Yi.Furion.Application.Rbac.Dtos.User
{
public class UserGetListOutputDto : IEntityDto<long>
{
public long Id { get; set; }
public string Name { get; set; }
public int? Age { get; set; }
public string UserName { get; set; } = string.Empty;
public string Icon { get; set; }
public string Nick { get; set; }
public string Email { get; set; }
public string Ip { get; set; }
public string Address { get; set; }
public long? Phone { get; set; }
public string Introduction { get; set; }
public string Remark { get; set; }
public SexEnum Sex { get; set; } = SexEnum.Unknown;
public long? DeptId { get; set; }
public DateTime CreationTime { get; set; } = DateTime.Now;
public long? CreatorId { get; set; }
public bool State { get; set; }
public string DeptName { get; set; }
}
}

View File

@@ -1,35 +0,0 @@
using Yi.Framework.Infrastructure.Ddd.Dtos.Abstract;
using Yi.Furion.Application.Rbac.Dtos.Dept;
using Yi.Furion.Application.Rbac.Dtos.Post;
using Yi.Furion.Application.Rbac.Dtos.Role;
using Yi.Furion.Core.Rbac.EnumClasses;
namespace Yi.Furion.Application.Rbac.Dtos.User
{
public class UserGetOutputDto : IEntityDto<long>
{
public long Id { get; set; }
public string Name { get; set; }
public int? Age { get; set; }
public string UserName { get; set; } = string.Empty;
public string Icon { get; set; }
public string Nick { get; set; }
public string Email { get; set; }
public string Ip { get; set; }
public string Address { get; set; }
public long? Phone { get; set; }
public string Introduction { get; set; }
public string Remark { get; set; }
public SexEnum Sex { get; set; } = SexEnum.Unknown;
public bool State { get; set; }
public DateTime CreationTime { get; set; }
public long DeptId { get; set; }
public DeptGetOutputDto Dept { get; set; }
public List<PostGetListOutputDto> Posts { get; set; }
public List<RoleGetListOutputDto> Roles { get; set; }
}
}

View File

@@ -1,28 +0,0 @@
using Yi.Furion.Core.Rbac.EnumClasses;
namespace Yi.Furion.Application.Rbac.Dtos.User
{
public class UserUpdateInputVo
{
public string Name { get; set; }
public int? Age { get; set; }
public string UserName { get; set; }
[AdaptIgnore]
public string Password { get; set; }
public string Icon { get; set; }
public string Nick { get; set; }
public string Email { get; set; }
public string Ip { get; set; }
public string Address { get; set; }
public long? Phone { get; set; }
public string Introduction { get; set; }
public string Remark { get; set; }
public SexEnum? Sex { get; set; }
public long? DeptId { get; set; }
public List<long> PostIds { get; set; }
public List<long> RoleIds { get; set; }
public bool? State { get; set; }
}
}

View File

@@ -9,25 +9,22 @@ using Yi.Furion.Core.Rbac.Etos;
namespace Yi.Furion.Application.Rbac.Event
{
public class LoginEventHandler : IEventSubscriber, ISingleton
public class LoginEventHandler : IEventSubscriber,ISingleton
{
private readonly IRepository<LoginLogEntity> _loginLogRepository;
private readonly IHttpContextAccessor _httpContextAccessor;
private HttpContext _httpContext => _httpContextAccessor.HttpContext;
public LoginEventHandler(IRepository<LoginLogEntity> loginLogRepository, IHttpContextAccessor httpContextAccessor)
public LoginEventHandler(IRepository<LoginLogEntity> loginLogRepository)
{
_loginLogRepository = loginLogRepository;
_httpContextAccessor = httpContextAccessor;
}
//[EventSubscribe(nameof(LoginEventSource))]
public Task HandlerAsync(EventHandlerExecutingContext context)
{
var eventData = (LoginEventArgs)context.Source.Payload;
var loginLogEntity = GetLoginLogInfo(_httpContext);
var loginLogEntity = GetLoginLogInfo(eventData.httpContext);
loginLogEntity.Id = SnowflakeHelper.NextId;
loginLogEntity.LogMsg = eventData.UserName + "登录系统";
loginLogEntity.LoginUser = eventData.UserName;
loginLogEntity.LoginIp = _httpContext.GetClientIp();
loginLogEntity.LoginIp = eventData.httpContext.GetClientIp();
_loginLogRepository.InsertAsync(loginLogEntity);
return Task.CompletedTask;

View File

@@ -0,0 +1,13 @@
using Yi.Framework.Infrastructure.Ddd.Services.Abstract;
using Yi.Furion.Core.Rbac.Dtos.Config;
namespace Yi.Furion.Application.Rbac.Services
{
/// <summary>
/// Config服务抽象
/// </summary>
public interface IConfigService : ICrudAppService<ConfigGetOutputDto, ConfigGetListOutputDto, long, ConfigGetListInputVo, ConfigCreateInputVo, ConfigUpdateInputVo>
{
}
}

View File

@@ -1,5 +1,5 @@
using Yi.Framework.Infrastructure.Ddd.Services.Abstract;
using Yi.Furion.Application.Rbac.Dtos.Dept;
using Yi.Furion.Core.Rbac.Dtos.Dept;
namespace Yi.Furion.Application.Rbac.Services
{

View File

@@ -1,5 +1,5 @@
using Yi.Framework.Infrastructure.Ddd.Services.Abstract;
using Yi.Furion.Application.Rbac.Dtos.Menu;
using Yi.Furion.Core.Rbac.Dtos.Menu;
namespace Yi.Furion.Application.Rbac.Services
{

View File

@@ -1,5 +1,5 @@
using Yi.Framework.Infrastructure.Ddd.Services.Abstract;
using Yi.Furion.Application.Rbac.Dtos.Post;
using Yi.Furion.Core.Rbac.Dtos.Post;
namespace Yi.Furion.Application.Rbac.Services
{

View File

@@ -1,5 +1,5 @@
using Yi.Framework.Infrastructure.Ddd.Services.Abstract;
using Yi.Furion.Application.Rbac.Dtos.Role;
using Yi.Furion.Core.Rbac.Dtos.Role;
namespace Yi.Furion.Application.Rbac.Services
{

View File

@@ -1,5 +1,5 @@
using Yi.Framework.Infrastructure.Ddd.Services.Abstract;
using Yi.Furion.Application.Rbac.Dtos.User;
using Yi.Furion.Core.Rbac.Dtos.User;
namespace Yi.Furion.Application.Rbac.Services
{

View File

@@ -10,9 +10,9 @@ using Yi.Framework.Infrastructure.Exceptions;
using Yi.Framework.Module.ImageSharp.HeiCaptcha;
using Yi.Framework.Module.Sms.Aliyun;
using Yi.Furion.Application.Rbac.Domain;
using Yi.Furion.Application.Rbac.Dtos.Account;
using Yi.Furion.Core.Rbac.ConstClasses;
using Yi.Furion.Core.Rbac.Consts;
using Yi.Furion.Core.Rbac.Dtos;
using Yi.Furion.Core.Rbac.Dtos.Account;
using Yi.Furion.Core.Rbac.Entities;
using Yi.Furion.Core.Rbac.Etos;
using Yi.Furion.Sqlsugar.Core.Repositories;
@@ -22,9 +22,9 @@ namespace Yi.Furion.Application.Rbac.Services.Impl
public class AccountService : ApplicationService, ITransient, IDynamicApiController
{
public AccountService(IUserRepository userRepository, ICurrentUser currentUser, AccountManager accountManager, IRepository<MenuEntity> menuRepository, SmsAliyunManager smsAliyunManager, IOptions<SmsAliyunOptions> smsAliyunManagerOptions, SecurityCodeHelper securityCode, IMemoryCache memoryCache, IEventPublisher eventPublisher) =>
(_userRepository, _currentUser, _accountManager, _menuRepository, _smsAliyunManager, _smsAliyunManagerOptions, _securityCode, _memoryCache, _eventPublisher) =
(userRepository, currentUser, accountManager, menuRepository, smsAliyunManager, smsAliyunManagerOptions, securityCode, memoryCache, eventPublisher);
public AccountService(IUserRepository userRepository, ICurrentUser currentUser, AccountManager accountManager, IRepository<MenuEntity> menuRepository, SmsAliyunManager smsAliyunManager, IOptions<SmsAliyunOptions> smsAliyunManagerOptions, SecurityCodeHelper securityCode, IMemoryCache memoryCache, IEventPublisher eventPublisher,IHttpContextAccessor httpContextAccessor) =>
(_userRepository, _currentUser, _accountManager, _menuRepository, _smsAliyunManager, _smsAliyunManagerOptions, _securityCode, _memoryCache, _eventPublisher, _httpContextAccessor) =
(userRepository, currentUser, accountManager, menuRepository, smsAliyunManager, smsAliyunManagerOptions, securityCode, memoryCache, eventPublisher, httpContextAccessor);
private IUserRepository _userRepository { get; set; }
@@ -62,6 +62,7 @@ namespace Yi.Furion.Application.Rbac.Services.Impl
private SmsAliyunManager _smsAliyunManager { get; set; }
private IHttpContextAccessor _httpContextAccessor { get; set; }
private IOptions<SmsAliyunOptions> _smsAliyunManagerOptions { get; set; }
@@ -124,17 +125,18 @@ namespace Yi.Furion.Application.Rbac.Services.Impl
//这里抛出一个登录的事件
//不阻碍执行,无需等待
#pragma warning disable CS4014 // 由于此调用不会等待,因此在调用完成前将继续执行当前方法
_eventPublisher.PublishAsync(new LoginEventSource(new LoginEventArgs
await _eventPublisher.PublishAsync(new LoginEventSource(new LoginEventArgs
{
UserId = userInfo.User.Id,
UserName = user.UserName
UserName = user.UserName,
httpContext= _httpContextAccessor.HttpContext
})
);;
})
);
#pragma warning restore CS4014 // 由于此调用不会等待,因此在调用完成前将继续执行当前方法
//创建token
var accessToken = JWTEncryption.Encrypt(_accountManager.UserInfoToClaim(userInfo));
@@ -295,6 +297,7 @@ namespace Yi.Furion.Application.Rbac.Services.Impl
/// </summary>
/// <returns></returns>
[Authorize]
[Route("Vue3Router")]
public async Task<List<Vue3RouterDto>> GetVue3Router()
{
var userId = _currentUser.Id;

View File

@@ -0,0 +1,34 @@
using SqlSugar;
using Yi.Framework.Infrastructure.Ddd.Dtos;
using Yi.Framework.Infrastructure.Ddd.Services;
using Yi.Furion.Core.Rbac.Dtos.Config;
using Yi.Furion.Core.Rbac.Entities;
namespace Yi.Furion.Application.Rbac.Services.Impl
{
/// <summary>
/// Config服务实现
/// </summary>
public class ConfigService : CrudAppService<ConfigEntity, ConfigGetOutputDto, ConfigGetListOutputDto, long, ConfigGetListInputVo, ConfigCreateInputVo, ConfigUpdateInputVo>,
IConfigService,IDynamicApiController,ITransient
{
/// <summary>
/// 多查
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public override async Task<PagedResultDto<ConfigGetListOutputDto>> GetListAsync(ConfigGetListInputVo input)
{
var entity = await MapToEntityAsync(input);
RefAsync<int> total = 0;
var entities = await _DbQueryable.WhereIF(!string.IsNullOrEmpty(input.ConfigKey), x => x.ConfigKey.Contains(input.ConfigKey!))
.WhereIF(!string.IsNullOrEmpty(input.ConfigName), x => x.ConfigName!.Contains(input.ConfigName!))
.WhereIF(input.StartTime is not null && input.EndTime is not null, x => x.CreationTime >= input.StartTime && x.CreationTime <= input.EndTime)
.ToPageListAsync(input.PageNum, input.PageSize, total);
return new PagedResultDto<ConfigGetListOutputDto>(total, await MapToGetListOutputDtosAsync(entities));
}
}
}

View File

@@ -1,7 +1,7 @@
using SqlSugar;
using Yi.Framework.Infrastructure.Ddd.Dtos;
using Yi.Framework.Infrastructure.Ddd.Services;
using Yi.Furion.Application.Rbac.Dtos.Dept;
using Yi.Furion.Core.Rbac.Dtos.Dept;
using Yi.Furion.Core.Rbac.Entities;
namespace Yi.Furion.Application.Rbac.Services.Impl

View File

@@ -0,0 +1,30 @@
using SqlSugar;
using Yi.Framework.Infrastructure.Ddd.Dtos;
using Yi.Framework.Infrastructure.Ddd.Services;
using Yi.Furion.Core.Rbac.Dtos.LoginLog;
using Yi.Furion.Core.Rbac.Entities;
namespace Yi.Furion.Application.Rbac.Services.Impl
{
public class LoginLogService : CrudAppService<LoginLogEntity, LoginLogGetListOutputDto, long, LoginLogGetListInputVo>,IDynamicApiController,ITransient
{
public override async Task<PagedResultDto<LoginLogGetListOutputDto>> GetListAsync(LoginLogGetListInputVo input)
{
var entity = await MapToEntityAsync(input);
RefAsync<int> total = 0;
var entities = await _DbQueryable.WhereIF(!string.IsNullOrEmpty(input.LoginIp), x => x.LoginIp.Contains(input.LoginIp!))
.WhereIF(!string.IsNullOrEmpty(input.LoginUser), x => x.LoginUser!.Contains(input.LoginUser!))
.WhereIF(input.StartTime is not null && input.EndTime is not null, x => x.CreationTime >= input.StartTime && x.CreationTime <= input.EndTime)
.ToPageListAsync(input.PageNum, input.PageSize, total);
return new PagedResultDto<LoginLogGetListOutputDto>(total, await MapToGetListOutputDtosAsync(entities));
}
[NonAction]
public override Task<LoginLogGetListOutputDto> UpdateAsync(long id, LoginLogGetListOutputDto input)
{
return base.UpdateAsync(id, input);
}
}
}

View File

@@ -1,8 +1,8 @@
using SqlSugar;
using Yi.Framework.Infrastructure.Ddd.Dtos;
using Yi.Framework.Infrastructure.Ddd.Services;
using Yi.Furion.Application.Rbac.Dtos.Menu;
using Yi.Furion.Application.Rbac.Services;
using Yi.Furion.Core.Rbac.Dtos.Menu;
using Yi.Furion.Core.Rbac.Entities;
namespace Yi.Furion.Application.Rbac.Services.Impl

View File

@@ -1,7 +1,7 @@
using SqlSugar;
using Yi.Framework.Infrastructure.Ddd.Dtos;
using Yi.Framework.Infrastructure.Ddd.Services;
using Yi.Furion.Application.Rbac.Dtos.Post;
using Yi.Furion.Core.Rbac.Dtos.Post;
using Yi.Furion.Core.Rbac.Entities;
namespace Yi.Furion.Application.Rbac.Services.Impl

View File

@@ -2,7 +2,7 @@ using SqlSugar;
using Yi.Framework.Infrastructure.Ddd.Dtos;
using Yi.Framework.Infrastructure.Ddd.Services;
using Yi.Furion.Application.Rbac.Domain;
using Yi.Furion.Application.Rbac.Dtos.Role;
using Yi.Furion.Core.Rbac.Dtos.Role;
using Yi.Furion.Core.Rbac.Entities;
namespace Yi.Furion.Application.Rbac.Services.Impl

View File

@@ -5,8 +5,8 @@ using Yi.Framework.Infrastructure.Ddd.Services;
using Yi.Framework.Infrastructure.Exceptions;
using Yi.Framework.Module.OperLogManager;
using Yi.Furion.Application.Rbac.Domain;
using Yi.Furion.Application.Rbac.Dtos.User;
using Yi.Furion.Core.Rbac.ConstClasses;
using Yi.Furion.Core.Rbac.Consts;
using Yi.Furion.Core.Rbac.Dtos.User;
using Yi.Furion.Core.Rbac.Entities;
using Yi.Furion.Sqlsugar.Core.Repositories;