feat:完成job后端接口

This commit is contained in:
橙子
2023-04-23 23:46:20 +08:00
parent 6977e233bb
commit 7d5a7e0fe8
7 changed files with 57 additions and 14 deletions

View File

@@ -24,16 +24,18 @@ namespace Yi.Furion.Application.Rbac.Services.Impl
/// </summary>
/// <param name="jobId"></param>
/// <returns></returns>
public SchedulerModel GetById(string jobId)
[HttpGet("{jobId}")]
public SchedulerModel GetById([FromRoute]string jobId)
{
var result = _schedulerFactory.TryGetJob(jobId, out var scheduler);
return scheduler.GetModel();
}
/// <summary>
/// 多job
/// 多job
/// </summary>
/// <returns></returns>
[HttpGet("")]
public PagedResultDto<SchedulerModel> GetList([FromQuery]TaskGetListInput input)
{
var data = _schedulerFactory.GetJobsOfModels().Skip(input.PageNum * input.PageSize).Take(input.PageSize).OrderByDescending(x => x.JobDetail.UpdatedTime).ToList();
@@ -92,6 +94,7 @@ namespace Yi.Furion.Application.Rbac.Services.Impl
/// </summary>
/// <param name="jobId"></param>
/// <returns></returns>
[HttpPut]
public ScheduleResult Pause(string jobId)
{
var res = _schedulerFactory.TryGetJob(jobId, out var scheduler);
@@ -105,6 +108,7 @@ namespace Yi.Furion.Application.Rbac.Services.Impl
/// </summary>
/// <param name="jobId"></param>
/// <returns></returns>
[HttpPut]
public ScheduleResult Start(string jobId)
{
var res = _schedulerFactory.TryGetJob(jobId, out var scheduler);

View File

@@ -460,7 +460,7 @@
</member>
<member name="M:Yi.Furion.Application.Rbac.Services.Impl.TaskService.GetList(Yi.Furion.Core.Rbac.Dtos.Task.TaskGetListInput)">
<summary>
job
job
</summary>
<returns></returns>
</member>

View File

@@ -5,7 +5,7 @@ using Yi.Framework.Module.DictionaryManager.Entities;
namespace Yi.Furion.Core.Rbac.DataSeeds
{
public class DictionaryDataSeed : AbstractDataSeed<DictionaryEntity>
public class DictionaryDataSeed : AbstractDataSeed<DictionaryEntity>, ITransient
{
public DictionaryDataSeed(IRepository<DictionaryEntity> repository) : base(repository)
{
@@ -23,6 +23,8 @@ namespace Yi.Furion.Core.Rbac.DataSeeds
OrderNum = 100,
Remark = "性别男",
IsDeleted = false,
State = true
};
entities.Add(dictInfo1);
@@ -35,6 +37,7 @@ namespace Yi.Furion.Core.Rbac.DataSeeds
OrderNum = 99,
Remark = "性别女",
IsDeleted = false,
State = true
};
entities.Add(dictInfo2);
@@ -47,6 +50,7 @@ namespace Yi.Furion.Core.Rbac.DataSeeds
OrderNum = 98,
Remark = "性别未知",
IsDeleted = false,
State = true
};
entities.Add(dictInfo3);
@@ -61,6 +65,7 @@ namespace Yi.Furion.Core.Rbac.DataSeeds
OrderNum = 100,
Remark = "显示菜单",
IsDeleted = false,
State = true
};
entities.Add(dictInfo4);
@@ -73,6 +78,7 @@ namespace Yi.Furion.Core.Rbac.DataSeeds
OrderNum = 99,
Remark = "隐藏菜单",
IsDeleted = false,
State = true
};
entities.Add(dictInfo5);
@@ -87,6 +93,7 @@ namespace Yi.Furion.Core.Rbac.DataSeeds
OrderNum = 100,
Remark = "正常状态",
IsDeleted = false,
State = true
};
entities.Add(dictInfo6);
DictionaryEntity dictInfo7 = new DictionaryEntity()
@@ -98,6 +105,7 @@ namespace Yi.Furion.Core.Rbac.DataSeeds
OrderNum = 99,
Remark = "停用状态",
IsDeleted = false,
State = true,
ListClass = "danger"
};
entities.Add(dictInfo7);
@@ -113,6 +121,7 @@ namespace Yi.Furion.Core.Rbac.DataSeeds
OrderNum = 100,
Remark = "正常状态",
IsDeleted = false,
State = true
};
entities.Add(dictInfo8);
DictionaryEntity dictInfo9 = new DictionaryEntity()
@@ -124,6 +133,7 @@ namespace Yi.Furion.Core.Rbac.DataSeeds
OrderNum = 99,
Remark = "停用状态",
IsDeleted = false,
State = true,
ListClass = "danger"
};
entities.Add(dictInfo9);
@@ -140,6 +150,7 @@ namespace Yi.Furion.Core.Rbac.DataSeeds
OrderNum = 100,
Remark = "默认分组",
IsDeleted = false,
State = true
};
entities.Add(dictInfo10);
DictionaryEntity dictInfo11 = new DictionaryEntity()
@@ -151,6 +162,7 @@ namespace Yi.Furion.Core.Rbac.DataSeeds
OrderNum = 99,
Remark = "系统分组",
IsDeleted = false,
State = true
};
entities.Add(dictInfo11);
@@ -165,6 +177,7 @@ namespace Yi.Furion.Core.Rbac.DataSeeds
OrderNum = 100,
Remark = "系统默认是",
IsDeleted = false,
State = true
};
entities.Add(dictInfo12);
DictionaryEntity dictInfo13 = new DictionaryEntity()
@@ -176,6 +189,7 @@ namespace Yi.Furion.Core.Rbac.DataSeeds
OrderNum = 99,
Remark = "系统默认否",
IsDeleted = false,
State = true,
ListClass = "danger"
};
entities.Add(dictInfo13);
@@ -191,6 +205,7 @@ namespace Yi.Furion.Core.Rbac.DataSeeds
OrderNum = 100,
Remark = "通知",
IsDeleted = false,
State = true
};
entities.Add(dictInfo14);
DictionaryEntity dictInfo15 = new DictionaryEntity()
@@ -202,6 +217,7 @@ namespace Yi.Furion.Core.Rbac.DataSeeds
OrderNum = 99,
Remark = "公告",
IsDeleted = false,
State = true
};
entities.Add(dictInfo15);
@@ -214,6 +230,7 @@ namespace Yi.Furion.Core.Rbac.DataSeeds
OrderNum = 100,
Remark = "正常状态",
IsDeleted = false,
State = true
};
entities.Add(dictInfo16);
DictionaryEntity dictInfo17 = new DictionaryEntity()
@@ -225,6 +242,7 @@ namespace Yi.Furion.Core.Rbac.DataSeeds
OrderNum = 99,
Remark = "关闭状态",
IsDeleted = false,
State = true,
ListClass = "danger"
};
entities.Add(dictInfo17);
@@ -238,6 +256,7 @@ namespace Yi.Furion.Core.Rbac.DataSeeds
OrderNum = 100,
Remark = "新增操作",
IsDeleted = false,
State = true
};
entities.Add(dictInfo18);
DictionaryEntity dictInfo19 = new DictionaryEntity()
@@ -249,6 +268,7 @@ namespace Yi.Furion.Core.Rbac.DataSeeds
OrderNum = 99,
Remark = "修改操作",
IsDeleted = false,
State = true
};
entities.Add(dictInfo19);
DictionaryEntity dictInfo22 = new DictionaryEntity()
@@ -260,6 +280,7 @@ namespace Yi.Furion.Core.Rbac.DataSeeds
OrderNum = 98,
Remark = "删除操作",
IsDeleted = false,
State = true,
ListClass = "danger"
};
entities.Add(dictInfo22);
@@ -272,6 +293,7 @@ namespace Yi.Furion.Core.Rbac.DataSeeds
OrderNum = 97,
Remark = "授权操作",
IsDeleted = false,
State = true
};
entities.Add(dictInfo23);
DictionaryEntity dictInfo24 = new DictionaryEntity()
@@ -283,6 +305,7 @@ namespace Yi.Furion.Core.Rbac.DataSeeds
OrderNum = 96,
Remark = "导出操作",
IsDeleted = false,
State = true
};
entities.Add(dictInfo24);
DictionaryEntity dictInfo25 = new DictionaryEntity()
@@ -294,6 +317,7 @@ namespace Yi.Furion.Core.Rbac.DataSeeds
OrderNum = 95,
Remark = "导入操作",
IsDeleted = false,
State = true
};
entities.Add(dictInfo25);
DictionaryEntity dictInfo26 = new DictionaryEntity()
@@ -305,6 +329,7 @@ namespace Yi.Furion.Core.Rbac.DataSeeds
OrderNum = 94,
Remark = "强退操作",
IsDeleted = false,
State = true
};
entities.Add(dictInfo26);
DictionaryEntity dictInfo27 = new DictionaryEntity()
@@ -316,6 +341,7 @@ namespace Yi.Furion.Core.Rbac.DataSeeds
OrderNum = 93,
Remark = "生成代码操作",
IsDeleted = false,
State = true
};
entities.Add(dictInfo27);
DictionaryEntity dictInfo28 = new DictionaryEntity()
@@ -327,6 +353,7 @@ namespace Yi.Furion.Core.Rbac.DataSeeds
OrderNum = 92,
Remark = "清空数据操作",
IsDeleted = false,
State = true,
ListClass = "danger"
};
entities.Add(dictInfo28);
@@ -342,6 +369,7 @@ namespace Yi.Furion.Core.Rbac.DataSeeds
OrderNum = 100,
Remark = "正常状态",
IsDeleted = false,
State = true
};
entities.Add(dictInfo20);
DictionaryEntity dictInfo21 = new DictionaryEntity()
@@ -353,6 +381,7 @@ namespace Yi.Furion.Core.Rbac.DataSeeds
OrderNum = 99,
Remark = "失败状态",
IsDeleted = false,
State = true,
ListClass = "danger"
};
entities.Add(dictInfo21);

