Browse Source

修改通知模块和ES

pull/10/head
王军 4 years ago
parent
commit
f06b912cb5
  1. 20
      aspnet-core/CompanyName.ProjectName.sln
  2. 22
      aspnet-core/Directory.Build.props
  3. 10
      aspnet-core/frameworks/ElasticSearch/src/Lion.Abp.ElasticSearch/Lion.Abp.ElasticSearch.csproj
  4. 9
      aspnet-core/frameworks/ElasticSearch/src/Lion.Abp.ElasticSearch/LionAbpElasticSearchModule.cs
  5. 18
      aspnet-core/modules/NotificationManagement/src/CompanyName.ProjectName.NotificationManagement.Application.Contracts/Notifications/INotificationAppService.cs
  6. 31
      aspnet-core/modules/NotificationManagement/src/CompanyName.ProjectName.NotificationManagement.Application.Contracts/Notifications/IQueryNotificationAppService.cs
  7. 4
      aspnet-core/modules/NotificationManagement/src/CompanyName.ProjectName.NotificationManagement.Application/Notifications/DistributedEventHandlers/NotificationCreatedDistributedEventHandler.cs
  8. 52
      aspnet-core/modules/NotificationManagement/src/CompanyName.ProjectName.NotificationManagement.Application/Notifications/NotificationAppService.cs
  9. 68
      aspnet-core/modules/NotificationManagement/src/CompanyName.ProjectName.NotificationManagement.Application/Notifications/QueryNotificationAppService.cs
  10. 9
      aspnet-core/modules/NotificationManagement/src/CompanyName.ProjectName.NotificationManagement.HttpApi/Notifications/NotificationController.cs
  11. 10
      aspnet-core/services/host/CompanyName.ProjectName.HttpApi.Host/Extensions/SerilogToEsExtensions.cs
  12. 8
      aspnet-core/services/host/CompanyName.ProjectName.HttpApi.Host/appsettings.Development.json
  13. 1
      aspnet-core/services/src/CompanyName.ProjectName.Application.Contracts/CompanyName.ProjectName.Application.Contracts.csproj
  14. 17
      aspnet-core/services/src/CompanyName.ProjectName.Application.Contracts/ElasticSearchs/ICompanyNameProjectNameLogAppService.cs
  15. 2
      aspnet-core/services/src/CompanyName.ProjectName.Application.Contracts/Permissions/ProjectNamePermissionDefinitionProvider.cs
  16. 6
      aspnet-core/services/src/CompanyName.ProjectName.Application.Contracts/Roles/IRoleAppService.cs
  17. 14
      aspnet-core/services/src/CompanyName.ProjectName.Application.Contracts/Roles/IRolePermissionAppService.cs
  18. 0
      aspnet-core/services/src/CompanyName.ProjectName.Application.Contracts/Settings/Dtos/UpdateSettingInput.cs
  19. 22
      aspnet-core/services/src/CompanyName.ProjectName.Application.Contracts/Settings/ISettingAppService.cs
  20. 2
      aspnet-core/services/src/CompanyName.ProjectName.Application.Contracts/Users/IAccountAppService.cs
  21. 7
      aspnet-core/services/src/CompanyName.ProjectName.Application.Contracts/Users/IUserAppService.cs
  22. 22
      aspnet-core/services/src/CompanyName.ProjectName.Application/ElasticSearchs/CompanyNameProjectNameLogAppService.cs
  23. 4
      aspnet-core/services/src/CompanyName.ProjectName.Application/ProjectNameApplicationModule.cs
  24. 148
      aspnet-core/services/src/CompanyName.ProjectName.Application/Roles/RoleAppService.cs
  25. 149
      aspnet-core/services/src/CompanyName.ProjectName.Application/Roles/RolePermissionAppService.cs
  26. 28
      aspnet-core/services/src/CompanyName.ProjectName.Application/Settings/SettingAppService.cs
  27. 4
      aspnet-core/services/src/CompanyName.ProjectName.Application/Users/AccountAppService.cs
  28. 11
      aspnet-core/services/src/CompanyName.ProjectName.Application/Users/UserAppService.cs
  29. 1
      aspnet-core/services/src/CompanyName.ProjectName.Domain.Shared/Localization/ProjectName/en.json
  30. 1
      aspnet-core/services/src/CompanyName.ProjectName.Domain.Shared/Localization/ProjectName/zh-Hans.json
  31. 16
      aspnet-core/services/src/CompanyName.ProjectName.ElasticsearchRepository/CompanyName.ProjectName.ElasticsearchRepository.csproj
  32. 69
      aspnet-core/services/src/CompanyName.ProjectName.ElasticsearchRepository/CompanyNameProjectNameLogRepository.cs
  33. 14
      aspnet-core/services/src/CompanyName.ProjectName.ElasticsearchRepository/Dto/PagingElasticSearchLogInput.cs
  34. 27
      aspnet-core/services/src/CompanyName.ProjectName.ElasticsearchRepository/Dto/PagingElasticSearchLogOutput.cs
  35. 2
      aspnet-core/services/src/CompanyName.ProjectName.ElasticsearchRepository/ElasticsearchBasicRepository.cs
  36. 2
      aspnet-core/services/src/CompanyName.ProjectName.ElasticsearchRepository/ElasticsearchProvider.cs
  37. 17
      aspnet-core/services/src/CompanyName.ProjectName.ElasticsearchRepository/ICompanyNameProjectNameLogRepository.cs
  38. 2
      aspnet-core/services/src/CompanyName.ProjectName.ElasticsearchRepository/IElasticsearchProvider.cs
  39. 10
      aspnet-core/services/src/CompanyName.ProjectName.ElasticsearchRepository/ProjectNameElasticSearchModule.cs
  40. 12
      aspnet-core/services/src/CompanyName.ProjectName.HttpApi/Controllers/Systems/AccountController.cs
  41. 30
      aspnet-core/services/src/CompanyName.ProjectName.HttpApi/Controllers/Systems/CompanyNameProjectNameLogController.cs
  42. 13
      aspnet-core/services/src/CompanyName.ProjectName.HttpApi/Controllers/Systems/PermissionController.cs
  43. 8
      aspnet-core/services/src/CompanyName.ProjectName.HttpApi/Controllers/Systems/RoleController.cs
  44. 16
      aspnet-core/services/src/CompanyName.ProjectName.HttpApi/Controllers/Systems/SettingController.cs
  45. 10
      aspnet-core/services/src/CompanyName.ProjectName.HttpApi/Controllers/Systems/UserController.cs
  46. 2
      vben271/nswag/nswag.json
  47. 28
      vben271/src/router/routes/modules/admin.ts
  48. 1416
      vben271/src/services/ServiceProxies.ts
  49. 6
      vben271/src/views/admin/elasticSearch/ElasticSearch.ts

20
aspnet-core/CompanyName.ProjectName.sln

@ -127,12 +127,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CompanyName.ProjectName.Sha
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CompanyName.ProjectName.Shared.Hosting.Gateways", "shared\CompanyName.ProjectName.Shared.Hosting.Gateways\CompanyName.ProjectName.Shared.Hosting.Gateways.csproj", "{C018EFF9-579E-43B3-9181-543BE95E2E03}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ElasticSearch", "ElasticSearch", "{3F507591-5C8A-49A7-AB0A-043B64B7EC41}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{1A57338B-65B1-4B8F-ABBD-83F4E8321D8F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lion.Abp.ElasticSearch", "frameworks\ElasticSearch\src\Lion.Abp.ElasticSearch\Lion.Abp.ElasticSearch.csproj", "{48D938A1-36E4-4AC1-9AF2-645CB75D4A05}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lion.Abp.Cap", "frameworks\CAP\src\Lion.Abp.Cap\Lion.Abp.Cap.csproj", "{800F4482-EAC3-472B-AF07-53980D47AA41}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lion.Abp.Extension", "frameworks\Extensions\src\Lion.Abp.Extension\Lion.Abp.Extension.csproj", "{6848FA46-EFFF-4E0C-8EAA-145D8C440333}"
@ -143,6 +137,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CompanyName.ProjectName.Web
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CompanyName.ProjectName.FreeSqlRepository", "services\src\CompanyName.ProjectName.FreeSqlRepository\CompanyName.ProjectName.FreeSqlRepository.csproj", "{FC30B17B-F671-4E55-90C6-9F37E40B483D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CompanyName.ProjectName.ElasticsearchRepository", "services\src\CompanyName.ProjectName.ElasticsearchRepository\CompanyName.ProjectName.ElasticsearchRepository.csproj", "{5910B07F-1520-45D6-A15F-7A3E0698BE18}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -309,10 +305,6 @@ Global
{C018EFF9-579E-43B3-9181-543BE95E2E03}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C018EFF9-579E-43B3-9181-543BE95E2E03}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C018EFF9-579E-43B3-9181-543BE95E2E03}.Release|Any CPU.Build.0 = Release|Any CPU
{48D938A1-36E4-4AC1-9AF2-645CB75D4A05}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{48D938A1-36E4-4AC1-9AF2-645CB75D4A05}.Debug|Any CPU.Build.0 = Debug|Any CPU
{48D938A1-36E4-4AC1-9AF2-645CB75D4A05}.Release|Any CPU.ActiveCfg = Release|Any CPU
{48D938A1-36E4-4AC1-9AF2-645CB75D4A05}.Release|Any CPU.Build.0 = Release|Any CPU
{800F4482-EAC3-472B-AF07-53980D47AA41}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{800F4482-EAC3-472B-AF07-53980D47AA41}.Debug|Any CPU.Build.0 = Debug|Any CPU
{800F4482-EAC3-472B-AF07-53980D47AA41}.Release|Any CPU.ActiveCfg = Release|Any CPU
@ -329,6 +321,10 @@ Global
{FC30B17B-F671-4E55-90C6-9F37E40B483D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FC30B17B-F671-4E55-90C6-9F37E40B483D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FC30B17B-F671-4E55-90C6-9F37E40B483D}.Release|Any CPU.Build.0 = Release|Any CPU
{5910B07F-1520-45D6-A15F-7A3E0698BE18}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5910B07F-1520-45D6-A15F-7A3E0698BE18}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5910B07F-1520-45D6-A15F-7A3E0698BE18}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5910B07F-1520-45D6-A15F-7A3E0698BE18}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -388,13 +384,11 @@ Global
{FB1C29FF-5467-4CF0-995D-5B3F931AB135} = {8C1B8C6C-C518-4290-B070-622CCA6004DA}
{A091AE9B-3A1E-49AC-9AD5-D29310512A3D} = {6434E3F2-B352-4B30-839A-88C2BA166D96}
{C018EFF9-579E-43B3-9181-543BE95E2E03} = {6434E3F2-B352-4B30-839A-88C2BA166D96}
{3F507591-5C8A-49A7-AB0A-043B64B7EC41} = {CC2EBB07-A070-4158-AB37-A0C0BBAEA9F5}
{1A57338B-65B1-4B8F-ABBD-83F4E8321D8F} = {3F507591-5C8A-49A7-AB0A-043B64B7EC41}
{48D938A1-36E4-4AC1-9AF2-645CB75D4A05} = {1A57338B-65B1-4B8F-ABBD-83F4E8321D8F}
{800F4482-EAC3-472B-AF07-53980D47AA41} = {11ED8435-B5AE-4BF3-9D4B-51FA1E4A18A6}
{6848FA46-EFFF-4E0C-8EAA-145D8C440333} = {C4AC9352-C9F5-4096-8D73-13638232CFB9}
{D9108313-8D05-4F5F-9AA0-B443EC3374B6} = {5C304CBC-F30D-413C-A0AF-8B6814A2D4A3}
{FC30B17B-F671-4E55-90C6-9F37E40B483D} = {CA9AC87F-097E-4F15-8393-4BC07735A5B0}
{5910B07F-1520-45D6-A15F-7A3E0698BE18} = {CA9AC87F-097E-4F15-8393-4BC07735A5B0}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {28315BFD-90E7-4E14-A2EA-F3D23AF4126F}

22
aspnet-core/Directory.Build.props

@ -3,6 +3,28 @@
<PropertyGroup>
<AbpPackageVersion>4.4.0</AbpPackageVersion>
<DotNetCoreCAP>5.1.4</DotNetCoreCAP>
<DotNetCoreCAPVersion>5.1.4</DotNetCoreCAPVersion>
<MicrosoftVersion>5.0.12</MicrosoftVersion>
<EasyAbpSttingVersion>1.5.0</EasyAbpSttingVersion>
<SerilogVersion>2.10.0</SerilogVersion>
<SerilogExtensionsLoggingVersion>3.0.1</SerilogExtensionsLoggingVersion>
<SerilogSinksAsyncVersion>1.4.0</SerilogSinksAsyncVersion>
<SerilogSinksFileVersion>5.0.0</SerilogSinksFileVersion>
<SerilogSinksConsoleVersion>3.1.1</SerilogSinksConsoleVersion>
<SerilogAspNetCoreVersion>4.1.0</SerilogAspNetCoreVersion>
<SerilogExceptionsVersion>7.0.0</SerilogExceptionsVersion>
<SerilogSettingsConfigurationVersion>3.1.0</SerilogSettingsConfigurationVersion>
<SerilogSinksElasticsearchVersion>8.4.1</SerilogSinksElasticsearchVersion>
<NESTVersion>7.14.1</NESTVersion>
<HangfireMySqlStorageVersion>2.0.3</HangfireMySqlStorageVersion>
<SwashbuckleAspNetCoreAnnotationsVersion>6.1.4</SwashbuckleAspNetCoreAnnotationsVersion>
<MicrosoftNETTestSdkVersion>16.9.1</MicrosoftNETTestSdkVersion>
<NSubstituteVersion>4.2.2</NSubstituteVersion>
<ShouldlyVersion>4.0.3</ShouldlyVersion>
<XunitVersion>2.4.1</XunitVersion>
<Xunitrunnervisualstudio>2.4.3</Xunitrunnervisualstudio>
<OcelotVersion>17.0.0</OcelotVersion>
<SwaggerUIVersion>6.2.3</SwaggerUIVersion>
</PropertyGroup>
</Project>

10
aspnet-core/frameworks/ElasticSearch/src/Lion.Abp.ElasticSearch/Lion.Abp.ElasticSearch.csproj

@ -1,10 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="NEST" Version="7.14.1" />
<PackageReference Include="Volo.Abp.Ddd.Domain" Version="4.4.0" />
</ItemGroup>
</Project>

9
aspnet-core/frameworks/ElasticSearch/src/Lion.Abp.ElasticSearch/LionAbpElasticSearchModule.cs

@ -1,9 +0,0 @@
using System;
using Volo.Abp.Modularity;
namespace Lion.Abp.ElasticSearch
{
public class LionAbpElasticSearchModule : AbpModule
{
}
}

18
aspnet-core/modules/NotificationManagement/src/CompanyName.ProjectName.NotificationManagement.Application.Contracts/Notifications/INotificationAppService.cs

@ -1,6 +1,8 @@
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using CompanyName.ProjectName.NotificationManagement.Notifications.Dtos;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;
namespace CompanyName.ProjectName.NotificationManagement.Notifications
@ -27,5 +29,21 @@ namespace CompanyName.ProjectName.NotificationManagement.Notifications
/// <param name="input"></param>
/// <returns></returns>
Task CreateAsync(CreateNotificationInput input);
/// <summary>
/// 分页获取用户普通文本消息
/// </summary>
/// <param name="listInput"></param>
/// <returns></returns>
Task<PagedResultDto<PagingNotificationListOutput>> GetPageTextNotificationByUserIdAsync(
PagingNotificationListInput listInput);
/// <summary>
/// 分页获取广播消息
/// </summary>
/// <param name="listInput"></param>
/// <returns></returns>
Task<PagedResultDto<PagingNotificationListOutput>> GetPageBroadCastNotificationByUserIdAsync(
PagingNotificationListInput listInput);
}
}

31
aspnet-core/modules/NotificationManagement/src/CompanyName.ProjectName.NotificationManagement.Application.Contracts/Notifications/IQueryNotificationAppService.cs

@ -1,31 +0,0 @@
using System.Threading;
using System.Threading.Tasks;
using CompanyName.ProjectName.NotificationManagement.Notifications.Dtos;
using Volo.Abp.Application.Services;
using Volo.Abp.Application.Dtos;
namespace CompanyName.ProjectName.NotificationManagement.Notifications
{
public interface IQueryNotificationAppService : IApplicationService
{
/// <summary>
/// 分页获取用户普通文本消息
/// </summary>
/// <param name="listInput"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
Task<PagedResultDto<PagingNotificationListOutput>> GetPageTextNotificationByUserIdAsync(
PagingNotificationListInput listInput,
CancellationToken cancellationToken = default);
/// <summary>
/// 分页获取广播消息
/// </summary>
/// <param name="listInput"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
Task<PagedResultDto<PagingNotificationListOutput>> GetPageBroadCastNotificationByUserIdAsync(
PagingNotificationListInput listInput,
CancellationToken cancellationToken = default);
}
}

4
aspnet-core/modules/NotificationManagement/src/CompanyName.ProjectName.NotificationManagement.Application/Notifications/DistributedEventHandlers/NotificationCreatedDistributedEventHandler.cs

@ -9,8 +9,8 @@ namespace CompanyName.ProjectName.NotificationManagement.Notifications.Distribut
/// <summary>
/// 创建消息事件处理
/// </summary>
public class
NotificationCreatedDistributedEventHandler : IDistributedEventHandler<CreatedNotificationDistributedEvent>,
public class NotificationCreatedDistributedEventHandler :
IDistributedEventHandler<CreatedNotificationDistributedEvent>,
ITransientDependency
{
private readonly INotificationAppService _hubAppService;

52
aspnet-core/modules/NotificationManagement/src/CompanyName.ProjectName.NotificationManagement.Application/Notifications/NotificationAppService.cs

@ -5,6 +5,7 @@ using CompanyName.ProjectName.NotificationManagement.Hubs;
using CompanyName.ProjectName.NotificationManagement.Notifications.Dtos;
using Microsoft.AspNetCore.SignalR;
using Volo.Abp;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Users;
namespace CompanyName.ProjectName.NotificationManagement.Notifications
@ -14,14 +15,17 @@ namespace CompanyName.ProjectName.NotificationManagement.Notifications
private readonly IHubContext<NotificationHub, INotificationHub> _hubContext;
private readonly NotificationManager _notificationManager;
private readonly ICurrentUser _currentUser;
private readonly IDapperNotificationRepository _dapperNotificationRepository;
public NotificationAppService(
IHubContext<NotificationHub, INotificationHub> hubContext, NotificationManager notificationManager,
ICurrentUser currentUser)
IHubContext<NotificationHub, INotificationHub> hubContext,
NotificationManager notificationManager,
ICurrentUser currentUser,
IDapperNotificationRepository dapperNotificationRepository)
{
_hubContext = hubContext;
_notificationManager = notificationManager;
_currentUser = currentUser;
_dapperNotificationRepository = dapperNotificationRepository;
}
public Task SetReadAsync(SetReadInput input)
@ -54,6 +58,47 @@ namespace CompanyName.ProjectName.NotificationManagement.Notifications
}
}
/// <summary>
/// 分页获取用户普通文本消息
/// </summary>
/// <param name="listInput"></param>
/// <returns></returns>
public async Task<PagedResultDto<PagingNotificationListOutput>> GetPageTextNotificationByUserIdAsync(
PagingNotificationListInput listInput)
{
if (!_currentUser.Id.HasValue)
{
return null;
}
var totalCount =
await _dapperNotificationRepository.GetPageTextNotificationCountByUserIdAsync(_currentUser.Id.Value);
var list = await _dapperNotificationRepository.GetPageTextNotificationByUserIdAsync(_currentUser.Id.Value,
listInput.PageSize,
listInput.SkipCount);
return new PagedResultDto<PagingNotificationListOutput>(totalCount, list);
}
/// <summary>
/// 分页获取广播消息
/// </summary>
/// <param name="listInput"></param>
/// <returns></returns>
public async Task<PagedResultDto<PagingNotificationListOutput>> GetPageBroadCastNotificationByUserIdAsync(
PagingNotificationListInput listInput)
{
if (!_currentUser.Id.HasValue)
{
return null;
}
var totalCount =
await _dapperNotificationRepository.GetPageBroadCastNotificationCountByUserIdAsync(_currentUser.Id.Value);
var list = await _dapperNotificationRepository.GetPageBroadCastNotificationByUserIdAsync(_currentUser.Id.Value,
listInput.PageSize,
listInput.SkipCount);
return new PagedResultDto<PagingNotificationListOutput>(totalCount, list);
}
/// <summary>
/// 发送消息指定客户端用户
@ -82,5 +127,6 @@ namespace CompanyName.ProjectName.NotificationManagement.Notifications
await _hubContext.Clients.All.ReceiveBroadCastMessageAsync(sendNotificationDto);
}
}
}

68
aspnet-core/modules/NotificationManagement/src/CompanyName.ProjectName.NotificationManagement.Application/Notifications/QueryNotificationAppService.cs

@ -1,68 +0,0 @@
using System.Threading;
using System.Threading.Tasks;
using CompanyName.ProjectName.NotificationManagement.Notifications.Dtos;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Users;
namespace CompanyName.ProjectName.NotificationManagement.Notifications
{
public class QueryNotificationAppService : NotificationManagementAppService, IQueryNotificationAppService
{
private readonly IDapperNotificationRepository _dapperNotificationRepository;
private readonly ICurrentUser _currentUser;
public QueryNotificationAppService(IDapperNotificationRepository dapperNotificationRepository, ICurrentUser currentUser)
{
_dapperNotificationRepository = dapperNotificationRepository;
_currentUser = currentUser;
}
/// <summary>
/// 分页获取用户普通文本消息
/// </summary>
/// <param name="listInput"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public async Task<PagedResultDto<PagingNotificationListOutput>> GetPageTextNotificationByUserIdAsync(
PagingNotificationListInput listInput,
CancellationToken cancellationToken = default)
{
if (!_currentUser.Id.HasValue)
{
return null;
}
var totalCount =
await _dapperNotificationRepository.GetPageTextNotificationCountByUserIdAsync(_currentUser.Id.Value, cancellationToken);
var list = await _dapperNotificationRepository.GetPageTextNotificationByUserIdAsync(_currentUser.Id.Value,
listInput.PageSize,
listInput.SkipCount, cancellationToken);
return new PagedResultDto<PagingNotificationListOutput>(totalCount, list);
}
/// <summary>
/// 分页获取广播消息
/// </summary>
/// <param name="listInput"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public async Task<PagedResultDto<PagingNotificationListOutput>> GetPageBroadCastNotificationByUserIdAsync(
PagingNotificationListInput listInput,
CancellationToken cancellationToken = default)
{
if (!_currentUser.Id.HasValue)
{
return null;
}
var totalCount =
await _dapperNotificationRepository.GetPageBroadCastNotificationCountByUserIdAsync(_currentUser.Id.Value,
cancellationToken);
var list = await _dapperNotificationRepository.GetPageBroadCastNotificationByUserIdAsync(_currentUser.Id.Value,
listInput.PageSize,
listInput.SkipCount, cancellationToken);
return new PagedResultDto<PagingNotificationListOutput>(totalCount, list);
}
}
}

9
aspnet-core/modules/NotificationManagement/src/CompanyName.ProjectName.NotificationManagement.HttpApi/Notifications/NotificationController.cs

