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

import cn.ezhizao.framework.aspectj.lang.annotation.Excel;
import cn.ezhizao.framework.aspectj.lang.annotation.Excels;
import cn.ezhizao.framework.web.domain.BaseEntity;
import cn.ezhizao.project.business.collection.domain.vo.ArchiveVo;
import cn.ezhizao.project.business.order.domain.BizArchiveInput;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;

/**
 * @author 朱汕
 */
@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = true)
@ApiModel("channel_detail 收款合同明细")
public class BizCollectionDetail extends BaseEntity implements Serializable {
    private static final long serialVersionUID = 1L;
    @ApiModelProperty(value = "收款主表id")
    private Long collectionId;

    @ApiModelProperty(value = "合同外键")
    private Long contractId;

    @ApiModelProperty("合同明细外键")
    private Long contractDetailId;

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

    @ApiModelProperty(value = "产品外键")
    @Excel(sort = 5,name = "任务类型", readConverterExp = "1=代理记账,2=社保代缴,3=公积金代缴,4=返税申报,5=注册,6=变更,7=注销,8=资质,9=其他")
    private Long taskTypeId;

    @ApiModelProperty(value = "购买数量")
    private BigDecimal buyNum;

    @ApiModelProperty(value = "赠送数量")
    private BigDecimal freeNum;

    @ApiModelProperty(value = "数量单位")
    private String unit;

    @ApiModelProperty(value = "总价")
    private BigDecimal amount;

    @ApiModelProperty(value = "优惠金额")
    private BigDecimal discountAmount;

    @ApiModelProperty(value = "成交价格")
    private BigDecimal dealPrice;

    @ApiModelProperty(value = "预估成本")
    private BigDecimal estimateCost;
    @Excel(sort = 7,name = "本次收款金额")
    @ApiModelProperty(value = "收款金额")
    private BigDecimal arriveAmount;

     /** 虚字段 */
    @ApiModelProperty(value = "客户")
    @TableField(exist = false)
    private String customerName;

    @ApiModelProperty(value = "产品")
    @TableField(exist = false)
    private String taskTypeName;

    @TableField(exist = false)
    @Excel(sort = 11,name = "已收款金额")
    private BigDecimal arrived;

    @TableField(exist = false)
    private String forRenew;

    @ApiModelProperty("账套外键")
    private Long tenantId;
    @TableField(exist = false)
    private List<Long> collectionIds;
    @TableField(exist = false)
    private List<Long> ids;
    @TableField(exist = false)
    private Integer verifyStatus;

    @TableField(exist = false)
    @ApiModelProperty("地址类型")
    private Integer addressStyle;
    @TableField(exist = false)
    @ApiModelProperty("虚拟地址外键")
    private Long fictionAddressId;

    @TableField(exist = false)
    @ApiModelProperty(value = "省")
    private String province;

    @TableField(exist = false)
    @ApiModelProperty(value = "市")
    private String city;


    @TableField(exist = false)
    @ApiModelProperty(value = "区")
    private String district;
    @ApiModelProperty("所属区")
    @TableField(exist = false)
    private Integer belongRegion;
    @ApiModelProperty("所属区")
    @TableField(exist = false)
    private String regionName;
    @TableField(exist = false)
    private String fictionAddressName;
    @TableField(exist = false)
    private String explain;

    @TableField(exist = false)
    private String inputRemark;
    @Excel(sort = 18, name = "收款备注")
    private String remark;

    public String getRemark() {
        return remark;
    }

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

    @TableField(exist = false)
    @Excels({
            @Excel(sort = 1, name = "客户名称",width = 40,targetAttr = "companyName", type = Excel.Type.EXPORT),
            @Excel(sort = 9,name = "是否是项目", targetAttr = "isProject", readConverterExp = "0=项目,1=非项目", type = Excel.Type.EXPORT),
            @Excel(sort = 10, name = "确认所属时间", targetAttr = "actuallyDate",dateFormat = "yyyy-MM-dd", type = Excel.Type.EXPORT),
            @Excel(sort = 11, name = "收款账户",width = 80, targetAttr = "subsidiaryName", type = Excel.Type.EXPORT),
            @Excel(sort = 12, name = "申请人", targetAttr = "applierName",dateFormat = "yyyy-MM-dd", type = Excel.Type.EXPORT),
            @Excel(sort = 13, name = "审核人", targetAttr = "verifyName", type = Excel.Type.EXPORT),
            @Excel(sort = 14, name = "审核时间", targetAttr = "verifyDate", type = Excel.Type.EXPORT),
            @Excel(sort = 15, name = "项目名称", targetAttr = "projectName", type = Excel.Type.EXPORT),
            @Excel(sort = 16, name = "项目主体名称", targetAttr = "projectMainName", type = Excel.Type.EXPORT),
            @Excel(sort = 17, name = "到账日期", targetAttr = "arriveDate",dateFormat = "yyyy-MM-dd", type = Excel.Type.EXPORT),
    })
    private BizCollection bizCollection;
    @TableField(exist = false)
    @Excels({
            @Excel(sort = 2,name = "合同编号",width = 40, targetAttr = "contractNo", type = Excel.Type.EXPORT),
            @Excel(sort = 3,name = "甲方", targetAttr = "boss", type = Excel.Type.EXPORT),
            @Excel(sort = 4,name = "乙方",width = 60, targetAttr = "party", type = Excel.Type.EXPORT),
            @Excel(sort = 6,name = "任务金额", targetAttr = "amount", type = Excel.Type.EXPORT),
            @Excel(sort = 8,name = "合同类型", targetAttr = "contractType",readConverterExp = "0=新签,1=续签", type = Excel.Type.EXPORT)
    })
    private ArchiveVo bizArchiveInput;
    @TableField(exist = false)
    private BigDecimal reviewAmount;
    @TableField(exist = false)
    private BigDecimal countAmount;
}
