package com.uas.finance.erp.model;

import com.uas.finance.model.MFCustInfo;
import com.uas.finance.model.MFCustInfoDetail;
import com.uas.finance.util.CollectionUtils;
import com.uas.finance.util.DateUtils;
import com.uas.sso.util.FlexJsonUtil;

import java.util.ArrayList;
import java.util.List;

/**
 * 买方客户资料
 * created by shicr on 2017/12/20
 **/
public class PurcCustInfo {

    /**
     * ID
     */
    private Long id;

    /**
     * 企业uu
     *
     * @return
     */
    private Long enuu;

    /**
     * 买方名称
     */
    private String mf_custname;

    /**
     * 额度申请
     */
    private Double mf_credit;

    /**
     * 法人代表
     */
    private String mf_legrep;

    /**
     * 注册资本(万元)
     */
    private Double mf_regcapital;

    /**
     * 经营地址
     */
    private String mf_addr;

    /**
     * 成立时间
     */
    private String mf_estabtime;

    /**
     * 联系人
     */
    private String mf_contact;

    /**
     * 联系电话
     */
    private String mf_contactnum;

    /**
     * 传真
     */
    private String mf_fax;

    /**
     * 电子邮箱
     */
    private String mf_email;

    /**
     * 结算开户行
     */
    private String mf_balancebank;

    /**
     * 银行账户
     */
    private String mf_bankaccount;

    /**
     * 交易产品
     */
    private String mf_tradprod;

    /**
     * 付款条件
     */
    private String mf_payterm;

    /**
     * 股东占比(%)
     */
    private Double mf_shareholder;

    /**
     * 经营范围
     */
    private String mf_businsscope;

    /**
     * 是否与其他保理商合作
     * -1:true 0:false
     */
    private Short mf_coopothers;

    /**
     * 保险公司取得保险额度
     * -1:true 0:false
     */
    private Short mf_hasinslimit;

    /**
     * 买方客户信息详情
     */
    //private List<PurcCustInfoDetail> purcCustInfoDetails;
    private String purcCustInfoDetails;

    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 getMf_custname() {
        return mf_custname;
    }

    public void setMf_custname(String mf_custname) {
        this.mf_custname = mf_custname;
    }

    public Double getMf_credit() {
        return mf_credit;
    }

    public void setMf_credit(Double mf_credit) {
        this.mf_credit = mf_credit;
    }

    public String getMf_legrep() {
        return mf_legrep;
    }

    public void setMf_legrep(String mf_legrep) {
        this.mf_legrep = mf_legrep;
    }

    public Double getMf_regcapital() {
        return mf_regcapital;
    }

    public void setMf_regcapital(Double mf_regcapital) {
        this.mf_regcapital = mf_regcapital;
    }

    public String getMf_addr() {
        return mf_addr;
    }

    public void setMf_addr(String mf_addr) {
        this.mf_addr = mf_addr;
    }

    public String getMf_estabtime() {
        return mf_estabtime;
    }

    public void setMf_estabtime(String mf_estabtime) {
        this.mf_estabtime = mf_estabtime;
    }

    public String getMf_contact() {
        return mf_contact;
    }

    public void setMf_contact(String mf_contact) {
        this.mf_contact = mf_contact;
    }

    public String getMf_contactnum() {
        return mf_contactnum;
    }

    public void setMf_contactnum(String mf_contactnum) {
        this.mf_contactnum = mf_contactnum;
    }

    public String getMf_fax() {
        return mf_fax;
    }

    public void setMf_fax(String mf_fax) {
        this.mf_fax = mf_fax;
    }

    public String getMf_email() {
        return mf_email;
    }

    public void setMf_email(String mf_email) {
        this.mf_email = mf_email;
    }

    public String getMf_balancebank() {
        return mf_balancebank;
    }

    public void setMf_balancebank(String mf_balancebank) {
        this.mf_balancebank = mf_balancebank;
    }

    public String getMf_bankaccount() {
        return mf_bankaccount;
    }