@ -11,13 +11,12 @@ namespace CompanyName.ProjectName.NotificationManagement.Notifications
[Route("Notification")]
public class NotificationController : AbpController, IApplicationService
{
private readonly IQueryNotificationAppService _queryNotificationAppService;
private readonly INotificationAppService _notificationAppService;
public NotificationController(IQueryNotificationAppService queryNotificationAppService,
public NotificationController(
INotificationAppService notificationAppService)
{
_queryNotificationAppService = queryNotificationAppService;
_notificationAppService = notificationAppService;
}
@ -32,7 +31,7 @@ namespace CompanyName.ProjectName.NotificationManagement.Notifications
public Task<PagedResultDto<PagingNotificationListOutput>> GetPageTextNotificationByUserIdAsync(
PagingNotificationListInput listInput)
{
return _queryNotificationAppService.GetPageTextNotificationByUserIdAsync(listInput);
return _notificationAppService.GetPageTextNotificationByUserIdAsync(listInput);
}
/// <summary>
@ -45,7 +44,7 @@ namespace CompanyName.ProjectName.NotificationManagement.Notifications
public Task<PagedResultDto<PagingNotificationListOutput>> GetPageBroadCastNotificationByUserIdAsync(
PagingNotificationListInput listInput)
{
return _queryNotificationAppService.GetPageBroadCastNotificationByUserIdAsync(listInput);
return _notificationAppService.GetPageBroadCastNotificationByUserIdAsync(listInput);
}
[HttpPost("Read")]

10
aspnet-core/services/host/CompanyName.ProjectName.HttpApi.Host/Extensions/SerilogToEsExtensions.cs

@ -31,7 +31,7 @@ namespace CompanyName.ProjectName.Extensions
loggerConfiguration.WriteTo.File("logs/logs.txt", rollingInterval: RollingInterval.Day);
}
loggerConfiguration.WriteTo.File("logs/logs.txt", rollingInterval: RollingInterval.Day);
var writeToElasticSearch = configuration.GetValue("LogToElasticSearch:Enabled", false);
var writeToElasticSearch = configuration.GetValue("ElasticSearch:Enabled", false);
// LogToElasticSearch:Enabled = true 才输出至ES
@ -40,20 +40,20 @@ namespace CompanyName.ProjectName.Extensions
var applicationName = "CompanyName.ProjectName.HttpApi.Host";
var esUrl = configuration["LogToElasticSearch:ElasticSearch:Url"];
var esUrl = configuration["ElasticSearch:Url"];
// 需要设置ES URL
if (string.IsNullOrEmpty(esUrl))
return;
var indexFormat = configuration["LogToElasticSearch:ElasticSearch:IndexFormat"];
var indexFormat = configuration["ElasticSearch:IndexFormat"];
// 需要设置ES URL
if (string.IsNullOrEmpty(indexFormat))
return;
var esUserName = configuration["LogToElasticSearch:ElasticSearch:UserName"];
var esPassword = configuration["LogToElasticSearch:ElasticSearch:Password"];
var esUserName = configuration["ElasticSearch:UserName"];
var esPassword = configuration["ElasticSearch:Password"];
loggerConfiguration.Enrich.FromLogContext().Enrich.WithExceptionDetails().WriteTo
.Elasticsearch(BuildElasticSearchSinkOptions(esUrl, indexFormat, esUserName, esPassword));

8
aspnet-core/services/host/CompanyName.ProjectName.HttpApi.Host/appsettings.Development.json

@ -38,15 +38,13 @@
"Password": "admin"
}
},
"LogToElasticSearch": {
"Enabled": "false",
"ElasticSearch": {
"Enabled": "false",
"Url": "http://es.cn",
"IndexFormat": "companyname.projectname.development",
"IndexFormat": "companyname.projectname.development.{0:yyyy.MM.dd}",
"UserName": "elastic",
"Password": "aVVhjQ95RP7nbwNy",
"DashboardIndex": "companyname.projectname"
}
"SearchIndexFormat": "companyname.projectname.development.*"
},
"HttpClient": {
"Sts": {

1
aspnet-core/services/src/CompanyName.ProjectName.Application.Contracts/CompanyName.ProjectName.Application.Contracts.csproj

@ -10,6 +10,7 @@
<ItemGroup>
<ProjectReference Include="..\..\..\modules\DataDictionaryManagement\src\CompanyName.ProjectName.DataDictionaryManagement.Application.Contracts\CompanyName.ProjectName.DataDictionaryManagement.Application.Contracts.csproj" />
<ProjectReference Include="..\CompanyName.ProjectName.Domain.Shared\CompanyName.ProjectName.Domain.Shared.csproj" />
<ProjectReference Include="..\CompanyName.ProjectName.ElasticsearchRepository\CompanyName.ProjectName.ElasticsearchRepository.csproj" />
</ItemGroup>
<ItemGroup>

17
aspnet-core/services/src/CompanyName.ProjectName.Application.Contracts/ElasticSearchs/ICompanyNameProjectNameLogAppService.cs

@ -0,0 +1,17 @@
using System.Threading.Tasks;
using CompanyName.ProjectName.ElasticsearchRepository.Dto;
using Lion.Abp.Extension;
using Volo.Abp.Application.Services;
namespace CompanyName.ProjectName.ElasticSearchs
{
public interface ICompanyNameProjectNameLogAppService : IApplicationService
{
/// <summary>
/// 分页查询es日志
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
Task<CustomePagedResultDto<PagingElasticSearchLogOutput>> PaingAsync(PagingElasticSearchLogInput input);
}
}

2
aspnet-core/services/src/CompanyName.ProjectName.Application.Contracts/Permissions/ProjectNamePermissionDefinitionProvider.cs

@ -22,6 +22,8 @@ namespace CompanyName.ProjectName.Permissions
var capManagement = abpIdentityGroup.AddPermission(ProjectNamePermissions.SystemManagement.Cap, L("Permission:CapManagement"));
var esManagement = abpIdentityGroup.AddPermission(ProjectNamePermissions.SystemManagement.ES, L("Permission:ESManagement"));
#region IdentityServer
// multiTenancySide: MultiTenancySides.Host 只有host租户才有权限

6
aspnet-core/services/src/CompanyName.ProjectName.Application.Contracts/Roles/IRoleAppService.cs

@ -1,6 +1,7 @@
using System;
using System.Threading.Tasks;
using CompanyName.ProjectName.Roles.Dtos;
using Lion.Abp.Extension;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;
using Volo.Abp.Identity;
@ -17,10 +18,7 @@ namespace CompanyName.ProjectName.Roles
Task<IdentityRoleDto> UpdateAsync(UpdateRoleInput input);
Task DeleteAsync(Guid id);
Task DeleteAsync(IdInput input);
Task<PermissionOutput> GetPermissionAsync(GetPermissionInput input);
Task UpdatePermissionAsync(UpdateRolePermissionsInput input);
}
}

14
aspnet-core/services/src/CompanyName.ProjectName.Application.Contracts/Roles/IRolePermissionAppService.cs

@ -0,0 +1,14 @@
using System.Threading.Tasks;
using CompanyName.ProjectName.Roles.Dtos;
using Volo.Abp.Application.Services;
namespace CompanyName.ProjectName.Roles
{
public interface IRolePermissionAppService : IApplicationService
{
Task<PermissionOutput> GetPermissionAsync(GetPermissionInput input);
Task UpdatePermissionAsync(UpdateRolePermissionsInput input);
}
}

0
aspnet-core/services/src/CompanyName.ProjectName.Application.Contracts/Settings/UpdateSettingInput.cs → aspnet-core/services/src/CompanyName.ProjectName.Application.Contracts/Settings/Dtos/UpdateSettingInput.cs

22
aspnet-core/services/src/CompanyName.ProjectName.Application.Contracts/Settings/ISettingAppService.cs

@ -0,0 +1,22 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using EasyAbp.Abp.SettingUi.Dto;
using Volo.Abp.Application.Services;
namespace CompanyName.ProjectName.Settings
{
public interface ISettingAppService : IApplicationService
{
/// <summary>
/// 获取setting信息
/// </summary>
/// <returns></returns>
Task<List<SettingGroup>> GetAsync();
/// <summary>
/// 更新setting
/// </summary>
/// <returns></returns>
Task UpdateAsync(UpdateSettingInput input);
}
}

2
aspnet-core/services/src/CompanyName.ProjectName.Application.Contracts/Users/ILoginAppService.cs → aspnet-core/services/src/CompanyName.ProjectName.Application.Contracts/Users/IAccountAppService.cs

