package com.uas.report.schedule.model;

import java.text.SimpleDateFormat;
import java.util.Date;

import com.alibaba.fastjson.JSON;

/**
 * 定时任务的执行日志
 * 
 * @author sunyj
 * @since 2016年12月19日 上午10:25:50
 */
public class TaskLog {

	/**
	 * 定时任务的信息
	 */
	private TaskInformation taskInformation;

	/**
	 * 任务执行时间
	 */
	private Date executeTime;

	/**
	 * 任务执行结果
	 */
	private String result;

	public TaskLog(TaskInformation taskInformation, Date executeTime, String result) {
		super();
		this.taskInformation = taskInformation;
		this.executeTime = executeTime;
		this.result = result;
	}

	public TaskInformation getTaskInformation() {
		return taskInformation;
	}

	public void setTaskInformation(TaskInformation taskInformation) {
		this.taskInformation = taskInformation;
	}

	public Date getExecuteTime() {
		return executeTime;
	}

	public void setExecuteTime(Date executeTime) {
		this.executeTime = executeTime;
	}

	public String getResult() {
		return result;
	}

	public void setResult(String result) {
		this.result = result;
	}

	public String toJSONString() {
		return "{\"taskInformation\": " + JSON.toJSONString(taskInformation) + ", \"executeTime\": \""
				+ new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(executeTime) + "\", \"result\": \"" + result
				+ "\"}";
	}

	@Override
	public String toString() {
		return "TaskLog [taskInformation=" + taskInformation + ", executeTime=" + executeTime + ", result=" + result
				+ "]";
	}

}
