package com.uas.platform.b2b.model;


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

/**
 *  招标单信息(因为存在根据日期判断状态，需要使用定时任务，采用视图)
 * Created by dongbw on 17/03/07 11:16.
 */

@Table(name = "purc$tender", indexes = {@Index(name= "unique_enuu_code", columnList = "pt_enuu,pt_code", unique = true)})
@Entity
public class PurchaseTenderInfo implements Serializable {
    /**
     * 序列号
     */
    private static final long serialVersionUID = 1L;

    @Id
    @Column(name = "pt_id")
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;

    /**
     * 招标编号
     */
    @Column(name = "pt_code")
    private String code;

    /**
     * 招标标题
     */
    @Column(name = "pt_title")
    private String title;

    /**
     * 单据最后时间
     */
    @Column(name = "pt_modified")
    private Date modified;

    /**
     * 录入日期
     */
    @Column(name = "pt_date")
    private Date date;

    /**
     * 联系人
     */
    @Column(name = "pt_user")
    private String user;

    /**
     * 联系人uu
     */
    @Column(name = "pt_useruu")
    private Long useruu;

    /**
     * 联系人tel
     */
    @Column(name = "pt_usertel")
    private String userTel;

    /**
     * 招标企业uu
     */
    @Column(name = "pt_enuu")
    private Long enUU;

    /**
     * 投标截止日期
     */
    @Column(name = "pt_enddate")
    private Date endDate;

    /**
     *  结果公布日期
     */
    @Column(name = "pt_publishdate")
    private Date publishDate;

    /**
     * 状态（待发布，待投标，待评标，已结标）
     */
    @Column(name = "pt_status")
    private String status;

    /**
     * 币别
     */
    @Column(name = "pt_currency")
    private String currency;

    /**
     * 是否开放报名（1为开放，0为指定供应商）
     */
    @Column(name = "pt_ifopen")
    private Short ifOpen;

    /**
     * 是否含税（1含税，0不含税）
     */
    @Column(name = "pt_iftax")
    private Short ifTax;

    /**
     * 收货地址
     */
    @Column(name = "pt_shipaddress")
    private String shipAddress;

    /**
     * 付款方式
     */
    @Column(name = "pt_payment")
    private String payment;

    /**
     * 发票类型（0表示不要发票， 1表示增值税普通发票， 2表示增值税专用发票）
     */
    @Column(name = "pt_invoicetype")
    private Short invoiceType;

    /**
     * 证照要求
     */
    @Column(name = "pt_certificate")
    private String certificate;

    /**
     * 发布状态（保存为0，发布为1）
     */
    @Column(name = "pt_ispublish")
    private Short isPublish;

    /**
     * 招标产品明细
     */
    @OneToMany(mappedBy = "tender", cascade = CascadeType.REFRESH, fetch = FetchType.EAGER)
    @OrderBy("id")
    private Set<PurchaseTenderProd> purchaseTenderProds;

    /**
     * 招标附件
     */
    @OneToMany(fetch = FetchType.EAGER, cascade = {CascadeType.REFRESH})
    @JoinTable(name = "purc$tenderattach", joinColumns = @JoinColumn(name = "pt_id", referencedColumnName = "pt_id"), inverseJoinColumns = @JoinColumn(name="at_id", referencedColumnName = "at_id"))
    private Set<Attach> tenderAttaches;

    /**
     * 招标回答
     */
    @OneToOne(mappedBy = "tender", cascade = CascadeType.REFRESH, fetch = FetchType.EAGER)
    private PurchaseTenderAnswer answer;

    /**
     * 是否截止(0未截止,1已截止)
     */
    @Column(name = "pt_overdue", insertable = false, updatable = false)
    private Short overdue;

    /**
     * 是否公布结果（0未公布，1已公布）
     */
    @Column(name = "pt_result", insertable = false, updatable = false)
    private Short result;


    /**
     * 审核状态(0代表已提交，1代表已审核，uas审批流用，平台发布单据为空)
     */
    @Column(name = "pt_auditstatus")
    private Short auditStatus;

    /**
     * 是否全包 (1为全包，0为部分供料)
     */
    @Column(name = "pt_ifall")
    private Short ifAll;