@ -7,7 +7,7 @@ using Volo.Abp.Application.Services;
namespace CompanyName.ProjectName.Users
{
public interface ILoginAppService: IApplicationService
public interface IAccountAppService: IApplicationService
{
Task<LoginOutput> LoginAsync(LoginInput input);

7
aspnet-core/services/src/CompanyName.ProjectName.Application.Contracts/Users/IUserAppService.cs

@ -1,6 +1,7 @@
using System;
using System.Threading.Tasks;
using CompanyName.ProjectName.Users.Dtos;
using Lion.Abp.Extension;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;
using Volo.Abp.Identity;
@ -33,16 +34,14 @@ namespace CompanyName.ProjectName.Users
/// <summary>
/// 删除用户
/// </summary>
/// <param name="id"></param>
Task DeleteAsync(Guid id);
Task DeleteAsync(IdInput input);
/// <summary>
/// 获取用户角色信息
/// </summary>
/// <param name="userId"></param>
/// <returns></returns>
Task<ListResultDto<IdentityRoleDto>> GetRoleByUserId(Guid userId);
Task<ListResultDto<IdentityRoleDto>> GetRoleByUserId(IdInput input);
/// <summary>
/// 修改密码

22
aspnet-core/services/src/CompanyName.ProjectName.Application/ElasticSearchs/CompanyNameProjectNameLogAppService.cs

@ -0,0 +1,22 @@
using System.Threading.Tasks;
using CompanyName.ProjectName.ElasticsearchRepository;
using CompanyName.ProjectName.ElasticsearchRepository.Dto;
using Lion.Abp.Extension;
namespace CompanyName.ProjectName.ElasticSearchs
{
public class CompanyNameProjectNameLogAppService:ProjectNameAppService,ICompanyNameProjectNameLogAppService
{
private readonly ICompanyNameProjectNameLogRepository _companyNameProjectNameLogRepository;
public CompanyNameProjectNameLogAppService(ICompanyNameProjectNameLogRepository companyNameProjectNameLogRepository)
{
_companyNameProjectNameLogRepository = companyNameProjectNameLogRepository;
}
public Task<CustomePagedResultDto<PagingElasticSearchLogOutput>> PaingAsync(PagingElasticSearchLogInput input)
{
return _companyNameProjectNameLogRepository.PaingAsync(input);
}
}
}

4
aspnet-core/services/src/CompanyName.ProjectName.Application/ProjectNameApplicationModule.cs

@ -1,4 +1,5 @@
using CompanyName.ProjectName.DataDictionaryManagement;
using CompanyName.ProjectName.ElasticsearchRepository;
using CompanyName.ProjectName.FreeSqlRepository;
using CompanyName.ProjectName.NotificationManagement;
using EasyAbp.Abp.SettingUi;
@ -27,7 +28,8 @@ namespace CompanyName.ProjectName
typeof(DataDictionaryManagementApplicationModule),
typeof(NotificationManagementApplicationModule),
typeof(AbpSettingUiApplicationModule),
typeof(FreeSqlRepositoryModule)
typeof(FreeSqlRepositoryModule),
typeof(ProjectNameElasticSearchModule)
)]
public class ProjectNameApplicationModule : AbpModule
{

148
aspnet-core/services/src/CompanyName.ProjectName.Application/Roles/RoleAppService.cs

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using CompanyName.ProjectName.Roles.Dtos;
using Lion.Abp.Extension;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;
using Volo.Abp.Identity;
@ -13,14 +14,15 @@ namespace CompanyName.ProjectName.Roles
public class RoleAppService : ProjectNameAppService, IRoleAppService
{
private readonly IIdentityRoleAppService _identityRoleAppService;
private readonly IPermissionAppService _permissionAppService;
private readonly IIdentityRoleRepository _roleRepository;
public RoleAppService(IIdentityRoleAppService identityRoleAppService,
IPermissionAppService permissionAppService, IIdentityRoleRepository roleRepository)
public RoleAppService(
IIdentityRoleAppService identityRoleAppService,
IIdentityRoleRepository roleRepository)
{
_identityRoleAppService = identityRoleAppService;
_permissionAppService = permissionAppService;
_roleRepository = roleRepository;
}
@ -31,7 +33,8 @@ namespace CompanyName.ProjectName.Roles
public async Task<ListResultDto<IdentityRoleDto>> AllListAsync()
{
List<IdentityRole> source =
await _roleRepository.GetListAsync().ConfigureAwait(continueOnCapturedContext: false);
await _roleRepository.GetListAsync()
.ConfigureAwait(continueOnCapturedContext: false);
return new ListResultDto<IdentityRoleDto>(
base.ObjectMapper.Map<List<IdentityRole>, List<IdentityRoleDto>>(source));
}
@ -45,13 +48,16 @@ namespace CompanyName.ProjectName.Roles
{
var request = new GetIdentityRolesInput
{
Filter = input.Filter?.Trim(), MaxResultCount = input.PageSize, SkipCount = input.SkipCount
Filter = input.Filter?.Trim(), MaxResultCount = input.PageSize,
SkipCount = input.SkipCount
};
List<IdentityRole> list = await _roleRepository
.GetListAsync(request.Sorting, request.MaxResultCount, request.SkipCount, request.Filter)
.GetListAsync(request.Sorting, request.MaxResultCount, request.SkipCount,
request.Filter)
.ConfigureAwait(continueOnCapturedContext: false);
return new PagedResultDto<IdentityRoleDto>(
await _roleRepository.GetCountAsync(request.Filter).ConfigureAwait(continueOnCapturedContext: false),
await _roleRepository.GetCountAsync(request.Filter)
.ConfigureAwait(continueOnCapturedContext: false),
base.ObjectMapper.Map<List<IdentityRole>, List<IdentityRoleDto>>(list));
}
@ -80,131 +86,9 @@ namespace CompanyName.ProjectName.Roles
/// <summary>
/// 删除角色
/// </summary>
/// <param name="id"></param>
public async Task DeleteAsync(Guid id)
{
await _identityRoleAppService.DeleteAsync(id);
}
/// <summary>
/// 获取所有权限
/// </summary>
/// <returns></returns>
public async Task<PermissionOutput> GetPermissionAsync(GetPermissionInput input)
{
var permissions = await _permissionAppService.GetAsync(input.ProviderName, input.ProviderKey);
return BuildTreeData(permissions.Groups);
}
/// <summary>
/// 更新权限
/// </summary>
/// <param name="input"></param>
public async Task UpdatePermissionAsync(UpdateRolePermissionsInput input)
public async Task DeleteAsync(IdInput input)
{
await _permissionAppService.UpdateAsync(input.ProviderName, input.ProviderKey, input.UpdatePermissionsDto);
}
/// <summary>
/// 生成权限树
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
private PermissionOutput BuildTreeData(List<PermissionGroupDto> input)
{
var result = new PermissionOutput();
var excludes = new List<string>
{
"AbpIdentity.Users.ManagePermissions",
"FeatureManagement",
"FeatureManagement.ManageHostFeatures",
// "AbpTenantManagement",
// "AbpTenantManagement.Tenants",
// "AbpTenantManagement.Tenants.Create",
// "AbpTenantManagement.Tenants.Update",
// "AbpTenantManagement.Tenants.Delete",
"AbpTenantManagement.Tenants.ManageFeatures",
// "AbpTenantManagement.Tenants.ManageConnectionStrings",
"SettingManagement",
"SettingManagement.Emailing",
"SettingUi"
};
var permissions = new List<PermissionTreeDto>();
foreach (var group in input)
{
if (excludes.Any(e => e == group.Name))
{
continue;
}
var groupPermission = new PermissionTreeDto {Key = @group.Name, Title = @group.DisplayName};
groupPermission.Key = group.Name;
groupPermission.Title =
group.Name == "AbpIdentity" ? L["Permission:SystemManagement"] : group.DisplayName;
foreach (var item in group.Permissions)
{
result.AllGrants.Add(item.Name);
if (item.IsGranted)
{
result.Grants.Add(item.Name);
}
//获取ParentName=null的权限
var management = group.Permissions.Where(e => e.ParentName.IsNullOrWhiteSpace()).ToList();
foreach (var managementItem in management)
{
if (groupPermission.Children.Any(e => e.Key == managementItem.Name))
{
continue;
}
{
var managementPermission = new PermissionTreeDto()
{
Key = managementItem.Name,
Title = managementItem.DisplayName
};
// 获取management下权限
var childrenPermission = @group.Permissions.Where(e => e.ParentName == managementItem.Name)
.ToList();
foreach (var childrenPermissionItem in childrenPermission)
{
managementPermission.Children.Add(new PermissionTreeDto()
{
Key = childrenPermissionItem.Name,
Title = childrenPermissionItem.DisplayName
});
}
groupPermission.Children.Add(managementPermission);
}
}
}
permissions.Add(groupPermission);
}
result.Permissions = permissions;
var settingUIPermisstion = "SettingUi.ShowSettingPage";
// https://github.com/EasyAbp/Abp.SettingUi/blob/develop/src/EasyAbp.Abp.SettingUi.Application/SettingUiAppService.cs
// 因为使用的SettingUI模块,想把权限添加到系统管理下
result.Permissions.First(e => e.Key == "AbpIdentity").Children.Add(new PermissionTreeDto()
{
Key = settingUIPermisstion,
Title = L["Permission:SettingUi:ShowSettingPage"]
});
result.AllGrants.Add(settingUIPermisstion);
var setting = input.First(e => e.Name == "SettingUi").Permissions.First(e => e.Name == settingUIPermisstion);
if (setting.IsGranted)
{
result.Grants.Add(settingUIPermisstion);
}
return result;
await _identityRoleAppService.DeleteAsync(input.Id);
}
}
}

149
aspnet-core/services/src/CompanyName.ProjectName.Application/Roles/RolePermissionAppService.cs

