package com.gxwebsoft.shop.entity;

import cn.hutool.core.util.NumberUtil;
import com.baomidou.mybatisplus.annotation.*;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

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

/**
 * 商户管理
 *
 * @author 科技小王子
 * @since 2022-11-30 15:10:54
 */
@Data
@EqualsAndHashCode(callSuper = false)
@ApiModel(value = "Merchant对象", description = "商户管理")
@TableName("shop_merchant")
public class Merchant implements Serializable {
    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "商户ID")
    @TableId(value = "merchant_id", type = IdType.AUTO)
    private Integer merchantId;

    @ApiModelProperty(value = "区域经理ID")
    private Integer managerId;

    @ApiModelProperty(value = "商户名称")
    private String merchantName;

    @ApiModelProperty(value = "商户编码")
    private String merchantCode;

    @ApiModelProperty(value = "商户类型")
    private String merchantType;

    @ApiModelProperty(value = "当前可提现金额")
    private BigDecimal money;

    @ApiModelProperty(value = "已冻结金额")
    private BigDecimal freezeMoney;

    @ApiModelProperty(value = "累积提现金额")
    private BigDecimal totalMoney;

    @ApiModelProperty(value = "今日收益")
    private BigDecimal todayMoney;

    @ApiModelProperty(value = "本月收益")
    private BigDecimal monthMoney;

    @ApiModelProperty(value = "推荐收益比率")
    private BigDecimal firstRatio;

    @ApiModelProperty(value = "本月收益")
    private BigDecimal secondRatio;

    @ApiModelProperty(value = "门店收益")
    private BigDecimal shopRatio;

    @ApiModelProperty(value = "区县收益")
    private BigDecimal regionRatio;

    @ApiModelProperty(value = "市级收益")
    private BigDecimal cityRatio;

    @ApiModelProperty(value = "省级收益")
    private BigDecimal provinceRatio;

    @ApiModelProperty(value = "线上会员收益")
    private BigDecimal onlineRatio;

    @ApiModelProperty(value = "线下会员收益")
    private BigDecimal offlineRatio;

    @ApiModelProperty(value = "服务费")
    private BigDecimal serverRatio;

    @ApiModelProperty(value = "商户logo")
    private String logo;

    @ApiModelProperty(value = "商户背景图片")
    private String background;

    @ApiModelProperty(value = "营业时间")
    private String merchantHours;

    @ApiModelProperty(value = "所在省份")
    private String province;

    @ApiModelProperty(value = "所在城市")
    private String city;

    @ApiModelProperty(value = "所在辖区")
    private String region;

    @ApiModelProperty(value = "详细地址")
    private String address;

    @ApiModelProperty(value = "商户详情")
    private String content;

    @ApiModelProperty(value = "商户坐标经纬度")
    private String lngAndLat;

    @ApiModelProperty(value = "geohash")
    private String geohash;

    @ApiModelProperty(value = "商户简介")
    private String summary;

    @ApiModelProperty(value = "打款方式 (10微信 20支付宝 30银行卡)")
    private Integer payType;

    @ApiModelProperty(value = "支付宝姓名")
    private String alipayName;

    @ApiModelProperty(value = "支付宝账号")
    private String alipayAccount;

    @ApiModelProperty(value = "开户行名称")
    private String bankName;

    @ApiModelProperty(value = "银行开户名")
    private String bankAccount;

    @ApiModelProperty(value = "银行卡号")
    private String bankCard;

    @ApiModelProperty(value = "是否可编辑 0 商户可编辑 1 管理员可编辑")
    private Integer isEdit;

    @ApiModelProperty(value = "是否支持自提核销(0否 1支持)")
    private Integer isCheck;

    @ApiModelProperty(value = "店主")
    private Integer merchantOwner;

    @ApiModelProperty(value = "门店联系电话")
    private String merchantPhone;

    @ApiModelProperty(value = "用户ID")
    private Integer userId;

    @ApiModelProperty(value = "排序(数字越小越靠前)")
    private Integer sortNumber;

    @ApiModelProperty(value = "备注")
    private String comments;

    @ApiModelProperty(value = "状态, 0正常, 1冻结")
    private Integer status;

    @ApiModelProperty(value = "是否删除, 0否, 1是")
    @TableLogic
    private Integer deleted;

    @ApiModelProperty(value = "客户ID")
    private Integer customerId;

    @ApiModelProperty(value = "租户id")
    private Integer tenantId;

    @ApiModelProperty(value = "注册时间")
    private Date createTime;

    @ApiModelProperty(value = "修改时间")
    private Date updateTime;

    @ApiModelProperty("登录账号")
    @TableField(exist = false)
    private String username;

    @ApiModelProperty("用户昵称")
    @TableField(exist = false)
    private String nickname;

    @ApiModelProperty("用户等级")
    @TableField(exist = false)
    private Integer gradeId;

    @ApiModelProperty("用户等级")
    @TableField(exist = false)
    private String gradeName;

    @ApiModelProperty(value = "联系电话")
    @TableField(exist = false)
    private String phone;

    @ApiModelProperty(value = "距离")
    @TableField(exist = false)
    private Double distance;

    @ApiModelProperty(value = "店铺ID")
    @TableField(exist = false)
    private Long shopId;

    @ApiModelProperty(value = "哗啦啦店铺信息")
    @TableField(exist = false)
    private Object shopInfo;

    @ApiModelProperty(value = "提现金额")
    @TableField(exist = false)
    private BigDecimal amount;

    public Long getShopId(){
      if(NumberUtil.isLong(this.merchantCode)){
        return Long.parseLong(merchantCode);
      }
      return null;
    }

}
