diff --git a/aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.Application.Contracts/AuditLogs/IAuditLogAppService.cs b/aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.Application.Contracts/AuditLogs/IAuditLogAppService.cs index 769f1531..9dce500a 100644 --- a/aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.Application.Contracts/AuditLogs/IAuditLogAppService.cs +++ b/aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.Application.Contracts/AuditLogs/IAuditLogAppService.cs @@ -7,6 +7,6 @@ namespace Lion.AbpPro.BasicManagement.AuditLogs /// /// /// - Task> GetListAsync(PagingAuditLogListInput input); + Task> GetListAsync(PagingAuditLogInput input); } } \ No newline at end of file diff --git a/aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.Application.Contracts/AuditLogs/PagingAuditLogActionOutput.cs b/aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.Application.Contracts/AuditLogs/PagingAuditLogActionOutput.cs new file mode 100644 index 00000000..b07482cc --- /dev/null +++ b/aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.Application.Contracts/AuditLogs/PagingAuditLogActionOutput.cs @@ -0,0 +1,22 @@ +namespace Lion.AbpPro.BasicManagement.AuditLogs; + +public class PagingAuditLogActionOutput +{ + public Guid Id { get; set; } + + public Guid? TenantId { get; set; } + + public Guid AuditLogId { get; set; } + + public string ServiceName { get; set; } + + public string MethodName { get; set; } + + public string Parameters { get; set; } + + public string ExecutionTime { get; set; } + + public int ExecutionDuration { get; set; } + + public ExtraPropertyDictionary ExtraProperties { get; set; } +} \ No newline at end of file diff --git a/aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.Application.Contracts/AuditLogs/PagingAuditLogListInput.cs b/aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.Application.Contracts/AuditLogs/PagingAuditLogInput.cs similarity index 83% rename from aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.Application.Contracts/AuditLogs/PagingAuditLogListInput.cs rename to aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.Application.Contracts/AuditLogs/PagingAuditLogInput.cs index 3b6933b2..afe9271d 100644 --- a/aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.Application.Contracts/AuditLogs/PagingAuditLogListInput.cs +++ b/aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.Application.Contracts/AuditLogs/PagingAuditLogInput.cs @@ -2,7 +2,7 @@ using System.Net; namespace Lion.AbpPro.BasicManagement.AuditLogs { - public class PagingAuditLogListInput : PagingBase + public class PagingAuditLogInput : PagingBase { /// /// 排序 @@ -29,6 +29,12 @@ namespace Lion.AbpPro.BasicManagement.AuditLogs /// public string Url { get; set; } + + /// + /// 用户Id + /// + public Guid? UserId { get; set; } + /// /// 用户名 /// @@ -63,5 +69,10 @@ namespace Lion.AbpPro.BasicManagement.AuditLogs /// http 状态码 /// public HttpStatusCode? HttpStatusCode { get; set; } + + /// + /// 客户端IP + /// + public string ClientIpAddress { get; set; } } } \ No newline at end of file diff --git a/aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.Application.Contracts/AuditLogs/GetAuditLogPageListOutput.cs b/aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.Application.Contracts/AuditLogs/PagingAuditLogOutput.cs similarity index 80% rename from aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.Application.Contracts/AuditLogs/GetAuditLogPageListOutput.cs rename to aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.Application.Contracts/AuditLogs/PagingAuditLogOutput.cs index 05766ca7..a3a58c65 100644 --- a/aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.Application.Contracts/AuditLogs/GetAuditLogPageListOutput.cs +++ b/aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.Application.Contracts/AuditLogs/PagingAuditLogOutput.cs @@ -1,6 +1,6 @@ namespace Lion.AbpPro.BasicManagement.AuditLogs { - public class GetAuditLogPageListOutput + public class PagingAuditLogOutput { public string ApplicationName { get; set; } @@ -16,7 +16,7 @@ namespace Lion.AbpPro.BasicManagement.AuditLogs public Guid? ImpersonatorTenantId { get; set; } - public DateTime ExecutionTime { get; set; } + public string ExecutionTime { get; set; } public int ExecutionDuration { get; set; } @@ -39,5 +39,9 @@ namespace Lion.AbpPro.BasicManagement.AuditLogs public string Comments { get; set; } public int? HttpStatusCode { get; set; } + + public List EntityChanges { get; set; } + + public List Actions { get; set; } } } \ No newline at end of file diff --git a/aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.Application.Contracts/AuditLogs/PagingEntityChangeOutput.cs b/aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.Application.Contracts/AuditLogs/PagingEntityChangeOutput.cs new file mode 100644 index 00000000..192dfd87 --- /dev/null +++ b/aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.Application.Contracts/AuditLogs/PagingEntityChangeOutput.cs @@ -0,0 +1,28 @@ +using Volo.Abp.Auditing; + +namespace Lion.AbpPro.BasicManagement.AuditLogs; + +public class PagingEntityChangeOutput +{ + public Guid Id { get; set; } + + public Guid AuditLogId { get; set; } + + public Guid? TenantId { get; set; } + + public string ChangeTime { get; set; } + + public EntityChangeType ChangeType { get; set; } + + public string ChangeTypeDescription { get; set; } + + public Guid? EntityTenantId { get; set; } + + public string EntityId { get; set; } + + public string EntityTypeFullName { get; set; } + + public List PropertyChanges { get; set; } + + public ExtraPropertyDictionary ExtraProperties { get; set; } +} \ No newline at end of file diff --git a/aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.Application.Contracts/AuditLogs/PagingEntityPropertyChangeOutput.cs b/aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.Application.Contracts/AuditLogs/PagingEntityPropertyChangeOutput.cs new file mode 100644 index 00000000..92c22c8b --- /dev/null +++ b/aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.Application.Contracts/AuditLogs/PagingEntityPropertyChangeOutput.cs @@ -0,0 +1,18 @@ +namespace Lion.AbpPro.BasicManagement.AuditLogs; + +public class PagingEntityPropertyChangeOutput +{ + public Guid Id { get; set; } + + public Guid? TenantId { get; set; } + + public Guid EntityChangeId { get; set; } + + public string NewValue { get; set; } + + public string OriginalValue { get; set; } + + public string PropertyName { get; set; } + + public string PropertyTypeFullName { get; set; } +} \ No newline at end of file diff --git a/aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.Application.Contracts/GlobalUsings.cs b/aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.Application.Contracts/GlobalUsings.cs index ad86891c..7562c69d 100644 --- a/aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.Application.Contracts/GlobalUsings.cs +++ b/aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.Application.Contracts/GlobalUsings.cs @@ -7,5 +7,6 @@ global using Lion.AbpPro.Core; global using Volo.Abp.Application.Dtos; global using Volo.Abp.Application.Services; global using Volo.Abp.AspNetCore.Mvc.MultiTenancy; +global using Volo.Abp.Data; global using Volo.Abp.PermissionManagement; global using Volo.Abp.TenantManagement; \ No newline at end of file diff --git a/aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.Application/AuditLogs/AuditLogAppService.cs b/aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.Application/AuditLogs/AuditLogAppService.cs index 42e1fbc8..e25f4797 100644 --- a/aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.Application/AuditLogs/AuditLogAppService.cs +++ b/aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.Application/AuditLogs/AuditLogAppService.cs @@ -10,45 +10,52 @@ namespace Lion.AbpPro.BasicManagement.AuditLogs _auditLogRepository = auditLogRepository; } + /// /// 分页查询审计日志 /// [Authorize(Policy = BasicManagementPermissions.SystemManagement.AuditLog)] - public async Task> GetListAsync(PagingAuditLogListInput input) + public async Task> GetListAsync(PagingAuditLogInput input) { - var list = await _auditLogRepository.GetListAsync( - input.Sorting, - input.PageSize, - input.SkipCount, - input.StartTime?.Date, - input.EndTime?.Date, + var totalCount = await _auditLogRepository.GetCountAsync( + input.StartTime, + input.EndTime, input.HttpMethod, input.Url, - null, + input.UserId, input.UserName, input.ApplicationName, + input.ClientIpAddress, input.CorrelationId, - null, input.MaxExecutionDuration, input.MinExecutionDuration, input.HasException, input.HttpStatusCode); - var totalCount = await _auditLogRepository.GetCountAsync( - input.StartTime?.Date, - input.EndTime?.Date, + if (totalCount == 0) + { + return new PagedResultDto(); + } + + var list = await _auditLogRepository.GetListAsync( + input.Sorting, + input.PageSize, + input.SkipCount, + input.StartTime, + input.EndTime, input.HttpMethod, input.Url, - null, + input.UserId, input.UserName, input.ApplicationName, - null, + input.ClientIpAddress, input.CorrelationId, input.MaxExecutionDuration, input.MinExecutionDuration, input.HasException, - input.HttpStatusCode); - return new PagedResultDto(totalCount, - ObjectMapper.Map, List>(list)); + input.HttpStatusCode, + true); + + return new PagedResultDto(totalCount, ObjectMapper.Map, List>(list)); } } } \ No newline at end of file diff --git a/aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.Application/BasicManagementApplicationAutoMapperProfile.cs b/aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.Application/BasicManagementApplicationAutoMapperProfile.cs index dd42966c..049e5b4a 100644 --- a/aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.Application/BasicManagementApplicationAutoMapperProfile.cs +++ b/aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.Application/BasicManagementApplicationAutoMapperProfile.cs @@ -8,7 +8,20 @@ public class BasicManagementApplicationAutoMapperProfile : Profile { public BasicManagementApplicationAutoMapperProfile() { - CreateMap(); + CreateMap() + .ForMember(dest => dest.ExecutionTime, + opt => opt.MapFrom(s => s.ExecutionTime.ToString("O"))); + CreateMap() + .ForMember(dest => dest.ExecutionTime, + opt => opt.MapFrom(s => s.ExecutionTime.ToString("O"))); + + CreateMap() + .ForMember(dest => dest.ChangeTypeDescription, + opt => opt.MapFrom(s => s.ChangeType.ToDescription())) + .ForMember(dest => dest.ChangeTime, + opt => opt.MapFrom(s => s.ChangeTime.ToString("O"))); + CreateMap(); + CreateMap() .ForMember(dest => dest.Token, opt => opt.Ignore()); CreateMap() diff --git a/aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.Domain/GlobalUsings.cs b/aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.Domain/GlobalUsings.cs index 09653865..af2f2e10 100644 --- a/aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.Domain/GlobalUsings.cs +++ b/aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.Domain/GlobalUsings.cs @@ -1,9 +1,12 @@ // Global using directives +global using System.Net; +global using Volo.Abp.Auditing; global using Volo.Abp.AuditLogging; global using Volo.Abp.AutoMapper; global using Volo.Abp.BackgroundJobs; global using Volo.Abp.Domain; +global using Volo.Abp.Domain.Services; global using Volo.Abp.FeatureManagement; global using Volo.Abp.Identity; global using Volo.Abp.Modularity; diff --git a/aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.HttpApi/Systems/AuditLogController.cs b/aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.HttpApi/Systems/AuditLogController.cs index 68e96a69..d585957e 100644 --- a/aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.HttpApi/Systems/AuditLogController.cs +++ b/aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.HttpApi/Systems/AuditLogController.cs @@ -12,7 +12,7 @@ namespace Lion.AbpPro.BasicManagement.Systems [HttpPost("page")] [SwaggerOperation(summary: "分页获取审计日志信息", Tags = new[] {"AuditLogs"})] - public Task> GetListAsync(PagingAuditLogListInput input) + public Task> GetListAsync(PagingAuditLogInput input) { return _auditLogAppService.GetListAsync(input); } diff --git a/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/AbpProHttpApiHostModule.cs b/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/AbpProHttpApiHostModule.cs index 42897c77..2f1b2eb1 100644 --- a/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/AbpProHttpApiHostModule.cs +++ b/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/AbpProHttpApiHostModule.cs @@ -355,7 +355,9 @@ namespace Lion.AbpPro { options.IgnoredUrls.Add("/AuditLogs/page"); options.IgnoredUrls.Add("/hangfire/stats"); + options.IgnoredUrls.Add("/hangfire/recurring/trigger"); options.IgnoredUrls.Add("/cap"); + options.IgnoredUrls.Add("/"); }); } diff --git a/vben28/src/services/ServiceProxies.ts b/vben28/src/services/ServiceProxies.ts index afdb8be4..861fff15 100644 --- a/vben28/src/services/ServiceProxies.ts +++ b/vben28/src/services/ServiceProxies.ts @@ -481,7 +481,7 @@ export class AuditLogsServiceProxy extends ServiceProxyBase { * @param body (optional) * @return Success */ - page(body: PagingAuditLogListInput | undefined , cancelToken?: CancelToken | undefined): Promise { + page(body: PagingAuditLogInput | undefined , cancelToken?: CancelToken | undefined): Promise { let url_ = this.baseUrl + "/AuditLogs/page"; url_ = url_.replace(/[?&]$/, ""); @@ -511,7 +511,7 @@ export class AuditLogsServiceProxy extends ServiceProxyBase { }); } - protected processPage(response: AxiosResponse): Promise { + protected processPage(response: AxiosResponse): Promise { const status = response.status; let _headers: any = {}; if (response.headers && typeof response.headers === "object") { @@ -525,8 +525,8 @@ export class AuditLogsServiceProxy extends ServiceProxyBase { const _responseText = response.data; let result200: any = null; let resultData200 = _responseText; - result200 = GetAuditLogPageListOutputPagedResultDto.fromJS(resultData200); - return Promise.resolve(result200); + result200 = PagingAuditLogOutputPagedResultDto.fromJS(resultData200); + return Promise.resolve(result200); } else if (status === 403) { const _responseText = response.data; @@ -574,7 +574,7 @@ export class AuditLogsServiceProxy extends ServiceProxyBase { const _responseText = response.data; return throwException("An unexpected server error occurred.", status, _responseText, _headers); } - return Promise.resolve(null as any); + return Promise.resolve(null as any); } } @@ -8912,6 +8912,12 @@ export interface IDeleteLanguageInput { id: string; } +export enum EntityChangeType { + Created = 0, + Updated = 1, + Deleted = 2, +} + export class EntityExtensionDto implements IEntityExtensionDto { properties!: { [key: string]: ExtensionPropertyDto; } | undefined; configuration!: { [key: string]: any; } | undefined; @@ -10644,162 +10650,6 @@ export interface IFindTenantResultDto { isActive: boolean; } -export class GetAuditLogPageListOutput implements IGetAuditLogPageListOutput { - applicationName!: string | undefined; - userId!: string | undefined; - userName!: string | undefined; - tenantId!: string | undefined; - tenantName!: string | undefined; - impersonatorUserId!: string | undefined; - impersonatorTenantId!: string | undefined; - executionTime!: dayjs.Dayjs; - executionDuration!: number; - clientIpAddress!: string | undefined; - clientName!: string | undefined; - clientId!: string | undefined; - correlationId!: string | undefined; - browserInfo!: string | undefined; - httpMethod!: string | undefined; - url!: string | undefined; - exceptions!: string | undefined; - comments!: string | undefined; - httpStatusCode!: number | undefined; - - constructor(data?: IGetAuditLogPageListOutput) { - if (data) { - for (var property in data) { - if (data.hasOwnProperty(property)) - (this)[property] = (data)[property]; - } - } - } - - init(_data?: any) { - if (_data) { - this.applicationName = _data["applicationName"]; - this.userId = _data["userId"]; - this.userName = _data["userName"]; - this.tenantId = _data["tenantId"]; - this.tenantName = _data["tenantName"]; - this.impersonatorUserId = _data["impersonatorUserId"]; - this.impersonatorTenantId = _data["impersonatorTenantId"]; - this.executionTime = _data["executionTime"] ? dayjs(_data["executionTime"].toString()) : undefined; - this.executionDuration = _data["executionDuration"]; - this.clientIpAddress = _data["clientIpAddress"]; - this.clientName = _data["clientName"]; - this.clientId = _data["clientId"]; - this.correlationId = _data["correlationId"]; - this.browserInfo = _data["browserInfo"]; - this.httpMethod = _data["httpMethod"]; - this.url = _data["url"]; - this.exceptions = _data["exceptions"]; - this.comments = _data["comments"]; - this.httpStatusCode = _data["httpStatusCode"]; - } - } - - static fromJS(data: any): GetAuditLogPageListOutput { - data = typeof data === 'object' ? data : {}; - let result = new GetAuditLogPageListOutput(); - result.init(data); - return result; - } - - toJSON(data?: any) { - data = typeof data === 'object' ? data : {}; - data["applicationName"] = this.applicationName; - data["userId"] = this.userId; - data["userName"] = this.userName; - data["tenantId"] = this.tenantId; - data["tenantName"] = this.tenantName; - data["impersonatorUserId"] = this.impersonatorUserId; - data["impersonatorTenantId"] = this.impersonatorTenantId; - data["executionTime"] = this.executionTime ? this.executionTime.toISOString() : undefined; - data["executionDuration"] = this.executionDuration; - data["clientIpAddress"] = this.clientIpAddress; - data["clientName"] = this.clientName; - data["clientId"] = this.clientId; - data["correlationId"] = this.correlationId; - data["browserInfo"] = this.browserInfo; - data["httpMethod"] = this.httpMethod; - data["url"] = this.url; - data["exceptions"] = this.exceptions; - data["comments"] = this.comments; - data["httpStatusCode"] = this.httpStatusCode; - return data; - } -} - -export interface IGetAuditLogPageListOutput { - applicationName: string | undefined; - userId: string | undefined; - userName: string | undefined; - tenantId: string | undefined; - tenantName: string | undefined; - impersonatorUserId: string | undefined; - impersonatorTenantId: string | undefined; - executionTime: dayjs.Dayjs; - executionDuration: number; - clientIpAddress: string | undefined; - clientName: string | undefined; - clientId: string | undefined; - correlationId: string | undefined; - browserInfo: string | undefined; - httpMethod: string | undefined; - url: string | undefined; - exceptions: string | undefined; - comments: string | undefined; - httpStatusCode: number | undefined; -} - -export class GetAuditLogPageListOutputPagedResultDto implements IGetAuditLogPageListOutputPagedResultDto { - items!: GetAuditLogPageListOutput[] | undefined; - totalCount!: number; - - constructor(data?: IGetAuditLogPageListOutputPagedResultDto) { - if (data) { - for (var property in data) { - if (data.hasOwnProperty(property)) - (this)[property] = (data)[property]; - } - } - } - - init(_data?: any) { - if (_data) { - if (Array.isArray(_data["items"])) { - this.items = [] as any; - for (let item of _data["items"]) - this.items!.push(GetAuditLogPageListOutput.fromJS(item)); - } - this.totalCount = _data["totalCount"]; - } - } - - static fromJS(data: any): GetAuditLogPageListOutputPagedResultDto { - data = typeof data === 'object' ? data : {}; - let result = new GetAuditLogPageListOutputPagedResultDto(); - result.init(data); - return result; - } - - toJSON(data?: any) { - data = typeof data === 'object' ? data : {}; - if (Array.isArray(this.items)) { - data["items"] = []; - for (let item of this.items) - data["items"].push(item.toJSON()); - } - data["totalCount"] = this.totalCount; - return data; - } -} - -export interface IGetAuditLogPageListOutputPagedResultDto { - items: GetAuditLogPageListOutput[] | undefined; - totalCount: number; -} - export class GetOrganizationUnitRoleInput implements IGetOrganizationUnitRoleInput { /** 当前页面.默认从1开始 */ pageIndex!: number; @@ -11966,6 +11816,7 @@ export class IdentityUserDto implements IIdentityUserDto { lockoutEnabled!: boolean; lockoutEnd!: dayjs.Dayjs | undefined; concurrencyStamp!: string | undefined; + entityVersion!: number; constructor(data?: IIdentityUserDto) { if (data) { @@ -12005,6 +11856,7 @@ export class IdentityUserDto implements IIdentityUserDto { this.lockoutEnabled = _data["lockoutEnabled"]; this.lockoutEnd = _data["lockoutEnd"] ? dayjs(_data["lockoutEnd"].toString()) : undefined; this.concurrencyStamp = _data["concurrencyStamp"]; + this.entityVersion = _data["entityVersion"]; } } @@ -12044,6 +11896,7 @@ export class IdentityUserDto implements IIdentityUserDto { data["lockoutEnabled"] = this.lockoutEnabled; data["lockoutEnd"] = this.lockoutEnd ? this.lockoutEnd.toISOString() : undefined; data["concurrencyStamp"] = this.concurrencyStamp; + data["entityVersion"] = this.entityVersion; return data; } } @@ -12070,6 +11923,7 @@ export interface IIdentityUserDto { lockoutEnabled: boolean; lockoutEnd: dayjs.Dayjs | undefined; concurrencyStamp: string | undefined; + entityVersion: number; } export class IdentityUserDtoPagedResultDto implements IIdentityUserDtoPagedResultDto { @@ -13199,7 +13053,87 @@ export interface IPageLanguageTextOutputPagedResultDto { totalCount: number; } -export class PagingAuditLogListInput implements IPagingAuditLogListInput { +export class PagingAuditLogActionOutput implements IPagingAuditLogActionOutput { + id!: string; + tenantId!: string | undefined; + auditLogId!: string; + serviceName!: string | undefined; + methodName!: string | undefined; + parameters!: string | undefined; + executionTime!: string | undefined; + executionDuration!: number; + extraProperties!: { [key: string]: any; } | undefined; + + constructor(data?: IPagingAuditLogActionOutput) { + if (data) { + for (var property in data) { + if (data.hasOwnProperty(property)) + (this)[property] = (data)[property]; + } + } + } + + init(_data?: any) { + if (_data) { + this.id = _data["id"]; + this.tenantId = _data["tenantId"]; + this.auditLogId = _data["auditLogId"]; + this.serviceName = _data["serviceName"]; + this.methodName = _data["methodName"]; + this.parameters = _data["parameters"]; + this.executionTime = _data["executionTime"]; + this.executionDuration = _data["executionDuration"]; + if (_data["extraProperties"]) { + this.extraProperties = {} as any; + for (let key in _data["extraProperties"]) { + if (_data["extraProperties"].hasOwnProperty(key)) + (this.extraProperties)![key] = _data["extraProperties"][key]; + } + } + } + } + + static fromJS(data: any): PagingAuditLogActionOutput { + data = typeof data === 'object' ? data : {}; + let result = new PagingAuditLogActionOutput(); + result.init(data); + return result; + } + + toJSON(data?: any) { + data = typeof data === 'object' ? data : {}; + data["id"] = this.id; + data["tenantId"] = this.tenantId; + data["auditLogId"] = this.auditLogId; + data["serviceName"] = this.serviceName; + data["methodName"] = this.methodName; + data["parameters"] = this.parameters; + data["executionTime"] = this.executionTime; + data["executionDuration"] = this.executionDuration; + if (this.extraProperties) { + data["extraProperties"] = {}; + for (let key in this.extraProperties) { + if (this.extraProperties.hasOwnProperty(key)) + (data["extraProperties"])[key] = (this.extraProperties)[key]; + } + } + return data; + } +} + +export interface IPagingAuditLogActionOutput { + id: string; + tenantId: string | undefined; + auditLogId: string; + serviceName: string | undefined; + methodName: string | undefined; + parameters: string | undefined; + executionTime: string | undefined; + executionDuration: number; + extraProperties: { [key: string]: any; } | undefined; +} + +export class PagingAuditLogInput implements IPagingAuditLogInput { /** 当前页面.默认从1开始 */ pageIndex!: number; /** 每页多少条.每页显示多少记录 */ @@ -13216,6 +13150,8 @@ export class PagingAuditLogListInput implements IPagingAuditLogListInput { httpMethod!: string | undefined; /** 请求地址 */ url!: string | undefined; + /** 用户Id */ + userId!: string | undefined; /** 用户名 */ userName!: string | undefined; /** 应用程序名称 */ @@ -13229,8 +13165,10 @@ export class PagingAuditLogListInput implements IPagingAuditLogListInput { /** 是否有异常 */ hasException!: boolean | undefined; httpStatusCode!: HttpStatusCode; + /** 客户端IP */ + clientIpAddress!: string | undefined; - constructor(data?: IPagingAuditLogListInput) { + constructor(data?: IPagingAuditLogInput) { if (data) { for (var property in data) { if (data.hasOwnProperty(property)) @@ -13249,6 +13187,7 @@ export class PagingAuditLogListInput implements IPagingAuditLogListInput { this.endTime = _data["endTime"] ? dayjs(_data["endTime"].toString()) : undefined; this.httpMethod = _data["httpMethod"]; this.url = _data["url"]; + this.userId = _data["userId"]; this.userName = _data["userName"]; this.applicationName = _data["applicationName"]; this.correlationId = _data["correlationId"]; @@ -13256,12 +13195,13 @@ export class PagingAuditLogListInput implements IPagingAuditLogListInput { this.minExecutionDuration = _data["minExecutionDuration"]; this.hasException = _data["hasException"]; this.httpStatusCode = _data["httpStatusCode"]; + this.clientIpAddress = _data["clientIpAddress"]; } } - static fromJS(data: any): PagingAuditLogListInput { + static fromJS(data: any): PagingAuditLogInput { data = typeof data === 'object' ? data : {}; - let result = new PagingAuditLogListInput(); + let result = new PagingAuditLogInput(); result.init(data); return result; } @@ -13276,6 +13216,7 @@ export class PagingAuditLogListInput implements IPagingAuditLogListInput { data["endTime"] = this.endTime ? this.endTime.toISOString() : undefined; data["httpMethod"] = this.httpMethod; data["url"] = this.url; + data["userId"] = this.userId; data["userName"] = this.userName; data["applicationName"] = this.applicationName; data["correlationId"] = this.correlationId; @@ -13283,11 +13224,12 @@ export class PagingAuditLogListInput implements IPagingAuditLogListInput { data["minExecutionDuration"] = this.minExecutionDuration; data["hasException"] = this.hasException; data["httpStatusCode"] = this.httpStatusCode; + data["clientIpAddress"] = this.clientIpAddress; return data; } } -export interface IPagingAuditLogListInput { +export interface IPagingAuditLogInput { /** 当前页面.默认从1开始 */ pageIndex: number; /** 每页多少条.每页显示多少记录 */ @@ -13304,6 +13246,8 @@ export interface IPagingAuditLogListInput { httpMethod: string | undefined; /** 请求地址 */ url: string | undefined; + /** 用户Id */ + userId: string | undefined; /** 用户名 */ userName: string | undefined; /** 应用程序名称 */ @@ -13317,6 +13261,188 @@ export interface IPagingAuditLogListInput { /** 是否有异常 */ hasException: boolean | undefined; httpStatusCode: HttpStatusCode; + /** 客户端IP */ + clientIpAddress: string | undefined; +} + +export class PagingAuditLogOutput implements IPagingAuditLogOutput { + applicationName!: string | undefined; + userId!: string | undefined; + userName!: string | undefined; + tenantId!: string | undefined; + tenantName!: string | undefined; + impersonatorUserId!: string | undefined; + impersonatorTenantId!: string | undefined; + executionTime!: string | undefined; + executionDuration!: number; + clientIpAddress!: string | undefined; + clientName!: string | undefined; + clientId!: string | undefined; + correlationId!: string | undefined; + browserInfo!: string | undefined; + httpMethod!: string | undefined; + url!: string | undefined; + exceptions!: string | undefined; + comments!: string | undefined; + httpStatusCode!: number | undefined; + entityChanges!: PagingEntityChangeOutput[] | undefined; + actions!: PagingAuditLogActionOutput[] | undefined; + + constructor(data?: IPagingAuditLogOutput) { + if (data) { + for (var property in data) { + if (data.hasOwnProperty(property)) + (this)[property] = (data)[property]; + } + } + } + + init(_data?: any) { + if (_data) { + this.applicationName = _data["applicationName"]; + this.userId = _data["userId"]; + this.userName = _data["userName"]; + this.tenantId = _data["tenantId"]; + this.tenantName = _data["tenantName"]; + this.impersonatorUserId = _data["impersonatorUserId"]; + this.impersonatorTenantId = _data["impersonatorTenantId"]; + this.executionTime = _data["executionTime"]; + this.executionDuration = _data["executionDuration"]; + this.clientIpAddress = _data["clientIpAddress"]; + this.clientName = _data["clientName"]; + this.clientId = _data["clientId"]; + this.correlationId = _data["correlationId"]; + this.browserInfo = _data["browserInfo"]; + this.httpMethod = _data["httpMethod"]; + this.url = _data["url"]; + this.exceptions = _data["exceptions"]; + this.comments = _data["comments"]; + this.httpStatusCode = _data["httpStatusCode"]; + if (Array.isArray(_data["entityChanges"])) { + this.entityChanges = [] as any; + for (let item of _data["entityChanges"]) + this.entityChanges!.push(PagingEntityChangeOutput.fromJS(item)); + } + if (Array.isArray(_data["actions"])) { + this.actions = [] as any; + for (let item of _data["actions"]) + this.actions!.push(PagingAuditLogActionOutput.fromJS(item)); + } + } + } + + static fromJS(data: any): PagingAuditLogOutput { + data = typeof data === 'object' ? data : {}; + let result = new PagingAuditLogOutput(); + result.init(data); + return result; + } + + toJSON(data?: any) { + data = typeof data === 'object' ? data : {}; + data["applicationName"] = this.applicationName; + data["userId"] = this.userId; + data["userName"] = this.userName; + data["tenantId"] = this.tenantId; + data["tenantName"] = this.tenantName; + data["impersonatorUserId"] = this.impersonatorUserId; + data["impersonatorTenantId"] = this.impersonatorTenantId; + data["executionTime"] = this.executionTime; + data["executionDuration"] = this.executionDuration; + data["clientIpAddress"] = this.clientIpAddress; + data["clientName"] = this.clientName; + data["clientId"] = this.clientId; + data["correlationId"] = this.correlationId; + data["browserInfo"] = this.browserInfo; + data["httpMethod"] = this.httpMethod; + data["url"] = this.url; + data["exceptions"] = this.exceptions; + data["comments"] = this.comments; + data["httpStatusCode"] = this.httpStatusCode; + if (Array.isArray(this.entityChanges)) { + data["entityChanges"] = []; + for (let item of this.entityChanges) + data["entityChanges"].push(item.toJSON()); + } + if (Array.isArray(this.actions)) { + data["actions"] = []; + for (let item of this.actions) + data["actions"].push(item.toJSON()); + } + return data; + } +} + +export interface IPagingAuditLogOutput { + applicationName: string | undefined; + userId: string | undefined; + userName: string | undefined; + tenantId: string | undefined; + tenantName: string | undefined; + impersonatorUserId: string | undefined; + impersonatorTenantId: string | undefined; + executionTime: string | undefined; + executionDuration: number; + clientIpAddress: string | undefined; + clientName: string | undefined; + clientId: string | undefined; + correlationId: string | undefined; + browserInfo: string | undefined; + httpMethod: string | undefined; + url: string | undefined; + exceptions: string | undefined; + comments: string | undefined; + httpStatusCode: number | undefined; + entityChanges: PagingEntityChangeOutput[] | undefined; + actions: PagingAuditLogActionOutput[] | undefined; +} + +export class PagingAuditLogOutputPagedResultDto implements IPagingAuditLogOutputPagedResultDto { + items!: PagingAuditLogOutput[] | undefined; + totalCount!: number; + + constructor(data?: IPagingAuditLogOutputPagedResultDto) { + if (data) { + for (var property in data) { + if (data.hasOwnProperty(property)) + (this)[property] = (data)[property]; + } + } + } + + init(_data?: any) { + if (_data) { + if (Array.isArray(_data["items"])) { + this.items = [] as any; + for (let item of _data["items"]) + this.items!.push(PagingAuditLogOutput.fromJS(item)); + } + this.totalCount = _data["totalCount"]; + } + } + + static fromJS(data: any): PagingAuditLogOutputPagedResultDto { + data = typeof data === 'object' ? data : {}; + let result = new PagingAuditLogOutputPagedResultDto(); + result.init(data); + return result; + } + + toJSON(data?: any) { + data = typeof data === 'object' ? data : {}; + if (Array.isArray(this.items)) { + data["items"] = []; + for (let item of this.items) + data["items"].push(item.toJSON()); + } + data["totalCount"] = this.totalCount; + return data; + } +} + +export interface IPagingAuditLogOutputPagedResultDto { + items: PagingAuditLogOutput[] | undefined; + totalCount: number; } export class PagingDataDictionaryDetailInput implements IPagingDataDictionaryDetailInput { @@ -13813,6 +13939,162 @@ export interface IPagingElasticSearchLogOutputCustomPagedResultDto { totalCount: number; } +export class PagingEntityChangeOutput implements IPagingEntityChangeOutput { + id!: string; + auditLogId!: string; + tenantId!: string | undefined; + changeTime!: string | undefined; + changeType!: EntityChangeType; + changeTypeDescription!: string | undefined; + entityTenantId!: string | undefined; + entityId!: string | undefined; + entityTypeFullName!: string | undefined; + propertyChanges!: PagingEntityPropertyChangeOutput[] | undefined; + extraProperties!: { [key: string]: any; } | undefined; + + constructor(data?: IPagingEntityChangeOutput) { + if (data) { + for (var property in data) { + if (data.hasOwnProperty(property)) + (this)[property] = (data)[property]; + } + } + } + + init(_data?: any) { + if (_data) { + this.id = _data["id"]; + this.auditLogId = _data["auditLogId"]; + this.tenantId = _data["tenantId"]; + this.changeTime = _data["changeTime"]; + this.changeType = _data["changeType"]; + this.changeTypeDescription = _data["changeTypeDescription"]; + this.entityTenantId = _data["entityTenantId"]; + this.entityId = _data["entityId"]; + this.entityTypeFullName = _data["entityTypeFullName"]; + if (Array.isArray(_data["propertyChanges"])) { + this.propertyChanges = [] as any; + for (let item of _data["propertyChanges"]) + this.propertyChanges!.push(PagingEntityPropertyChangeOutput.fromJS(item)); + } + if (_data["extraProperties"]) { + this.extraProperties = {} as any; + for (let key in _data["extraProperties"]) { + if (_data["extraProperties"].hasOwnProperty(key)) + (this.extraProperties)![key] = _data["extraProperties"][key]; + } + } + } + } + + static fromJS(data: any): PagingEntityChangeOutput { + data = typeof data === 'object' ? data : {}; + let result = new PagingEntityChangeOutput(); + result.init(data); + return result; + } + + toJSON(data?: any) { + data = typeof data === 'object' ? data : {}; + data["id"] = this.id; + data["auditLogId"] = this.auditLogId; + data["tenantId"] = this.tenantId; + data["changeTime"] = this.changeTime; + data["changeType"] = this.changeType; + data["changeTypeDescription"] = this.changeTypeDescription; + data["entityTenantId"] = this.entityTenantId; + data["entityId"] = this.entityId; + data["entityTypeFullName"] = this.entityTypeFullName; + if (Array.isArray(this.propertyChanges)) { + data["propertyChanges"] = []; + for (let item of this.propertyChanges) + data["propertyChanges"].push(item.toJSON()); + } + if (this.extraProperties) { + data["extraProperties"] = {}; + for (let key in this.extraProperties) { + if (this.extraProperties.hasOwnProperty(key)) + (data["extraProperties"])[key] = (this.extraProperties)[key]; + } + } + return data; + } +} + +export interface IPagingEntityChangeOutput { + id: string; + auditLogId: string; + tenantId: string | undefined; + changeTime: string | undefined; + changeType: EntityChangeType; + changeTypeDescription: string | undefined; + entityTenantId: string | undefined; + entityId: string | undefined; + entityTypeFullName: string | undefined; + propertyChanges: PagingEntityPropertyChangeOutput[] | undefined; + extraProperties: { [key: string]: any; } | undefined; +} + +export class PagingEntityPropertyChangeOutput implements IPagingEntityPropertyChangeOutput { + id!: string; + tenantId!: string | undefined; + entityChangeId!: string; + newValue!: string | undefined; + originalValue!: string | undefined; + propertyName!: string | undefined; + propertyTypeFullName!: string | undefined; + + constructor(data?: IPagingEntityPropertyChangeOutput) { + if (data) { + for (var property in data) { + if (data.hasOwnProperty(property)) + (this)[property] = (data)[property]; + } + } + } + + init(_data?: any) { + if (_data) { + this.id = _data["id"]; + this.tenantId = _data["tenantId"]; + this.entityChangeId = _data["entityChangeId"]; + this.newValue = _data["newValue"]; + this.originalValue = _data["originalValue"]; + this.propertyName = _data["propertyName"]; + this.propertyTypeFullName = _data["propertyTypeFullName"]; + } + } + + static fromJS(data: any): PagingEntityPropertyChangeOutput { + data = typeof data === 'object' ? data : {}; + let result = new PagingEntityPropertyChangeOutput(); + result.init(data); + return result; + } + + toJSON(data?: any) { + data = typeof data === 'object' ? data : {}; + data["id"] = this.id; + data["tenantId"] = this.tenantId; + data["entityChangeId"] = this.entityChangeId; + data["newValue"] = this.newValue; + data["originalValue"] = this.originalValue; + data["propertyName"] = this.propertyName; + data["propertyTypeFullName"] = this.propertyTypeFullName; + return data; + } +} + +export interface IPagingEntityPropertyChangeOutput { + id: string; + tenantId: string | undefined; + entityChangeId: string; + newValue: string | undefined; + originalValue: string | undefined; + propertyName: string | undefined; + propertyTypeFullName: string | undefined; +} + export class PagingNotificationListInput implements IPagingNotificationListInput { /** 当前页面.默认从1开始 */ pageIndex!: number; diff --git a/vben28/src/views/admin/auditLog/AuditLog.ts b/vben28/src/views/admin/auditLog/AuditLog.ts index 7a223f94..5512e7be 100644 --- a/vben28/src/views/admin/auditLog/AuditLog.ts +++ b/vben28/src/views/admin/auditLog/AuditLog.ts @@ -1,32 +1,31 @@ import { FormSchema } from '/@/components/Table'; import { BasicColumn } from '/@/components/Table'; import { useI18n } from '/@/hooks/web/useI18n'; - +import { formatToDateTime, dateUtil } from '/@/utils/dateUtil'; const { t } = useI18n(); -import { formatToDateTime } from '/@/utils/dateUtil'; -import { AuditLogsServiceProxy, PagingAuditLogListInput } from '/@/services/ServiceProxies'; +import { AuditLogsServiceProxy, PagingAuditLogInput } from '/@/services/ServiceProxies'; export const searchFormSchema: FormSchema[] = [ { field: 'userName', label: t('routes.admin.userManagement_userName'), component: 'Input', - colProps: { span: 4 }, + colProps: { span: 3 }, }, { field: 'time', component: 'RangePicker', label: t('routes.admin.audit_executeTime'), - labelWidth: 120, colProps: { - span: 6, + span: 4, }, + defaultValue: [dateUtil().subtract(7, 'days'), dateUtil().add(1, 'days')], }, { field: 'hasException', label: t('routes.admin.audit_hasException'), component: 'Select', - colProps: { span: 4 }, + colProps: { span: 2 }, componentProps: () => { return { options: [ @@ -37,20 +36,33 @@ export const searchFormSchema: FormSchema[] = [ }; }, }, + { + field: 'correlationId', + label: 'CorrelationId', + labelWidth: 95, + component: 'Input', + colProps: { span: 4 }, + }, + { + field: 'url', + label: 'Url', + component: 'Input', + colProps: { span: 4 }, + }, ]; export const tableColumns: BasicColumn[] = [ - // { - // title: t('routes.admin.tenant'), - // dataIndex: 'tenantName', - // width: 100, - // }, { title: 'Url', dataIndex: 'url', width: 350, align: 'left', }, + { + title: t('routes.admin.tenant'), + dataIndex: 'tenantName', + width: 100, + }, { title: t('routes.admin.userManagement_userName'), dataIndex: 'userName', @@ -59,24 +71,32 @@ export const tableColumns: BasicColumn[] = [ { title: t('routes.admin.executionTime'), dataIndex: 'executionTime', - width: 200, customRender: ({ text }) => { return formatToDateTime(text); }, + width: 150, }, { title: t('routes.admin.executionDuration'), dataIndex: 'executionDuration', + width: 120, + }, + { + title: t('routes.admin.audit_ipAddress'), + dataIndex: 'clientIpAddress', width: 150, }, + { + title: 'CorrelationId', + dataIndex: 'correlationId', + width: 280, + }, { title: t('routes.admin.executionMessage'), dataIndex: 'exceptions', - resizable: false, - width: 350, customRender: ({ text }) => { if (text) { - return text.toString(); + return text.toString().substring(0, 300); } }, }, @@ -87,7 +107,7 @@ export const tableColumns: BasicColumn[] = [ * @param params * @returns */ -export async function getTableListAsync(params: PagingAuditLogListInput) { +export async function getTableListAsync(params: PagingAuditLogInput) { const _auditLogsServiceProxy = new AuditLogsServiceProxy(); return _auditLogsServiceProxy.page(params); } diff --git a/vben28/src/views/admin/auditLog/AuditLog.vue b/vben28/src/views/admin/auditLog/AuditLog.vue index 2ee05e7a..59e5e877 100644 --- a/vben28/src/views/admin/auditLog/AuditLog.vue +++ b/vben28/src/views/admin/auditLog/AuditLog.vue @@ -10,13 +10,25 @@ {{ record.url }} + + diff --git a/vben28/src/views/admin/roles/AbpRole.vue b/vben28/src/views/admin/roles/AbpRole.vue index 963b9f73..167e06dd 100644 --- a/vben28/src/views/admin/roles/AbpRole.vue +++ b/vben28/src/views/admin/roles/AbpRole.vue @@ -1,13 +1,13 @@