@ -0,0 +1,149 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using CompanyName.ProjectName.Roles.Dtos;
using Volo.Abp.PermissionManagement;
namespace CompanyName.ProjectName.Roles
{
public class RolePermissionAppService : ProjectNameAppService, IRolePermissionAppService
{
private readonly IPermissionAppService _rolePermissionAppService;
public RolePermissionAppService(IPermissionAppService rolePermissionAppService)
{
_rolePermissionAppService = rolePermissionAppService;
}
/// <summary>
/// 获取所有权限
/// </summary>
/// <returns></returns>
public async Task<PermissionOutput> GetPermissionAsync(GetPermissionInput input)
{
var permissions =
await _rolePermissionAppService.GetAsync(input.ProviderName, input.ProviderKey);
return BuildTreeData(permissions.Groups);
}
/// <summary>
/// 更新权限
/// </summary>
/// <param name="input"></param>
public async Task UpdatePermissionAsync(UpdateRolePermissionsInput input)
{
await _rolePermissionAppService.UpdateAsync(input.ProviderName, input.ProviderKey,
input.UpdatePermissionsDto);
}
/// <summary>
/// 生成权限树
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
private PermissionOutput BuildTreeData(List<PermissionGroupDto> input)
{
var result = new PermissionOutput();
var excludes = new List<string>
{
"AbpIdentity.Users.ManagePermissions",
"FeatureManagement",
"FeatureManagement.ManageHostFeatures",
// "AbpTenantManagement",
// "AbpTenantManagement.Tenants",
// "AbpTenantManagement.Tenants.Create",
// "AbpTenantManagement.Tenants.Update",
// "AbpTenantManagement.Tenants.Delete",
"AbpTenantManagement.Tenants.ManageFeatures",
// "AbpTenantManagement.Tenants.ManageConnectionStrings",
"SettingManagement",
"SettingManagement.Emailing",
"SettingUi"
};
var permissions = new List<PermissionTreeDto>();
foreach (var group in input)
{
if (excludes.Any(e => e == group.Name))
{
continue;
}
var groupPermission = new PermissionTreeDto
{ Key = @group.Name, Title = @group.DisplayName };
groupPermission.Key = group.Name;
groupPermission.Title =
group.Name == "AbpIdentity"
? L["Permission:SystemManagement"]
: group.DisplayName;
foreach (var item in group.Permissions)
{
result.AllGrants.Add(item.Name);
if (item.IsGranted)
{
result.Grants.Add(item.Name);
}
//获取ParentName=null的权限
var management = group.Permissions
.Where(e => string.IsNullOrWhiteSpace(e.ParentName)).ToList();
foreach (var managementItem in management)
{
if (groupPermission.Children.Any(e => e.Key == managementItem.Name))
{
continue;
}
{
var managementPermission = new PermissionTreeDto()
{
Key = managementItem.Name,
Title = managementItem.DisplayName
};
// 获取management下权限
var childrenPermission = @group.Permissions
.Where(e => e.ParentName == managementItem.Name)
.ToList();
foreach (var childrenPermissionItem in childrenPermission)
{
managementPermission.Children.Add(new PermissionTreeDto()
{
Key = childrenPermissionItem.Name,
Title = childrenPermissionItem.DisplayName
});
}
groupPermission.Children.Add(managementPermission);
}
}
}
permissions.Add(groupPermission);
}
result.Permissions = permissions;
var settingUIPermisstion = "SettingUi.ShowSettingPage";
// https://github.com/EasyAbp/Abp.SettingUi/blob/develop/src/EasyAbp.Abp.SettingUi.Application/SettingUiAppService.cs
// 因为使用的SettingUI模块,想把权限添加到系统管理下
result.Permissions.First(e => e.Key == "AbpIdentity").Children.Add(
new PermissionTreeDto()
{
Key = settingUIPermisstion,
Title = L["Permission:SettingUi:ShowSettingPage"]
});
result.AllGrants.Add(settingUIPermisstion);
var setting = input.First(e => e.Name == "SettingUi").Permissions
.First(e => e.Name == settingUIPermisstion);
if (setting.IsGranted)
{
result.Grants.Add(settingUIPermisstion);
}
return result;
}
}
}

28
aspnet-core/services/src/CompanyName.ProjectName.Application/Settings/SettingAppService.cs

@ -0,0 +1,28 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using EasyAbp.Abp.SettingUi;
using EasyAbp.Abp.SettingUi.Dto;
namespace CompanyName.ProjectName.Settings
{
public class SettingAppService : ProjectNameAppService, ISettingAppService
{
private readonly ISettingUiAppService _settingUiAppService;
public SettingAppService(ISettingUiAppService settingUiAppService)
{
_settingUiAppService = settingUiAppService;
}
public async Task<List<SettingGroup>> GetAsync()
{
return await _settingUiAppService.GroupSettingDefinitions();
}
public async Task UpdateAsync(UpdateSettingInput input)
{
await _settingUiAppService.SetSettingValues(input.Values);
}
}
}

4
aspnet-core/services/src/CompanyName.ProjectName.Application/Users/LoginAppService.cs → aspnet-core/services/src/CompanyName.ProjectName.Application/Users/AccountAppService.cs