    public void setMf_bankaccount(String mf_bankaccount) {
        this.mf_bankaccount = mf_bankaccount;
    }

    public String getMf_tradprod() {
        return mf_tradprod;
    }

    public void setMf_tradprod(String mf_tradprod) {
        this.mf_tradprod = mf_tradprod;
    }

    public String getMf_payterm() {
        return mf_payterm;
    }

    public void setMf_payterm(String mf_payterm) {
        this.mf_payterm = mf_payterm;
    }

    public Double getMf_shareholder() {
        return mf_shareholder;
    }

    public void setMf_shareholder(Double mf_shareholder) {
        this.mf_shareholder = mf_shareholder;
    }

    public String getMf_businsscope() {
        return mf_businsscope;
    }

    public void setMf_businsscope(String mf_businsscope) {
        this.mf_businsscope = mf_businsscope;
    }

    public Short getMf_coopothers() {
        return mf_coopothers;
    }

    public void setMf_coopothers(Short mf_coopothers) {
        this.mf_coopothers = mf_coopothers;
    }

    public Short getMf_hasinslimit() {
        return mf_hasinslimit;
    }

    public void setMf_hasinslimit(Short mf_hasinslimit) {
        this.mf_hasinslimit = mf_hasinslimit;
    }

    public String getPurcCustInfoDetails() {
        return purcCustInfoDetails;
    }

    public void setPurcCustInfoDetails(String purcCustInfoDetails) {
        this.purcCustInfoDetails = purcCustInfoDetails;
    }
/*public List<PurcCustInfoDetail> getPurcCustInfoDetails() {
        return purcCustInfoDetails;
    }

    public void setPurcCustInfoDetails(List<PurcCustInfoDetail> purcCustInfoDetails) {
        this.purcCustInfoDetails = purcCustInfoDetails;
    }*/

    public PurcCustInfo(MFCustInfo custInfo) {
        this.id = custInfo.getId();
        this.enuu = custInfo.getEnuu();
        this.mf_custname = custInfo.getMf_custname();
        this.mf_addr = custInfo.getMf_addr();
        this.mf_balancebank = custInfo.getMf_balancebank();
        this.mf_bankaccount = custInfo.getMf_bankaccount();
        this.mf_businsscope = custInfo.getMf_businsscope();
        this.mf_contact = custInfo.getMf_contact();
        this.mf_contactnum = custInfo.getMf_contactnum();
        this.mf_credit = custInfo.getMf_credit();
        this.mf_custname = custInfo.getMf_custname();
        this.mf_email = custInfo.getMf_email();
        this.mf_estabtime = custInfo.getMf_estabtime() == null ? null : DateUtils.DateInfo(custInfo.getMf_estabtime());
        this.mf_fax = custInfo.getMf_fax();
        this.mf_payterm = custInfo.getMf_payterm();
        this.mf_shareholder = custInfo.getMf_shareholder();
        this.mf_tradprod = custInfo.getMf_tradprod();
        this.mf_coopothers=custInfo.getMf_coopohers();
        this.mf_hasinslimit = custInfo.getMf_hasinslimit();
        this.mf_shareholder = custInfo.getMf_shareholder();
        this.mf_regcapital = custInfo.getMf_regcapital();
        this.mf_legrep = custInfo.getMf_legrep();
        if (!CollectionUtils.isEmpty(custInfo.getMfCustInfoDetailList())) {
            List<PurcCustInfoDetail> purcCustInfoDetails = new ArrayList<PurcCustInfoDetail>();
            for (MFCustInfoDetail mfCustInfoDetail : custInfo.getMfCustInfoDetailList()) {
                purcCustInfoDetails.add(new PurcCustInfoDetail(mfCustInfoDetail));
            }
            //this.purcCustInfoDetails = purcCustInfoDetails;
            this.purcCustInfoDetails = FlexJsonUtil.toJsonArray(purcCustInfoDetails);
        }
    }

    public PurcCustInfo() {

    }
}
