Commit 4b26bb75 by 王祖波

增加折扣

parent 47ab956a
package com.gic.haoban.manage.api.dto.contact; package com.gic.haoban.manage.api.dto.contact;
import cn.hutool.core.util.NumberUtil;
import java.io.Serializable; import java.io.Serializable;
import java.math.RoundingMode;
public class ContactOrderGoodsInfoDTO implements Serializable { public class ContactOrderGoodsInfoDTO implements Serializable {
private static final long serialVersionUID = 973688857967269975L; private static final long serialVersionUID = 973688857967269975L;
...@@ -31,6 +34,17 @@ public class ContactOrderGoodsInfoDTO implements Serializable { ...@@ -31,6 +34,17 @@ public class ContactOrderGoodsInfoDTO implements Serializable {
private Double payAmount; private Double payAmount;
/** /**
* 吊牌价
*/
private Double unitPrice;
/**
* 折扣 = 实付/吊牌价
*
*/
private Double discount;
/**
* 商品名称 * 商品名称
*/ */
private String proName; private String proName;
...@@ -95,6 +109,28 @@ public class ContactOrderGoodsInfoDTO implements Serializable { ...@@ -95,6 +109,28 @@ public class ContactOrderGoodsInfoDTO implements Serializable {
this.payAmount = payAmount; this.payAmount = payAmount;
} }
public Double getUnitPrice() {
return unitPrice;
}
public void setUnitPrice(Double unitPrice) {
this.unitPrice = unitPrice;
}
public Double getDiscount() {
if (unitPrice != null && payAmount != null) {
if (unitPrice == 0) {
return 1.0;
}
return NumberUtil.div(payAmount * 1.0, unitPrice.doubleValue(), 2, RoundingMode.HALF_UP);
}
return discount;
}
public void setDiscount(Double discount) {
this.discount = discount;
}
public String getProName() { public String getProName() {
return proName; return proName;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment