| | |
| | | .divide(BigDecimal.valueOf(exchangeType.getNums() == null ? 1 : exchangeType.getNums()), 2, java.math.RoundingMode.HALF_UP); |
| | | } else if (Integer.valueOf(2).equals(coupon.getType())) { |
| | | BigDecimal deduction = rule.getBigDecimal("conditionalAmount"); |
| | | if (deduction == null || orderCash.compareTo(deduction) < 0) { |
| | | if (deduction == null || deduction.compareTo(BigDecimal.ZERO) <= 0) { |
| | | return ResultUtil.error("该优惠券无法使用"); |
| | | } |
| | | // 代金券可覆盖全部订单金额,超出订单金额的部分不找零。 |
| | | ticketPayableCashAmount = orderCash.subtract(deduction).max(BigDecimal.ZERO); |
| | | cashAmount = ticketPayableCashAmount |
| | | .divide(BigDecimal.valueOf(exchangeType.getNums() == null ? 1 : exchangeType.getNums()), 2, java.math.RoundingMode.HALF_UP); |