砍价活动,当随机金额超过剩余砍价金额时,返回剩余金额,防止超过
This commit is contained in:
parent
4dac80f084
commit
40822ca05b
@ -211,6 +211,10 @@ public class KanjiaActivityServiceImpl extends ServiceImpl<KanJiaActivityMapper,
|
|||||||
//获取随机砍价金额
|
//获取随机砍价金额
|
||||||
BigDecimal bigDecimal = RandomUtil.randomBigDecimal(Convert.toBigDecimal(kanjiaActivityGoods.getLowestPrice()),
|
BigDecimal bigDecimal = RandomUtil.randomBigDecimal(Convert.toBigDecimal(kanjiaActivityGoods.getLowestPrice()),
|
||||||
Convert.toBigDecimal(kanjiaActivityGoods.getHighestPrice()));
|
Convert.toBigDecimal(kanjiaActivityGoods.getHighestPrice()));
|
||||||
|
|
||||||
|
if(bigDecimal.setScale(2, RoundingMode.UP).doubleValue() > surplusPrice){
|
||||||
|
return surplusPrice;
|
||||||
|
}
|
||||||
return bigDecimal.setScale(2, RoundingMode.UP).doubleValue();
|
return bigDecimal.setScale(2, RoundingMode.UP).doubleValue();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user