package cn.ezhizao.project.business.collection.domain;

import cn.ezhizao.framework.aspectj.lang.annotation.Excel;
import cn.ezhizao.framework.web.domain.BaseEntity;
import cn.ezhizao.project.system.domain.SysFileStorage;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import javax.validation.constraints.Pattern;
import java.io.Serializable;
import java.math.BigDecimal;
import java.sql.Date;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;

/**
 * @author 朱汕
 */
@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = true)
@ApiModel("collection 收款")
public class BizCollection extends BaseEntity implements Serializable {
    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "收款流水号")
    private String flowNo;


    @ApiModelProperty(value = "收款流水号")
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Timestamp formDate;

    @ApiModelProperty(value = "服务公司id")
    private Long subsidiaryId;

    @ApiModelProperty(value = "服务公司")
    private String subsidiary;


    @ApiModelProperty(value = "服务公司账号")
    private String subsidiaryBankAccount;

    @ApiModelProperty(value = "服务公司开户行")
    private String subsidiaryBankName;

    @ApiModelProperty(value = "客户 Id")
    private Long companyId;


    @ApiModelProperty(value = "应收金额")
    private BigDecimal amount;

    @ApiModelProperty(value = "到账日期")
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Timestamp arriveDate;

    @ApiModelProperty(value = "到账时间")
    private String arriveTime;

    @ApiModelProperty(value = "审核状态")
    private Byte status;

    @TableField(exist = false)
    private String statusStr;
    @ApiModelProperty(value = "到款状态")
    private Byte arriveStatus;
    @TableField(exist = false)
    private String arriveStatusStr;
    @ApiModelProperty(value = "付款名称")
    private String applyName;

    @TableField(exist = false)
    @ApiModelProperty(value = "实收金额")
    private BigDecimal trueAmount;

    @ApiModelProperty(value = "付款账号")
    private String appyAccount;

    @ApiModelProperty(value = "从表biz_collection")
    @TableField(exist = false)
    private List<BizCollectionDetail> details = new ArrayList<>();

    @TableField(exist = false)
    private List<SysFileStorage> files = new ArrayList<>();

    @ApiModelProperty("审核时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Timestamp verifyDate;

    @ApiModelProperty("审核意见")
    private String verifyComment;

    @TableField(exist = false)
    @ApiModelProperty("客户名称")
    private String customerName;

    @ApiModelProperty("合同id")
    private Long contractId;


    @ApiModelProperty(value = "申请人")
    private Long applierId;


    @TableField(exist = false)
    private List<BizCollectionDetail> contractDetails;

    @TableField(exist = false)
    private String applierDept;

    @ApiModelProperty("新签/续签")
    private Integer isNew;

    @ApiModelProperty("项目/非项目")
    private Integer isProject;

    @ApiModelProperty("项目名称")
    private String projectName;

    @ApiModelProperty("项目编号")
    private String projectNo;

    @ApiModelProperty("项目主体名称")
    private String projectMainName;

    @ApiModelProperty("账套外键")
    private Long tenantId;
    @ApiModelProperty("审核状态")
    private Integer verifyStatus;

    @TableField(exist = false)
    private BigDecimal paymentAmount;

    @TableField(exist = false)
    private BigDecimal nonpaymentAmount;

    @TableField(exist = false)
    private BigDecimal contractAmount;
    @TableField(exist = false)
    private boolean nonpayment;
    @TableField(exist = false)
    private Date startDate;
    @TableField(exist = false)
    private Date endDate;

    @TableField(exist = false)
    private String orderRemark;

    /**
     * 导出数据
     */

    @Excel(name = "客户名称", width = 35)
    @ApiModelProperty(value = "客户名称")
    private String companyName;

    @Excel(name = "合同编号")
    @ApiModelProperty("合同单号")
    @TableField(exist = false)
    private String contractNo;

    @Excel(name = "实际付款时间", width = 20, dateFormat = "yyyy-MM-dd")
    @ApiModelProperty("确认到账时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Timestamp actuallyDate;

    @Excel(name = "收款金额")
    @ApiModelProperty(value = "收款金额")
    private BigDecimal arriveAmount;

    @Excel(name = "申请人")
    @TableField(exist = false)
    private String applierName;

    @Excel(name = "审核状态")
    @TableField(exist = false)
    private String statusName;

    @Excel(name = "支付状态")
    @TableField(exist = false)
    private String arriveStatusName;
    @ApiModelProperty(value = "服务公司账户")
    @Excel(name = "收款账户")
    private String subsidiaryName;
    @Excel(name = "备注")
    @ApiModelProperty(value = "备注")
    private String remark;

    @TableField(exist = false)
    private List<String> dateFilter;

    @TableField(exist = false)
    private List<SysFileStorage> evidenceFiles;
    @TableField(exist = false)
    private String boss;
    @TableField(exist = false)
    private String party;
    private Long verifyId;
    @TableField(exist = false)
    private String verifyName;
    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

}
