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

@@ -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;