@ -19,7 +19,7 @@ using Volo.Abp.Security.Claims;
namespace CompanyName.ProjectName.Users
{
public class LoginAppService : ProjectNameAppService, ILoginAppService
public class AccountAppService : ProjectNameAppService, IAccountAppService
{
private readonly IdentityUserManager _userManager;
private readonly JwtOptions _jwtOptions;
@ -29,7 +29,7 @@ namespace CompanyName.ProjectName.Users
private readonly IHttpContextAccessor _contextAccessor;
public LoginAppService(
public AccountAppService(
IdentityUserManager userManager,
IOptionsSnapshot<JwtOptions> jwtOptions,
Microsoft.AspNetCore.Identity.SignInManager<IdentityUser> signInManager,

11
aspnet-core/services/src/CompanyName.ProjectName.Application/Users/UserAppService.cs

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using CompanyName.ProjectName.Users.Dtos;
using Lion.Abp.Extension;
using Microsoft.AspNetCore.Identity;
using Volo.Abp;
using Volo.Abp.Application.Dtos;
@ -76,20 +77,18 @@ namespace CompanyName.ProjectName.Users
/// <summary>
/// 删除用户
/// </summary>
/// <param name="id"></param>
public virtual async Task DeleteAsync(Guid id)
public virtual async Task DeleteAsync(IdInput input)
{
await _identityUserAppService.DeleteAsync(id);
await _identityUserAppService.DeleteAsync(input.Id);
}
/// <summary>
/// 获取用户角色信息
/// </summary>
/// <param name="userId"></param>
/// <returns></returns>
public async Task<ListResultDto<IdentityRoleDto>> GetRoleByUserId(Guid userId)
public async Task<ListResultDto<IdentityRoleDto>> GetRoleByUserId(IdInput input)
{
return await _identityUserAppService.GetRolesAsync(userId);
return await _identityUserAppService.GetRolesAsync(input.Id);
}
/// <summary>

1
aspnet-core/services/src/CompanyName.ProjectName.Domain.Shared/Localization/ProjectName/en.json

@ -14,6 +14,7 @@
"Permission:AuditLogManagement": "AuditLog",
"Permission:HangfireManagement": "BackgroundTask",
"Permission:CapManagement": "IntegratedEvent",
"Permission:ESManagement": "ESManagement",
"Permission:IdentityServerManagement": "IdentityServer",
"Permission:IdentityServerManagement:Client": "Client",
"Permission:IdentityServerManagement:ApiResource": "ApiResource",

1
aspnet-core/services/src/CompanyName.ProjectName.Domain.Shared/Localization/ProjectName/zh-Hans.json

@ -14,6 +14,7 @@
"Permission:SystemManagement": "系统管理",
"Permission:HangfireManagement": "后台任务",
"Permission:CapManagement": "集成事件",
"Permission:ESManagement": "ES日志",
"Permission:IdentityServerManagement": "IdentityServer",
"Permission:IdentityServerManagement:Client": "客户端",
"Permission:IdentityServerManagement:ApiResource": "Api资源",

16
aspnet-core/services/src/CompanyName.ProjectName.ElasticsearchRepository/CompanyName.ProjectName.ElasticsearchRepository.csproj

@ -0,0 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Volo.Abp.Core" Version="4.4.0" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="NEST" Version="7.14.1" />
<ProjectReference Include="..\CompanyName.ProjectName.Domain\CompanyName.ProjectName.Domain.csproj" />
</ItemGroup>
</Project>

69
aspnet-core/services/src/CompanyName.ProjectName.ElasticsearchRepository/CompanyNameProjectNameLogRepository.cs

@ -0,0 +1,69 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using CompanyName.ProjectName.ElasticsearchRepository.Dto;
using Lion.Abp.Extension;
using Microsoft.Extensions.Configuration;
using Nest;
namespace CompanyName.ProjectName.ElasticsearchRepository
{
public class CompanyNameProjectNameLogRepository : ElasticsearchBasicRepository,
ICompanyNameProjectNameLogRepository
{
private readonly IConfiguration _configuration;
public CompanyNameProjectNameLogRepository(
IElasticsearchProvider elasticsearchProvider,
IConfiguration configuration) : base(elasticsearchProvider)
{
_configuration = configuration;
}
public async Task<CustomePagedResultDto<PagingElasticSearchLogOutput>> PaingAsync(
PagingElasticSearchLogInput input)
{
var IndexName =
_configuration.GetValue<string>("ElasticSearch:SearchIndexFormat");
// 默认查询当天
input.StartCreationTime = input.StartCreationTime?.AddMilliseconds(-1) ??
DateTime.Now.Date.AddMilliseconds(-1);
input.EndCreationTime =
input.EndCreationTime?.AddDays(1).AddMilliseconds(-1) ??
DateTime.Now.Date.AddDays(1).AddMilliseconds(-1);
var mustFilters =
new List<Func<QueryContainerDescriptor<PagingElasticSearchLogOutput>,
QueryContainer>>
{
t => t.DateRange(f =>
f.Field(fd => fd.CreationTime).TimeZone("Asia/Shanghai")
.GreaterThanOrEquals(input.StartCreationTime.Value)),
t => t.DateRange(
f => f.Field(fd => fd.CreationTime).TimeZone("Asia/Shanghai")
.LessThanOrEquals(input.EndCreationTime.Value))
};
if (!string.IsNullOrWhiteSpace(input.Filter))
{
mustFilters.Add(t =>
t.MatchPhrase(f => f.Field(fd => fd.Message).Query(input.Filter.Trim())));
}
var result = await Client.SearchAsync<PagingElasticSearchLogOutput>(e => e
.Index(IndexName)
.From(input.SkipCount)
.Size(input.PageSize)
.Sort(s => s.Descending(sd => sd.CreationTime))
.Query(q => q.Bool(qb => qb.Filter(mustFilters))));
if (result.HitsMetadata != null)
{
return new CustomePagedResultDto<PagingElasticSearchLogOutput>(
result.HitsMetadata.Total.Value, result.Documents.ToList());
}
return null;
}
}
}

14
aspnet-core/services/src/CompanyName.ProjectName.ElasticsearchRepository/Dto/PagingElasticSearchLogInput.cs

@ -0,0 +1,14 @@
using System;
using Lion.Abp.Extension;
namespace CompanyName.ProjectName.ElasticsearchRepository.Dto
{
public class PagingElasticSearchLogInput : PagingBase
{
public string Filter { get; set; }
public DateTime? StartCreationTime { get; set; }
public DateTime? EndCreationTime { get; set; }
}
}

27
aspnet-core/services/src/CompanyName.ProjectName.ElasticsearchRepository/Dto/PagingElasticSearchLogOutput.cs

@ -0,0 +1,27 @@
using System;
using Nest;
namespace CompanyName.ProjectName.ElasticsearchRepository.Dto
{
[Serializable]
public class PagingElasticSearchLogOutput
{
/// <summary>
/// 日志级别
/// </summary>
public string Level { get; set; }
/// <summary>
/// 日志内容
/// </summary>
public string Message { get; set; }
/// <summary>
/// 创建时间
/// </summary>
[PropertyName("@timestamp")]
public DateTime CreationTime { get; set; }
}
}

2
aspnet-core/frameworks/ElasticSearch/src/Lion.Abp.ElasticSearch/ElasticsearchBasicRepository.cs → aspnet-core/services/src/CompanyName.ProjectName.ElasticsearchRepository/ElasticsearchBasicRepository.cs

@ -1,7 +1,7 @@
using Nest;
using Volo.Abp.Domain.Services;
namespace Lion.Abp.ElasticSearch
namespace CompanyName.ProjectName.ElasticsearchRepository
{
public abstract class ElasticsearchBasicRepository : DomainService
{

2
aspnet-core/frameworks/ElasticSearch/src/Lion.Abp.ElasticSearch/ElasticsearchProvider.cs → aspnet-core/services/src/CompanyName.ProjectName.ElasticsearchRepository/ElasticsearchProvider.cs

@ -4,7 +4,7 @@ using Microsoft.Extensions.Configuration;
using Nest;
using Volo.Abp.DependencyInjection;
namespace Lion.Abp.ElasticSearch
namespace CompanyName.ProjectName.ElasticsearchRepository
{
public class ElasticsearchProvider : IElasticsearchProvider, ISingletonDependency
{

17
aspnet-core/services/src/CompanyName.ProjectName.ElasticsearchRepository/ICompanyNameProjectNameLogRepository.cs

@ -0,0 +1,17 @@
using System.Threading.Tasks;
using CompanyName.ProjectName.ElasticsearchRepository.Dto;
using Lion.Abp.Extension;
using Volo.Abp.DependencyInjection;
namespace CompanyName.ProjectName.ElasticsearchRepository
{
public interface ICompanyNameProjectNameLogRepository : ITransientDependency
{
/// <summary>
/// 分页查询es日志
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
Task<CustomePagedResultDto<PagingElasticSearchLogOutput>> PaingAsync(PagingElasticSearchLogInput input);
}
}

2
aspnet-core/frameworks/ElasticSearch/src/Lion.Abp.ElasticSearch/IElasticsearchProvider.cs → aspnet-core/services/src/CompanyName.ProjectName.ElasticsearchRepository/IElasticsearchProvider.cs

@ -1,7 +1,7 @@
using Nest;
using Volo.Abp.DependencyInjection;
namespace Lion.Abp.ElasticSearch
namespace CompanyName.ProjectName.ElasticsearchRepository
{
public interface IElasticsearchProvider : ISingletonDependency
{

10
aspnet-core/services/src/CompanyName.ProjectName.ElasticsearchRepository/ProjectNameElasticSearchModule.cs

@ -0,0 +1,10 @@
using Volo.Abp.Modularity;
namespace CompanyName.ProjectName.ElasticsearchRepository
{
public class ProjectNameElasticSearchModule : AbpModule
{
}
}

12
aspnet-core/services/src/CompanyName.ProjectName.HttpApi/Controllers/Systems/AccountController.cs

@ -6,27 +6,27 @@ using Swashbuckle.AspNetCore.Annotations;
namespace CompanyName.ProjectName.Controllers.Systems
{
public class AccountController : ProjectNameController,ILoginAppService
public class AccountController : ProjectNameController,IAccountAppService
{
private readonly ILoginAppService _loginAppService;
private readonly IAccountAppService _accountAppService;
public AccountController(ILoginAppService loginAppService)
public AccountController(IAccountAppService accountAppService)
{
_loginAppService = loginAppService;
_accountAppService = accountAppService;
}
[SwaggerOperation(summary: "登录", Tags = new[] {"Account"})]
public Task<LoginOutput> LoginAsync(LoginInput input)
{
return _loginAppService.LoginAsync(input);
return _accountAppService.LoginAsync(input);
}
[SwaggerOperation(summary: "登录", Tags = new[] {"Account"})]
[HttpPost("/api/app/account/login/Sts")]
public Task<LoginOutput> StsLoginAsync(string accessToken)
{
return _loginAppService.StsLoginAsync(accessToken);
return _accountAppService.StsLoginAsync(accessToken);
}
}
}

30
aspnet-core/services/src/CompanyName.ProjectName.HttpApi/Controllers/Systems/CompanyNameProjectNameLogController.cs

@ -0,0 +1,30 @@
using System.Threading.Tasks;
using CompanyName.ProjectName.ElasticsearchRepository.Dto;
using CompanyName.ProjectName.ElasticSearchs;
using CompanyName.ProjectName.Permissions;
using Lion.Abp.Extension;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Swashbuckle.AspNetCore.Annotations;
namespace CompanyName.ProjectName.Controllers.Systems
{
[Route("EsLog")]
public class CompanyNameProjectNameLogController: ProjectNameController,ICompanyNameProjectNameLogAppService
{
private readonly ICompanyNameProjectNameLogAppService _companyNameProjectNameLogAppService;
public CompanyNameProjectNameLogController(ICompanyNameProjectNameLogAppService companyNameProjectNameLogAppService)
{
_companyNameProjectNameLogAppService = companyNameProjectNameLogAppService;
}
[HttpPost("page")]
[SwaggerOperation(summary: "分页获取Es日志", Tags = new[] { "EsLog" })]
[Authorize(Policy = ProjectNamePermissions.SystemManagement.ES)]
public Task<CustomePagedResultDto<PagingElasticSearchLogOutput>> PaingAsync(PagingElasticSearchLogInput input)
{
return _companyNameProjectNameLogAppService.PaingAsync(input);
}
}
}

13
aspnet-core/services/src/CompanyName.ProjectName.HttpApi/Controllers/Systems/PermissionController.cs

@ -10,20 +10,21 @@ namespace CompanyName.ProjectName.Controllers.Systems
{
[Route("Permissions")]
[Authorize]
public class PermissionController : ProjectNameController
public class PermissionController : ProjectNameController,IRolePermissionAppService
{
private readonly IRoleAppService _roleAppService;
private readonly IRolePermissionAppService _rolePermissionAppService;
public PermissionController(IRoleAppService roleAppService)
public PermissionController(IRolePermissionAppService rolePermissionAppService)
{
_roleAppService = roleAppService;
_rolePermissionAppService = rolePermissionAppService;
}
[HttpPost("tree")]
[SwaggerOperation(summary: "获取角色权限", Tags = new[] { "Permissions" })]
public Task<PermissionOutput> GetPermissionAsync(GetPermissionInput input)
{
return _roleAppService.GetPermissionAsync(input);
return _rolePermissionAppService.GetPermissionAsync(input);
}
[HttpPost("update")]
@ -31,7 +32,7 @@ namespace CompanyName.ProjectName.Controllers.Systems
[SwaggerOperation(summary: "更新角色", Tags = new[] { "Permissions" })]
public Task UpdatePermissionAsync(UpdateRolePermissionsInput input)
{
return _roleAppService.UpdatePermissionAsync(input);
return _rolePermissionAppService.UpdatePermissionAsync(input);
}
}
}

8
aspnet-core/services/src/CompanyName.ProjectName.HttpApi/Controllers/Systems/RoleController.cs

@ -1,4 +1,5 @@
using System.Threading.Tasks;
using System;
using System.Threading.Tasks;
using CompanyName.ProjectName.Roles;
using CompanyName.ProjectName.Roles.Dtos;
using Lion.Abp.Extension;
@ -12,7 +13,7 @@ namespace CompanyName.ProjectName.Controllers.Systems
{
[Route("Roles")]
[Authorize(Policy = IdentityPermissions.Roles.Default)]
public class RoleController : ProjectNameController
public class RoleController : ProjectNameController,IRoleAppService
{
private readonly IRoleAppService _roleAppService;
@ -51,12 +52,13 @@ namespace CompanyName.ProjectName.Controllers.Systems
return _roleAppService.UpdateAsync(input);
}
[HttpPost("delete")]
[Authorize(IdentityPermissions.Roles.Delete)]
[SwaggerOperation(summary: "删除角色", Tags = new[] { "Roles" })]
public Task DeleteAsync(IdInput input)
{
return _roleAppService.DeleteAsync(input.Id);
return _roleAppService.DeleteAsync(input);
}

16
aspnet-core/services/src/CompanyName.ProjectName.HttpApi/Controllers/Systems/SettingController.cs

@ -9,27 +9,27 @@ using Swashbuckle.AspNetCore.Annotations;
namespace CompanyName.ProjectName.Controllers.Systems
{
[Route("Settings")]
public class SettingController : ProjectNameController
public class SettingController : ProjectNameController,ISettingAppService
{
private readonly ISettingUiAppService _settingUiAppService;
private readonly ISettingAppService _settingAppService;
public SettingController(ISettingUiAppService settingUiAppService)
public SettingController(ISettingAppService settingAppService)
{
_settingUiAppService = settingUiAppService;
_settingAppService = settingAppService;
}
[HttpPost("all")]
[SwaggerOperation(summary: "获取所有Setting", Tags = new[] {"Settings"})]
[SwaggerOperation(summary: "获取所有Setting", Tags = new[] { "Settings" })]
public async Task<List<SettingGroup>> GetAsync()
{
return await _settingUiAppService.GroupSettingDefinitions();
return await _settingAppService.GetAsync();
}
[HttpPost("update")]
[SwaggerOperation(summary: "更新Setting", Tags = new[] {"Settings"})]
[SwaggerOperation(summary: "更新Setting", Tags = new[] { "Settings" })]
public async Task UpdateAsync(UpdateSettingInput input)
{
await _settingUiAppService.SetSettingValues(input.Values);
await _settingAppService.UpdateAsync(input);
}
}
}

10
aspnet-core/services/src/CompanyName.ProjectName.HttpApi/Controllers/Systems/UserController.cs

@ -1,4 +1,5 @@
using System.Threading.Tasks;
using System;
using System.Threading.Tasks;
using CompanyName.ProjectName.Permissions;
using CompanyName.ProjectName.Users;
using CompanyName.ProjectName.Users.Dtos;
@ -13,7 +14,7 @@ namespace CompanyName.ProjectName.Controllers.Systems
{
[Route("Users")]
[Authorize(Policy = IdentityPermissions.Users.Default)]
public class UserContoller:ProjectNameController
public class UserContoller:ProjectNameController,IUserAppService
{
private readonly IUserAppService _userAppService;
@ -50,14 +51,15 @@ namespace CompanyName.ProjectName.Controllers.Systems
[SwaggerOperation(summary: "删除用户", Tags = new[] { "Users" })]
public Task DeleteAsync(IdInput input)
{
return _userAppService.DeleteAsync(input.Id);
return _userAppService.DeleteAsync(input);
}
[HttpPost("role")]
[SwaggerOperation(summary: "获取用户角色信息", Tags = new[] { "Users" })]
public Task<ListResultDto<IdentityRoleDto>> GetRoleByUserId(IdInput input)
{
return _userAppService.GetRoleByUserId(input.Id);
return _userAppService.GetRoleByUserId(input);
}
[HttpPost("changePassword")]

2
vben271/nswag/nswag.json

@ -3,7 +3,7 @@
"defaultVariables": null,
"documentGenerator": {
"fromDocument": {
"url": "http://localhost:44315/swagger/v1/swagger.json",
"url": "http://localhost:44315/swagger/ProjectName/swagger.json",
"output": null,
"newLineBehavior": "Auto"
}

28
vben271/src/router/routes/modules/admin.ts

@ -1,10 +1,6 @@
import type { AppRouteModule } from '/@/router/types';
import { LAYOUT } from '/@/router/constant';
import { t } from '/@/hooks/web/useI18n';
const IFrame = () => import('/@/views/sys/iframe/FrameBlank.vue');
import { useUserStoreWithOut } from '/@/store/modules/user';
const userStore = useUserStoreWithOut();
const token = userStore.getToken;
const admin: AppRouteModule = {
path: '/admin',
@ -66,29 +62,7 @@ const admin: AppRouteModule = {
policy: 'System.ES',
icon: 'ant-design:snippets-twotone',
},
},
{
path: 'hangfire',
name: 'Hangfire',
component: IFrame,
meta: {
frameSrc: import.meta.env.VITE_API_URL + '/hangfire?access_token=' + token,
title: t('routes.admin.backgroundTask'),
policy: 'System.Hangfire',
icon: 'ant-design:clock-circle-outlined',
},
},
{
path: 'cap',
name: 'Cap',
component: IFrame,
meta: {
frameSrc: import.meta.env.VITE_API_URL + '/cap?access_token=' + token,
title: t('routes.admin.integratedEvent'),
policy: 'System.Cap',
icon: 'ant-design:sync-outlined',
},
},
}
],
};

1416
vben271/src/services/ServiceProxies.ts

File diff suppressed because it is too large

6
vben271/src/views/admin/elasticSearch/ElasticSearch.ts

@ -4,7 +4,7 @@ import { useI18n } from '/@/hooks/web/useI18n';
const { t } = useI18n();
import moment from 'moment';
import {
ElasticSearchServiceProxy,
EsLogServiceProxy,
PagingElasticSearchLogInput,
PagingElasticSearchLogOutputCustomePagedResultDto,
} from '/@/services/ServiceProxies';
@ -55,6 +55,6 @@ export const tableColumns: BasicColumn[] = [
export async function getElasticSearchLogAsync(
request: PagingElasticSearchLogInput
): Promise<PagingElasticSearchLogOutputCustomePagedResultDto> {
const _elasticSearchServiceProxy = new ElasticSearchServiceProxy();
return await _elasticSearchServiceProxy.paging(request);
const _elasticSearchServiceProxy = new EsLogServiceProxy();
return await _elasticSearchServiceProxy.page(request);
}

Loading…
Cancel
Save