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

import com.alibaba.fastjson.JSON;
import com.google.common.collect.Maps;
import com.zm.order.tool.server.enums.DocTypeEnum;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;

import java.util.Date;
import java.util.Map;


/**
 * 商品制作表
 *
 * @author nianchang
 */
public class ItemProduction {

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

	/**
	 * 业务类型
	 */
	private Integer bizType;

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

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

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

	/**
	 * 门店id
	 */
	private Long storeId;

	/**
	 * goods id
	 */
	private Long spuId;

	/**
	 * 商品制作单唯一标识
	 */
	private String productionSign;

	/**
	 * item id
	 */
	private String skuId;

	/**
	 * 商品数量
	 */
	private Integer num;

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

	/**
	 * 制作单类型
	 */
	private Integer pdcType;

	/**
	 * 订单商品主键
	 */
	private Long orderItemId;

	/**
	 * 操作时间
	 */
	private Date productionAtStart;

	/**
	 * 操作时间
	 */
	private Date productionAtEnd;

	/**
	 * 操作时间
	 */
	private Date operateAt;

	/**
	 * 版本号
	 */
	private Integer version;

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

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

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

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

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

	/**
	 * 制作单号
	 */
	private String productionNo;

	/**
	 * 制作成功数量
	 */
	private Integer successNum;

	public Integer getSuccessNum() {
		return successNum;
	}

	public void setSuccessNum(Integer successNum) {
		this.successNum = successNum;
	}

	public Integer getPdcType() {
		return pdcType;
	}

	public void setPdcType(Integer pdcType) {
		this.pdcType = pdcType;
	}

	public String getProductionNo() {
		return productionNo;
	}

	public void setProductionNo(String productionNo) {
		this.productionNo = productionNo;
	}

	public Long getOrderItemId() {
		return orderItemId;
	}

	public void setOrderItemId(Long orderItemId) {
		this.orderItemId = orderItemId;
	}

	public Integer getBizType() {
		return bizType;
	}

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

	public String getProductionSign() {
		return productionSign;
	}

	public void setProductionSign(String productionSign) {
		this.productionSign = productionSign;
	}

	public Date getProductionAtStart() {
		return productionAtStart;
	}

	public void setProductionAtStart(Date productionAtStart) {
		this.productionAtStart = productionAtStart;
	}

	public Date getProductionAtEnd() {
		return productionAtEnd;
	}

	public void setProductionAtEnd(Date productionAtEnd) {
		this.productionAtEnd = productionAtEnd;
	}

	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 Long getSellerId() {
		return sellerId;
	}

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

	public Long getStoreId() {
		return storeId;
	}

	public void setStoreId(Long storeId) {
		this.storeId = storeId;
	}

	public Long getSpuId() {
		return spuId;
	}

	public void setSpuId(Long spuId) {
		this.spuId = spuId;
	}

	public String getSkuId() {
		return skuId;
	}

	public void setSkuId(String skuId) {
		this.skuId = skuId;
	}

	public Integer getNum() {
		return num;
	}

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

	public Integer getStatus() {
		return status;
	}

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

	public Date getOperateAt() {
		return operateAt;
	}

	public void setOperateAt(Date operateAt) {
		this.operateAt = operateAt;
	}

	public Integer getVersion() {
		return version;
	}

	public void setVersion(Integer version) {
		this.version = version;
	}

	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 String getFeatures() {
		return features;
	}

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

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

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

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

}
