package org.xmx0632.deliciousfruit.entity;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import org.apache.commons.lang3.builder.ToStringBuilder;
import com.google.common.collect.Lists;
/**
* Order.
*/
@Entity
@Table(name = "tbl_order")
public class Order extends IdEntity {
private Date orderTime;// 订单创建时间
private BigDecimal totalPrice;// 总价
private BigDecimal payAmount;// 实际支付
private String orderNumber;// 订单号
private BigDecimal freight;// 运费
private BigDecimal freightPay;// 实际运费
private String paymentMethod;// 支付方法
private BigDecimal priceOff;// 促销立减金额
private BigDecimal payByPoint;// 通过积分支付金额
private Integer pointLeft;// 支付后积分剩余
private BigDecimal payFromAccount;// 储值账户支付金额
private BigDecimal accountBalance;// 储值账户支付完毕后余额
private String deliveryDatePeriod;// 送货日期
private String deliveryTimePeriod;// 送货时间
private String receiverName;// 收货人名字
private String receiverPhoneNumber;// 收货人电话号码
private String receiverAddress;// 收货人地址
private String receiverProvince;// 收货人省份
private String receiverCity;// 收货人城市
private String receiverDistrict;// 收货人地区
private int givePoint;// 赠送积分
private UserAccount userAccount;
private List<OrderGiveEcoupon> giveEcoupon = Lists.newArrayList();// 赠送电子活动券
private List<OrderPayByCashCoupon> payByCashCoupon = Lists.newArrayList();// 用于支付的现金券
private List<OrderPayByEcoupon> payByEcoupon = Lists.newArrayList();// 用于支付的电子活动券
private List<OrderPayByGiftCard> payByGiftCard = Lists.newArrayList();// 用于支付的礼品卡
private List<OrderProduct> productList = Lists.newArrayList();// 购买的产品列表
private List<OrderProductFree> productsFree = Lists.newArrayList();// 赠送的产品列表
public Order() {
}
public Order(Date orderTime, BigDecimal totalPrice, BigDecimal payAmount,
String orderNumber, BigDecimal priceOff) {
this.orderTime = orderTime;
this.totalPrice = totalPrice;
this.payAmount = payAmount;
this.orderNumber = orderNumber;
this.priceOff = priceOff;
}
@OneToMany(mappedBy = "order")
public List<OrderPayByCashCoupon> getPayByCashCoupon() {
return payByCashCoupon;
}
public void setPayByCashCoupon(List<OrderPayByCashCoupon> payByCashCoupon) {
this.payByCashCoupon = payByCashCoupon;
}
@OneToMany(mappedBy = "order")
public List<OrderPayByEcoupon> getPayByEcoupon() {
return payByEcoupon;
}
public void setPayByEcoupon(List<OrderPayByEcoupon> payByEcoupon) {
this.payByEcoupon = payByEcoupon;
}
@OneToMany(mappedBy = "order")
public List<OrderPayByGiftCard> getPayByGiftCard() {
return payByGiftCard;
}
public void setPayByGiftCard(List<OrderPayByGiftCard> payByGiftCard) {
this.payByGiftCard = payByGiftCard;
}
@OneToMany(mappedBy = "order")
public List<OrderProduct> getProductList() {
return productList;
}
public void setProductList(List<OrderProduct> productList) {
this.productList = productList;
}
@OneToMany(mappedBy = "order")
public List<OrderProductFree> getProductsFree() {
return productsFree;
}
public void setProductsFree(List<OrderProductFree> productsFree) {
this.productsFree = productsFree;
}
@OneToMany(mappedBy = "order")
public List<OrderGiveEcoupon> getGiveEcoupon() {
return giveEcoupon;
}
public void setGiveEcoupon(List<OrderGiveEcoupon> giveEcoupon) {
this.giveEcoupon = giveEcoupon;
}
public int getGivePoint() {
return givePoint;
}
public void setGivePoint(int givePoint) {
this.givePoint = givePoint;
}
@ManyToOne
@JoinColumn(name = "user_id")
public UserAccount getUserAccount() {
return userAccount;
}
public void setUserAccount(UserAccount userAccount) {
this.userAccount = userAccount;
}
@NotNull
public Date getOrderTime() {
return this.orderTime;
}
public void setOrderTime(Date orderTime) {
this.orderTime = orderTime;
}
@NotNull
public BigDecimal getTotalPrice() {
return this.totalPrice;
}
public void setTotalPrice(BigDecimal totalPrice) {
this.totalPrice = totalPrice;
}
@NotNull
public BigDecimal getPayAmount() {
return this.payAmount;
}
public void setPayAmount(BigDecimal payAmount) {
this.payAmount = payAmount;
}
@NotNull
public String getOrderNumber() {
return this.orderNumber;
}
public void setOrderNumber(String orderNumber) {
this.orderNumber = orderNumber;
}
public BigDecimal getFreight() {
return this.freight;
}
public void setFreight(BigDecimal freight) {
this.freight = freight;
}
public BigDecimal getFreightPay() {
return this.freightPay;
}
public void setFreightPay(BigDecimal freightPay) {
this.freightPay = freightPay;
}
public String getPaymentMethod() {
return this.paymentMethod;
}
public void setPaymentMethod(String paymentMethod) {
this.paymentMethod = paymentMethod;
}
@NotNull
public BigDecimal getPriceOff() {
return this.priceOff;
}
public void setPriceOff(BigDecimal priceOff) {
this.priceOff = priceOff;
}
public BigDecimal getPayByPoint() {
return this.payByPoint;
}
public void setPayByPoint(BigDecimal payByPoint) {
this.payByPoint = payByPoint;
}
public Integer getPointLeft() {
return this.pointLeft;
}
public void setPointLeft(Integer pointLeft) {
this.pointLeft = pointLeft;
}
public BigDecimal getPayFromAccount() {
return this.payFromAccount;
}
public void setPayFromAccount(BigDecimal payFromAccount) {
this.payFromAccount = payFromAccount;
}
public BigDecimal getAccountBalance() {
return this.accountBalance;
}
public void setAccountBalance(BigDecimal accountBalance) {
this.accountBalance = accountBalance;
}
public String getDeliveryDatePeriod() {
return this.deliveryDatePeriod;
}
public void setDeliveryDatePeriod(String deliveryDatePeriod) {
this.deliveryDatePeriod = deliveryDatePeriod;
}
public String getDeliveryTimePeriod() {
return this.deliveryTimePeriod;
}
public void setDeliveryTimePeriod(String deliveryTimePeriod) {
this.deliveryTimePeriod = deliveryTimePeriod;
}
public String getReceiverName() {
return this.receiverName;
}
public void setReceiverName(String receiverName) {
this.receiverName = receiverName;
}
public String getReceiverPhoneNumber() {
return this.receiverPhoneNumber;
}
public void setReceiverPhoneNumber(String receiverPhoneNumber) {
this.receiverPhoneNumber = receiverPhoneNumber;
}
public String getReceiverAddress() {
return this.receiverAddress;
}
public void setReceiverAddress(String receiverAddress) {
this.receiverAddress = receiverAddress;
}
public String getReceiverProvince() {
return this.receiverProvince;
}
public void setReceiverProvince(String receiverProvince) {
this.receiverProvince = receiverProvince;
}
public String getReceiverCity() {
return this.receiverCity;
}
public void setReceiverCity(String receiverCity) {
this.receiverCity = receiverCity;
}
public String getReceiverDistrict() {
return this.receiverDistrict;
}
public void setReceiverDistrict(String receiverDistrict) {
this.receiverDistrict = receiverDistrict;
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this);
}
}