package org.xmx0632.deliciousfruit.api.v1.bo;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
public class SettlementResponse {
private Result result;
private String transactionID;
// 总价
private BigDecimal totalPrice = BigDecimal.ZERO;
// 运费
private BigDecimal freight = BigDecimal.valueOf(10.0);
// 实际运费
private BigDecimal freightPay = BigDecimal.valueOf(10.0);
// 实际需支付
private BigDecimal actualAmount = BigDecimal.ZERO;
// 用户当前可享受的促销活动
private PromotionInfo promotionInfo = new PromotionInfo();
// 促销提示
private List<String> promotionTips = new ArrayList<String>();
public List<String> getPromotionTips() {
return promotionTips;
}
public void setPromotionTips(List<String> promotionTips) {
this.promotionTips = promotionTips;
}
public void addPromotionTip(String promotionTip) {
this.promotionTips.add(promotionTip);
}
public Result getResult() {
return result;
}
public void setResult(Result result) {
this.result = result;
}
public String getTransactionID() {
return transactionID;
}
public void setTransactionID(String transactionID) {
this.transactionID = transactionID;
}
public BigDecimal getTotalPrice() {
return totalPrice;
}
public void setTotalPrice(BigDecimal totalPrice) {
this.totalPrice = totalPrice;
}
public BigDecimal getActualAmount() {
return actualAmount;
}
public void setActualAmount(BigDecimal actualAmount) {
this.actualAmount = actualAmount;
}
public PromotionInfo getPromotionInfo() {
return promotionInfo;
}
public void setPromotionInfo(PromotionInfo promotionInfo) {
if (promotionInfo != null
&& (promotionInfo.getPromotionForProduct() != null || promotionInfo
.getPromotionForTotal() != null)) {
this.promotionInfo = promotionInfo;
}
}
public BigDecimal getFreight() {
return freight;
}
public void setFreight(BigDecimal freight) {
this.freight = freight;
}
public BigDecimal getFreightPay() {
return freightPay;
}
public void setFreightPay(BigDecimal freightPay) {
this.freightPay = freightPay;
}
@Override
public String toString() {
return "SettlementResponse [result=" + result + ", transactionID="
+ transactionID + ", totalPrice=" + totalPrice + ", freight="
+ freight + ", freightPay=" + freightPay + ", actualAmount="
+ actualAmount + ", promotionInfo=" + promotionInfo
+ ", promotionTips=" + promotionTips + "]";
}
public static class PromotionInfo {
private PromotionDetails promotionForTotal = new PromotionDetails();
private PromotionDetails promotionForProduct = new PromotionDetails();
@Override
public String toString() {
return "PromotionInfo [promotionForTotal=" + promotionForTotal
+ ", promotionForProduct=" + promotionForProduct + "]";
}
public PromotionDetails getPromotionForTotal() {
return promotionForTotal;
}
public void setPromotionForTotal(PromotionDetails promotionForTotal) {
this.promotionForTotal = promotionForTotal;
}
public PromotionDetails getPromotionForProduct() {
return promotionForProduct;
}
public void setPromotionForProduct(PromotionDetails promotionForProduct) {
this.promotionForProduct = promotionForProduct;
}
}
public static class PromotionDetails {
private BigDecimal priceOff = BigDecimal.ZERO;// 根据促销规则,用户可以省下的金额
private List<ProductFreeInfo> productsFree = new ArrayList<ProductFreeInfo>();// 赠品
public PromotionDetails() {
}
public PromotionDetails(BigDecimal priceOff,
List<ProductFreeInfo> productsFree) {
this.priceOff = priceOff;
this.productsFree = productsFree;
}
@Override
public String toString() {
return "PromotionDetails [priceOff=" + priceOff + ", productsFree="
+ productsFree + "]";
}
public BigDecimal getPriceOff() {
return priceOff;
}
public void setPriceOff(BigDecimal priceOff) {
this.priceOff = priceOff;
}
public List<ProductFreeInfo> getProductsFree() {
return productsFree;
}
public void setProductsFree(List<ProductFreeInfo> productsFree) {
this.productsFree = productsFree;
}
public void addProductsFree(ProductFreeInfo productsFree) {
if (productsFree == null) {
return;
}
this.productsFree.add(productsFree);
}
public void addProductsFreeList(List<ProductFreeInfo> productsFree) {
if (productsFree == null) {
return;
}
this.productsFree.addAll(productsFree);
}
public void addPriceOff(BigDecimal priceOff2) {
if (priceOff2 == null) {
return;
}
this.priceOff = priceOff.add(priceOff2);
}
}
// 促销/赠送商品信息
public static class ProductFreeInfo {
private String productName;
private int quantity;
private String unit;
private String spec;
public ProductFreeInfo(String productName, int quantity, String unit,
String spec) {
this.productName = productName;
this.quantity = quantity;
this.unit = unit;
this.spec = spec;
}
public ProductFreeInfo() {
}
@Override
public String toString() {
return "ProductFreeInfo [productName=" + productName
+ ", quantity=" + quantity + ", unit=" + unit + ", spec="
+ spec + "]";
}
public int getQuantity() {
return quantity;
}
public void setQuantity(int quantity) {
this.quantity = quantity;
}
public String getProductName() {
return productName;
}
public void setProductName(String productName) {
this.productName = productName;
}
public String getUnit() {
return unit;
}
public void setUnit(String unit) {
this.unit = unit;
}
public String getSpec() {
return spec;
}
public void setSpec(String spec) {
this.spec = spec;
}
}
}