package cn.estsh.i3plus.pojo.platform.platbean;

import cn.estsh.i3plus.pojo.base.annotation.AnnoOutputColumn;
import cn.estsh.i3plus.pojo.base.bean.BaseBean;
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiParam;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.springframework.data.mongodb.core.index.Indexed;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;

/**
 * @Description : 定时任务执行记录
 * @Reference   :
 * @Author      : wei.peng
 * @Date        : 2018-10-22 16:58:43.992
 * @Modify      :
 **/
@Data
@Entity
@DynamicInsert
@DynamicUpdate
@EqualsAndHashCode(callSuper = true)
@Table(name="SYS_LOG_TASK_TIME")
@Api(value="定时任务执行日志",description = "定时任务执行记录")
public class SysLogTaskTime extends BaseBean {

    @Column(name="SCHEDULER_INSTANCE_ID")
    @ApiParam(value ="调度器实例id")
    private String schedulerInstanceId;

    @Column(name="SCHEDULER_SERVER_IP")
    @ApiParam(value ="调度服务器ip")
    private String schedulerServerIp;

    @Column(name="SCHEDULER_SERVER_PORT")
    @ApiParam(value ="调度服务器端口")
    private String schedulerServerPort;

    @Column(name="TASK_THREAD_ID")
    @ApiParam(value ="任务线程id")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long taskThreadId;

    @Column(name="NAME")
    @ApiParam(value ="任务名称")
    private String name;

    @Column(name="GROUP_NAME")
    @ApiParam(value ="任务组名称")
    private String groupName;

    @Column(name="TASK_PLAN_ID")
    @ApiParam(value ="任务计划id" , example = "-1")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long taskPlanId;

    @Column(name = "TASK_SOFT_TYPE_RDD")
    @ApiParam(value = "任务所属模块")
    private Integer taskSoftTypeRdd;

    @Column(name="TASK_CYCLE_NAME_RDD")
    @ApiParam(value ="任务周期名称")
    private String taskCycleNameRdd;

    @Column(name="TASK_CYCLE_EXPS_RDD")
    @ApiParam(value ="任务周期表达式")
    private String taskCycleExpsRdd;

    @Indexed
    @Column(name="EXECUTE_TIME")
    @ApiParam(value ="执行耗时")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long executeTime;

    @Column(name="TASK_STATUS")
    @ApiParam(value ="任务完成情况(枚举：1正常，2失败)")
    @AnnoOutputColumn(refClass = CommonEnumUtil.TRUE_OR_FALSE.class, refForeignKey = "value", value = "description")
    private Integer taskStatus;

    @Column(name="TASK_LOG_ERROR")
    @ApiParam(value ="任务异常日志")
    private String taskLogError;
}
