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.
59 lines
1.9 KiB
C#
59 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 taskCommand = new HDP_Command();
|
|
taskCommand.TableId = "ERP_Task";
|
|
taskCommand.Where = new JObject() { { "Id","=" } };
|
|
taskCommand.Data = new JObject() { {"Id",taskParams.Id } };
|
|
var taskInfo = _HadoopService.QuerySingle<HDP_Task>(taskCommand);
|
|
//获取计划任务配置
|
|
var taskConfigCommand = new HDP_Command();
|
|
taskConfigCommand.TableId = "ERP_TaskConfig";
|
|
taskConfigCommand.Where = new JObject() { { "TaskId","=" } };
|
|
taskConfigCommand.Data = new JObject() { {"TaskId",taskParams.Id} };
|
|
|
|
QZ_JobParams jobParams = new QZ_JobParams();
|
|
jobParams.TaskId = taskInfo.Id;
|
|
jobParams.CronTime = taskInfo.CronTime;
|
|
jobParams.IsLog = taskInfo.IsLog;
|
|
jobParams.Params = _HadoopService.Query<QZ_JobConfig>(taskConfigCommand).ToList();
|
|
|
|
// 调用任务管理类 开启任务管理
|
|
_QuartzService.CreateHttpJob(jobParams);
|
|
|
|
return taskParams.Id;
|
|
}
|
|
public string Pause(string Id)
|
|
{
|
|
return Id;
|
|
}
|
|
public string Close(string Id)
|
|
{
|
|
return Id;
|
|
}
|
|
|
|
}
|
|
}
|