package com.ssm.manage.entity;

import com.alibaba.excel.annotation.ExcelProperty;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.ssm.manage.extendEntity.AchiCommEntity;
import lombok.Getter;
import lombok.Setter;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import javax.persistence.*;

@Table(name = "recharge_account")
@JsonIgnoreProperties(ignoreUnknown = true)
public class RechargeAccount implements Serializable {
    /**
     * 主键ID
     */
    @Id
    private Long id;
    @Getter
    @Setter
    private List<AchiCommEntity> entities;

    /**
     * 会员ID
     */
    @Column(name = "member_id")
    @ExcelProperty("会员ID*")
    private Long memberId;

    /**
     * 会员名称
     */
    @Column(name = "member_name")
    @ExcelProperty("会员名称*")
    private String memberName;

    /**
     * 会员卡
     */
    private String card;

    /**
     * 充值单号
     */
    @Column(name = "recharge_num")
    @ExcelProperty("充值单号")
    private String rechargeNum;

    /**
     * 账户充值金额
     */
    @Column(name = "card_recharge_money")
    @ExcelProperty("账户充值金额*")
    private BigDecimal cardRechargeMoney;

    /**
     * 账户剩余金额
     */
    @Column(name = "card_rest_money")
    @ExcelProperty("账户剩余金额*")
    private BigDecimal cardRestMoney;

    /**
     * 最近消费日期
     */
    @Column(name = "last_consume_time")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @ExcelProperty("最近消费日期")
    private Date lastConsumeTime;

    /**
     * 充值类别ID
     */
    @Column(name = "recharge_type_id")
    @ExcelProperty("充值类别ID*")
    private Long rechargeTypeId;

    /**
     * 充值类别名称
     */
    @Column(name = "recharge_type_name")
    @ExcelProperty("充值类别名称*")
    private String rechargeTypeName;

    /**
     * 类别 1:折扣卡类型/0:赠送卡类型
     */
    @ExcelProperty("类别*")
    private Integer type;

    /**
     * 享受优惠
     */
    @ExcelProperty("享受折扣(%)")
    private BigDecimal discount;

    /**
     * 赠送卡赠送金额
     */
    @Column(name = "card_gift_money")
    @ExcelProperty("赠送金额")
    private BigDecimal cardGiftMoney;

    /**
     * 门店ID
     */
    @Column(name = "store_id")
    private Long storeId;

    /**
     * 门店名称
     */
    @Column(name = "store_name")
    private String storeName;

    /**
     * 账户可用金额
     */
    @Column(name = "card_consume_money")
    @ExcelProperty("账户可用金额*")
    private BigDecimal cardConsumeMoney;

    /**
     * 赠送卡可用金额
     */
    @Column(name = "gift_consume_money")
    @ExcelProperty("赠送可用金额")
    private BigDecimal giftConsumeMoney;

    /**
     * 0:锁定/1:正常
     */
    @ExcelProperty("状态*")
    private Integer state;

