package com.bocloud.ims.entity.common;

import com.bocloud.common.utils.DateDeserializer;
import com.bocloud.common.utils.DateSerializer;
import com.bocloud.entity.annotations.Column;
import com.bocloud.entity.annotations.IgnoreAll;
import com.bocloud.entity.annotations.PK;
import com.bocloud.entity.annotations.Table;
import com.bocloud.entity.bean.Generic;
import com.bocloud.entity.meta.PKStrategy;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;

/**
 * 云平台同步记录
 *
 * @author wangyu
 * @version 4.1.0-SNAPSHOT
 * @since 2019/10/25
 */
@Table("vendor_sync_record")
public class VendorSyncRecord extends Generic {

    @PK(value = PKStrategy.AUTO)
    private Long id; // ID
    @Column("vendor_id")
    private Long vendorId;//云平台ID
    @Column("start_time")
    @JsonSerialize(using = DateSerializer.class)
    @JsonDeserialize(using = DateDeserializer.class)
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date startTime;//同步开始时间
    @Column("end_time")
    @JsonSerialize(using = DateSerializer.class)
    @JsonDeserialize(using = DateDeserializer.class)
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date endTime;//同步结束时间
    @Column("cost")
    private Long cost;//同步耗时
    @Column("result")
    private String result;//同步结果
    @Column("sync_result")
    private Boolean syncResult;//同步是否成功
    @Column("auto")
    private Boolean auto;//是否是自动同步
    @Column("creator_id")
    private Long creatorId;//同步人
    @IgnoreAll
    private String creatorName;//同步人姓名
    @IgnoreAll
    private String costStr;//同步耗时 String格式

    /**
     *
     */
    public VendorSyncRecord() {
    }

    /**
     * @param vendorId
     * @param startTime
     * @param endTime
     * @param cost
     * @param result
     * @param creatorId
     */
    public VendorSyncRecord(Long vendorId, Date startTime, Date endTime, Long cost, String result, Long creatorId) {
        this.vendorId = vendorId;
        this.startTime = startTime;
        this.endTime = endTime;
        this.cost = cost;
        this.result = result;
        this.creatorId = creatorId;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getVendorId() {
        return vendorId;
    }

    public void setVendorId(Long vendorId) {
        this.vendorId = vendorId;
    }

    public Date getStartTime() {
        return startTime;
    }

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

    public Date getEndTime() {
        return endTime;
    }

    public void setEndTime(Date endTime) {
        this.endTime = endTime;
    }

    public Long getCost() {
        return cost;
    }

    public void setCost(Long cost) {
        this.cost = cost;
    }

    public String getResult() {
        return result;
    }

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

    public Long getCreatorId() {
        return creatorId;
    }

    public void setCreatorId(Long creatorId) {
        this.creatorId = creatorId;
    }

    public String getCreatorName() {
        return creatorName;
    }

    public void setCreatorName(String creatorName) {
        this.creatorName = creatorName;
    }

    public String getCostStr() {
        return costStr;
    }

    public void setCostStr(String costStr) {
        this.costStr = costStr;
    }

    public Boolean getSyncResult() {
        return syncResult;
    }

    public void setSyncResult(Boolean syncResult) {
        this.syncResult = syncResult;
    }

    public Boolean getAuto() {
        return auto;
    }

    public void setAuto(Boolean auto) {
        this.auto = auto;
    }
}
