package com.jsc.oscm.entity;

import com.jsc.oscm.util.DateUtil;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

@Entity
@Data
@NoArgsConstructor
public class Log {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer id;
    private String jobId; //xxl-job 的 log id
    private Integer taskId; //oscm任务id
    private String scrapydId;
    private Date createTime;
    private Date startTime;
    private Date finishTime;
    private Date updateTime;
    private Integer time;
    private String status;
    private String result;
    private Integer pagesCount;
    private Integer itemsCount;
    private Integer filesCount;
    private Long downloadBytes;
    private Integer nodeId;
    private String redisQueueName;

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Date getStartTime() {
        return startTime;
    }

    public void setStartTime(Date startTime) {
        this.startTime = startTime;
    }

    public Date getFinishTime() {
        return finishTime;
    }

    public void setFinishTime(Date finishTime) {
        this.finishTime = finishTime;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    public void setFinishTime(String finishTime) {
        this.finishTime = DateUtil.DateStringToDate(finishTime, "yyyy-MM-dd HH:mm:ss");
    }

    public void setUpdateTime(String updateTime) {
        this.updateTime = DateUtil.DateStringToDate(updateTime, "yyyy-MM-dd HH:mm:ss");
    }

    public void setCreateTime(String createTime) {
        this.createTime = DateUtil.DateStringToDate(createTime, "yyyy-MM-dd HH:mm:ss");
    }

    public void setStartTime(String startTime) {
        this.startTime = DateUtil.DateStringToDate(startTime, "yyyy-MM-dd HH:mm:ss");
    }

}
