package com.uas.finance.model;

import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

import javax.persistence.*;
import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

/**
 * 金融服务申请数据
 *
 * @author hejq
 * @time 创建时间：2017年11月24日
 */
@Entity
@Table(name = "financingapply")

public class FinancingApply implements Serializable {

    private static final long serialVersionUID = 1L;

    private static final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");

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

    /**
     * 企业uu
     */
    @Column(name = "fa_enuu")
    private Long enuu;

    /**
     * 保理UU
     */
    @Column(name = "fa_faenuu")
    private Long fauu;

    /**
     * 企业名
     */
    @Column(name = "fa_enname")
    private String fa_enname;

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

    /**
     * 联系方式1
     */
    @Column(name = "fa_telphone")
    private String fa_telphone;

    /**
     * 联系方式2
     */
    @Column(name = "fa_phone")
    private String fa_phone;

    /**
     * erp下载状态
     */
    @Column(name = "fa_erpstatus")
    private Integer erpstatus;

    /**
     * 申请金额
     */
    @Column(name = "fa_appamount")
    private Long fa_appamount;

    /**
     * 申请人
     */
    @Column(name = "fa_applyman")
    private String fa_applyman;

    /**
     * 申请日期
     */
    @Column(name = "fa_applydate")
    private Date fa_applydate;

    /**
     * 申请得分
     */
    @Transient
    private Double fa_score;

    /**
     * UAS数据库融资申请单号
     */
    @Column(name = "fa_busincode")
    private String fa_busincode;

    /**
     * 保理公司名称
     */
    @Column(name = "fa_facorpname")
    private String fa_facorpname;

    /**
     * 保理公司
     */
    @Transient
    private String fa_facorpcode;

    /**
     * 客户资料id
     */
    @Column(name = "fa_cus_id")
    private Long cusId;

    /**
     * 保理申请单状态
     * 201:已保存
     * 202:已提交
     * 203:已下载
     * 204:批复额度成功
     * 205:拒绝批复额度
     */
    @Column(name = "fa_status")
    private Integer status;

    /**
     * 受理日期
     */
    @Column(name = "fa_time")
    private Date approveTime;

    /**
     * 提交日期
     */
    @Column(name = "fa_subtime")
    private Date submitTime;

    /**
     * 0:等待确认
     * 1：已确认
     */
    @Column(name = "fa_check")
    private Integer checkinfo;


    @OneToOne(cascade = CascadeType.REFRESH)
    @JoinColumn(name = "fa_cus_id", insertable = false, updatable = false)

    private CustomerInfo customerInfo;

    @OneToMany(mappedBy = "financingApply", cascade = CascadeType.REFRESH)
    private List<Attach> attachList;

    public Integer getCheckinfo() {
        return checkinfo;
    }

    public void setCheckinfo(Integer checkinfo) {
        this.checkinfo = checkinfo;
    }

    public Integer getStatus() {
        return status;
    }

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

    public Integer getErpstatus() {
        return erpstatus;
    }

    public void setErpstatus(Integer erpstatus) {
        this.erpstatus = erpstatus;
    }

    public List<Attach> getAttachList() {
        return attachList;
    }

    public void setAttachList(List<Attach> attachList) {
        this.attachList = attachList;
    }

    public Long getCusId() {
        return cusId;
    }

    public void setCusId(Long cusId) {
        this.cusId = cusId;
    }

    public String getFa_enname() {
        return fa_enname;
    }

    public void setFa_enname(String fa_enname) {
        this.fa_enname = fa_enname;
    }

    public CustomerInfo getCustomerInfo() {
        return customerInfo;
    }

    public void setCustomerInfo(CustomerInfo customerInfo) {
        this.customerInfo = customerInfo;
    }

    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 String getFa_contact() {
        return fa_contact;
    }

    public void setFa_contact(String fa_contact) {
        this.fa_contact = fa_contact;
    }

    public String getFa_telphone() {
        return fa_telphone;
    }

    public void setFa_telphone(String fa_telphone) {
        this.fa_telphone = fa_telphone;
    }

    public String getFa_phone() {
        return fa_phone;
    }

    public void setFa_phone(String fa_phone) {
        this.fa_phone = fa_phone;
    }

    public Long getFa_appamount() {
        return fa_appamount;
    }

    public void setFa_appamount(Long fa_appamount) {
        this.fa_appamount = fa_appamount;
    }

    public String getFa_applyman() {
        return fa_applyman;
    }

    public void setFa_applyman(String fa_applyman) {
        this.fa_applyman = fa_applyman;
    }

    public Date getFa_applydate() {
        return fa_applydate;
    }

    public void setFa_applydate(Date fa_applydate) {
        this.fa_applydate = fa_applydate;
    }

    public Double getFa_score() {
        return fa_score;
    }

    public void setFa_score(Double fa_score) {
        this.fa_score = fa_score;
    }

    public String getFa_busincode() {
        return fa_busincode;
    }

    public void setFa_busincode(String fa_busincode) {
        this.fa_busincode = fa_busincode;
    }

    public String getFa_facorpname() {
        return fa_facorpname;
    }

    public void setFa_facorpname(String fa_facorpname) {
        this.fa_facorpname = fa_facorpname;
    }

    public String getFa_facorpcode() {
        return fa_facorpcode;
    }

    public void setFa_facorpcode(String fa_facorpcode) {
        this.fa_facorpcode = fa_facorpcode;
    }

    public Long getFauu() {
        return fauu;
    }

    public void setFauu(Long fauu) {
        this.fauu = fauu;
    }

    public Date getApproveTime() {
        return approveTime;
    }

    public void setApproveTime(Date approveTime) {
        this.approveTime = approveTime;
    }

    public String getSubmitTime() {
        Date date = this.submitTime;
        return date !=null ? sdf.format(date) : null;
    }

    public void setSubmitTime(Date submitTime) {
        this.submitTime = submitTime;
    }
}
