| | |
| | | return BigDecimalUtil.getWithNoZera(money).setScale(2);
|
| | | }
|
| | |
|
| | |
|
| | | public static BigDecimal getGoodsShareMoney(PDDGoodsDetail goods, BigDecimal rate) {
|
| | | BigDecimal money = null;
|
| | | BigDecimal hundred = new BigDecimal(100);
|
| | | rate = MoneyBigDecimalUtil.div(rate, hundred);
|
| | | BigDecimal price = MoneyBigDecimalUtil.div(new BigDecimal(goods.getMinGroupPrice()), hundred).setScale(2);
|
| | | BigDecimal promotionRate = MoneyBigDecimalUtil.div3(new BigDecimal(goods.getPromotionRate()),
|
| | | new BigDecimal(1000));
|
| | | Boolean hasCoupon = goods.getHasCoupon();
|
| | | if (hasCoupon == null || !hasCoupon) {
|
| | | money = MoneyBigDecimalUtil.mul(MoneyBigDecimalUtil.mul(price, promotionRate), rate);
|
| | | } else {
|
| | | BigDecimal amount = MoneyBigDecimalUtil.div(new BigDecimal(goods.getCouponDiscount()), hundred);
|
| | | BigDecimal startFree = MoneyBigDecimalUtil.div(new BigDecimal(goods.getCouponMinOrderAmount()), hundred);
|
| | | if (startFree.compareTo(price) <= 0 && price.compareTo(amount) > 0) {
|
| | | BigDecimal finalPrice = price.subtract(amount);
|
| | | money = MoneyBigDecimalUtil.mul(MoneyBigDecimalUtil.mul(finalPrice, promotionRate), rate);
|
| | | } else {// 不能用券
|
| | | money = MoneyBigDecimalUtil.mul(MoneyBigDecimalUtil.mul(price, promotionRate), rate);
|
| | | }
|
| | | }
|
| | | return BigDecimalUtil.getWithNoZera(money).setScale(2);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 计算商品券后价,没有券则返回原价
|
| | | *
|