    /**
     * 账户到期时间
     */
    @Column(name = "end_time")
    @DateTimeFormat(pattern="yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    @ExcelProperty("账户到期时间")
    private Date endTime;

    /**
     * 修改人名称
     */
    @Column(name = "update_by")
    private String updateBy;

    /**
     * 修改人ID
     */
    @Column(name = "update_id")
    private Long updateId;

    /**
     * 修改时间
     */
    @Column(name = "update_time")
    private Date updateTime;

    private static final long serialVersionUID = 1L;

    /**
     * 赠送金额使用折扣
     */
    @Column(name = "discount_free_amount")
    private BigDecimal discountFreeAmount;


    /**
     * 充值金额占比
     */
    @Column(name = "recharge_bl")
    private BigDecimal rechargeBl;

    /**
     * 赠送金额占比
     */
    @Column(name = "free_of")
    private BigDecimal freeOf;


    /**
     * 赠送金额占比
     */
    @Column(name = "card_gift_discount")
    private BigDecimal cardGiftDiscount;

    /**
     * 赠送金额占比
     */
    @Column(name = "first_charge")
    private Long firstCharge;

    /**
     * 赠送金额占比
     */
    @Column(name = "recharge_type_num")
    private String rechargeTypeNum;



    /**
     * 升降级卡对应ID
     */
    @Column(name = "card_num")
    private Integer cardNum;



    @Column(name = "unified_due")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date unifiedDue;



    /**
     * 修改说明
     */
    @Column(name = "explain_modify")
    private String explainModify;

    public String getExplainModify() {
        return explainModify;
    }

    public void setExplainModify(String explainModify) {
        this.explainModify = explainModify;
    }

    public Date getUnifiedDue() {
        return unifiedDue;
    }

    public void setUnifiedDue(Date unifiedDue) {
        this.unifiedDue = unifiedDue;
    }

    public Integer getCardNum() {
        return cardNum;
    }

    public void setCardNum(Integer cardNum) {
        this.cardNum = cardNum;
    }

    public String getRechargeTypeNum() {
        return rechargeTypeNum;
    }

    public void setRechargeTypeNum(String rechargeTypeNum) {
        this.rechargeTypeNum = rechargeTypeNum;
    }

    public BigDecimal getCardGiftDiscount() {
        return cardGiftDiscount;
    }

    public void setCardGiftDiscount(BigDecimal cardGiftDiscount) {
        this.cardGiftDiscount = cardGiftDiscount;
    }

    /**
     * 获取主键ID
     *
     * @return id - 主键ID
     */
    public Long getId() {
        return id;
    }

    /**
     * 设置主键ID
     *
     * @param id 主键ID
     */
    public void setId(Long id) {
        this.id = id;
    }

    /**
     * 获取会员ID
     *
     * @return member_id - 会员ID
     */
    public Long getMemberId() {
        return memberId;
    }

    /**
     * 设置会员ID
     *
     * @param memberId 会员ID
     */
    public void setMemberId(Long memberId) {
        this.memberId = memberId;
    }

    /**
     * 获取会员名称
     *
     * @return member_name - 会员名称
     */
    public String getMemberName() {
        return memberName;
    }

    /**
     * 设置会员名称
     *
     * @param memberName 会员名称
     */
    public void setMemberName(String memberName) {
        this.memberName = memberName;
    }

    /**
     * 获取会员卡
     *
     * @return card - 会员卡
     */
    public String getCard() {
        return card;
    }

    /**
     * 设置会员卡
     *
     * @param card 会员卡
     */
    public void setCard(String card) {
        this.card = card;
    }

    /**
     * 获取充值单号
     *
     * @return recharge_num - 充值单号
     */
    public String getRechargeNum() {
        return rechargeNum;
    }

    /**
     * 设置充值单号
     *
     * @param rechargeNum 充值单号
     */
    public void setRechargeNum(String rechargeNum) {
        this.rechargeNum = rechargeNum;
    }

    /**
     * 获取账户充值金额
     *
     * @return card_recharge_money - 账户充值金额
     */
    public BigDecimal getCardRechargeMoney() {
        return cardRechargeMoney;
    }

    /**
     * 设置账户充值金额
     *
     * @param cardRechargeMoney 账户充值金额
     */
    public void setCardRechargeMoney(BigDecimal cardRechargeMoney) {
        this.cardRechargeMoney = cardRechargeMoney;
    }

    /**
     * 获取账户剩余金额
     *
     * @return card_rest_money - 账户剩余金额
     */
    public BigDecimal getCardRestMoney() {
        return cardRestMoney;
    }

    /**
     * 设置账户剩余金额
     *
     * @param cardRestMoney 账户剩余金额
     */
    public void setCardRestMoney(BigDecimal cardRestMoney) {
        this.cardRestMoney = cardRestMoney;
    }

    /**
     * 获取最近消费日期
     *
     * @return last_consume_time - 最近消费日期
     */
    public Date getLastConsumeTime() {
        return lastConsumeTime;
    }

    /**
     * 设置最近消费日期
     *
     * @param lastConsumeTime 最近消费日期
     */
    public void setLastConsumeTime(Date lastConsumeTime) {
        this.lastConsumeTime = lastConsumeTime;
    }

    /**
     * 获取充值类别ID
     *
     * @return recharge_type_id - 充值类别ID
     */
    public Long getRechargeTypeId() {
        return rechargeTypeId;
    }

    /**
     * 设置充值类别ID
     *
     * @param rechargeTypeId 充值类别ID
     */
    public void setRechargeTypeId(Long rechargeTypeId) {
        this.rechargeTypeId = rechargeTypeId;
    }

    /**
     * 获取充值类别名称
     *
     * @return recharge_type_name - 充值类别名称
     */
    public String getRechargeTypeName() {
        return rechargeTypeName;
    }

    /**
     * 设置充值类别名称
     *
     * @param rechargeTypeName 充值类别名称
     */
    public void setRechargeTypeName(String rechargeTypeName) {
        this.rechargeTypeName = rechargeTypeName;
    }

    /**
     * 获取类别 1:折扣卡类型/0:赠送卡类型
     *
     * @return type - 类别 1:折扣卡类型/0:赠送卡类型/2:活动卡类型
     */
    public Integer getType() {
        return type;
    }

    /**
     * 设置类别 1:折扣卡类型/0:赠送卡类型
     *
     * @param type 类别 1:折扣卡类型/0:赠送卡类型
     */
    public void setType(Integer type) {
        this.type = type;
    }

    /**
     * 获取享受优惠
     *
     * @return discount - 享受优惠
     */
    public BigDecimal getDiscount() {
        return discount;
    }

    /**
     * 设置享受优惠
     *
     * @param discount 享受优惠
     */
    public void setDiscount(BigDecimal discount) {
        this.discount = discount;
    }

    /**
     * 获取赠送卡赠送金额
     *
     * @return card_gift_money - 赠送卡赠送金额
     */
    public BigDecimal getCardGiftMoney() {
        return cardGiftMoney;
    }

    /**
     * 设置赠送卡赠送金额
     *
     * @param cardGiftMoney 赠送卡赠送金额
     */
    public void setCardGiftMoney(BigDecimal cardGiftMoney) {
        this.cardGiftMoney = cardGiftMoney;
    }

    /**
     * 获取门店ID
     *
     * @return store_id - 门店ID
     */
    public Long getStoreId() {
        return storeId;
    }

    /**
     * 设置门店ID
     *
     * @param storeId 门店ID
     */
    public void setStoreId(Long storeId) {
        this.storeId = storeId;
    }

    /**
     * 获取门店名称
     *
     * @return store_name - 门店名称
     */
    public String getStoreName() {
        return storeName;
    }

    /**
     * 设置门店名称
     *
     * @param storeName 门店名称
     */
    public void setStoreName(String storeName) {
        this.storeName = storeName;
    }

    /**
     * 获取账户可用金额
     *
     * @return card_consume_money - 账户可用金额
     */
    public BigDecimal getCardConsumeMoney() {
        return cardConsumeMoney;
    }

    /**
     * 设置账户可用金额
     *
     * @param cardConsumeMoney 账户可用金额
     */
    public void setCardConsumeMoney(BigDecimal cardConsumeMoney) {
        this.cardConsumeMoney = cardConsumeMoney;
    }

    /**
     * 获取赠送卡可用金额
     *
     * @return gift_consume_money - 赠送卡可用金额
     */
    public BigDecimal getGiftConsumeMoney() {
        return giftConsumeMoney;
    }

    /**
     * 设置赠送卡可用金额
     *
     * @param giftConsumeMoney 赠送卡可用金额
     */
    public void setGiftConsumeMoney(BigDecimal giftConsumeMoney) {
        this.giftConsumeMoney = giftConsumeMoney;
    }

    /**
     * 获取0:锁定/1:正常
     *
     * @return state - 0:锁定/1:正常
     */
    public Integer getState() {
        return state;
    }

    /**
     * 设置0:锁定/1:正常
     *
     * @param state 0:锁定/1:正常
     */
    public void setState(Integer state) {
        this.state = state;
    }

    /**
     * 获取账户到期时间
     *
     * @return end_time - 账户到期时间
     */
    public Date getEndTime() {
        return endTime;
    }

    /**
     * 设置账户到期时间
     *
     * @param endTime 账户到期时间
     */
    public void setEndTime(Date endTime) {
        this.endTime = endTime;
    }

    /**
     * 获取修改人名称
     *
     * @return update_by - 修改人名称
     */
    public String getUpdateBy() {
        return updateBy;
    }

    /**
     * 设置修改人名称
     *
     * @param updateBy 修改人名称
     */
    public void setUpdateBy(String updateBy) {
        this.updateBy = updateBy;
    }

    /**
     * 获取修改人ID
     *
     * @return update_id - 修改人ID
     */
    public Long getUpdateId() {
        return updateId;
    }

    /**
     * 设置修改人ID
     *
     * @param updateId 修改人ID
     */
    public void setUpdateId(Long updateId) {
        this.updateId = updateId;
    }

    /**
     * 获取修改时间
     *
     * @return update_time - 修改时间
     */
    public Date getUpdateTime() {
        return updateTime;
    }

    /**
     * 设置修改时间
     *
     * @param updateTime 修改时间
     */
    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }


