Merge branch 'S07' into test
This commit is contained in:
commit
b503251dc5
@ -11,10 +11,15 @@ public class GetWarningRuleInput
|
||||
public int? SubSystemId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 关键字(kpi/客户名称 模糊)
|
||||
/// 关键字(kpi名称 模糊查询)
|
||||
/// </summary>
|
||||
public string? Keywords { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 客户id
|
||||
/// </summary>
|
||||
public int? CustomId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否启用(留null查全部)
|
||||
/// </summary>
|
||||
|
||||
@ -38,7 +38,7 @@ public class WarningService : ApplicationService
|
||||
[HttpPost("GetWarningRule")]
|
||||
public async Task<UnifyResultDto<List<WarningRuleDto>>> GetWarningRule(GetWarningRuleInput input)
|
||||
{
|
||||
var result = await _warningRuleRepository.GetWarningRuleListAsync(input.SubSystemId, input.Keywords, input.IsEnabled, input.WarningType);
|
||||
var result = await _warningRuleRepository.GetWarningRuleListAsync(input.SubSystemId, input.CustomId, input.Keywords, input.IsEnabled, input.WarningType);
|
||||
if (result.Count == 0)
|
||||
return new UnifyResultDto<List<WarningRuleDto>>(true, new List<WarningRuleDto>());
|
||||
|
||||
|
||||
@ -221,12 +221,13 @@ public class SjzyTrackApplicationModule : AbpModule
|
||||
context.Services.Configure<TrackWarningTaskOptions>(configuration.GetSection("WarningTask"));
|
||||
context.Services.AddHangfire(o =>
|
||||
{
|
||||
var options = new RedisStorageOptions()
|
||||
var options = new RedisStorageOptions
|
||||
{
|
||||
Prefix = GlobalConst.TrackHangfireKeyPrefix,
|
||||
Prefix = $"{GlobalConst.TrackHangfireKeyPrefix}:",
|
||||
Db = int.Parse(configuration["Redis:Database"]!),
|
||||
};
|
||||
o.UseRedisStorage(connectionString,options);
|
||||
o.UseRedisStorage(connectionString, options)
|
||||
.WithJobExpirationTimeout(TimeSpan.FromHours(1)); // 终止态任务只保留1小时
|
||||
});
|
||||
context.Services.AddHangfireServer(o =>
|
||||
{
|
||||
|
||||
@ -25,7 +25,7 @@ public interface IWarningRuleRepository : IBasicRepository<WarningRuleEntity>
|
||||
Task<string> UpdateVersionAsync(WarningRuleEntity entity);
|
||||
|
||||
// 模糊查询预警规则主体
|
||||
Task<List<WarningRuleEntity>> GetWarningRuleListAsync(int? subsystemId, string? keyword, bool? isEnabled, int? warningType);
|
||||
Task<List<WarningRuleEntity>> GetWarningRuleListAsync(int? subsystemId, int? customId, string? keyword, bool? isEnabled, int? warningType);
|
||||
|
||||
// 获取启用的预警规则主体
|
||||
Task<WarningRuleEntity?> GetWarningRuleForEnabledAsync(int subSystemId, int customId, WarningRuleType warningType);
|
||||
|
||||
@ -76,14 +76,14 @@ public class WarningRuleRepository : BasicRepository<WarningRuleEntity>, IWarnin
|
||||
return version;
|
||||
}
|
||||
|
||||
public Task<List<WarningRuleEntity>> GetWarningRuleListAsync(int? subsystemId, string? keywords, bool? isEnabled, int? warningType)
|
||||
public Task<List<WarningRuleEntity>> GetWarningRuleListAsync(int? subsystemId, int? customId, string? keywords, bool? isEnabled, int? warningType)
|
||||
{
|
||||
return Context.Queryable<WarningRuleEntity>()
|
||||
.WhereIF(customId.HasValue, x => x.CustomId == customId!.Value)
|
||||
.WhereIF(subsystemId.HasValue, x => x.SubSystemId == subsystemId!.Value)
|
||||
// todo: 客户/kpi名称 改成客户下拉
|
||||
.WhereIF(!string.IsNullOrWhiteSpace(keywords), x => x.Name.Contains(keywords!))
|
||||
.WhereIF(isEnabled.HasValue, x => x.IsEnabled == isEnabled!.Value)
|
||||
.WhereIF(warningType.HasValue, x => x.WarningType == warningType!.Value)
|
||||
.WhereIF(isEnabled.HasValue, x => x.IsEnabled == isEnabled!.Value)
|
||||
.WhereIF(!string.IsNullOrWhiteSpace(keywords), x => x.Name.Contains(keywords!))
|
||||
.ToListAsync();
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user