package org.cs.mgr.order.model;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Transient;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.TableGenerator;
import javax.persistence.Version;
import java.util.HashMap;
import java.math.BigDecimal;
import java.util.Map;
import java.util.Date;
import org.cs.core.model.BaseEntity;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

/**
 * 订单管理 
 * 
 * @ClassName: MgmOrder 
 * @Description:  
 * @author: sunny_shi
 * @date: 2018-06-09 13:29:02
 */
@Table(name = "mgm_order")
@Entity
@DynamicInsert
@DynamicUpdate
public class MgmOrder extends  BaseEntity {

    /**
	 * 
	 */
	private static final long serialVersionUID = -9078162265241979361L;
	private static final Class<MgmOrder> ENTITY_CLASS = MgmOrder.class;
    
	public MgmOrder()
	{
	}
     
	
	/** 订单编号  */
	private String orderNo;  
	/** 订单状态  */
	private String orderState;  
	/** 订单状态  */
	private String orderStateName;  
	/** 订单备注  */
	private String remark;  
	/** 推介人id  */
	private Long userId;  
	/** 客户id  */
	private Long customerId;  
	/** 销售员姓名  */
	private String salerName;  
	/** 销售员id  */
	private Long salerId;  
	/** 主销售id  */
	private Long salerMaster;  
	/** 推介时间  */
	private java.util.Date recommendTime;  
	/** 指派人id  */
	private Long assignUserid;  
	/** 指派人姓名  */
	private String assignUsername;  
	/** 指派时间  */
	private java.util.Date assignTime;  
	/** 接收时间  */
	private java.util.Date receiveTime;  
	/** 邀约时间  */
	private java.util.Date inviteTime;  
	/** 到访时间  */
	private java.util.Date visitTime;  
	/** 认购时间  */
	private java.util.Date subscribeTime;  
	/** 签约时间  */
	private java.util.Date contractTime;  
	/** 审核签约  */
	private java.util.Date checkTime;  
	/** 终止时间  */
	private java.util.Date breakTime;  
	/** 停滞时间  */
	private java.util.Date stopTimes;  
	/** 佣金  */
	private Double commission;  
	/** 合同金额  */
	private Double amount;  
	
	private String customerName;//客户姓名
	
	private String customerPhone;//客户电话
	
	private String orderType;//订单类别()
	
	private String userName;//推荐人姓名
	
	private String breakState;//订单终止状态
	
