|
@@ -335,7 +335,8 @@ public class MercCouponFactoryBase extends ServiceImpl<MercCouponMapper, MercCou
|
|
|
if (Objects.equals(mercCoupon.getType(), CouponTypeEnum.T_2.getCode())) {
|
|
|
JSONObject priceJson = JSONUtil.parseObj(mercCoupon.getPrice());
|
|
|
BigDecimal scalar = new BigDecimal(priceJson.getStr("scalar"));
|
|
|
- goods.set("priceOnsale", goods.getInt("priceOnsale") * scalar.doubleValue());
|
|
|
+ goods.set("priceOnsale", scalar.multiply(goods.getBigDecimal("priceOnsale")).setScale(0, RoundingMode.CEILING).intValue());
|
|
|
+ goods.set("amount", scalar.multiply(goods.getBigDecimal("amount")).setScale(0, RoundingMode.CEILING).intValue());
|
|
|
goods.set("msg", goods.getString("msg") + priceJson.getStr("scalar").replace("0.", "") + "折券;");
|
|
|
}
|
|
|
//满减券
|
|
@@ -379,10 +380,9 @@ public class MercCouponFactoryBase extends ServiceImpl<MercCouponMapper, MercCou
|
|
|
BigDecimal zyh = new BigDecimal(priceOnsaleType1);
|
|
|
//计算公式:(单价*数量/总金额*总优惠)
|
|
|
Integer goodsYh = promotionPriceOnsale.multiply(num).divide(zje, 2, BigDecimal.ROUND_HALF_UP).multiply(zyh).setScale(0, RoundingMode.CEILING).intValue();
|
|
|
-
|
|
|
- Integer priceOnsale = promotionPriceOnsale.multiply(num).subtract(new BigDecimal(goodsYh)).intValue();
|
|
|
-
|
|
|
+ Integer priceOnsale = promotionPriceOnsale.subtract(new BigDecimal(goodsYh).divide(num, 2, BigDecimal.ROUND_HALF_UP)).intValue();
|
|
|
goods.set("priceOnsale", priceOnsale);
|
|
|
+ goods.set("amount", goods.getInt("amount") - goodsYh);
|
|
|
goods.set("msg", goods.getString("msg") + "满减券减:" + (goodsYh * 0.01) + "元;");
|
|
|
}
|
|
|
}
|