From 7d5a7e0fe85cddd14f83b9b2cf6ceabf9ba8954f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=A9=99=E5=AD=90?= <454313500@qq.com>
Date: Sun, 23 Apr 2023 23:46:20 +0800
Subject: [PATCH] =?UTF-8?q?feat:=E5=AE=8C=E6=88=90job=E5=90=8E=E7=AB=AF?=
=?UTF-8?q?=E6=8E=A5=E5=8F=A3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Rbac/Services/Impl/TaskService.cs | 8 +++--
.../Yi.Furion.Application.xml | 2 +-
.../Rbac/DataSeeds/DictionaryDataSeed.cs | 31 ++++++++++++++++++-
.../Rbac/DataSeeds/DictionaryTypeDataSeed.cs | 10 ++++++
Yi.Furion.Net6/Yi.Furion.Web.Core/Startup.cs | 4 +--
Yi.RuoYi.Vue3/src/api/monitor/job.js | 12 +++----
Yi.RuoYi.Vue3/src/views/monitor/job/index.vue | 4 +--
7 files changed, 57 insertions(+), 14 deletions(-)
diff --git a/Yi.Furion.Net6/Yi.Furion.Application/Rbac/Services/Impl/TaskService.cs b/Yi.Furion.Net6/Yi.Furion.Application/Rbac/Services/Impl/TaskService.cs
index 598efd2c..3a78b0df 100644
--- a/Yi.Furion.Net6/Yi.Furion.Application/Rbac/Services/Impl/TaskService.cs
+++ b/Yi.Furion.Net6/Yi.Furion.Application/Rbac/Services/Impl/TaskService.cs
@@ -24,16 +24,18 @@ namespace Yi.Furion.Application.Rbac.Services.Impl
///
///
///
- public SchedulerModel GetById(string jobId)
+ [HttpGet("{jobId}")]
+ public SchedulerModel GetById([FromRoute]string jobId)
{
var result = _schedulerFactory.TryGetJob(jobId, out var scheduler);
return scheduler.GetModel();
}
///
- /// 多询job
+ /// 多查job
///
///
+ [HttpGet("")]
public PagedResultDto 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
///
///
///
+ [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
///
///
///
+ [HttpPut]
public ScheduleResult Start(string jobId)
{
var res = _schedulerFactory.TryGetJob(jobId, out var scheduler);
diff --git a/Yi.Furion.Net6/Yi.Furion.Application/Yi.Furion.Application.xml b/Yi.Furion.Net6/Yi.Furion.Application/Yi.Furion.Application.xml
index a20dc0c4..f87daa3f 100644
--- a/Yi.Furion.Net6/Yi.Furion.Application/Yi.Furion.Application.xml
+++ b/Yi.Furion.Net6/Yi.Furion.Application/Yi.Furion.Application.xml
@@ -460,7 +460,7 @@
- 多询job
+ 多查job
diff --git a/Yi.Furion.Net6/Yi.Furion.Core/Rbac/DataSeeds/DictionaryDataSeed.cs b/Yi.Furion.Net6/Yi.Furion.Core/Rbac/DataSeeds/DictionaryDataSeed.cs
index 6b297925..2695ae8d 100644
--- a/Yi.Furion.Net6/Yi.Furion.Core/Rbac/DataSeeds/DictionaryDataSeed.cs
+++ b/Yi.Furion.Net6/Yi.Furion.Core/Rbac/DataSeeds/DictionaryDataSeed.cs
@@ -5,7 +5,7 @@ using Yi.Framework.Module.DictionaryManager.Entities;
namespace Yi.Furion.Core.Rbac.DataSeeds
{
- public class DictionaryDataSeed : AbstractDataSeed
+ public class DictionaryDataSeed : AbstractDataSeed, ITransient
{
public DictionaryDataSeed(IRepository 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);
diff --git a/Yi.Furion.Net6/Yi.Furion.Core/Rbac/DataSeeds/DictionaryTypeDataSeed.cs b/Yi.Furion.Net6/Yi.Furion.Core/Rbac/DataSeeds/DictionaryTypeDataSeed.cs
index d60ab327..f968d33c 100644
--- a/Yi.Furion.Net6/Yi.Furion.Core/Rbac/DataSeeds/DictionaryTypeDataSeed.cs
+++ b/Yi.Furion.Net6/Yi.Furion.Core/Rbac/DataSeeds/DictionaryTypeDataSeed.cs
@@ -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;
diff --git a/Yi.Furion.Net6/Yi.Furion.Web.Core/Startup.cs b/Yi.Furion.Net6/Yi.Furion.Web.Core/Startup.cs
index 118a4618..207406bb 100644
--- a/Yi.Furion.Net6/Yi.Furion.Web.Core/Startup.cs
+++ b/Yi.Furion.Net6/Yi.Furion.Web.Core/Startup.cs
@@ -36,8 +36,8 @@ public class Startup : AppStartup
services.AddSchedule(options =>
{
// 注册作业,并配置作业触发器
- //options.AddJob(Triggers.Period(10000)); // 表示每秒执行
- options.AddJob(Triggers.Cron("0 0 0,12 ? * ?",CronStringFormat.WithSeconds)); // 表示每天凌晨与12点
+ // options.AddJob(Triggers.Period(10000)); // 表示每秒执行
+ options.AddJob(Triggers.Cron("0 0 0,12 ? * ?",CronStringFormat.WithSeconds)); // 表示每天凌晨与12点
});
services.AddFileLogging("application-{0:yyyy}-{0:MM}-{0:dd}.log", options =>
{
diff --git a/Yi.RuoYi.Vue3/src/api/monitor/job.js b/Yi.RuoYi.Vue3/src/api/monitor/job.js
index 38155693..2f556fc4 100644
--- a/Yi.RuoYi.Vue3/src/api/monitor/job.js
+++ b/Yi.RuoYi.Vue3/src/api/monitor/job.js
@@ -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'
})
}
diff --git a/Yi.RuoYi.Vue3/src/views/monitor/job/index.vue b/Yi.RuoYi.Vue3/src/views/monitor/job/index.vue
index e92e5645..18c5cb12 100644
--- a/Yi.RuoYi.Vue3/src/views/monitor/job/index.vue
+++ b/Yi.RuoYi.Vue3/src/views/monitor/job/index.vue
@@ -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;
});
}