feat:完成job页面+接口功能,还差job状态更新

This commit is contained in:
陈淳
2023-04-25 13:30:54 +08:00
parent bc5aaff9c9
commit 94f902f788
8 changed files with 82 additions and 46 deletions

View File

@@ -30,6 +30,10 @@ namespace Yi.Furion.Application.Rbac.Services.Impl
var result = _schedulerFactory.TryGetJob(jobId, out var scheduler);
var data = scheduler.GetModel();
var output = data.JobDetail.Adapt<TaskGetOutput>();
output.TriggerArgs = data.Triggers[0].Args;
output.NextRunTime = data.Triggers[0].NextRunTime;
output.LastRunTime = data.Triggers[0].LastRunTime;
output.NumberOfRuns = data.Triggers[0].NumberOfRuns;
return output;
}
@@ -43,10 +47,14 @@ namespace Yi.Furion.Application.Rbac.Services.Impl
var data = _schedulerFactory.GetJobsOfModels().Skip((input.PageNum - 1) * input.PageSize).Take(input.PageSize).OrderByDescending(x => x.JobDetail.UpdatedTime)
.ToList();
var output = data.Select(x => x.JobDetail).Adapt<List<TaskGetListOutput>>();
var output = data.Select(x => {
var res= new TaskGetListOutput();
res= x.JobDetail.Adapt<TaskGetListOutput>();
res.TriggerArgs = x.Triggers[0].Args;
res.Status = x.Triggers[0].Status.ToString();
return res;
} ).ToList();
return new PagedResultDto<TaskGetListOutput>(data.Count(), output);
}
@@ -60,8 +68,8 @@ namespace Yi.Furion.Application.Rbac.Services.Impl
//jobBuilder
var jobBuilder = JobBuilder.Create(input.AssemblyName, input.JobTypeFullName).SetJobId(input.JobId).SetGroupName(input.GroupName);
//.SetConcurrent(input.Concurrent).SetDescription(input.Description).SetProperties(Newtonsoft.Json.JsonConvert.SerializeObject(input.Properties));
var jobBuilder = JobBuilder.Create(input.AssemblyName, input.JobType).SetJobId(input.JobId).SetGroupName(input.GroupName)
.SetConcurrent(input.Concurrent).SetDescription(input.Description);
//triggerBuilder
//毫秒
@@ -133,8 +141,8 @@ namespace Yi.Furion.Application.Rbac.Services.Impl
public ScheduleResult Update(string jobId, TaskUpdateInput input)
{
//jobBuilder
var jobBuilder = JobBuilder.Create(input.AssemblyName, input.JobTypeFullName).SetJobId(jobId).SetGroupName(input.GroupName)
.SetConcurrent(input.Concurrent).SetDescription(input.Description).SetProperties(Newtonsoft.Json.JsonConvert.SerializeObject(input.Properties));
var jobBuilder = JobBuilder.Create(input.AssemblyName, input.JobType).SetJobId(jobId).SetGroupName(input.GroupName)
.SetConcurrent(input.Concurrent).SetDescription(input.Description);
//triggerBuilder
//毫秒

View File

@@ -11,11 +11,11 @@ namespace Yi.Furion.Core.Rbac.Dtos.Task
{
public string AssemblyName { get; set; }
public string JobTypeFullName { get; set; }
public string JobType { get; set; }
public string JobId { get; set; }
public string GroupName { get; set; }
public string? GroupName { get; set; }
public JobTypeEnum Type { get; set; }
@@ -25,8 +25,8 @@ namespace Yi.Furion.Core.Rbac.Dtos.Task
public bool Concurrent { get; set; }
public Dictionary<string, object> Properties { get; set; }
//public Dictionary<string, object>? Properties { get; set; }
public string Description { get; set; }
public string? Description { get; set; }
}
}

View File

@@ -81,5 +81,14 @@ namespace Yi.Furion.Core.Rbac.Dtos.Task
/// 作业信息额外数据运行时实例
/// </summary>
internal string RuntimeProperties { get; set; }
/// <summary>
/// 触发器参数
/// </summary>
public string TriggerArgs { get; set; }
//状态
public string Status { get; set; }
}
}

View File

@@ -81,5 +81,13 @@ namespace Yi.Furion.Core.Rbac.Dtos.Task
/// 作业信息额外数据运行时实例
/// </summary>
internal string RuntimeProperties { get; set; }
public string TriggerArgs { get; set; }
public DateTime? NextRunTime { get; set; }
public DateTime? LastRunTime { get; set; }
public long NumberOfRuns { get; set; }
}
}

View File

@@ -11,20 +11,20 @@ namespace Yi.Furion.Core.Rbac.Dtos.Task
{
public string AssemblyName { get; set; }
public string JobTypeFullName { get; set; }
public string JobType { get; set; }
public string GroupName { get; set; }
public string? GroupName { get; set; }
public JobTypeEnum Type { get; set; }
public string Cron { get; set; }
public string? Cron { get; set; }
public int Millisecond { get; set; }
public bool Concurrent { get; set; }
public Dictionary<string, object> Properties { get; set; }
// public Dictionary<string, object>? Properties { get; set; }
public string Description { get; set; }
public string? Description { get; set; }
}
}

View File

@@ -430,6 +430,11 @@
作业信息额外数据运行时实例
</summary>
</member>
<member name="P:Yi.Furion.Core.Rbac.Dtos.Task.TaskGetListOutput.TriggerArgs">
<summary>
触发器参数
</summary>
</member>
<member name="P:Yi.Furion.Core.Rbac.Dtos.Task.TaskGetOutput.JobId">
<summary>
作业 Id