package com.sunxung.factoring.entity.underlying.sop;

import com.alibaba.fastjson.annotation.JSONField;
import com.sunxung.factoring.component.annotation.ObjectValidator;
import com.sunxung.factoring.entity.BaseEntity;
import com.sunxung.factoring.entity.sys.Dictionary;
import org.hibernate.validator.constraints.NotEmpty;

import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * @Description:收放款计划(保理融资款)实体 -- 对应sop收放款计划
 */
public class PaymentCollectionPlanFactoring extends BaseEntity {

    private static final long serialVersionUID = 1L;

    @NotNull(message = "序号不能为空")
    private Integer serialNo;
    /**
     * 约定日期
     **/
    @JSONField(format = "yyyy-MM-dd")
    private Date planDate;
    @ObjectValidator(message = "金额类型不能为空")
    private Dictionary amountType;// 取值IncormeExpenditureTypeDict.java包括“逾期利息”类型
    @NotEmpty(message = "收放款类型不能为空")
    private String paymentCollectionType;// 要求与ConstantConversionUtil.java中paymentCollectionMap常量值一致
    @NotNull(message = "金额不能为空，必须大于0")
    private BigDecimal amount;// 若为逾期利息，则默认设置为0，当不为0时表示逾期利息金额已确定，即本金状态“逾期完成”
    @ObjectValidator(message = "币种能为空")
    private Dictionary currencyType;
    @NotNull(message = "实际净现金流不能为空")
    private BigDecimal actualCashFlow;
    /**
     * 收款主体:债权人creditor、债务人debtor
     **/
    private String receivingSubject;
    /**
     * 状态
     **/
    private Dictionary status;
    /**
     * 历史记录表映射实际执行计划表中保理融资款数据，null表示新增的收款，非null表示update
     **/
    private Long actualId;
    /**
     * 合同收支计划ID，可为null值表示新增的“收款”
     **/
    private Long contractIncomeExpenditurePlanId;// 尤其放款，其状态会根据财务出账来判断的
    /**
     * 金额分配记录
     **/
    private List<PayCollPlanFactoringAmountAllocation> amountAllocationList;
    /**
     * 逾期(利息)数据来源ID
     **/
    private Long overdueSourceId;// 仅“逾期利息”类型的保理融资款(收款)，该字段不能为空
    /**
     * 不保存数据库，所有已分配金额的总和，若是放款，则是付款总额
     **/
    private BigDecimal sumAmountAllocation;
    /**
     * 是否允许(计划变更)被修改，默认false表示否
     **/
    private boolean allowedChange;
    /**
     * 不保存数据库，判断计划变更约定日期时是否需要新增逾期数据的标识，默认false表示不新增
     **/
    private boolean overdueTempFlag;
    /**
     * 不保存数据库，，仅页面展示，指保理融资款中放款类型数据的约定日期
     **/
    private List<Date> paymentPlanDateList;// 来源于付款申请审批通过后的付款计划日期

    /**
     * 不保存数据库，仅页面展示 本金放款实际放款信息
     **/
    private List<BillingFactoringBusinessLoanRecord> loanRecordList;

    /**
     * 不保存数据库，仅页面展示 收款实际放款信息
     **/
    private List<PayCollPlanFactoringAmountAllocation> collRecordList;

    /**
     * 宽限期类型 0：无 1：一次延期 2：二次延期
     */
    private Integer graceType;

    /**
     * 是否选中 1 是 0 否
     **/
    private Boolean selected;

    /**
     * 收放款类型-名称
     */
    private String paymentCollectionTypeName;

    /**
     * 金额类型-名称
     */
    private String amountTypeName;

    /**
     * 状态
     */
    private String statusStr;

    public PaymentCollectionPlanFactoring() {
    }

    public PaymentCollectionPlanFactoring(Date planDate, BigDecimal amount) {
        this.planDate = planDate;
        this.amount = amount;
    }

    public Integer getSerialNo() {
        return serialNo;
    }

    public void setSerialNo(Integer serialNo) {
        this.serialNo = serialNo;
    }

    public Date getPlanDate() {
        return planDate;
    }

    public void setPlanDate(Date planDate) {
        this.planDate = planDate;
    }

    public Dictionary getAmountType() {
        return amountType;
    }

    public void setAmountType(Dictionary amountType) {
        this.amountType = amountType;
    }

