📄 order.java
字号:
package com.webshop.domain;
/**
* @author w
*
* To change this generated comment edit the template variable "typecomment":
* Window>Preferences>Java>Templates.
* To enable and disable the creation of type comments go to
* Window>Preferences>Java>Code Generation.
*/
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
public class Order implements Serializable {
public final static String ORDER_STATUS_PREPROCESSED="预处理";
public final static String ORDER_STATUS_NOTPAY="未付款";
public final static String ORDER_STATUS_PAIED="已付款";
public final static String ORDER_STATUS_DELIVER="已配送";
public final static String ORDER_STATUS_PROCESSED="已处理";
public final static String ORDER_STATUS_CANCELED="已取消";
/* Private Fields */
private int orderId;
private String userId;
private Date orderDate;
private String shipAddress1;
private String shipAddress2;
private String shipCity;
private String shipState;
private String shipZip;
private String shipCountry;
private String courier;
private BigDecimal totalPrice;
private String shipToName;
private List lineItems = new ArrayList();
private PayInfo payInfo;
/* JavaBeans Properties */
public int getOrderId() {
return orderId;
}
public void setOrderId(int orderId) {
this.orderId = orderId;
}
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public Date getOrderDate() {
return orderDate;
}
public void setOrderDate(Date orderDate) {
this.orderDate = orderDate;
}
public String getShipAddress1() {
return shipAddress1;
}
public void setShipAddress1(String shipAddress1) {
this.shipAddress1 = shipAddress1;
}
public String getShipAddress2() {
return shipAddress2;
}
public void setShipAddress2(String shipAddress2) {
this.shipAddress2 = shipAddress2;
}
public String getShipCity() {
return shipCity;
}
public void setShipCity(String shipCity) {
this.shipCity = shipCity;
}
public String getShipState() {
return shipState;
}
public void setShipState(String shipState) {
this.shipState = shipState;
}
public String getShipZip() {
return shipZip;
}
public void setShipZip(String shipZip) {
this.shipZip = shipZip;
}
public String getShipCountry() {
return shipCountry;
}
public void setShipCountry(String shipCountry) {
this.shipCountry = shipCountry;
}
public String getCourier() {
return courier;
}
public void setCourier(String courier) {
this.courier = courier;
}
public BigDecimal getTotalPrice() {
return totalPrice;
}
public void setTotalPrice(BigDecimal totalPrice) {
this.totalPrice = totalPrice;
}
public String getShipToName() {
return shipToName;
}
public void setShipToName(String shipToName) {
this.shipToName = shipToName;
}
public PayInfo getPayInfo() {
return payInfo;
}
public void setPayInfo(PayInfo payInfo) {
this.payInfo = payInfo;
}
public void setLineItems(List lineItems) {
this.lineItems = lineItems;
}
public List getLineItems() {
return lineItems;
}
/* Public Methods */
public void initOrder(int id,Account account, Cart cart) {
orderId=id;
userId = account.getUserId();
orderDate = new Date();
shipToName = account.getName();
shipAddress1 = account.getAddr1();
shipAddress2 = account.getAddr2();
shipCity = account.getCity();
shipState = account.getState();
shipZip = account.getZip();
shipCountry = account.getCountry();
payInfo=new PayInfo(id);
/**
* billToFirstName = account.getFirstName();
billToLastName = account.getLastName();
billAddress1 = account.getAddress1();
billAddress2 = account.getAddress2();
billCity = account.getCity();
billState = account.getState();
billZip = account.getZip();
billCountry = account.getCountry();
*/
totalPrice = cart.getSubTotal();
courier = "UPS";
Iterator i = cart.getCartItems();
while (i.hasNext()) {
CartItem cartItem = (CartItem) i.next();
addLineItem(cartItem);
}
}
public void addLineItem(CartItem cartItem) {
LineItem lineItem = new LineItem(lineItems.size() + 1, cartItem);
addLineItem(lineItem);
}
public void addLineItem(LineItem lineItem) {
lineItems.add(lineItem);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -