商品單價價格是單位是(分),用戶下單金額=商品單價*折扣 代碼如下
Integer discount = 5 折扣五折
Integer orderPrice = 1000 單位分
BigDecimal bigDecimal = new BigDecimal(discount * 0.1 + "");
BigDecimal multiply = bigDecimal.multiply(new BigDecimal(orderPrice));
orderPrice = multiply.setScale(0, BigDecimal.ROUND_HALF_UP).intValue();