    /**
     * 提问截止时间
     */
    @Column(name = "pt_questionenddate")
    private Date questionEndDate;

    /**
     * 是否截止提问（0未截止，1已截止）
     */
    @Column(name = "pt_questionend", insertable = false, updatable = false)
    private Short questionEnd;

    @Transient
    private Short bidEnNum;

    public Long getId() {
        return id;
    }

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

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public Date getModified() {
        return modified;
    }

    public void setModified(Date modified) {
        this.modified = modified;
    }

    public Date getDate() {
        return date;
    }

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

    public String getUser() {
        return user;
    }

    public void setUser(String user) {
        this.user = user;
    }

    public Long getUseruu() {
        return useruu;
    }

    public void setUseruu(Long useruu) {
        this.useruu = useruu;
    }

    public String getUserTel() {
        return userTel;
    }

    public void setUserTel(String userTel) {
        this.userTel = userTel;
    }

    public Long getEnUU() {
        return enUU;
    }

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

    public Date getEndDate() {
        return endDate;
    }

    public void setEndDate(Date endDate) {
        this.endDate = endDate;
    }

    public Date getPublishDate() {
        return publishDate;
    }

    public void setPublishDate(Date publishDate) {
        this.publishDate = publishDate;
    }

    public String getStatus() {
        return status;
    }

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

    public String getCurrency() {
        return currency;
    }

    public void setCurrency(String currency) {
        this.currency = currency;
    }

    public Short getIfOpen() {
        return ifOpen;
    }

    public void setIfOpen(Short ifOpen) {
        this.ifOpen = ifOpen;
    }

    public Short getIfTax() {
        return ifTax;
    }

    public void setIfTax(Short ifTax) {
        this.ifTax = ifTax;
    }

    public String getShipAddress() {
        return shipAddress;
    }

    public void setShipAddress(String shipAddress) {
        this.shipAddress = shipAddress;
    }

    public String getPayment() {
        return payment;
    }

    public void setPayment(String payment) {
        this.payment = payment;
    }

    public Short getInvoiceType() {
        return invoiceType;
    }

    public void setInvoiceType(Short invoiceType) {
        this.invoiceType = invoiceType;
    }

    public String getCertificate() {
        return certificate;
    }

    public void setCertificate(String certificate) {
        this.certificate = certificate;
    }

    public Short getIsPublish() {
        return isPublish;
    }

    public void setIsPublish(Short isPublish) {
        this.isPublish = isPublish;
    }

    public Set<PurchaseTenderProd> getPurchaseTenderProds() {
        return purchaseTenderProds;
    }

    public void setPurchaseTenderProds(Set<PurchaseTenderProd> purchaseTenderProds) {
        this.purchaseTenderProds = purchaseTenderProds;
    }

    public Set<Attach> getTenderAttaches() {
        return tenderAttaches;
    }

    public void setTenderAttaches(Set<Attach> tenderAttaches) {
        this.tenderAttaches = tenderAttaches;
    }

    public Short getOverdue() {
        return overdue;
    }

    public void setOverdue(Short overdue) {
        this.overdue = overdue;
    }

    public Short getResult() {
        return result;
    }

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

    public Short getAuditStatus() {
        return auditStatus;
    }

    public void setAuditStatus(Short auditStatus) {
        this.auditStatus = auditStatus;
    }

    public Short getBidEnNum() {
        return bidEnNum;
    }

    public void setBidEnNum(Short bidEnNum) {
        this.bidEnNum = bidEnNum;
    }

    public Short getIfAll() {
        return ifAll;
    }

    public void setIfAll(Short ifAll) {
        this.ifAll = ifAll;
    }

    public Date getQuestionEndDate() {
        return questionEndDate;
    }

    public void setQuestionEndDate(Date questionEndDate) {
        this.questionEndDate = questionEndDate;
    }

    public PurchaseTenderAnswer getAnswer() {
        return answer;
    }

    public void setAnswer(PurchaseTenderAnswer answer) {
        this.answer = answer;
    }

    public Short getQuestionEnd() {
        return questionEnd;
    }

    public void setQuestionEnd(Short questionEnd) {
        this.questionEnd = questionEnd;
    }
}


