Merge branch 'dev' of https://git.tuotong-tech.com/tnb/tnb.server into dev
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
namespace JNPF.TaskScheduler.Listener
|
||||
{
|
||||
public class GenerateSpotInspectionPlanTimeWorker : ISpareTimeWorker
|
||||
{
|
||||
[SpareTime("0 45 14 * * ? *", "生成点巡检计划", ExecuteType = SpareTimeExecuteTypes.Serial,StartNow = false)]
|
||||
public void GenerateSpotInspectionPlan(SpareTimer timer, long count)
|
||||
{
|
||||
Console.WriteLine("hello world");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -377,14 +377,16 @@ public class TimeTaskService : ITimeTaskService, IDynamicApiController, ITransie
|
||||
/// <returns></returns>
|
||||
private async Task<List<TaskMethodInfo>> GetTaskMethods()
|
||||
{
|
||||
var taskMethods = await _cacheManager.GetAsync<List<TaskMethodInfo>>(CommonConst.CACHEKEYTIMERJOB);
|
||||
if (taskMethods != null) return taskMethods;
|
||||
// var taskMethods = await _cacheManager.GetAsync<List<TaskMethodInfo>>(CommonConst.CACHEKEYTIMERJOB);
|
||||
// if (taskMethods != null) return taskMethods;
|
||||
|
||||
List<TaskMethodInfo> taskMethods = null;
|
||||
|
||||
// 获取所有本地任务方法,必须有spareTimeAttribute特性
|
||||
taskMethods = App.EffectiveTypes
|
||||
.Where(u => u.IsClass && !u.IsInterface && !u.IsAbstract && typeof(ISpareTimeWorker).IsAssignableFrom(u))
|
||||
.SelectMany(u => u.GetMethods(BindingFlags.Public | BindingFlags.Instance)
|
||||
.Where(m => m.IsDefined(typeof(SpareTimeAttribute), false) &&
|
||||
.Where(m => m.GetCustomAttributes(typeof(SpareTimeAttribute), false).ToString().Contains("SpareTime") &&
|
||||
m.GetParameters().Length == 2 &&
|
||||
m.GetParameters()[0].ParameterType == typeof(SpareTimer) &&
|
||||
m.GetParameters()[1].ParameterType == typeof(long) && m.ReturnType == typeof(void))
|
||||
|
||||
Reference in New Issue
Block a user