View File

@@ -22,6 +22,7 @@ namespace Yi.Furion.Core.Rbac.DataSeeds
OrderNum = 100,
Remark = "用户性别列表",
IsDeleted = false,
State=true
};
entities.Add(dict1);
@@ -33,6 +34,7 @@ namespace Yi.Furion.Core.Rbac.DataSeeds
OrderNum = 100,
Remark = "菜单状态列表",
IsDeleted = false,
State = true
};
entities.Add(dict2);
@@ -44,6 +46,7 @@ namespace Yi.Furion.Core.Rbac.DataSeeds
OrderNum = 100,
Remark = "系统开关列表",
IsDeleted = false,
State = true
};
entities.Add(dict3);
@@ -55,6 +58,7 @@ namespace Yi.Furion.Core.Rbac.DataSeeds
OrderNum = 100,
Remark = "任务状态列表",
IsDeleted = false,
State = true
};
entities.Add(dict4);
@@ -66,6 +70,7 @@ namespace Yi.Furion.Core.Rbac.DataSeeds
OrderNum = 100,
Remark = "任务分组列表",
IsDeleted = false,
State = true
};
entities.Add(dict5);
@@ -77,6 +82,7 @@ namespace Yi.Furion.Core.Rbac.DataSeeds
OrderNum = 100,
Remark = "系统是否列表",
IsDeleted = false,
State = true
};
entities.Add(dict6);
@@ -88,6 +94,7 @@ namespace Yi.Furion.Core.Rbac.DataSeeds
OrderNum = 100,
Remark = "通知类型列表",
IsDeleted = false,
State = true
};
entities.Add(dict7);
DictionaryTypeEntity dict8 = new DictionaryTypeEntity()
@@ -98,6 +105,7 @@ namespace Yi.Furion.Core.Rbac.DataSeeds
OrderNum = 100,
Remark = "通知状态列表",
IsDeleted = false,
State = true
};
entities.Add(dict8);
@@ -109,6 +117,7 @@ namespace Yi.Furion.Core.Rbac.DataSeeds
OrderNum = 100,
Remark = "操作类型列表",
IsDeleted = false,
State = true
};
entities.Add(dict9);
@@ -121,6 +130,7 @@ namespace Yi.Furion.Core.Rbac.DataSeeds
OrderNum = 100,
Remark = "登录状态列表",
IsDeleted = false,
State = true
};
entities.Add(dict10);
return entities;