	//private Integer id;
	@Id
	@SequenceGenerator(name="sequenceGenerator",sequenceName="mgm_order_seq")
	@GeneratedValue(generator="sequenceGenerator",strategy=GenerationType.SEQUENCE)
	@Column(name = "id", unique = true, nullable = false, precision = 11, scale = 0)
	public Integer getId() {
		return id;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	
	@Column(name = "order_no", columnDefinition="VARCHAR2(30) " )
	public String getOrderNo()
	{
		return orderNo;
	}
	
	public void setOrderNo(String orderNo)
	{
		this.orderNo= orderNo;
	}
	
	@Column(name = "customer_name", columnDefinition="VARCHAR2(50) " )
	public String getCustomerName() {
		return customerName;
	}
	public void setCustomerName(String customerName) {
		this.customerName = customerName;
	}
	
	
	@Column(name = "customer_phone", columnDefinition="VARCHAR2(20) " )
	public String getCustomerPhone() {
		return customerPhone;
	}
	
	public void setCustomerPhone(String customerPhone) {
		this.customerPhone = customerPhone;
	}
	
	@Column(name = "order_state", columnDefinition="CHAR(1) " )
	public String getOrderState()
	{
		return orderState;
	}
	
	public void setOrderState(String orderState)
	{
		this.orderState= orderState;
	}
	
	@Column(name = "order_state_name", columnDefinition="VARCHAR2(100) " )
	public String getOrderStateName() {
		return orderStateName;
	}
	public void setOrderStateName(String orderStateName) {
		this.orderStateName = orderStateName;
	}
	
	
	@Column(name = "remark", columnDefinition="VARCHAR2(100) " )
	public String getRemark()
	{
		return remark;
	}
	
	public void setRemark(String remark)
	{
		this.remark= remark;
	}
	
	
	@Column(name = "user_id", columnDefinition="NUMBER(11) " )
	public Long getUserId()
	{
		return userId;
	}
	
	public void setUserId(Long userId)
	{
		this.userId= userId;
	}
	
	
	@Column(name = "customer_id", columnDefinition="NUMBER(11) " )
	public Long getCustomerId()
	{
		return customerId;
	}
	
	public void setCustomerId(Long customerId)
	{
		this.customerId= customerId;
	}
	
	
	@Column(name = "saler_name", columnDefinition="VARCHAR2(20) " )
	public String getSalerName()
	{
		return salerName;
	}
	
	public void setSalerName(String salerName)
	{
		this.salerName= salerName;
	}
	
	
	@Column(name = "saler_id", columnDefinition="NUMBER(11) " )
	public Long getSalerId()
	{
		return salerId;
	}
	
	public void setSalerId(Long salerId)
	{
		this.salerId= salerId;
	}
	
	
	@Column(name = "saler_master", columnDefinition="NUMBER(11) " )
	public Long getSalerMaster()
	{
		return salerMaster;
	}
	
	public void setSalerMaster(Long salerMaster)
	{
		this.salerMaster= salerMaster;
	}
	
	
	@Column(name = "recommend_time", columnDefinition="DATE " )
	public java.util.Date getRecommendTime()
	{
		return recommendTime;
	}
	
	public void setRecommendTime(java.util.Date recommendTime)
	{
		this.recommendTime= recommendTime;
	}
	
	
	@Column(name = "assign_userid", columnDefinition="NUMBER(11) " )
	public Long getAssignUserid()
	{
		return assignUserid;
	}
	
	public void setAssignUserid(Long assignUserid)
	{
		this.assignUserid= assignUserid;
	}
	
	
	@Column(name = "assign_username", columnDefinition="VARCHAR2(20) " )
	public String getAssignUsername()
	{
		return assignUsername;
	}
	
	public void setAssignUsername(String assignUsername)
	{
		this.assignUsername= assignUsername;
	}
	
	
	@Column(name = "assign_time", columnDefinition="DATE " )
	public java.util.Date getAssignTime()
	{
		return assignTime;
	}
	
	public void setAssignTime(java.util.Date assignTime)
	{
		this.assignTime= assignTime;
	}
	
	
	@Column(name = "receive_time", columnDefinition="DATE " )
	public java.util.Date getReceiveTime()
	{
		return receiveTime;
	}
	
	public void setReceiveTime(java.util.Date receiveTime)
	{
		this.receiveTime= receiveTime;
	}
	
	
	@Column(name = "invite_time", columnDefinition="DATE " )
	public java.util.Date getInviteTime()
	{
		return inviteTime;
	}
	
	public void setInviteTime(java.util.Date inviteTime)
	{
		this.inviteTime= inviteTime;
	}
	
	
	@Column(name = "visit_time", columnDefinition="DATE " )
	public java.util.Date getVisitTime()
	{
		return visitTime;
	}
	
	public void setVisitTime(java.util.Date visitTime)
	{
		this.visitTime= visitTime;
	}
	
	
	@Column(name = "subscribe_time", columnDefinition="DATE " )
	public java.util.Date getSubscribeTime()
	{
		return subscribeTime;
	}
	
	public void setSubscribeTime(java.util.Date subscribeTime)
	{
		this.subscribeTime= subscribeTime;
	}
	
	
	@Column(name = "contract_time", columnDefinition="DATE " )
	public java.util.Date getContractTime()
	{
		return contractTime;
	}
	
	public void setContractTime(java.util.Date contractTime)
	{
		this.contractTime= contractTime;
	}
	
	
	@Column(name = "check_time", columnDefinition="DATE " )
	public java.util.Date getCheckTime()
	{
		return checkTime;
	}
	
	public void setCheckTime(java.util.Date checkTime)
	{
		this.checkTime= checkTime;
	}
	
	
	@Column(name = "break_time", columnDefinition="DATE " )
	public java.util.Date getBreakTime()
	{
		return breakTime;
	}
	
	public void setBreakTime(java.util.Date breakTime)
	{
		this.breakTime= breakTime;
	}
	
	
	@Column(name = "stop_times", columnDefinition="DATE " )
	public java.util.Date getStopTimes()
	{
		return stopTimes;
	}
	
	public void setStopTimes(java.util.Date stopTimes)
	{
		this.stopTimes= stopTimes;
	}
	
	
	@Column(name = "commission", columnDefinition="NUMBER(8,2) " )
	public Double getCommission()
	{
		return commission;
	}
	
	public void setCommission(Double commission)
	{
		this.commission= commission;
	}
	
	
	@Column(name = "amount", columnDefinition="NUMBER(8,2) " )
	public Double getAmount()
	{
		return amount;
	}
	
	public void setAmount(Double amount)
	{
		this.amount= amount;
	}
	
	@Column(name = "order_type", columnDefinition="VARCHAR2(20) " )
	public String getOrderType() {
		return orderType;
	}
	public void setOrderType(String orderType) {
		this.orderType = orderType;
	}
	
	@Column(name = "user_name", columnDefinition="VARCHAR2(20) " )
	public String getUserName() {
		return userName;
	}
	public void setUserName(String userName) {
		this.userName = userName;
	}
	
	
	public Class entityClass()
	{
		return ENTITY_CLASS;
	}
	
	
 	protected StringBuilder toStringBuilder(StringBuilder sb)
 	{
 		return sb 
		.append(",id=").append(this.id)
		.append(",orderNo=").append(this.orderNo)
		.append(",orderState=").append(this.orderState)
		.append(",remark=").append(this.remark)
		.append(",userId=").append(this.userId)
		.append(",customerId=").append(this.customerId)
		.append(",salerName=").append(this.salerName)
		.append(",salerId=").append(this.salerId)
		.append(",salerMaster=").append(this.salerMaster)
		.append(",recommendTime=").append(this.recommendTime)
		.append(",assignUserid=").append(this.assignUserid)
		.append(",assignUsername=").append(this.assignUsername)
		.append(",assignTime=").append(this.assignTime)
		.append(",receiveTime=").append(this.receiveTime)
		.append(",inviteTime=").append(this.inviteTime)
		.append(",visitTime=").append(this.visitTime)
		.append(",subscribeTime=").append(this.subscribeTime)
		.append(",contractTime=").append(this.contractTime)
		.append(",checkTime=").append(this.checkTime)
		.append(",breakTime=").append(this.breakTime)
		.append(",stopTimes=").append(this.stopTimes)
		.append(",commission=").append(this.commission)
		.append(",amount=").append(this.amount)
		.append(",attr1=").append(this.attr1)
		.append(",attr2=").append(this.attr2)
		.append(",attr3=").append(this.attr3)
		.append(",createDate=").append(this.createDate)
		.append(",modifyDate=").append(this.modifyDate)
		.append(",isDelete=").append(this.isDelete)
		.append(",customerName=").append(this.customerName)
		.append(",customerPhone=").append(this.customerPhone)
		.append(",orderType=").append(this.orderType)
		.append(",userName=").append(this.userName)
		.append(",breakState=").append(this.breakState)
		;
 	}
 	
 	
 	@Override
	public String toString()
	{
		return toStringBuilder(new StringBuilder().append("MgmOrder[")).append(']').toString();
	}
	 
	
	public Map<String,Object> mapValue()
	{
	    Map<String,Object> map=new HashMap<String,Object>();
	     if(this.id!=null){ map.put("id",this.id);}
	     if(this.orderNo!=null){ map.put("orderNo",this.orderNo);}
	     if(this.orderState!=null){ map.put("orderState",this.orderState);}
	     if(this.remark!=null){ map.put("remark",this.remark);}
	     if(this.userId!=null){ map.put("userId",this.userId);}
	     if(this.customerId!=null){ map.put("customerId",this.customerId);}
	     if(this.salerName!=null){ map.put("salerName",this.salerName);}
	     if(this.salerId!=null){ map.put("salerId",this.salerId);}
	     if(this.salerMaster!=null){ map.put("salerMaster",this.salerMaster);}
	     if(this.recommendTime!=null){ map.put("recommendTime",this.recommendTime);}
	     if(this.assignUserid!=null){ map.put("assignUserid",this.assignUserid);}
	     if(this.assignUsername!=null){ map.put("assignUsername",this.assignUsername);}
	     if(this.assignTime!=null){ map.put("assignTime",this.assignTime);}
	     if(this.receiveTime!=null){ map.put("receiveTime",this.receiveTime);}
	     if(this.inviteTime!=null){ map.put("inviteTime",this.inviteTime);}
	     if(this.visitTime!=null){ map.put("visitTime",this.visitTime);}
	     if(this.subscribeTime!=null){ map.put("subscribeTime",this.subscribeTime);}
	     if(this.contractTime!=null){ map.put("contractTime",this.contractTime);}
	     if(this.checkTime!=null){ map.put("checkTime",this.checkTime);}
	     if(this.breakTime!=null){ map.put("breakTime",this.breakTime);}
	     if(this.stopTimes!=null){ map.put("stopTimes",this.stopTimes);}
	     if(this.commission!=null){ map.put("commission",this.commission);}
	     if(this.amount!=null){ map.put("amount",this.amount);}
		 if(this.attr1 !=null){ map.put("attr1", this.attr1);}
		 if(this.attr2 !=null){ map.put("attr2", this.attr2);}
		 if(this.attr3 !=null){ map.put("attr3", this.attr3);}
		 if(this.createDate != null){ map.put("createDate", this.createDate);}
		 if(this.modifyDate != null){ map.put("modifyDate", this.modifyDate);}
		 if(this.isDelete != null){ map.put("isDelete", this.isDelete);}
		 if(this.customerName!=null) {map.put("customerName", this.customerName);}
		 if(this.customerPhone!=null) {map.put("customerPhone", this.customerPhone);}
		 if(this.orderType!=null) {map.put("orderType", this.orderType);}
		 if(this.userName!=null) {map.put("userName",this.userName);}
		 if(this.breakState!=null) {map.put("breakState", this.breakState);}
		return map;
	}
	
	public void mergeTo(MgmOrder en)
	{
		  if(this.id !=null){ en.setId(this.id);}
		  if(this.orderNo !=null){ en.setOrderNo(this.orderNo);}
		  if(this.orderState !=null){ en.setOrderState(this.orderState);}
		  if(this.remark !=null){ en.setRemark(this.remark);}
		  if(this.userId !=null){ en.setUserId(this.userId);}
		  if(this.customerId !=null){ en.setCustomerId(this.customerId);}
		  if(this.salerName !=null){ en.setSalerName(this.salerName);}
		  if(this.salerId !=null){ en.setSalerId(this.salerId);}
		  if(this.salerMaster !=null){ en.setSalerMaster(this.salerMaster);}
		  if(this.recommendTime !=null){ en.setRecommendTime(this.recommendTime);}
		  if(this.assignUserid !=null){ en.setAssignUserid(this.assignUserid);}
		  if(this.assignUsername !=null){ en.setAssignUsername(this.assignUsername);}
		  if(this.assignTime !=null){ en.setAssignTime(this.assignTime);}
		  if(this.receiveTime !=null){ en.setReceiveTime(this.receiveTime);}
		  if(this.inviteTime !=null){ en.setInviteTime(this.inviteTime);}
		  if(this.visitTime !=null){ en.setVisitTime(this.visitTime);}
		  if(this.subscribeTime !=null){ en.setSubscribeTime(this.subscribeTime);}
		  if(this.contractTime !=null){ en.setContractTime(this.contractTime);}
		  if(this.checkTime !=null){ en.setCheckTime(this.checkTime);}
		  if(this.breakTime !=null){ en.setBreakTime(this.breakTime);}
		  if(this.stopTimes !=null){ en.setStopTimes(this.stopTimes);}
		  if(this.commission !=null){ en.setCommission(this.commission);}
		  if(this.amount !=null){ en.setAmount(this.amount);}
		  if(this.attr1!=null){ en.setAttr1(this.attr1);}
		  if(this.attr2!=null){ en.setAttr2(this.attr2);}
		  if(this.attr3!=null){ en.setAttr3(this.attr3);}
		  if(this.createDate != null){ en.setCreateDate(this.createDate);}
		  if(this.modifyDate != null){ en.setModifyDate(this.modifyDate);}
		  if(this.isDelete != null){ en.setIsDelete(this.isDelete);}
		  if(this.customerName!=null) {en.setCustomerName(this.customerName);}
		  if(this.customerPhone!=null) {en.setCustomerPhone(this.customerPhone);}
		  if(this.orderType!=null) {en.setOrderType(this.orderType);}
		  if(this.userName!=null) {en.setUserName(this.userName);}
		  if(this.breakState!=null) {en.setBreakState(this.breakState);}
	}
	
  	@Override
  	public void copyFrom(Object obj)
  	{  
  		 if(!(obj instanceof MgmOrder)) {
  	 		super.copyFrom(obj);
  	 	}else {
  	  		MgmOrder bean=(MgmOrder)obj;
			this.setId(bean.getId());
			this.setOrderNo(bean.getOrderNo());
			this.setOrderState(bean.getOrderState());
			this.setRemark(bean.getRemark());
			this.setUserId(bean.getUserId());
			this.setCustomerId(bean.getCustomerId());
			this.setSalerName(bean.getSalerName());
			this.setSalerId(bean.getSalerId());
			this.setSalerMaster(bean.getSalerMaster());
			this.setRecommendTime(bean.getRecommendTime());
			this.setAssignUserid(bean.getAssignUserid());
			this.setAssignUsername(bean.getAssignUsername());
			this.setAssignTime(bean.getAssignTime());
			this.setReceiveTime(bean.getReceiveTime());
			this.setInviteTime(bean.getInviteTime());
			this.setVisitTime(bean.getVisitTime());
			this.setSubscribeTime(bean.getSubscribeTime());
			this.setContractTime(bean.getContractTime());
			this.setCheckTime(bean.getCheckTime());
			this.setBreakTime(bean.getBreakTime());
			this.setStopTimes(bean.getStopTimes());
			this.setCommission(bean.getCommission());
			this.setAmount(bean.getAmount());
	     	this.setAttr1(bean.getAttr1());
	     	this.setAttr2(bean.getAttr2());
	     	this.setAttr3(bean.getAttr3());
	     	this.setCreateDate(bean.getCreateDate());
	     	this.setModifyDate(bean.getModifyDate());
	     	this.setIsDelete(bean.getIsDelete());
	     	this.setCustomerName(bean.getCustomerName());
	     	this.setCustomerPhone(bean.getCustomerPhone());
	     	this.setOrderType(bean.getOrderType());
	     	this.setUserName(bean.getUserName());
	     	this.setBreakState(bean.getBreakState());
     	}
 	 }
  	
  	
  	public void copyFromMap(Object obj)
  	{  
  		MgmOrder bean=(MgmOrder)obj;
		this.setId(bean.getId());
		this.setOrderNo(bean.getOrderNo());
		this.setOrderState(bean.getOrderState());
		this.setRemark(bean.getRemark());
		this.setUserId(bean.getUserId());
		this.setCustomerId(bean.getCustomerId());
		this.setSalerName(bean.getSalerName());
		this.setSalerId(bean.getSalerId());
		this.setSalerMaster(bean.getSalerMaster());
		this.setRecommendTime(bean.getRecommendTime());
		this.setAssignUserid(bean.getAssignUserid());
		this.setAssignUsername(bean.getAssignUsername());
		this.setAssignTime(bean.getAssignTime());
		this.setReceiveTime(bean.getReceiveTime());
		this.setInviteTime(bean.getInviteTime());
		this.setVisitTime(bean.getVisitTime());
		this.setSubscribeTime(bean.getSubscribeTime());
		this.setContractTime(bean.getContractTime());
		this.setCheckTime(bean.getCheckTime());
		this.setBreakTime(bean.getBreakTime());
		this.setStopTimes(bean.getStopTimes());
		this.setCommission(bean.getCommission());
		this.setAmount(bean.getAmount());
     	this.setAttr1(bean.getAttr1());
     	this.setAttr2(bean.getAttr2());
     	this.setAttr3(bean.getAttr3());
     	this.setCreateDate(bean.getCreateDate());
     	this.setModifyDate(bean.getModifyDate());
     	this.setIsDelete(bean.getIsDelete());     	
     	this.setCustomerName(bean.getCustomerName());
     	this.setCustomerPhone(bean.getCustomerPhone());
     	this.setOrderType(bean.getOrderType());
     	this.setUserName(bean.getUserName());
     	this.setBreakState(bean.getBreakState());
 	 }
  	
  	@Column(name = "break_state", columnDefinition="VARCHAR2(20) " )
	public String getBreakState() {
		return breakState;
	}
	public void setBreakState(String breakState) {
		this.breakState = breakState;
	}
	
	
	
}
