package com.iformall.domain.vo;

import cn.afterturn.easypoi.excel.annotation.Excel;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.iformall.domain.po.WxCouponOrder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;

import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.DecimalFormat;
import java.util.Date;
import java.util.List;
@JsonIgnoreProperties(value = {"handler"})
@Data
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
public class WxCouponOrderBVo extends WxCouponOrder{

	private static final long serialVersionUID = 6687954932922444531L;

	@Excel(name = "券码", width = 20, orderNum = "1")
	protected Long id;

	/** 基础购买到的券信息 */
	@io.swagger.annotations.ApiModelProperty(value = "", name = "tenantId")
	private String tenantId;

	@io.swagger.annotations.ApiModelProperty(value = "用户订单ID", name = "orderId")
	private Long orderId;

	@io.swagger.annotations.ApiModelProperty(value = "该订单对应券的实际过期时间 ", name = "expiredTime")
	private Date expiredTime;

	@Excel(name = "券名称", width = 50, orderNum = "2")
	@io.swagger.annotations.ApiModelProperty(value="券名称",name="title")
	private String title;

    public String getcUserPhone() {
        return cUserPhone;
    }

    public void setcUserPhone(String cUserPhone) {
        this.cUserPhone = cUserPhone;
    }

    public String getcuserPhone() {
        return cUserPhone;
    }

    public void setcuserPhone(String cUserPhone) {
        this.cUserPhone = cUserPhone;
    }

	@Excel(name = "会员手机号", width = 20, orderNum = "13")
	@io.swagger.annotations.ApiModelProperty(value="c用户绑定的手机号",name="cUserPhone")
	private String cUserPhone;

	@Excel(name = "交易时间", width = 20, exportFormat = "yyyy-MM-dd HH:mm:ss", orderNum = "9")
	@io.swagger.annotations.ApiModelProperty(value = "创建时间", name = "createDate")
	private Date createDate;

	@TableField(exist = false)
	@Excel(name = "面额(元)", width = 20, orderNum = "7")
	private String priceStr;

	@TableField(exist = false)
	@Excel(name = "交易价格(元)", width = 20, orderNum = "6")
	private String salePriceStr;

	@Excel(name = "状态", width = 20, replace = {"待使用_0", "已核销_1", "已过期_2", "已退款_3"}, orderNum = "14")
	@io.swagger.annotations.ApiModelProperty(value = "状态：0，待使用 1，已核销 2，已过期 3，已作废 ", name = "couponOrderStatus")
	private Integer couponOrderStatus;

	@Excel(name = "核销/过期/退款时间", width = 20, exportFormat = "yyyy-MM-dd HH:mm:ss", orderNum = "10")
	@io.swagger.annotations.ApiModelProperty(value = "", name = "updateDate")
	private Date updateDate;

	@io.swagger.annotations.ApiModelProperty(value = "单券实际购买价格", name = "couponPrice")
	private Integer couponPrice;

	@io.swagger.annotations.ApiModelProperty(value="券类型(1.满减券,2.代金券,3.团购券,4.礼品券,5.停车券)",name="type")
	private Integer type;

	@io.swagger.annotations.ApiModelProperty(value="售价（适用于类型2，3，4，5）",name="salePrice")
	private Integer salePrice;
	@io.swagger.annotations.ApiModelProperty(value="使用条件金额（适用于类型1,2,3,4）",name="usePrice")
	private Integer usePrice;
	@io.swagger.annotations.ApiModelProperty(value="面额",name="price")
	private Integer price;

	@Excel(name = "所属业态", width = 50, orderNum = "11", replace = {"餐饮_1", "娱乐_2", "服饰_3", "亲子_4", "超市_5", "其它_6", "美妆_7", "珠宝_8", "服务_9", "家居_10"})
	@io.swagger.annotations.ApiModelProperty(value = "业态", name = "business")
	private Integer business;

	@io.swagger.annotations.ApiModelProperty(value = "补贴额", name = "subsidyNum")
	private Integer subsidyNum;

	public String getSubsidyNumStr() {
		return new BigDecimal(subsidyNum == null ? 0 : subsidyNum).divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN).toPlainString();
	}

	@Excel(name = "补贴额(元)", width = 50, orderNum = "8")
	@io.swagger.annotations.ApiModelProperty(value = "补贴额", name = "subsidyNumStr")
	private String subsidyNumStr;

	@io.swagger.annotations.ApiModelProperty(value = "补贴类型", name = "subsidyType")
	private Integer subsidyType;

    public String getbUserName() {
        return bUserName;
    }

    public void setbUserName(String bUserName) {
        this.bUserName = bUserName;
    }

    public String getbuserName() {
        return bUserName;
    }

    public void setbuserName(String bUserName) {
        this.bUserName = bUserName;
    }

	@io.swagger.annotations.ApiModelProperty(value="b端用户姓名",name="bUserName")
	private String bUserName;
	@io.swagger.annotations.ApiModelProperty(value="b端用户手机号",name="bUserPhone")
	private String bUserPhone;
	@Excel(name = "发券商户", width = 50, orderNum = "3")
	@io.swagger.annotations.ApiModelProperty(value="使用券商户名",name="merchantName")
	private String merchantName;

	@Excel(name = "商铺号", width = 50, orderNum = "5")
	@TableField(exist = false)
	private String shopNumber;

	/**发券商户信息*/
	@io.swagger.annotations.ApiModelProperty(value="商户列表",name="merchantVoList")
	private List<WxMerchantVo> merchantVoList;

	/**发券渠道信息*/
	@io.swagger.annotations.ApiModelProperty(value="商户列表",name="channelType")
	private Integer channelType;

    @TableField(exist = false)
    private Date startDate;

    @TableField(exist = false)
    private Date endDate;

	@TableField(exist = false)
	private Long merchantId;

	@TableField(exist = false)
	private Date verifyStartDate;

	@TableField(exist = false)
	private Date verifyEndDate;

	@TableField(exist = false)
	private Long couponId;

    @Excel(name = "券类型", width = 50, orderNum = "15", replace = {"满减券_1", "代金券_2", "团购券_3", "礼品券_4", "停车券_5", "通用券_6", "砍价券_8", "团购券_9", "积分券_50", "积分停车券_51", "消费卡_100"})
	@TableField(exist = false)
	private Integer couponType;

	@Excel(name = "核销商户", width = 50, orderNum = "4")
	@TableField(exist = false)
	private String verifyMerchantName;

	@TableField(exist = false)
	private Integer floor;
	@TableField(exist = false)
	private Integer building;

	@Excel(name = "楼层楼座", width = 50, orderNum = "12")
	@TableField(exist = false)
	private String buildingStr;

	@Override
	public Long getCouponId() {
		return couponId;
	}

	@Override
	public void setCouponId(Long couponId) {
		this.couponId = couponId;
	}

	@Override
	public Integer getCouponType() {
		return couponType;
	}

	@Override
	public void setCouponType(Integer couponType) {
		this.couponType = couponType;
	}

	public String getSalePriceStr() {
		if(salePrice!=null) {
			DecimalFormat df=new DecimalFormat("0.00");
			salePriceStr = df.format((float)salePrice/100);
		}
		return salePriceStr;
	}

	public String getPriceStr() {
		if(price!=null) {
			DecimalFormat df=new DecimalFormat("0.00");
			priceStr = df.format((float)price/100);
		}
		return priceStr;
	}

}
