去除引用common.props
This commit is contained in:
@@ -12,14 +12,12 @@ using JNPF.DependencyInjection;
|
||||
using JNPF.DynamicApiController;
|
||||
using JNPF.FriendlyException;
|
||||
using JNPF.LinqBuilder;
|
||||
using JNPF.Schedule;
|
||||
using JNPF.Systems.Interfaces.System;
|
||||
using JNPF.TaskScheduler.Entitys;
|
||||
using JNPF.TaskScheduler.Entitys.Dto.TaskScheduler;
|
||||
using JNPF.TaskScheduler.Entitys.Enum;
|
||||
using JNPF.TaskScheduler.Entitys.Model;
|
||||
using JNPF.TaskScheduler.Interfaces.TaskScheduler;
|
||||
using JNPF.TimeCrontab;
|
||||
using Mapster;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using SqlSugar;
|
||||
@@ -149,7 +147,7 @@ public class TimeTaskService : ITimeTaskService, IDynamicApiController, ITransie
|
||||
/// <param name="input">实体对象.</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("")]
|
||||
public async Task Create([FromBody] TimeTaskCrInput input,bool startNow = true)
|
||||
public async Task Create([FromBody] TimeTaskCrInput input, bool startNow = true)
|
||||
{
|
||||
if (await _repository.IsAnyAsync(x => (x.EnCode == input.enCode || x.FullName == input.fullName) && x.DeleteMark == null))
|
||||
throw Oops.Oh(ErrorCode.COM1004);
|
||||
@@ -168,7 +166,7 @@ public class TimeTaskService : ITimeTaskService, IDynamicApiController, ITransie
|
||||
_ = result ?? throw Oops.Oh(ErrorCode.COM1000);
|
||||
|
||||
// 添加到任务调度里
|
||||
AddTimerJob(result,startNow);
|
||||
AddTimerJob(result, startNow);
|
||||
//await AddJob(result);
|
||||
}
|
||||
|
||||
@@ -233,11 +231,11 @@ public class TimeTaskService : ITimeTaskService, IDynamicApiController, ITransie
|
||||
[HttpDelete("{fullName}")]
|
||||
public async Task DeleteByName(string fullName)
|
||||
{
|
||||
var entitys = await _repository.AsQueryable().Where(p=>p.FullName==fullName).ToListAsync();
|
||||
var entitys = await _repository.AsQueryable().Where(p => p.FullName == fullName).ToListAsync();
|
||||
foreach (var entity in entitys)
|
||||
{
|
||||
await _repository.AsSugarClient().Deleteable(entity).ExecuteCommandAsync();
|
||||
|
||||
await _repository.AsSugarClient().Deleteable(entity).ExecuteCommandAsync();
|
||||
|
||||
// 从调度器里取消
|
||||
SpareTime.Cancel(entity.Id);
|
||||
}
|
||||
@@ -308,7 +306,7 @@ public class TimeTaskService : ITimeTaskService, IDynamicApiController, ITransie
|
||||
// 非多租户模式启动自启任务
|
||||
if (!KeyVariable.MultiTenancy)
|
||||
{
|
||||
_repository.AsSugarClient().CopyNew().Queryable<TimeTaskEntity>().Where(x => x.DeleteMark == null && x.EnabledMark == 1).ToList().ForEach(x=>AddTimerJob(x,false));//modifyby zhoukeda 20230607
|
||||
_repository.AsSugarClient().CopyNew().Queryable<TimeTaskEntity>().Where(x => x.DeleteMark == null && x.EnabledMark == 1).ToList().ForEach(x => AddTimerJob(x, false));//modifyby zhoukeda 20230607
|
||||
}
|
||||
}
|
||||
|
||||
@@ -356,7 +354,7 @@ public class TimeTaskService : ITimeTaskService, IDynamicApiController, ITransie
|
||||
/// 新增定时任务.
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
private async void AddTimerJob(TimeTaskEntity input,bool startNow = true)
|
||||
private async void AddTimerJob(TimeTaskEntity input, bool startNow = true)
|
||||
{
|
||||
Action<SpareTimer, long>? action = null;
|
||||
ContentModel? comtentModel = input.ExecuteContent.ToObject<ContentModel>();
|
||||
@@ -402,7 +400,7 @@ public class TimeTaskService : ITimeTaskService, IDynamicApiController, ITransie
|
||||
var isRun = comtentModel.endTime.IsNullOrEmpty() ? DateTime.Now >= starTime : DateTime.Now >= starTime && DateTime.Now < endTime;
|
||||
if (isRun)
|
||||
{
|
||||
nextHandle = ()=>SpareTime.GetCronNextOccurrence(comtentModel.cron);
|
||||
nextHandle = () => SpareTime.GetCronNextOccurrence(comtentModel.cron);
|
||||
}
|
||||
SpareTime.Do(nextHandle
|
||||
,
|
||||
|
||||
Reference in New Issue
Block a user