package cn.pluss.platform.entity;

import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

/**
 * <p>
 * 缴费通商户费率表(新)
 * </p>
 *
 * <p>
 *     缴费通费率设置为0级，即1-10级，费率值为0.38-0.56
 * </p>
 *
 * @author Djh
 * @since 2022-06-21
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("tb_pluss_jft_merchant_rate")
public class JftMerchantRate implements Serializable {

    public interface Common{}

    public static final int ZERO_LEVEL_VALUE = 58;

    public static final int MAX_RATE_VALUE = 56;

    public static final int MIN_RATE_VALUE = 38;

    private static final long serialVersionUID = 1L;

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


    @TableField("userId")
    private Long userId;

    /**
     * 通道id
     */
    @TableField("channel")
    private Integer channel;


    /**
     * 用户id
     */
    @TableField("merchantId")
    private String merchantId;


    /**
     * 支付宝费率等级，缴费通费率值与常规进件不同
     */
    @NotNull(message = "费率不能为空")
    @Min(message = "最低费率不能低于28(0.28%)", value = 28)
    @TableField("aliRate")
    private BigDecimal aliRate;


    /**
     * 创建时间
     */
    @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(value = "updateTime", fill = FieldFill.INSERT_UPDATE)
    private Date updateTime;

    /**
     * 更新时间 开始时间
     */
    @TableField(exist = false, condition = "updateTime &gt; #{%s}")
    private Date updateTimeStart;

    /**
     * 更新时间 截止时间
     */
    @TableField(exist = false, condition = "updateTime &lt; #{%s}")
    private Date updateTimeEnd;

    /**
     * 用户等级
     */
    @TableField(exist = false)
    private String levelCode;

    /**
     * 参考费率
     */
    @TableField(exist = false)
    private BigDecimal consultRate;
}