package com.zm.order.tool.server.model;

import com.alibaba.fastjson.JSON;
import com.google.common.collect.Maps;
import org.springframework.util.StringUtils;

import java.math.BigDecimal;
import java.util.Date;
import java.util.Map;
import java.util.Objects;

/**
 * 
 *
 * @author mybatis-generator
 * @date 2019/10/28
 */
public class RoutingOrderItem {

    /**
     * 主键
     */
    private Long id;

    private Integer bizType;

    /**
     * 订单号
     */
    private String orderNo;

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

    /**
     * 商品id
     */
    private String itemId;

    /**
     * 商品名称
     */
    private String itemName;

    /**
     * 商品图片
     */
    private String itemImage;

    /**
     * 商品规格
     */
    private String itemSpec;

    /**
     * 商品单位
     */
    private String itemUnit;

    /**
     * 商品条码
     */
    private String itemBarcode;

    /**
     * 商品标识
     */
    private String itemSign;

    /**
     * 品牌标识
     */
    private String brandSign;

    /**
     * 市场价
     */
    private Integer marketPrice;

    /**
     * 成本价
     */
    private Integer costPrice;

    /**
     * 会员价
     */
    private Integer memberPrice;

    /**
     * 成交价
     */
    private Integer itemPrice;

    /**
     * 数量
     */
    private BigDecimal num;

    /**
     * 优惠金额
     */
    private Integer discountAmount;

    /**
     * 包装费
     */
    private Integer packAmount;

    /**
     * f码
     */
    private String fCode;

    /**
     * 状态
     */
    private Integer status;

    /**
     * 扩展信息 json
     */
    private String features;

    /**
     * 扩展信息 map
     */
    private Map<String, Object> extraMap;

    /**
     * 创建时间
     */
    private Date createdAt;

    /**
     * 修改时间
     */
    private Date updatedAt;

    /**
     * 删除标识
     */
    private Integer isDeleted;

    /**
     * spuId
     */
    private Long goodsId;

    /**
     * 活动id
     */
    private Long activityId;

    /**
     * 限时活动
     */
    private Integer isTimeDiscount;

    /**
     * 加菜时间
     */
    private Date orderAt;

    /**
     * 条码
     */
    private String productNo;

    /**
     * 是否赠品
     */
    private Integer isGift;

    /**
     * 商家id
     */
    private Long sellerId;

    /**
     * 商品类型
     * 0:普通商品 1:套餐商品 2:套餐子商品
     */
    private Integer itemType;

    /**
     * 归属商品ID
     */
    private Long ownerId;

    /**
     * 加料信息
     */
    private String batchingInfo;

    private Integer dbIndex;

    private Integer tbIndex;

    private Date syncAt;

    public Integer getDbIndex() {
        return dbIndex;
    }

    public void setDbIndex(Integer dbIndex) {
        this.dbIndex = dbIndex;
    }

    public Integer getTbIndex() {
        return tbIndex;
    }

    public void setTbIndex(Integer tbIndex) {
        this.tbIndex = tbIndex;
    }

    public Date getSyncAt() {
        return syncAt;
    }

    public void setSyncAt(Date syncAt) {
        this.syncAt = syncAt;
    }

    public Integer getItemType() {
        return itemType;
    }

    public void setItemType(Integer itemType) {
        this.itemType = itemType;
    }

    public Long getOwnerId() {
        return ownerId;
    }

    public void setOwnerId(Long ownerId) {
        this.ownerId = ownerId;
    }

    public String getBatchingInfo() {
        return batchingInfo;
    }

    public void setBatchingInfo(String batchingInfo) {
        this.batchingInfo = batchingInfo;
    }

    public Integer getBizType() {
        return bizType;
    }

    public void setBizType(Integer bizType) {
        this.bizType = bizType;
    }

    public Date getOrderAt() {
        return orderAt;
    }

