package com.fs.his.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fs.common.annotation.Excel;
import com.fs.common.core.domain.BaseEntity;
import com.vdurmont.emoji.EmojiParser;
import io.swagger.models.auth.In;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import javax.crypto.Cipher;
import javax.crypto.spec.SecretKeySpec;
import java.math.BigDecimal;
import java.util.Base64;
import java.util.Date;

/**
 * 用户对象 fs_user
 *
 * @author fs
 * @date 2023-06-07
 */
public class FsUser extends BaseEntity
{
    private static final long serialVersionUID = 1L;

    /** 用户id */
    private Long userId;

    /** 用户昵称 */
    @Excel(name = "用户昵称")
    private String nickName;

    /** 用户头像 */
    @Excel(name = "用户头像")
    private String avatar;

    /** 手机号码 */
    @Excel(name = "手机号码")
    private String phone;

    /** 用户积分 */
    @Excel(name = "用户积分")
    private Long integral;

    /** 1为正常，0为禁止 */
    @Excel(name = "1为正常，0为禁止")
    private Integer status;

    /** 推广上级用户ID */
    @Excel(name = "推广上级用户ID")
    private String tuiUserId;

    /** 推广员关联时间 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "推广员关联时间", width = 30, dateFormat = "yyyy-MM-dd")
    private Date tuiTime;

    /** 下级人数 */
    @Excel(name = "下级人数")
    private Long tuiUserCount;

    /** 微信小程序OPENID */
    @Excel(name = "微信小程序OPENID")
    private String maOpenId;

    /** 微信公众号OPENID */
    @Excel(name = "微信公众号OPENID")
    private String mpOpenId;

    /** 关联ID */
    @Excel(name = "关联ID")
    private String unionId;

    /** $column.columnComment */
    @Excel(name = "关联ID")
    private Integer isDel;

    /** 邀请码 */
    @Excel(name = "邀请码")
    private String userCode;

    /** 最后一次登录ip */
    @Excel(name = "最后一次登录ip")
    private String lastIp;

    /** 余额 */
    @Excel(name = "余额")
    private BigDecimal balance;

    /** 连续签到天数 */
    @Excel(name = "连续签到天数")
    private Long signNum;

    private Integer integralStatus;

    private String password;
    private Integer isBuy;

    private String jpushId;
    private Integer isVip;
    private Date  vipStartDate;
    private Date  vipEndDate;
    private Integer vipLevel;
    private Integer vipStatus;

    private Integer sex;
    private String storeOpenId;

    //是否关注公众号
    private Integer isOfficialAccountAuth;
    private Integer isPush; //是否消息通知

    private Integer isIndividuationPush;//是否个性化推送

    private Integer isWeixinAuth;

    private String loginDevice;//当前登录设备

    private String source;//app来源

    private Integer isAddQw;//是否添加企微客服

    private Long parentId; //邀请人id

    private String courseMaOpenId; //看课小程序openid

    private Long qwExtId;

    public Long getQwExtId() {
        return qwExtId;
    }

    public void setQwExtId(Long qwExtId) {
        this.qwExtId = qwExtId;
    }

    public String getCourseMaOpenId() {
        return courseMaOpenId;
    }

    public void setCourseMaOpenId(String courserMaOpenId) {
        this.courseMaOpenId = courserMaOpenId;
    }

    public Integer getIsAddQw() {
        return isAddQw;
    }

    public void setIsAddQw(Integer isAddQw) {
        this.isAddQw = isAddQw;
    }

    public String getSource() {
        return source;
    }

    public void setSource(String source) {
        this.source = source;
    }

    public String getLoginDevice() {
        return loginDevice;
    }

    public void setLoginDevice(String loginDevice) {
        this.loginDevice = loginDevice;
    }

    public Integer getIsWeixinAuth() {
        return isWeixinAuth;
    }

    public void setIsWeixinAuth(Integer isWeixinAuth) {
        this.isWeixinAuth = isWeixinAuth;
    }

    public Integer getIsIndividuationPush() {
        return isIndividuationPush;
    }

    public void setIsIndividuationPush(Integer isIndividuationPush) {
        this.isIndividuationPush = isIndividuationPush;
    }

    public Integer getIsPush() {
        return isPush;
    }

    public void setIsPush(Integer isPush) {
        this.isPush = isPush;
    }

    public Integer getIsOfficialAccountAuth() {
        return isOfficialAccountAuth;
    }

    public void setIsOfficialAccountAuth(Integer isOfficialAccountAuth) {
        this.isOfficialAccountAuth = isOfficialAccountAuth;
    }


    public String getStoreOpenId() {
        return storeOpenId;
    }

    public void setStoreOpenId(String storeOpenId) {
        this.storeOpenId = storeOpenId;
    }

    public Integer getSex() {
        return sex;
    }

    public void setSex(Integer sex) {
        this.sex = sex;
    }

    public Integer getIsVip() {
        return isVip;
    }

