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