砍价活动极端情况为负数问题处理。
砍价金额保留两位小数
This commit is contained in:
parent
15c6b74829
commit
6c95a784f8
@ -19,6 +19,13 @@ public class KanjiaActivityGoodsVO {
|
||||
@ApiModelProperty(value = "最低购买金额")
|
||||
private Double purchasePrice;
|
||||
|
||||
public Double getPurchasePrice() {
|
||||
if (purchasePrice < 0) {
|
||||
return 0D;
|
||||
}
|
||||
return purchasePrice;
|
||||
}
|
||||
|
||||
@ApiModelProperty(value = "活动库存")
|
||||
private Integer stock;
|
||||
|
||||
|
@ -204,8 +204,7 @@ public class KanjiaActivityServiceImpl extends ServiceImpl<KanJiaActivityMapper,
|
||||
//获取随机砍价金额
|
||||
BigDecimal bigDecimal = RandomUtil.randomBigDecimal(Convert.toBigDecimal(kanjiaActivityGoods.getLowestPrice()),
|
||||
Convert.toBigDecimal(kanjiaActivityGoods.getHighestPrice()));
|
||||
bigDecimal.setScale(2, BigDecimal.ROUND_UP);
|
||||
return Convert.toDouble(bigDecimal, 0.0);
|
||||
return bigDecimal.setScale(2, BigDecimal.ROUND_UP).doubleValue();
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user