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

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

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


/**
 * 订单评价表
 *
 * @author NianChang
 */
public class OrderComment {

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

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

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

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

	/**
	 * 联系方式
	 */
	private String mobile;

	/**
	 * 订单类型
	 */
	private Integer orderType;

	/**
	 * 订单类型
	 */
	private Integer orderSubType;

	public Integer getOrderSubType() {
		return orderSubType;
	}

	public void setOrderSubType(Integer orderSubType) {
		this.orderSubType = orderSubType;
	}

	/**
	 * 评论类型
	 */
	private Integer commentType;

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

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

	/**
	 * 是否匿名 0:否 1:是
	 */
	private Integer anonymous;

	/**
	 * 是否有推荐菜 0:没有 1:有
	 */
	private Integer existRecommend;

	/**
	 * 评论信息
	 */
	private String commentInfo;

	/**
	 * 用户备注
	 */
	private String buyerRemarks;

	/**
	 * 商家是否回复
	 * 0:未回复 1:已回复
	 */
	private Integer sellerReply;

	/**
	 * 商家回复信息
	 */
	private String sellerReplyInfo;

	/**
	 * 是否存在图片
	 * 0：不存在
	 * 1：存在
	 */
	private Integer existImage;

	/**
	 * 评论图片列表
	 */
	private List<String> commentImageList;

	/**
	 * 是否隐藏评论
	 * 0：不隐藏
	 * 1：隐藏
	 */
	private Integer hide;

	/**
	 * 是否精选 0:否 1:是
	 */
	private Integer quality;

	/**
	 * 评论时间
	 */
	private Date commentAt;

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

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

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

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

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

	/**
	 * 评论图片
	 */
	private String commentImage;

	/**
	 * 推荐商品信息
	 */
	private String recommendItemInfo;

	/**
	 * 配送评价
	 * 0:超赞 1:一般 2:很差
	 */
	private Integer deliveryComment;

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

	/**
	 * 商家回复时间
	 */
	private Date replyAt;

	/**
	 * 追加评价时间
	 */
	private Date appendCommentAt;

	/**
	 * 追加评价详情
	 */
	private String appendCommentInfo;

	/**
	 * 评价反馈
	 */
	private Integer commentFeedback;

	/**
	 * 评分
	 */
	private Integer commentScore;

	/**
	 * 履约类型
	 */
	private Integer performanceType;

	private String mobileCipher;

	/**
	 * 主数据源标记
	 */
	private Integer masterDataSource;

	public Integer getMasterDataSource() {
		return masterDataSource;
	}

	public void setMasterDataSource(Integer masterDataSource) {
		this.masterDataSource = masterDataSource;
	}

	public void paint(DataStream data) {
		this.orderType = data.getOrderType();
		this.performanceType = data.getPerformanceType();
	}

	public Integer getCommentScore() {
		return commentScore;
	}

	public void setCommentScore(Integer commentScore) {
		this.commentScore = commentScore;
	}

	public String getMobileCipher() {
		return mobileCipher;
	}

	public void setMobileCipher(String mobileCipher) {
		this.mobileCipher = mobileCipher;
	}

	public Integer getPerformanceType() {
		return performanceType;
	}

	public void setPerformanceType(Integer performanceType) {
		this.performanceType = performanceType;
	}

	public Date getAppendCommentAt() {
		return appendCommentAt;
	}

	public void setAppendCommentAt(Date appendCommentAt) {
		this.appendCommentAt = appendCommentAt;
	}

	public String getAppendCommentInfo() {
		return appendCommentInfo;
	}

	public void setAppendCommentInfo(String appendCommentInfo) {
		this.appendCommentInfo = appendCommentInfo;
	}

	public Integer getCommentFeedback() {
		return commentFeedback;
	}

	public void setCommentFeedback(Integer commentFeedback) {
		this.commentFeedback = commentFeedback;
	}

	public Date getReplyAt() {
		return replyAt;
	}

	public void setReplyAt(Date replyAt) {
		this.replyAt = replyAt;
	}

	public Integer getDeliveryComment() {
		return deliveryComment;
	}

	public void setDeliveryComment(Integer deliveryComment) {
		this.deliveryComment = deliveryComment;
	}

	public Integer getVersion() {
		return version;
	}

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

	public String getRecommendItemInfo() {
		return recommendItemInfo;
	}

	public void setRecommendItemInfo(String recommendItemInfo) {
		this.recommendItemInfo = recommendItemInfo;
	}

	public List<String> getCommentImageList() {
        if (!StringUtils.isEmpty(commentImage)) {
            return (List)JSON.parseArray(commentImage);
        }
        if (commentImageList == null) {
            return Lists.newArrayList();
        }
        return commentImageList;
    }

    public void setCommentImageList(List<String> commentImageList) {
        if (!CollectionUtils.isEmpty(commentImageList)) {
            this.commentImage = JSON.toJSONString(commentImageList);
        }
        this.commentImageList = commentImageList;
    }

	public Integer getExistRecommend() {
		return existRecommend;
	}

	public void setExistRecommend(Integer existRecommend) {
		this.existRecommend = existRecommend;
	}

	public Integer getCommentType() {
		return commentType;
	}

	public void setCommentType(Integer commentType) {
		this.commentType = commentType;
	}

	public Integer getQuality() {
		return quality;
	}

	public void setQuality(Integer quality) {
		this.quality = quality;
	}

	public Integer getHide() {
		return hide;
	}

	public void setHide(Integer hide) {
		this.hide = hide;
	}

	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;
	}

    public Long getId() {
		return id;
	}

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

	public Integer getBizType() {
		return bizType;
	}

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

	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 getMobile() {
		return mobile;
	}

	public void setMobile(String mobile) {
		this.mobile = mobile;
	}

	public Integer getOrderType() {
		return orderType;
	}

	public void setOrderType(Integer orderType) {
		this.orderType = orderType;
	}

	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 Integer getAnonymous() {
		return anonymous;
	}

	public void setAnonymous(Integer anonymous) {
		this.anonymous = anonymous;
	}

	public String getCommentInfo() {
		return commentInfo;
	}

	public void setCommentInfo(String commentInfo) {
		this.commentInfo = commentInfo;
	}

	public String getBuyerRemarks() {
		return buyerRemarks;
	}

	public void setBuyerRemarks(String buyerRemarks) {
		this.buyerRemarks = buyerRemarks;
	}

	public Integer getSellerReply() {
		return sellerReply;
	}

	public void setSellerReply(Integer sellerReply) {
		this.sellerReply = sellerReply;
	}

	public String getSellerReplyInfo() {
		return sellerReplyInfo;
	}

	public void setSellerReplyInfo(String sellerReplyInfo) {
		this.sellerReplyInfo = sellerReplyInfo;
	}

	public Integer getExistImage() {
		return existImage;
	}

	public void setExistImage(Integer existImage) {
		this.existImage = existImage;
	}

	public String getCommentImage() {
		return commentImage;
	}

	public void setCommentImage(String commentImage) {
		this.commentImage = commentImage;
	}

	public Date getCommentAt() {
		return commentAt;
	}

	public void setCommentAt(Date commentAt) {
		this.commentAt = commentAt;
	}

	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;
	}

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

}