    public void setOrderAt(Date orderAt) {
        this.orderAt = orderAt;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getOrderNo() {
        return orderNo;
    }

    public void setOrderNo(String orderNo) {
        this.orderNo = orderNo;
    }

    public Long getUserId() {
        return userId;
    }

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

    public String getItemId() {
        return itemId;
    }

    public void setItemId(String itemId) {
        this.itemId = itemId;
    }

    public String getItemName() {
        return itemName;
    }

    public void setItemName(String itemName) {
        this.itemName = itemName;
    }

    public String getItemImage() {
        return itemImage;
    }

    public void setItemImage(String itemImage) {
        this.itemImage = itemImage;
    }

    public String getItemSpec() {
        return itemSpec;
    }

    public void setItemSpec(String itemSpec) {
        this.itemSpec = itemSpec;
    }

    public String getItemUnit() {
        return itemUnit;
    }

    public void setItemUnit(String itemUnit) {
        this.itemUnit = itemUnit;
    }

    public String getItemBarcode() {
        return itemBarcode;
    }

    public void setItemBarcode(String itemBarcode) {
        this.itemBarcode = itemBarcode;
    }

    public String getItemSign() {
        return itemSign;
    }

    public void setItemSign(String itemSign) {
        this.itemSign = itemSign;
    }

    public String getBrandSign() {
        return brandSign;
    }

    public void setBrandSign(String brandSign) {
        this.brandSign = brandSign;
    }

    public Integer getMarketPrice() {
        return marketPrice;
    }

    public void setMarketPrice(Integer marketPrice) {
        this.marketPrice = marketPrice;
    }

    public Integer getCostPrice() {
        return costPrice;
    }

    public void setCostPrice(Integer costPrice) {
        this.costPrice = costPrice;
    }

    public Integer getMemberPrice() {
        return memberPrice;
    }

    public void setMemberPrice(Integer memberPrice) {
        this.memberPrice = memberPrice;
    }

    public Long getSellerId() {
        return sellerId;
    }

    public void setSellerId(Long sellerId) {
        this.sellerId = sellerId;
    }

    public Integer getItemPrice() {
        return itemPrice;
    }

    public void setItemPrice(Integer itemPrice) {
        this.itemPrice = itemPrice;
    }

    public String getProductNo() {
        return productNo;
    }

    public void setProductNo(String productNo) {
        this.productNo = productNo;
    }

    public Integer getIsGift() {
        return isGift;
    }

    public void setIsGift(Integer isGift) {
        this.isGift = isGift;
    }

    public BigDecimal getNum() {
        return num;
    }

    public void setNum(BigDecimal num) {
        this.num = num;
    }

    public Integer getPackAmount() {
        return packAmount;
    }

    public void setPackAmount(Integer packAmount) {
        this.packAmount = packAmount;
    }

    public Integer getDiscountAmount() {
        return discountAmount;
    }

    public void setDiscountAmount(Integer discountAmount) {
        this.discountAmount = discountAmount;
    }

    public String getfCode() {
        return fCode;
    }

    public void setfCode(String fCode) {
        this.fCode = fCode;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public String getFeatures() {
        return features;
    }

    public void setFeatures(String features) {
        this.features = features;
    }

    public Date getCreatedAt() {
        return createdAt;
    }

    public void setCreatedAt(Date createdAt) {
        this.createdAt = createdAt;
    }

    public Date getUpdatedAt() {
        return updatedAt;
    }

    public void setUpdatedAt(Date updatedAt) {
        this.updatedAt = updatedAt;
    }

    public Integer getIsDeleted() {
        return isDeleted;
    }

    public void setIsDeleted(Integer isDeleted) {
        this.isDeleted = isDeleted;
    }

    public Long getGoodsId() {
        return goodsId;
    }

    public void setGoodsId(Long goodsId) {
        this.goodsId = goodsId;
    }

    public Long getActivityId() {
        return activityId;
    }

    public void setActivityId(Long activityId) {
        this.activityId = activityId;
    }

    public Integer getIsTimeDiscount() {
        return isTimeDiscount;
    }

    public void setIsTimeDiscount(Integer isTimeDiscount) {
        this.isTimeDiscount = isTimeDiscount;
    }

    public Map<String, Object> getExtraMap() {
        if (!StringUtils.isEmpty(features)) {
            Map<String, Object> extra = JSON.parseObject(features, Map.class);
            return extra;
        }
        return Maps.newHashMap();
    }

    public void setExtraMap(Map<String, Object> extraMap) {
        if (Objects.nonNull(extraMap) && !extraMap.isEmpty()) {
            this.features = JSON.toJSONString(extraMap);
        }
        this.extraMap = extraMap;
    }

    @Override
    public String toString() {
        return JSON.toJSONString(this);
    }
}