package cn.pluss.platform.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;

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

/**
 * <p>
 * 
 * </p>
 *
 * @author bzg
 * @since 2022-01-14
 */
@Data
@NoArgsConstructor
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("tb_pluss_user_profit")
public class UserProfit implements Serializable {

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;


    /**
     * 用户ID
     */
    @TableField("userId")
    private Long userId;

    /**
     * 上级ID
     */
    @TableField("parentId")
    private Long parentId;


    /**
     * 用户角色
     */
    @TableField("roleCode")
    private String roleCode;


    /**
     * 总交易金额(即团队流水)
     */
    @TableField("teamTransFlow")
    private BigDecimal teamTransFlow;

    /**
     * 自己交易金额
     */
    @TableField("ownTransFlow")
    private BigDecimal ownTransFlow;

    /**
     * 直推交易流水
     */
    @TableField("directTransFlow")
    private BigDecimal directTransFlow;


    /**
     * 直推交易流水
     */
    @TableField("indirectTransFlow")
    private BigDecimal indirectTransFlow;

    /**
     * 总分润金额
     */
    @TableField("totalProfitAmt")
    private BigDecimal totalProfitAmt;


    /**
     * 直推分润
     */
    @TableField("directProfitAmt")
    private BigDecimal directProfitAmt;

    /**
     * 间推分润
     * @date: 2022/1/15 19:14
     */
    @TableField("indirectProfitAmt")
    private BigDecimal indirectProfitAmt;

    @TableField("otherProfitAmt")
    private BigDecimal otherProfitAmt;


    /**
     * t2收益
     */
    @TableField("t2ProfitAmt")
    private BigDecimal t2ProfitAmt;


    /**
     * t3收益
     */
    @TableField("t3ProfitAmt")
    private BigDecimal t3ProfitAmt;


    /**
     * 分红奖励
     */
    @TableField("dividProfitAmt")
    private BigDecimal dividProfitAmt;


    /**
     * 区域合伙人流水
     */
    @TableField("areaFlow")
    private BigDecimal areaFlow;

    /**
     * 区域合伙人奖励
     */
    @TableField("areaProfitAmt")
    private BigDecimal areaProfitAmt;


    /**
     * 创建时间
     */
    @TableField(value = "createTime", fill = FieldFill.INSERT)
    private Date createTime;

    /**
     * 创建时间 开始时间
     */
    @TableField(exist = false, condition = "createTime &gt; #{%s}")
    private Date createTimeStart;

    /**
     * 创建时间 截止时间
     */
    @TableField(exist = false, condition = "createTime &lt; #{%s}")
    private Date createTimeEnd;

    /**
     * 分润时间
     */
    @TableField("profitDate")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd",timezone="GMT+8")
    private Date profitDate;

    /**
     * 分润归属月份
     * @date: 2022/1/20 10:22
     */
    @TableField("profitMonth")
    private String profitMonth;

    /**
     * 备注
     */
    @TableField("remarks")
    private String remarks;

    /**
     * 等级Code
     */
    @TableField("levelCode")
    private String levelCode;

    /**
     * 交易笔数
     * @date: 2022/1/22 16:12
     */
    @TableField("transNum")
    private Integer transNum;

    /**
     * 自己的交易笔数(当自己有流水和团队有流水的时候会冲突)
     * @date: 2022/3/14 15:06
     */
    @TableField("ownTransNum")
    private Integer ownTransNum;

    @TableField(exist = false)
    private BigDecimal directRate;

    @TableField(exist = false)
    private BigDecimal indirectRate;

    @TableField(exist = false)
    private BigDecimal t2Scale;

    @TableField(exist = false)
    private BigDecimal t3Scale;

    @TableField(exist = false)
    private BigDecimal dividScale;

    @TableField(exist = false)
    private BigDecimal areaScale;


    /**
     * 用户名称
     */
    @TableField(exist = false)
    private String userName;

}