package com.gxwebsoft.common.system.entity;

import java.math.BigDecimal;

import cn.hutool.core.util.DesensitizedUtil;
import com.baomidou.mybatisplus.annotation.*;
import java.io.Serializable;
import java.util.Date;
import java.util.List;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * 订单
 *
 * @author 科技小王子
 * @since 2024-04-24 13:46:21
 */
@Data
@EqualsAndHashCode(callSuper = false)
@ApiModel(value = "Order对象", description = "订单")
@TableName("sys_order")
public class Order implements Serializable {
  private static final long serialVersionUID = 1L;

  @ApiModelProperty(value = "订单号")
  @TableId(value = "order_id", type = IdType.AUTO)
  private Integer orderId;

  @ApiModelProperty(value = "订单编号")
  private String orderNo;

  @ApiModelProperty(value = "微信支付订单号")
  private String wechatOrder;

  @ApiModelProperty(value = "微信退款订单号")
  private String refundOrder;

  @ApiModelProperty(value = "场馆id用于权限判断")
  private Long merchantId;

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

  @ApiModelProperty(value = "使用的优惠券id")
  private Integer couponId;

  @ApiModelProperty(value = "使用的会员卡id")
  private Integer cardId;

  @ApiModelProperty(value = "关联管理员id")
  private Integer aid;

  @ApiModelProperty(value = "核销管理员id")
  private Integer adminId;

  @ApiModelProperty(value = "IC卡号")
  private String code;

  @ApiModelProperty(value = "真实姓名")
  private String name;

  @ApiModelProperty(value = "手机号码")
  private String phone;

  @ApiModelProperty(value = "订单总额")
  private BigDecimal totalPrice;

  @ApiModelProperty(value = "减少的金额，使用VIP会员折扣、优惠券抵扣、优惠券折扣后减去的价格")
  private BigDecimal reducePrice;

  @ApiModelProperty(value = "实际付款")
  private BigDecimal payPrice;

  @ApiModelProperty(value = "用于统计")
  private BigDecimal price;

  @ApiModelProperty(value = "价钱，用于积分赠送")
  private BigDecimal money;

  @ApiModelProperty(value = "退款金额")
  private BigDecimal refundMoney;

  @ApiModelProperty(value = "教练价格")
  private BigDecimal coachPrice;

  @ApiModelProperty(value = "教练id")
  private Integer coachId;

  @ApiModelProperty(value = "1微信支付，2积分，3支付宝，4现金，5POS机，6VIP月卡，7VIP年卡，8VIP次卡，9IC月卡，10IC年卡，11IC次卡，12免费，13VIP充值卡，14IC充值卡，15积分支付，16VIP季卡，17IC季卡")
  private Integer payType;

  @ApiModelProperty(value = "1已付款，2未付款")
  private Integer payStatus;

  @ApiModelProperty(value = "1已完成，2未使用，3已取消，4退款申请中，5退款被拒绝，6退款成功，7客户端申请退款")
  private Integer orderStatus;

  @ApiModelProperty(value = "优惠类型：0无、1抵扣优惠券、2折扣优惠券、3、VIP月卡、4VIP年卡，5VIP次卡、6VIP会员卡、7IC月卡、8IC年卡、9IC次卡、10IC会员卡、11免费订单、12VIP充值卡、13IC充值卡、14VIP季卡、15IC季卡")
  private Integer type;

  @ApiModelProperty(value = "二维码地址，保存订单号，支付成功后才生成")
  private String qrcode;

  @ApiModelProperty(value = "优惠说明")
  private String desc;

  @ApiModelProperty(value = "vip月卡年卡、ic月卡年卡回退次数")
  private Integer returnNum;

  @ApiModelProperty(value = "vip充值回退金额")
  private BigDecimal returnMoney;

  @ApiModelProperty(value = "预约详情开始时间数组")
  private Integer startTime;

  @ApiModelProperty(value = "是否已开具发票：1已开发票，2未开发票，3不能开具发票")
  private Integer isInvoice;

  @ApiModelProperty(value = "付款时间")
  private Date payTime;

  @ApiModelProperty(value = "退款时间")
  private Integer refundTime;

  @ApiModelProperty(value = "申请退款时间")
  private Integer refundApplyTime;

  @ApiModelProperty(value = "对账情况：1=已对账；2=未对账；3=已对账，金额对不上；4=未查询到该订单")
  private Integer checkBill;

  @ApiModelProperty(value = "系统版本")
  private Integer version;

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

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

  @ApiModelProperty(value = "创建时间")
  private Date createTime;

  @ApiModelProperty(value = "更新时间")
  private Date updateTime;

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

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

  @ApiModelProperty(value = "商户图标")
  @TableField(exist = false)
  private String merchantAvatar;

  @ApiModelProperty(value = "微信OPENID,用于微信支付")
  @TableField(exist = false)
  private String openid;

  @ApiModelProperty(value = "订单详情")
  @TableField(exist = false)
  private List<OrderInfo> orderInfoList;

  @ApiModelProperty(value = "套餐ID")
  private Integer planId;

  @ApiModelProperty(value = "卡ID")
  private Integer priceId;

  @ApiModelProperty(value = "获得的会员等级")
  private Integer gradeId;

  @ApiModelProperty(value = "卡名称")
  private String priceName;

  @ApiModelProperty(value = "持有者ID")
  private Integer memberId;

  @ApiModelProperty(value = "真实姓名")
  private String realName;



  @ApiModelProperty(value = "支付流水号")
  private String transactionId;

  @ApiModelProperty(value = "支付方式（余额/微信/支付宝）")
  private String payMethod;

  @ApiModelProperty(value = "到期时间")
  private Date expirationTime;

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

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

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

  @ApiModelProperty(value = "所在地区")
  private String area;

  @ApiModelProperty(value = "街道地址")
  private String address;

  @ApiModelProperty(value = "退款凭证")
  private String refundImage;

  @ApiModelProperty(value = "退款理由")
  private String refundContent;

  @ApiModelProperty(value = "订单是否已结算(0未结算 1已结算)")
  private Integer isSettled;

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

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

  @ApiModelProperty(value = "租户名称")
  @TableField(exist = false)
  private String tenantName;

  @ApiModelProperty(value = "企业ID")
  @TableField(exist = false)
  private Integer companyId;

  @ApiModelProperty("手机号(脱敏)")
  @TableField(exist = false)
  private String mobile;

  public String getMobile() {
    return DesensitizedUtil.mobilePhone(this.phone);
  }

}