    public BigDecimal getDiscountFreeAmount() {
        return discountFreeAmount;
    }

    public void setDiscountFreeAmount(BigDecimal discountFreeAmount) {
        this.discountFreeAmount = discountFreeAmount;
    }

    public BigDecimal getRechargeBl() {
        return rechargeBl;
    }

    public void setRechargeBl(BigDecimal rechargeBl) {
        this.rechargeBl = rechargeBl;
    }

    public BigDecimal getFreeOf() {
        return freeOf;
    }

    public void setFreeOf(BigDecimal freeOf) {
        this.freeOf = freeOf;
    }

    public Long getFirstCharge() {
        return firstCharge;
    }

    public void setFirstCharge(Long firstCharge) {
        this.firstCharge = firstCharge;
    }

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        RechargeAccount other = (RechargeAccount) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getMemberId() == null ? other.getMemberId() == null : this.getMemberId().equals(other.getMemberId()))
            && (this.getMemberName() == null ? other.getMemberName() == null : this.getMemberName().equals(other.getMemberName()))
            && (this.getCard() == null ? other.getCard() == null : this.getCard().equals(other.getCard()))
            && (this.getRechargeNum() == null ? other.getRechargeNum() == null : this.getRechargeNum().equals(other.getRechargeNum()))
            && (this.getCardRechargeMoney() == null ? other.getCardRechargeMoney() == null : this.getCardRechargeMoney().equals(other.getCardRechargeMoney()))
            && (this.getCardRestMoney() == null ? other.getCardRestMoney() == null : this.getCardRestMoney().equals(other.getCardRestMoney()))
            && (this.getLastConsumeTime() == null ? other.getLastConsumeTime() == null : this.getLastConsumeTime().equals(other.getLastConsumeTime()))
            && (this.getRechargeTypeId() == null ? other.getRechargeTypeId() == null : this.getRechargeTypeId().equals(other.getRechargeTypeId()))
            && (this.getRechargeTypeName() == null ? other.getRechargeTypeName() == null : this.getRechargeTypeName().equals(other.getRechargeTypeName()))
            && (this.getType() == null ? other.getType() == null : this.getType().equals(other.getType()))
            && (this.getDiscount() == null ? other.getDiscount() == null : this.getDiscount().equals(other.getDiscount()))
            && (this.getCardGiftMoney() == null ? other.getCardGiftMoney() == null : this.getCardGiftMoney().equals(other.getCardGiftMoney()))
            && (this.getStoreId() == null ? other.getStoreId() == null : this.getStoreId().equals(other.getStoreId()))
            && (this.getStoreName() == null ? other.getStoreName() == null : this.getStoreName().equals(other.getStoreName()))
            && (this.getCardConsumeMoney() == null ? other.getCardConsumeMoney() == null : this.getCardConsumeMoney().equals(other.getCardConsumeMoney()))
            && (this.getGiftConsumeMoney() == null ? other.getGiftConsumeMoney() == null : this.getGiftConsumeMoney().equals(other.getGiftConsumeMoney()))
            && (this.getState() == null ? other.getState() == null : this.getState().equals(other.getState()))
            && (this.getEndTime() == null ? other.getEndTime() == null : this.getEndTime().equals(other.getEndTime()))
            && (this.getUpdateBy() == null ? other.getUpdateBy() == null : this.getUpdateBy().equals(other.getUpdateBy()))
            && (this.getUpdateId() == null ? other.getUpdateId() == null : this.getUpdateId().equals(other.getUpdateId()))
            && (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()))
            && (this.getRechargeBl() == null ? other.getRechargeBl() == null : this.getRechargeBl().equals(other.getRechargeBl()))
            && (this.getFreeOf() == null ? other.getFreeOf() == null : this.getFreeOf().equals(other.getFreeOf()))
            && (this.getDiscountFreeAmount() == null ? other.getDiscountFreeAmount() == null : this.getDiscountFreeAmount().equals(other.getDiscountFreeAmount()))
            && (this.getExplainModify() == null ? other.getExplainModify() == null : this.getExplainModify().equals(other.getExplainModify()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getMemberId() == null) ? 0 : getMemberId().hashCode());
        result = prime * result + ((getMemberName() == null) ? 0 : getMemberName().hashCode());
        result = prime * result + ((getCard() == null) ? 0 : getCard().hashCode());
        result = prime * result + ((getRechargeNum() == null) ? 0 : getRechargeNum().hashCode());
        result = prime * result + ((getCardRechargeMoney() == null) ? 0 : getCardRechargeMoney().hashCode());
        result = prime * result + ((getCardRestMoney() == null) ? 0 : getCardRestMoney().hashCode());
        result = prime * result + ((getLastConsumeTime() == null) ? 0 : getLastConsumeTime().hashCode());
        result = prime * result + ((getRechargeTypeId() == null) ? 0 : getRechargeTypeId().hashCode());
        result = prime * result + ((getRechargeTypeName() == null) ? 0 : getRechargeTypeName().hashCode());
        result = prime * result + ((getType() == null) ? 0 : getType().hashCode());
        result = prime * result + ((getDiscount() == null) ? 0 : getDiscount().hashCode());
        result = prime * result + ((getCardGiftMoney() == null) ? 0 : getCardGiftMoney().hashCode());
        result = prime * result + ((getStoreId() == null) ? 0 : getStoreId().hashCode());
        result = prime * result + ((getStoreName() == null) ? 0 : getStoreName().hashCode());
        result = prime * result + ((getCardConsumeMoney() == null) ? 0 : getCardConsumeMoney().hashCode());
        result = prime * result + ((getGiftConsumeMoney() == null) ? 0 : getGiftConsumeMoney().hashCode());
        result = prime * result + ((getState() == null) ? 0 : getState().hashCode());
        result = prime * result + ((getEndTime() == null) ? 0 : getEndTime().hashCode());
        result = prime * result + ((getUpdateBy() == null) ? 0 : getUpdateBy().hashCode());
        result = prime * result + ((getUpdateId() == null) ? 0 : getUpdateId().hashCode());
        result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
        result = prime * result + ((getDiscountFreeAmount() == null) ? 0 : getDiscountFreeAmount().hashCode());
        result = prime * result + ((getRechargeBl() == null) ? 0 : getRechargeBl().hashCode());
        result = prime * result + ((getFreeOf() == null) ? 0 : getFreeOf().hashCode());
        result = prime * result + ((getExplainModify() == null) ? 0 : getExplainModify().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", memberId=").append(memberId);
        sb.append(", memberName=").append(memberName);
        sb.append(", card=").append(card);
        sb.append(", rechargeNum=").append(rechargeNum);
        sb.append(", cardRechargeMoney=").append(cardRechargeMoney);
        sb.append(", cardRestMoney=").append(cardRestMoney);
        sb.append(", lastConsumeTime=").append(lastConsumeTime);
        sb.append(", rechargeTypeId=").append(rechargeTypeId);
        sb.append(", rechargeTypeName=").append(rechargeTypeName);
        sb.append(", type=").append(type);
        sb.append(", discount=").append(discount);
        sb.append(", cardGiftMoney=").append(cardGiftMoney);
        sb.append(", storeId=").append(storeId);
        sb.append(", storeName=").append(storeName);
        sb.append(", cardConsumeMoney=").append(cardConsumeMoney);
        sb.append(", giftConsumeMoney=").append(giftConsumeMoney);
        sb.append(", state=").append(state);
        sb.append(", endTime=").append(endTime);
        sb.append(", updateBy=").append(updateBy);
        sb.append(", updateId=").append(updateId);
        sb.append(", updateTime=").append(updateTime);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append(", discountFreeAmount=").append(discountFreeAmount);
        sb.append(", rechargeBl=").append(rechargeBl);
        sb.append(", freeOf=").append(freeOf);
        sb.append(", explainModify=").append(explainModify);
        sb.append("]");
        return sb.toString();
    }

    @Getter
    @Setter
    @Transient
    private List<RechargeAccountGive> rechargeAccountGiveList;
}