package com.uas.platform.b2b.ps.model;

import com.uas.platform.core.model.Status;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

/**
 * 待转的个人物料信息
 *
 * Created by hejq on 2018-06-05.
 */
@Table(name = "personl$product")
@Entity
public class PersonalProduct implements Serializable {

    /**
     * 序列号
     */
    private static final long serialVersionUID = 1L;

    /**
     * id
     */
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "pr_id")
    private Long id;

    /**
     * 企业UU
     */
    @Column(name = "pr_enuu")
    private Long enUU;

    /**
     * 用户UU
     */
    @Column(name = "pr_useruu")
    private Long userUU;

    /**
     * 物料ID
     */
    @Column(name = "pr_prid")
    private Long prId;

    /**
     * 状态
     *  <node>
     *      NOT_UPLOAD(202, "待上传")
     *      DOWNLOADED(203, "已下载")
     *  </node>
     */
    @Column(name = "pr_status")
    private Integer status;

    /**
     * 方法
     */
    @Column(name = "pr_method")
    private String method;

    /**
     * 时间
     */
    @Column(name = "pr_date")
    private Date date;

    /**
     * 处理时间
     */
    @Column(name = "pr_dealtime")
    private Date dealTime;

    public Long getId() {
        return id;
    }

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

    public Long getEnUU() {
        return enUU;
    }

    public void setEnUU(Long enUU) {
        this.enUU = enUU;
    }

    public Long getUserUU() {
        return userUU;
    }

    public void setUserUU(Long userUU) {
        this.userUU = userUU;
    }

    public Long getPrId() {
        return prId;
    }

    public void setPrId(Long prId) {
        this.prId = prId;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public String getMethod() {
        return method;
    }

    public void setMethod(String method) {
        this.method = method;
    }

    public Date getDate() {
        return date;
    }

    public void setDate(Date date) {
        this.date = date;
    }

    public Date getDealTime() {
        return dealTime;
    }

    public void setDealTime(Date dealTime) {
        this.dealTime = dealTime;
    }

    public PersonalProduct() {

    }

    /**
     * 根据物料Id,企业UU，个人UU和方法记录待处理个人物料信息
     *
     * @param prId 物料id
     * @param enUU 企业UU
     * @param userUU 用户UU
     * @param method 方法
     */
    public PersonalProduct(Long prId, Long enUU, Long userUU, String method) {
        this.date = new Date(System.currentTimeMillis());
        this.enUU = enUU;
        this.userUU = userUU;
        this.prId = prId;
        this.status = Status.NOT_UPLOAD.value();
        this.method = method;
    }
}