View File

@@ -36,8 +36,8 @@ public class Startup : AppStartup
services.AddSchedule(options =>
{
// 注册作业,并配置作业触发器
//options.AddJob<SystemDataJob>(Triggers.Period(10000)); // 表示每秒执行
options.AddJob<SystemDataJob>(Triggers.Cron("0 0 0,12 ? * ?",CronStringFormat.WithSeconds)); // 表示每天凌晨与12点
// options.AddJob<SystemDataJob>(Triggers.Period(10000)); // 表示每秒执行
options.AddJob<SystemDataJob>(Triggers.Cron("0 0 0,12 ? * ?",CronStringFormat.WithSeconds)); // 表示每天凌晨与12点
});
services.AddFileLogging("application-{0:yyyy}-{0:MM}-{0:dd}.log", options =>
{

View File

@@ -3,7 +3,7 @@ import request from '@/utils/request'
// 查询定时任务调度列表
export function listJob(query) {
return request({
url: '/monitor/job/list',
url: '/task',
method: 'get',
params: query
})
@@ -12,7 +12,7 @@ export function listJob(query) {
// 查询定时任务调度详细
export function getJob(jobId) {
return request({
url: '/monitor/job/' + jobId,
url: '/task/' + jobId,
method: 'get'
})
}
@@ -20,16 +20,16 @@ export function getJob(jobId) {
// 新增定时任务调度
export function addJob(data) {
return request({
url: '/monitor/job',
url: '/task',
method: 'post',
data: data
})
}
// 修改定时任务调度
export function updateJob(data) {
export function updateJob(jobId,data) {
return request({
url: '/monitor/job',
url: '/task/'+jobId,
method: 'put',
data: data
})
@@ -38,7 +38,7 @@ export function updateJob(data) {
// 删除定时任务调度
export function delJob(jobId) {
return request({
url: '/monitor/job/' + jobId,
url: '/task/' + jobId,
method: 'delete'
})
}

View File

@@ -346,8 +346,8 @@ const { queryParams, form, rules } = toRefs(data);
function getList() {
loading.value = true;
listJob(queryParams.value).then(response => {
jobList.value = response.rows;
total.value = response.total;
jobList.value = response.data.items;
total.value = response.data.total;
loading.value = false;
});
}