    public void setIsVip(Integer isVip) {
        this.isVip = isVip;
    }

    public Date getVipStartDate() {
        return vipStartDate;
    }

    public void setVipStartDate(Date vipStartDate) {
        this.vipStartDate = vipStartDate;
    }

    public Date getVipEndDate() {
        return vipEndDate;
    }

    public void setVipEndDate(Date vipEndDate) {
        this.vipEndDate = vipEndDate;
    }

    public Integer getVipLevel() {
        return vipLevel;
    }

    public void setVipLevel(Integer vipLevel) {
        this.vipLevel = vipLevel;
    }

    public Integer getVipStatus() {
        return vipStatus;
    }

    public void setVipStatus(Integer vipStatus) {
        this.vipStatus = vipStatus;
    }

    public String getJpushId() {
        return jpushId;
    }

    public void setJpushId(String jpushId) {
        this.jpushId = jpushId;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public Integer getIsBuy() {
        return isBuy;
    }

    public void setIsBuy(Integer isBuy) {
        this.isBuy = isBuy;
    }

    public Integer getIntegralStatus() {
        return integralStatus;
    }

    public void setIntegralStatus(Integer integralStatus) {
        this.integralStatus = integralStatus;
    }

    public Long getSignNum() {
        return signNum;
    }

    public void setSignNum(Long signNum) {
        this.signNum = signNum;
    }

    public void setUserId(Long userId)
    {
        this.userId = userId;
    }

    public Long getUserId()
    {
        return userId;
    }
    public void setNickName(String nickname)
    {
        if(StringUtils.isNotEmpty(nickname)){
            this.nickName= EmojiParser.parseToHtmlDecimal(nickname);
        }
        else{
            this.nickName= nickname;
        }
    }

    public String getNickName()
    {
        if(StringUtils.isNotEmpty(nickName)){
            return EmojiParser.parseToUnicode(nickName);
        }
        else{
            return nickName;
        }
    }
    public void setAvatar(String avatar)
    {
        this.avatar = avatar;
    }

    public String getAvatar()
    {
        return avatar;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public void setIntegral(Long integral)
    {
        this.integral = integral;
    }

    public Long getIntegral()
    {
        return integral;
    }
    public void setStatus(Integer status)
    {
        this.status = status;
    }

    public Integer getStatus()
    {
        return status;
    }
    public void setTuiUserId(String tuiUserId)
    {
        this.tuiUserId = tuiUserId;
    }

    public String getTuiUserId()
    {
        return tuiUserId;
    }
    public void setTuiTime(Date tuiTime)
    {
        this.tuiTime = tuiTime;
    }

    public Date getTuiTime()
    {
        return tuiTime;
    }
    public void setTuiUserCount(Long tuiUserCount)
    {
        this.tuiUserCount = tuiUserCount;
    }

    public Long getTuiUserCount()
    {
        return tuiUserCount;
    }
    public void setMaOpenId(String maOpenId)
    {
        this.maOpenId = maOpenId;
    }

    public String getMaOpenId()
    {
        return maOpenId;
    }
    public void setMpOpenId(String mpOpenId)
    {
        this.mpOpenId = mpOpenId;
    }

    public String getMpOpenId()
    {
        return mpOpenId;
    }
    public void setUnionId(String unionId)
    {
        this.unionId = unionId;
    }

    public String getUnionId()
    {
        return unionId;
    }
    public void setIsDel(Integer isDel)
    {
        this.isDel = isDel;
    }

    public Integer getIsDel()
    {
        return isDel;
    }
    public void setUserCode(String userCode)
    {
        this.userCode = userCode;
    }

    public String getUserCode()
    {
        return userCode;
    }
    public void setLastIp(String lastIp)
    {
        this.lastIp = lastIp;
    }

    public String getLastIp()
    {
        return lastIp;
    }
    public void setBalance(BigDecimal balance)
    {
        this.balance = balance;
    }

    public BigDecimal getBalance()
    {
        return balance;
    }

    public Long getParentId() {
        return parentId;
    }

    public void setParentId(Long parentId) {
        this.parentId = parentId;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
            .append("userId", getUserId())
            .append("nickName", getNickName())
            .append("avatar", getAvatar())
            .append("phone", getPhone())
            .append("integral", getIntegral())
            .append("status", getStatus())
            .append("tuiUserId", getTuiUserId())
            .append("tuiTime", getTuiTime())
            .append("tuiUserCount", getTuiUserCount())
            .append("maOpenId", getMaOpenId())
            .append("mpOpenId", getMpOpenId())
            .append("unionId", getUnionId())
            .append("isDel", getIsDel())
            .append("userCode", getUserCode())
            .append("remark", getRemark())
            .append("createTime", getCreateTime())
            .append("updateTime", getUpdateTime())
            .append("lastIp", getLastIp())
            .append("balance", getBalance())
            .append("parentId", getParentId())
            .toString();
    }
}
