mirror of
https://github.com/nsnail/NetAdmin.git
synced 2025-06-19 18:28:17 +08:00
@ -11,11 +11,11 @@ public sealed class CommandLineArgs : CommandSettings
|
||||
/// 插入种子数据
|
||||
/// </summary>
|
||||
[CommandOption("-i|--insert-seed-data")]
|
||||
public bool InsertSeedData { get; set; }
|
||||
public bool InsertSeedData { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 同步数据库结构
|
||||
/// </summary>
|
||||
[CommandOption("-s|--sync-structure")]
|
||||
public bool SyncStructure { get; set; }
|
||||
public bool SyncStructure { get; init; }
|
||||
}
|
@ -14,13 +14,11 @@
|
||||
},
|
||||
{
|
||||
"Group": "Tpl",
|
||||
"Title": "示例服务",
|
||||
"Description": "NetAdmin - 示例服务",
|
||||
"Visible": false
|
||||
"Visible": false,
|
||||
},
|
||||
{
|
||||
"Group": "Health",
|
||||
"Visible": false
|
||||
"Group": "Probe",
|
||||
"Visible": false,
|
||||
}
|
||||
],
|
||||
"SecurityDefinitions": [
|
||||
|
@ -31,6 +31,13 @@ public record Sys_JobRecord : LiteImmutableEntity
|
||||
[JsonIgnore]
|
||||
public virtual int HttpStatusCode { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 拥有者信息
|
||||
/// </summary>
|
||||
[Navigate(nameof(JobId))]
|
||||
[JsonIgnore]
|
||||
public Sys_Job Job { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 作业编号
|
||||
/// </summary>
|
||||
|
17
src/backend/NetAdmin.Domain/Dto/Sys/GetBarChartRsp.cs
Normal file
17
src/backend/NetAdmin.Domain/Dto/Sys/GetBarChartRsp.cs
Normal file
@ -0,0 +1,17 @@
|
||||
namespace NetAdmin.Domain.Dto.Sys;
|
||||
|
||||
/// <summary>
|
||||
/// 响应:获取条形图数据
|
||||
/// </summary>
|
||||
public sealed record GetBarChartRsp : DataAbstraction
|
||||
{
|
||||
/// <summary>
|
||||
/// 时间戳
|
||||
/// </summary>
|
||||
public DateTime Timestamp { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 值
|
||||
/// </summary>
|
||||
public int Value { get; init; }
|
||||
}
|
17
src/backend/NetAdmin.Domain/Dto/Sys/GetPieChartRsp.cs
Normal file
17
src/backend/NetAdmin.Domain/Dto/Sys/GetPieChartRsp.cs
Normal file
@ -0,0 +1,17 @@
|
||||
namespace NetAdmin.Domain.Dto.Sys;
|
||||
|
||||
/// <summary>
|
||||
/// 响应:获取饼图数据
|
||||
/// </summary>
|
||||
public sealed record GetPieChartRsp : DataAbstraction
|
||||
{
|
||||
/// <summary>
|
||||
/// 键名
|
||||
/// </summary>
|
||||
public string Key { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 键值
|
||||
/// </summary>
|
||||
public int Value { get; init; }
|
||||
}
|
@ -7,9 +7,9 @@ namespace NetAdmin.Domain.Enums.Sys;
|
||||
public enum SiteMsgTypes
|
||||
{
|
||||
/// <summary>
|
||||
/// 私信
|
||||
/// 通知
|
||||
/// </summary>
|
||||
[ResourceDescription<Ln>(nameof(Ln.私信))]
|
||||
[ResourceDescription<Ln>(nameof(Ln.通知))]
|
||||
Private = 1
|
||||
|
||||
,
|
||||
|
@ -23,6 +23,7 @@ public static class Numbers
|
||||
public const int MAX_LIMIT_QUERY_PAGE_NO = 10000; // 最大限制:分页查询页码
|
||||
public const int MAX_LIMIT_QUERY_PAGE_SIZE = 100; // 最大限制:分页查询页容量
|
||||
|
||||
public const int SECS_CACHE_CHART = 300; // 秒:缓存时间-仪表
|
||||
public const int SECS_CACHE_DEFAULT = 60; // 秒:缓存时间-默认
|
||||
public const int SECS_RED_LOCK_EXPIRY = 30; // 秒:RedLock-锁过期时间,锁区域内的逻辑执行如果超过过期时间,锁将被释放
|
||||
public const int SECS_RED_LOCK_RETRY = 1; // 秒:RedLock-锁等待时间内,多久尝试获取一次
|
||||
|
@ -27,4 +27,12 @@ public enum Orders
|
||||
/// </summary>
|
||||
[ResourceDescription<Ln>(nameof(Ln.随机排序))]
|
||||
Random = 3
|
||||
|
||||
,
|
||||
|
||||
/// <summary>
|
||||
/// 不排序
|
||||
/// </summary>
|
||||
[ResourceDescription<Ln>(nameof(Ln.不排序))]
|
||||
None = 4
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
using NetAdmin.Application.Modules;
|
||||
using NetAdmin.Domain.Dto.Dependency;
|
||||
using NetAdmin.Domain.Dto.Sys;
|
||||
using NetAdmin.Domain.Dto.Sys.Job;
|
||||
using NetAdmin.Domain.Dto.Sys.JobRecord;
|
||||
|
||||
@ -19,6 +20,21 @@ public interface IJobModule : ICrudModule<CreateJobReq, QueryJobRsp // 创建类
|
||||
/// </summary>
|
||||
Task<QueryJobRsp> EditAsync(UpdateJobReq req);
|
||||
|
||||
/// <summary>
|
||||
/// 获取作业记录条形图数据
|
||||
/// </summary>
|
||||
Task<IOrderedEnumerable<GetBarChartRsp>> GetRecordBarChartAsync(QueryReq<QueryJobRecordReq> req);
|
||||
|
||||
/// <summary>
|
||||
/// 状态码分组作业记录饼图数据
|
||||
/// </summary>
|
||||
Task<IOrderedEnumerable<GetPieChartRsp>> GetRecordPieChartByHttpStatusCodeAsync(QueryReq<QueryJobRecordReq> req);
|
||||
|
||||
/// <summary>
|
||||
/// 名称分组作业记录饼图数据
|
||||
/// </summary>
|
||||
Task<IOrderedEnumerable<GetPieChartRsp>> GetRecordPieChartByNameAsync(QueryReq<QueryJobRecordReq> req);
|
||||
|
||||
/// <summary>
|
||||
/// 获取单个作业记录
|
||||
/// </summary>
|
||||
|
@ -1,5 +1,6 @@
|
||||
using NetAdmin.Application.Modules;
|
||||
using NetAdmin.Domain.Dto.Dependency;
|
||||
using NetAdmin.Domain.Dto.Sys;
|
||||
using NetAdmin.Domain.Dto.Sys.RequestLog;
|
||||
|
||||
namespace NetAdmin.SysComponent.Application.Modules.Sys;
|
||||
@ -11,4 +12,20 @@ public interface IRequestLogModule : ICrudModule<CreateRequestLogReq, QueryReque
|
||||
, QueryRequestLogReq, QueryRequestLogRsp // 查询类型
|
||||
, NopReq, NopReq // 修改类型
|
||||
, DelReq // 删除类型
|
||||
>;
|
||||
>
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取条形图数据
|
||||
/// </summary>
|
||||
Task<IOrderedEnumerable<GetBarChartRsp>> GetBarChartAsync(QueryReq<QueryRequestLogReq> req);
|
||||
|
||||
/// <summary>
|
||||
/// 描述分组饼图数据
|
||||
/// </summary>
|
||||
Task<IOrderedEnumerable<GetPieChartRsp>> GetPieChartByApiSummaryAsync(QueryReq<QueryRequestLogReq> req);
|
||||
|
||||
/// <summary>
|
||||
/// 状态码分组饼图数据
|
||||
/// </summary>
|
||||
Task<IOrderedEnumerable<GetPieChartRsp>> GetPieChartByHttpStatusCodeAsync(QueryReq<QueryRequestLogReq> req);
|
||||
}
|
@ -148,8 +148,11 @@ public sealed class ApiService(
|
||||
private ISelect<Sys_Api> QueryInternal(QueryReq<QueryApiReq> req)
|
||||
{
|
||||
var ret = Rpo.Select.WhereDynamicFilter(req.DynamicFilter).WhereDynamic(req.Filter);
|
||||
if (req.Order == Orders.Random) {
|
||||
return ret.OrderByRandom();
|
||||
switch (req.Order) {
|
||||
case Orders.None:
|
||||
return ret;
|
||||
case Orders.Random:
|
||||
return ret.OrderByRandom();
|
||||
}
|
||||
|
||||
ret = ret.OrderByPropertyNameIf(req.Prop?.Length > 0, req.Prop, req.Order == Orders.Ascending);
|
||||
|
@ -121,8 +121,11 @@ public sealed class ConfigService(DefaultRepository<Sys_Config> rpo) //
|
||||
.WhereDynamicFilter(req.DynamicFilter)
|
||||
.WhereIf( //
|
||||
req.Filter?.Enabled.HasValue ?? false, a => a.Enabled == req.Filter.Enabled.Value);
|
||||
if (req.Order == Orders.Random) {
|
||||
return ret.OrderByRandom();
|
||||
switch (req.Order) {
|
||||
case Orders.None:
|
||||
return ret;
|
||||
case Orders.Random:
|
||||
return ret.OrderByRandom();
|
||||
}
|
||||
|
||||
ret = ret.OrderByPropertyNameIf(req.Prop?.Length > 0, req.Prop, req.Order == Orders.Ascending);
|
||||
|
@ -1,4 +1,7 @@
|
||||
using NetAdmin.Application.Services;
|
||||
using NetAdmin.Domain.Dto.Dependency;
|
||||
using NetAdmin.Domain.Dto.Sys;
|
||||
using NetAdmin.Domain.Dto.Sys.JobRecord;
|
||||
using NetAdmin.SysComponent.Application.Modules.Sys;
|
||||
|
||||
namespace NetAdmin.SysComponent.Application.Services.Sys.Dependency;
|
||||
@ -6,4 +9,20 @@ namespace NetAdmin.SysComponent.Application.Services.Sys.Dependency;
|
||||
/// <summary>
|
||||
/// 计划作业执行记录服务
|
||||
/// </summary>
|
||||
public interface IJobRecordService : IService, IJobRecordModule;
|
||||
public interface IJobRecordService : IService, IJobRecordModule
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取条形图数据
|
||||
/// </summary>
|
||||
Task<IOrderedEnumerable<GetBarChartRsp>> GetBarChartAsync(QueryReq<QueryJobRecordReq> req);
|
||||
|
||||
/// <summary>
|
||||
/// 状态码分组饼图数据
|
||||
/// </summary>
|
||||
Task<IOrderedEnumerable<GetPieChartRsp>> GetPieChartByHttpStatusCodeAsync(QueryReq<QueryJobRecordReq> req);
|
||||
|
||||
/// <summary>
|
||||
/// 名称分组饼图数据
|
||||
/// </summary>
|
||||
Task<IOrderedEnumerable<GetPieChartRsp>> GetPieChartByNameAsync(QueryReq<QueryJobRecordReq> req);
|
||||
}
|
@ -124,8 +124,11 @@ public sealed class DeptService(DefaultRepository<Sys_Dept> rpo) //
|
||||
ret = ret.AsTreeCte();
|
||||
}
|
||||
|
||||
if (req.Order == Orders.Random) {
|
||||
return ret.OrderByRandom();
|
||||
switch (req.Order) {
|
||||
case Orders.None:
|
||||
return ret;
|
||||
case Orders.Random:
|
||||
return ret.OrderByRandom();
|
||||
}
|
||||
|
||||
ret = ret.OrderByPropertyNameIf(req.Prop?.Length > 0, req.Prop, req.Order == Orders.Ascending);
|
||||
|
@ -120,8 +120,11 @@ public sealed class DicCatalogService(DefaultRepository<Sys_DicCatalog> rpo) //
|
||||
private ISelect<Sys_DicCatalog> QueryInternal(QueryReq<QueryDicCatalogReq> req)
|
||||
{
|
||||
var ret = Rpo.Select.WhereDynamicFilter(req.DynamicFilter).WhereDynamic(req.Filter);
|
||||
if (req.Order == Orders.Random) {
|
||||
return ret.OrderByRandom();
|
||||
switch (req.Order) {
|
||||
case Orders.None:
|
||||
return ret;
|
||||
case Orders.Random:
|
||||
return ret.OrderByRandom();
|
||||
}
|
||||
|
||||
ret = ret.OrderByPropertyNameIf(req.Prop?.Length > 0, req.Prop, req.Order == Orders.Ascending);
|
||||
|
@ -125,8 +125,11 @@ public sealed class DicContentService(DefaultRepository<Sys_DicContent> rpo) //
|
||||
private ISelect<Sys_DicContent> QueryInternal(QueryReq<QueryDicContentReq> req)
|
||||
{
|
||||
var ret = Rpo.Select.WhereDynamicFilter(req.DynamicFilter).WhereDynamic(req.Filter);
|
||||
if (req.Order == Orders.Random) {
|
||||
return ret.OrderByRandom();
|
||||
switch (req.Order) {
|
||||
case Orders.None:
|
||||
return ret;
|
||||
case Orders.Random:
|
||||
return ret.OrderByRandom();
|
||||
}
|
||||
|
||||
ret = ret.OrderByPropertyNameIf(req.Prop?.Length > 0, req.Prop, req.Order == Orders.Ascending);
|
||||
|
@ -2,6 +2,7 @@ using NetAdmin.Application.Repositories;
|
||||
using NetAdmin.Application.Services;
|
||||
using NetAdmin.Domain.DbMaps.Sys;
|
||||
using NetAdmin.Domain.Dto.Dependency;
|
||||
using NetAdmin.Domain.Dto.Sys;
|
||||
using NetAdmin.Domain.Dto.Sys.JobRecord;
|
||||
using NetAdmin.SysComponent.Application.Services.Sys.Dependency;
|
||||
using DataType = FreeSql.DataType;
|
||||
@ -65,6 +66,56 @@ public sealed class JobRecordService(DefaultRepository<Sys_JobRecord> rpo) //
|
||||
return ret.Adapt<QueryJobRecordRsp>();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<IOrderedEnumerable<GetBarChartRsp>> GetBarChartAsync(QueryReq<QueryJobRecordReq> req)
|
||||
{
|
||||
req.ThrowIfInvalid();
|
||||
|
||||
var ret = await QueryInternal(req with { Order = Orders.None })
|
||||
.GroupBy(a => new {
|
||||
a.CreatedTime.Year
|
||||
, a.CreatedTime.Month
|
||||
, a.CreatedTime.Day
|
||||
, a.CreatedTime.Hour
|
||||
})
|
||||
.ToListAsync(a => new GetBarChartRsp {
|
||||
Timestamp = new DateTime(
|
||||
a.Key.Year, a.Key.Month, a.Key.Day, a.Key.Hour, 0
|
||||
, 0, DateTimeKind.Unspecified)
|
||||
, Value = a.Count()
|
||||
})
|
||||
.ConfigureAwait(false);
|
||||
return ret.OrderBy(x => x.Timestamp);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<IOrderedEnumerable<GetPieChartRsp>> GetPieChartByHttpStatusCodeAsync(
|
||||
QueryReq<QueryJobRecordReq> req)
|
||||
{
|
||||
req.ThrowIfInvalid();
|
||||
var ret = await QueryInternal(req with { Order = Orders.None })
|
||||
.Include(a => a.Job)
|
||||
.GroupBy(a => a.HttpStatusCode)
|
||||
#pragma warning disable CA1305
|
||||
.ToListAsync(a => new GetPieChartRsp { Value = a.Count(), Key = a.Key.ToString() })
|
||||
#pragma warning restore CA1305
|
||||
.ConfigureAwait(false);
|
||||
return ret.Select(x => x with { Key = Enum.Parse<HttpStatusCode>(x.Key).ToString() })
|
||||
.OrderByDescending(x => x.Value);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<IOrderedEnumerable<GetPieChartRsp>> GetPieChartByNameAsync(QueryReq<QueryJobRecordReq> req)
|
||||
{
|
||||
req.ThrowIfInvalid();
|
||||
var ret = await QueryInternal(req with { Order = Orders.None })
|
||||
.Include(a => a.Job)
|
||||
.GroupBy(a => a.Job.JobName)
|
||||
.ToListAsync(a => new GetPieChartRsp { Value = a.Count(), Key = a.Key })
|
||||
.ConfigureAwait(false);
|
||||
return ret.OrderByDescending(x => x.Value);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<PagedQueryRsp<QueryJobRecordRsp>> PagedQueryAsync(PagedQueryReq<QueryJobRecordReq> req)
|
||||
{
|
||||
@ -114,8 +165,11 @@ public sealed class JobRecordService(DefaultRepository<Sys_JobRecord> rpo) //
|
||||
.WhereIf( //
|
||||
req.Keywords?.Length > 0
|
||||
, a => a.JobId == req.Keywords.Int64Try(0) || a.Id == req.Keywords.Int64Try(0));
|
||||
if (req.Order == Orders.Random) {
|
||||
return ret.OrderByRandom();
|
||||
switch (req.Order) {
|
||||
case Orders.None:
|
||||
return ret;
|
||||
case Orders.Random:
|
||||
return ret.OrderByRandom();
|
||||
}
|
||||
|
||||
ret = ret.OrderByPropertyNameIf(req.Prop?.Length > 0, req.Prop, req.Order == Orders.Ascending);
|
||||
|
@ -3,6 +3,7 @@ using NetAdmin.Application.Repositories;
|
||||
using NetAdmin.Application.Services;
|
||||
using NetAdmin.Domain.DbMaps.Sys;
|
||||
using NetAdmin.Domain.Dto.Dependency;
|
||||
using NetAdmin.Domain.Dto.Sys;
|
||||
using NetAdmin.Domain.Dto.Sys.Job;
|
||||
using NetAdmin.Domain.Dto.Sys.JobRecord;
|
||||
using NetAdmin.Domain.Enums.Sys;
|
||||
@ -143,6 +144,28 @@ public sealed class JobService(DefaultRepository<Sys_Job> rpo, IJobRecordService
|
||||
.ConfigureAwait(false);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public Task<IOrderedEnumerable<GetBarChartRsp>> GetRecordBarChartAsync(QueryReq<QueryJobRecordReq> req)
|
||||
{
|
||||
req.ThrowIfInvalid();
|
||||
return jobRecordService.GetBarChartAsync(req);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public Task<IOrderedEnumerable<GetPieChartRsp>> GetRecordPieChartByHttpStatusCodeAsync(
|
||||
QueryReq<QueryJobRecordReq> req)
|
||||
{
|
||||
req.ThrowIfInvalid();
|
||||
return jobRecordService.GetPieChartByHttpStatusCodeAsync(req);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public Task<IOrderedEnumerable<GetPieChartRsp>> GetRecordPieChartByNameAsync(QueryReq<QueryJobRecordReq> req)
|
||||
{
|
||||
req.ThrowIfInvalid();
|
||||
return jobRecordService.GetPieChartByNameAsync(req);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<PagedQueryRsp<QueryJobRsp>> PagedQueryAsync(PagedQueryReq<QueryJobReq> req)
|
||||
{
|
||||
@ -227,8 +250,11 @@ public sealed class JobService(DefaultRepository<Sys_Job> rpo, IJobRecordService
|
||||
.WhereIf( //
|
||||
req.Keywords?.Length > 0
|
||||
, a => a.Id == req.Keywords.Int64Try(0) || a.JobName.Contains(req.Keywords));
|
||||
if (req.Order == Orders.Random) {
|
||||
return ret.OrderByRandom();
|
||||
switch (req.Order) {
|
||||
case Orders.None:
|
||||
return ret;
|
||||
case Orders.Random:
|
||||
return ret.OrderByRandom();
|
||||
}
|
||||
|
||||
ret = ret.OrderByPropertyNameIf(req.Prop?.Length > 0, req.Prop, req.Order == Orders.Ascending);
|
||||
|
@ -2,6 +2,7 @@ using NetAdmin.Application.Repositories;
|
||||
using NetAdmin.Application.Services;
|
||||
using NetAdmin.Domain.DbMaps.Sys;
|
||||
using NetAdmin.Domain.Dto.Dependency;
|
||||
using NetAdmin.Domain.Dto.Sys;
|
||||
using NetAdmin.Domain.Dto.Sys.RequestLog;
|
||||
using NetAdmin.SysComponent.Application.Services.Sys.Dependency;
|
||||
|
||||
@ -64,6 +65,54 @@ public sealed class RequestLogService(DefaultRepository<Sys_RequestLog> rpo) //
|
||||
return ret.Adapt<QueryRequestLogRsp>();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<IOrderedEnumerable<GetBarChartRsp>> GetBarChartAsync(QueryReq<QueryRequestLogReq> req)
|
||||
{
|
||||
req.ThrowIfInvalid();
|
||||
|
||||
var ret = await QueryInternal(req with { Order = Orders.None })
|
||||
.GroupBy(a => new {
|
||||
a.CreatedTime.Year
|
||||
, a.CreatedTime.Month
|
||||
, a.CreatedTime.Day
|
||||
, a.CreatedTime.Hour
|
||||
})
|
||||
.ToListAsync(a => new GetBarChartRsp {
|
||||
Timestamp = new DateTime(
|
||||
a.Key.Year, a.Key.Month, a.Key.Day, a.Key.Hour, 0
|
||||
, 0, DateTimeKind.Unspecified)
|
||||
, Value = a.Count()
|
||||
})
|
||||
.ConfigureAwait(false);
|
||||
return ret.OrderBy(x => x.Timestamp);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<IOrderedEnumerable<GetPieChartRsp>> GetPieChartByApiSummaryAsync(QueryReq<QueryRequestLogReq> req)
|
||||
{
|
||||
req.ThrowIfInvalid();
|
||||
var ret = await QueryInternal(req with { Order = Orders.None })
|
||||
.GroupBy(a => a.Api.Summary)
|
||||
.ToListAsync(a => new GetPieChartRsp { Value = a.Count(), Key = a.Key })
|
||||
.ConfigureAwait(false);
|
||||
return ret.OrderByDescending(x => x.Value);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<IOrderedEnumerable<GetPieChartRsp>> GetPieChartByHttpStatusCodeAsync(
|
||||
QueryReq<QueryRequestLogReq> req)
|
||||
{
|
||||
req.ThrowIfInvalid();
|
||||
var ret = await QueryInternal(req with { Order = Orders.None })
|
||||
.GroupBy(a => a.HttpStatusCode)
|
||||
#pragma warning disable CA1305
|
||||
.ToListAsync(a => new GetPieChartRsp { Value = a.Count(), Key = a.Key.ToString() })
|
||||
#pragma warning restore CA1305
|
||||
.ConfigureAwait(false);
|
||||
return ret.Select(x => x with { Key = Enum.Parse<HttpStatusCode>(x.Key).ToString() })
|
||||
.OrderByDescending(x => x.Value);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<PagedQueryRsp<QueryRequestLogRsp>> PagedQueryAsync(PagedQueryReq<QueryRequestLogReq> req)
|
||||
{
|
||||
@ -114,8 +163,11 @@ public sealed class RequestLogService(DefaultRepository<Sys_RequestLog> rpo) //
|
||||
private ISelect<Sys_RequestLog> QueryInternal(QueryReq<QueryRequestLogReq> req)
|
||||
{
|
||||
var ret = Rpo.Select.Include(a => a.Api).WhereDynamicFilter(req.DynamicFilter).WhereDynamic(req.Filter);
|
||||
if (req.Order == Orders.Random) {
|
||||
return ret.OrderByRandom();
|
||||
switch (req.Order) {
|
||||
case Orders.None:
|
||||
return ret;
|
||||
case Orders.Random:
|
||||
return ret.OrderByRandom();
|
||||
}
|
||||
|
||||
ret = ret.OrderByPropertyNameIf(req.Prop?.Length > 0, req.Prop, req.Order == Orders.Ascending);
|
||||
|
@ -110,8 +110,11 @@ public sealed class SiteMsgDeptService(DefaultRepository<Sys_SiteMsgDept> rpo) /
|
||||
private ISelect<Sys_SiteMsgDept> QueryInternal(QueryReq<QuerySiteMsgDeptReq> req)
|
||||
{
|
||||
var ret = Rpo.Select.WhereDynamicFilter(req.DynamicFilter).WhereDynamic(req.Filter);
|
||||
if (req.Order == Orders.Random) {
|
||||
return ret.OrderByRandom();
|
||||
switch (req.Order) {
|
||||
case Orders.None:
|
||||
return ret;
|
||||
case Orders.Random:
|
||||
return ret.OrderByRandom();
|
||||
}
|
||||
|
||||
ret = ret.OrderByPropertyNameIf(req.Prop?.Length > 0, req.Prop, req.Order == Orders.Ascending);
|
||||
|
@ -116,8 +116,11 @@ public sealed class SiteMsgFlagService(DefaultRepository<Sys_SiteMsgFlag> rpo) /
|
||||
private ISelect<Sys_SiteMsgFlag> QueryInternal(QueryReq<QuerySiteMsgFlagReq> req)
|
||||
{
|
||||
var ret = Rpo.Select.WhereDynamicFilter(req.DynamicFilter).WhereDynamic(req.Filter);
|
||||
if (req.Order == Orders.Random) {
|
||||
return ret.OrderByRandom();
|
||||
switch (req.Order) {
|
||||
case Orders.None:
|
||||
return ret;
|
||||
case Orders.Random:
|
||||
return ret.OrderByRandom();
|
||||
}
|
||||
|
||||
ret = ret.OrderByPropertyNameIf(req.Prop?.Length > 0, req.Prop, req.Order == Orders.Ascending);
|
||||
|
@ -110,8 +110,11 @@ public sealed class SiteMsgRoleService(DefaultRepository<Sys_SiteMsgRole> rpo) /
|
||||
private ISelect<Sys_SiteMsgRole> QueryInternal(QueryReq<QuerySiteMsgRoleReq> req)
|
||||
{
|
||||
var ret = Rpo.Select.WhereDynamicFilter(req.DynamicFilter).WhereDynamic(req.Filter);
|
||||
if (req.Order == Orders.Random) {
|
||||
return ret.OrderByRandom();
|
||||
switch (req.Order) {
|
||||
case Orders.None:
|
||||
return ret;
|
||||
case Orders.Random:
|
||||
return ret.OrderByRandom();
|
||||
}
|
||||
|
||||
ret = ret.OrderByPropertyNameIf(req.Prop?.Length > 0, req.Prop, req.Order == Orders.Ascending);
|
||||
|
@ -285,8 +285,11 @@ public sealed class SiteMsgService(
|
||||
req.Keywords?.Length > 0
|
||||
, a => a.Id == req.Keywords.Int64Try(0) || a.Title.Contains(req.Keywords) ||
|
||||
a.Summary.Contains(req.Keywords));
|
||||
if (req.Order == Orders.Random) {
|
||||
return ret.OrderByRandom();
|
||||
switch (req.Order) {
|
||||
case Orders.None:
|
||||
return ret;
|
||||
case Orders.Random:
|
||||
return ret.OrderByRandom();
|
||||
}
|
||||
|
||||
ret = ret.OrderByPropertyNameIf(req.Prop?.Length > 0, req.Prop, req.Order == Orders.Ascending);
|
||||
|
@ -110,8 +110,11 @@ public sealed class SiteMsgUserService(DefaultRepository<Sys_SiteMsgUser> rpo) /
|
||||
private ISelect<Sys_SiteMsgUser> QueryInternal(QueryReq<QuerySiteMsgUserReq> req)
|
||||
{
|
||||
var ret = Rpo.Select.WhereDynamicFilter(req.DynamicFilter).WhereDynamic(req.Filter);
|
||||
if (req.Order == Orders.Random) {
|
||||
return ret.OrderByRandom();
|
||||
switch (req.Order) {
|
||||
case Orders.None:
|
||||
return ret;
|
||||
case Orders.Random:
|
||||
return ret.OrderByRandom();
|
||||
}
|
||||
|
||||
ret = ret.OrderByPropertyNameIf(req.Prop?.Length > 0, req.Prop, req.Order == Orders.Ascending);
|
||||
|
@ -486,8 +486,11 @@ public sealed class UserService(
|
||||
private ISelect<Sys_User> QueryInternal(QueryReq<QueryUserReq> req)
|
||||
{
|
||||
var ret = Rpo.Select.WhereDynamicFilter(req.DynamicFilter).WhereDynamic(req.Filter);
|
||||
if (req.Order == Orders.Random) {
|
||||
return ret.OrderByRandom();
|
||||
switch (req.Order) {
|
||||
case Orders.None:
|
||||
return ret;
|
||||
case Orders.Random:
|
||||
return ret.OrderByRandom();
|
||||
}
|
||||
|
||||
ret = ret.OrderByPropertyNameIf(req.Prop?.Length > 0, req.Prop, req.Order == Orders.Ascending);
|
||||
@ -522,8 +525,11 @@ public sealed class UserService(
|
||||
, a => a.Id == req.Keywords.Int64Try(0) || a.UserName.Contains(req.Keywords) ||
|
||||
a.Mobile.Contains(req.Keywords) || a.Email.Contains(req.Keywords) ||
|
||||
a.Summary.Contains(req.Keywords));
|
||||
if (req.Order == Orders.Random) {
|
||||
return ret.OrderByRandom();
|
||||
switch (req.Order) {
|
||||
case Orders.None:
|
||||
return ret;
|
||||
case Orders.Random:
|
||||
return ret.OrderByRandom();
|
||||
}
|
||||
|
||||
ret = ret.OrderByPropertyNameIf(req.Prop?.Length > 0, req.Prop, req.Order == Orders.Ascending);
|
||||
|
@ -110,8 +110,11 @@ public sealed class ExampleService(DefaultRepository<Tpl_Example> rpo) //
|
||||
private ISelect<Tpl_Example> QueryInternal(QueryReq<QueryExampleReq> req)
|
||||
{
|
||||
var ret = Rpo.Select.WhereDynamicFilter(req.DynamicFilter).WhereDynamic(req.Filter);
|
||||
if (req.Order == Orders.Random) {
|
||||
return ret.OrderByRandom();
|
||||
switch (req.Order) {
|
||||
case Orders.None:
|
||||
return ret;
|
||||
case Orders.Random:
|
||||
return ret.OrderByRandom();
|
||||
}
|
||||
|
||||
ret = ret.OrderByPropertyNameIf(req.Prop?.Length > 0, req.Prop, req.Order == Orders.Ascending);
|
||||
|
@ -1,5 +1,6 @@
|
||||
using NetAdmin.Cache;
|
||||
using NetAdmin.Domain.Dto.Dependency;
|
||||
using NetAdmin.Domain.Dto.Sys;
|
||||
using NetAdmin.Domain.Dto.Sys.Job;
|
||||
using NetAdmin.Domain.Dto.Sys.JobRecord;
|
||||
using NetAdmin.SysComponent.Application.Services.Sys.Dependency;
|
||||
@ -53,6 +54,44 @@ public sealed class JobCache(IDistributedCache cache, IJobService service)
|
||||
return Service.GetAsync(req);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public Task<IOrderedEnumerable<GetBarChartRsp>> GetRecordBarChartAsync(QueryReq<QueryJobRecordReq> req)
|
||||
{
|
||||
#if !DEBUG
|
||||
return GetOrCreateAsync( //
|
||||
GetCacheKey(req.GetHashCode().ToString(CultureInfo.InvariantCulture)) //
|
||||
, () => Service.GetRecordBarChartAsync(req), TimeSpan.FromSeconds(Numbers.SECS_CACHE_CHART));
|
||||
#else
|
||||
return Service.GetRecordBarChartAsync(req);
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public Task<IOrderedEnumerable<GetPieChartRsp>> GetRecordPieChartByHttpStatusCodeAsync(
|
||||
QueryReq<QueryJobRecordReq> req)
|
||||
{
|
||||
#if !DEBUG
|
||||
return GetOrCreateAsync( //
|
||||
GetCacheKey(req.GetHashCode().ToString(CultureInfo.InvariantCulture)) //
|
||||
, () => Service.GetRecordPieChartByHttpStatusCodeAsync(req)
|
||||
, TimeSpan.FromSeconds(Numbers.SECS_CACHE_DEFAULT));
|
||||
#else
|
||||
return Service.GetRecordPieChartByHttpStatusCodeAsync(req);
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public Task<IOrderedEnumerable<GetPieChartRsp>> GetRecordPieChartByNameAsync(QueryReq<QueryJobRecordReq> req)
|
||||
{
|
||||
#if !DEBUG
|
||||
return GetOrCreateAsync( //
|
||||
GetCacheKey(req.GetHashCode().ToString(CultureInfo.InvariantCulture)) //
|
||||
, () => Service.GetRecordPieChartByNameAsync(req), TimeSpan.FromSeconds(Numbers.SECS_CACHE_CHART));
|
||||
#else
|
||||
return Service.GetRecordPieChartByNameAsync(req);
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public Task<PagedQueryRsp<QueryJobRsp>> PagedQueryAsync(PagedQueryReq<QueryJobReq> req)
|
||||
{
|
||||
|
@ -1,5 +1,6 @@
|
||||
using NetAdmin.Cache;
|
||||
using NetAdmin.Domain.Dto.Dependency;
|
||||
using NetAdmin.Domain.Dto.Sys;
|
||||
using NetAdmin.Domain.Dto.Sys.RequestLog;
|
||||
using NetAdmin.SysComponent.Application.Services.Sys.Dependency;
|
||||
using NetAdmin.SysComponent.Cache.Sys.Dependency;
|
||||
@ -46,6 +47,42 @@ public sealed class RequestLogCache(IDistributedCache cache, IRequestLogService
|
||||
return Service.GetAsync(req);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public Task<IOrderedEnumerable<GetBarChartRsp>> GetBarChartAsync(QueryReq<QueryRequestLogReq> req)
|
||||
{
|
||||
#if !DEBUG
|
||||
return GetOrCreateAsync( //
|
||||
GetCacheKey(req.GetHashCode().ToString(CultureInfo.InvariantCulture)) //
|
||||
, () => Service.GetBarChartAsync(req), TimeSpan.FromSeconds(Numbers.SECS_CACHE_CHART));
|
||||
#else
|
||||
return Service.GetBarChartAsync(req);
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public Task<IOrderedEnumerable<GetPieChartRsp>> GetPieChartByApiSummaryAsync(QueryReq<QueryRequestLogReq> req)
|
||||
{
|
||||
#if !DEBUG
|
||||
return GetOrCreateAsync( //
|
||||
GetCacheKey(req.GetHashCode().ToString(CultureInfo.InvariantCulture)) //
|
||||
, () => Service.GetPieChartByApiSummaryAsync(req), TimeSpan.FromSeconds(Numbers.SECS_CACHE_CHART));
|
||||
#else
|
||||
return Service.GetPieChartByApiSummaryAsync(req);
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public Task<IOrderedEnumerable<GetPieChartRsp>> GetPieChartByHttpStatusCodeAsync(QueryReq<QueryRequestLogReq> req)
|
||||
{
|
||||
#if !DEBUG
|
||||
return GetOrCreateAsync( //
|
||||
GetCacheKey(req.GetHashCode().ToString(CultureInfo.InvariantCulture)) //
|
||||
, () => Service.GetPieChartByHttpStatusCodeAsync(req), TimeSpan.FromSeconds(Numbers.SECS_CACHE_CHART));
|
||||
#else
|
||||
return Service.GetPieChartByHttpStatusCodeAsync(req);
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public Task<PagedQueryRsp<QueryRequestLogRsp>> PagedQueryAsync(PagedQueryReq<QueryRequestLogReq> req)
|
||||
{
|
||||
|
@ -1,4 +1,5 @@
|
||||
using NetAdmin.Domain.Dto.Dependency;
|
||||
using NetAdmin.Domain.Dto.Sys;
|
||||
using NetAdmin.Domain.Dto.Sys.Job;
|
||||
using NetAdmin.Domain.Dto.Sys.JobRecord;
|
||||
using NetAdmin.Host.Attributes;
|
||||
@ -75,6 +76,31 @@ public sealed class JobController(IJobCache cache) : ControllerBase<IJobCache, I
|
||||
return Cache.GetAsync(req);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取作业记录条形图数据
|
||||
/// </summary>
|
||||
public Task<IOrderedEnumerable<GetBarChartRsp>> GetRecordBarChartAsync(QueryReq<QueryJobRecordReq> req)
|
||||
{
|
||||
return Cache.GetRecordBarChartAsync(req);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 状态码分组作业记录饼图数据
|
||||
/// </summary>
|
||||
public Task<IOrderedEnumerable<GetPieChartRsp>> GetRecordPieChartByHttpStatusCodeAsync(
|
||||
QueryReq<QueryJobRecordReq> req)
|
||||
{
|
||||
return Cache.GetRecordPieChartByHttpStatusCodeAsync(req);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 名称分组作业记录饼图数据
|
||||
/// </summary>
|
||||
public Task<IOrderedEnumerable<GetPieChartRsp>> GetRecordPieChartByNameAsync(QueryReq<QueryJobRecordReq> req)
|
||||
{
|
||||
return Cache.GetRecordPieChartByNameAsync(req);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 分页查询计划作业
|
||||
/// </summary>
|
||||
|
@ -1,4 +1,5 @@
|
||||
using NetAdmin.Domain.Dto.Dependency;
|
||||
using NetAdmin.Domain.Dto.Sys;
|
||||
using NetAdmin.Domain.Dto.Sys.RequestLog;
|
||||
using NetAdmin.Host.Attributes;
|
||||
using NetAdmin.Host.Controllers;
|
||||
@ -70,6 +71,30 @@ public sealed class LogController(IRequestLogCache cache) : ControllerBase<IRequ
|
||||
return Cache.GetAsync(req);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取条形图数据
|
||||
/// </summary>
|
||||
public Task<IOrderedEnumerable<GetBarChartRsp>> GetBarChartAsync(QueryReq<QueryRequestLogReq> req)
|
||||
{
|
||||
return Cache.GetBarChartAsync(req);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 描述分组饼图数据
|
||||
/// </summary>
|
||||
public Task<IOrderedEnumerable<GetPieChartRsp>> GetPieChartByApiSummaryAsync(QueryReq<QueryRequestLogReq> req)
|
||||
{
|
||||
return Cache.GetPieChartByApiSummaryAsync(req);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 状态码分组饼图数据
|
||||
/// </summary>
|
||||
public Task<IOrderedEnumerable<GetPieChartRsp>> GetPieChartByHttpStatusCodeAsync(QueryReq<QueryRequestLogReq> req)
|
||||
{
|
||||
return Cache.GetPieChartByHttpStatusCodeAsync(req);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 分页查询请求日志
|
||||
/// </summary>
|
||||
|
Reference in New Issue
Block a user