| | |
| | | private Integer buyNum = 0; |
| | | /**子单现价x数量算出的总金额*/ |
| | | private BigDecimal skuPrice = BigDecimal.ZERO; |
| | | /**子单分摊系统金额(储值金+增值金)*/ |
| | | private BigDecimal skuSystemPrice = BigDecimal.ZERO; |
| | | /**子单优惠金额*/ |
| | | private BigDecimal skuDiscountPrice = BigDecimal.ZERO; |
| | | /**子单剩余还需支付的金额*/ |
| | | private BigDecimal skuRemainingPrice = BigDecimal.ZERO; |
| | | /**子单可抵扣最大现金金额*/ |
| | | private BigDecimal skuMaxCash = BigDecimal.ZERO; |
| | | |
| | |
| | | * 计算抵扣金额 |
| | | * */ |
| | | public void handlerMoney() { |
| | | //计算剩余还要支付的金额 |
| | | this.skuRemainingPrice = this.skuPrice.subtract(this.skuSystemPrice).subtract(this.skuDiscountPrice).setScale(2, RoundingMode.HALF_UP); |
| | | //计算子单最大可抵扣 |
| | | this.skuMaxCash = this.maxCash.multiply(new BigDecimal(this.buyNum)); |
| | | //如果Sku本身计算的最大抵扣现金 大于 剩余要支付的现金,取剩余要支付的现金 |
| | | if (this.skuMaxCash.compareTo(this.skuRemainingPrice) > 0){ |
| | | this.skuMaxCash = this.skuRemainingPrice; |
| | | } |
| | | //默认赋值cash |
| | | handlerCash(BigDecimal.ZERO); |
| | | } |