You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
66 lines
1.9 KiB
C#
66 lines
1.9 KiB
C#
using Newtonsoft.Json.Linq;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using ZKLT.Hadoop.Interface;
|
|
using ZKLT.Hadoop.Model;
|
|
using ZKLT.Quartz.Interface;
|
|
using ZKLT.Quartz.Model;
|
|
|
|
namespace ZKLT.Hadoop
|
|
{
|
|
public class TaskService : ITaskService
|
|
{
|
|
private IHadoopService _HadoopService;
|
|
private IQuartzService _QuartzService;
|
|
public TaskService(IHadoopService hadoopService, IQuartzService quartzService) {
|
|
_HadoopService = hadoopService;
|
|
_QuartzService = quartzService;
|
|
}
|
|
|
|
public string Start(HDP_Task taskParams)
|
|
{
|
|
//获取计划任务信息
|
|
var command = new HDP_Command();
|
|
command.TableId = "ERP_Task";
|
|
command.Where = new JObject
|
|
{
|
|
{ "Id","=" }
|
|
};
|
|
command.Data = new JObject
|
|
{
|
|
{"Id",taskParams.Id }
|
|
};
|
|
var taskInfo = _HadoopService.QuerySingle<HDP_Task>(command);
|
|
command.TableId = "ERP_TaskConfig";
|
|
command.Where = new JObject
|
|
{
|
|
{ "TaskId","=" }
|
|
};
|
|
command.Data = new JObject
|
|
{
|
|
{"TaskId",taskParams.Id }
|
|
};
|
|
|
|
QZ_JobParams jobParams = new QZ_JobParams();
|
|
jobParams.TaskId = taskInfo.Id;
|
|
jobParams.CronTime = taskInfo.CronTime;
|
|
jobParams.Params = _HadoopService.Query<QZ_JobConfig>(command).ToList();
|
|
// 调用任务管理类 开启任务管理
|
|
_QuartzService.CreateHttpJob(jobParams);
|
|
return taskParams.Id;
|
|
}
|
|
public string Pause(string Id)
|
|
{
|
|
return Id;
|
|
}
|
|
public string Close(string Id)
|
|
{
|
|
return Id;
|
|
}
|
|
|
|
}
|
|
}
|