    public String getPaymentCollectionType() {
        return paymentCollectionType;
    }

    public void setPaymentCollectionType(String paymentCollectionType) {
        this.paymentCollectionType = paymentCollectionType;
    }

    public BigDecimal getAmount() {
        return amount;
    }

    public void setAmount(BigDecimal amount) {
        this.amount = amount;
    }

    public Dictionary getCurrencyType() {
        return currencyType;
    }

    public void setCurrencyType(Dictionary currencyType) {
        this.currencyType = currencyType;
    }

    public BigDecimal getActualCashFlow() {
        return actualCashFlow;
    }

    public void setActualCashFlow(BigDecimal actualCashFlow) {
        this.actualCashFlow = actualCashFlow;
    }

    public String getReceivingSubject() {
        return receivingSubject;
    }

    public void setReceivingSubject(String receivingSubject) {
        this.receivingSubject = receivingSubject;
    }

    public Dictionary getStatus() {
        return status;
    }

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

    public Long getActualId() {
        return actualId;
    }

    public void setActualId(Long actualId) {
        this.actualId = actualId;
    }

    public Long getContractIncomeExpenditurePlanId() {
        return contractIncomeExpenditurePlanId;
    }

    public void setContractIncomeExpenditurePlanId(Long contractIncomeExpenditurePlanId) {
        this.contractIncomeExpenditurePlanId = contractIncomeExpenditurePlanId;
    }

    public Long getOverdueSourceId() {
        return overdueSourceId;
    }

    public void setOverdueSourceId(Long overdueSourceId) {
        this.overdueSourceId = overdueSourceId;
    }

    public BigDecimal getSumAmountAllocation() {
        return sumAmountAllocation;
    }

    public void setSumAmountAllocation(BigDecimal sumAmountAllocation) {
        this.sumAmountAllocation = sumAmountAllocation;
    }

    public boolean getAllowedChange() {
        return allowedChange;
    }

    public void setAllowedChange(boolean allowedChange) {
        this.allowedChange = allowedChange;
    }

    public boolean getOverdueTempFlag() {
        return overdueTempFlag;
    }

    public void setOverdueTempFlag(boolean overdueTempFlag) {
        this.overdueTempFlag = overdueTempFlag;
    }

    public List<Date> getPaymentPlanDateList() {
        return paymentPlanDateList;
    }

    public void setPaymentPlanDateList(List<Date> paymentPlanDateList) {
        this.paymentPlanDateList = paymentPlanDateList;
    }

    public List<PayCollPlanFactoringAmountAllocation> getAmountAllocationList() {
        return amountAllocationList;
    }

    public void setAmountAllocationList(List<PayCollPlanFactoringAmountAllocation> amountAllocationList) {
        this.amountAllocationList = amountAllocationList;
    }

    public List<BillingFactoringBusinessLoanRecord> getLoanRecordList() {
        return loanRecordList;
    }

    public void setLoanRecordList(List<BillingFactoringBusinessLoanRecord> loanRecordList) {
        this.loanRecordList = loanRecordList;
    }

    public List<PayCollPlanFactoringAmountAllocation> getCollRecordList() {
        return collRecordList;
    }

    public void setCollRecordList(List<PayCollPlanFactoringAmountAllocation> collRecordList) {
        this.collRecordList = collRecordList;
    }

    public Integer getGraceType() {
        return graceType;
    }

    public void setGraceType(Integer graceType) {
        this.graceType = graceType;
    }

    public boolean isAllowedChange() {
        return allowedChange;
    }

    public boolean isOverdueTempFlag() {
        return overdueTempFlag;
    }

    public Boolean getSelected() {
        return selected;
    }

    public void setSelected(Boolean selected) {
        this.selected = selected;
    }

    public String getPaymentCollectionTypeName() {
        return paymentCollectionTypeName;
    }

    public void setPaymentCollectionTypeName(String paymentCollectionTypeName) {
        this.paymentCollectionTypeName = paymentCollectionTypeName;
    }

    public String getAmountTypeName() {
        return amountTypeName;
    }

    public void setAmountTypeName(String amountTypeName) {
        this.amountTypeName = amountTypeName;
    }

    public String getStatusStr() {
        return statusStr;
    }

    public void setStatusStr(String statusStr) {
        this.statusStr = statusStr;
    }
}
