| | |
| | | if(vo.getDiscountAlgorithm() == OrderItemConstants.DISCOUNT_ALGORITHM_TOTAL){ |
| | | actualTotal = promotion.getTotal(); |
| | | }else{ |
| | | actualTotal = promotion.getTotal().multiply(vo.getDiscount().divide(new BigDecimal(100),15,BigDecimal.ROUND_HALF_UP)).setScale(2,BigDecimal.ROUND_HALF_UP); |
| | | actualTotal = promotion.getTotal().multiply(vo.getDiscount().divide(new BigDecimal(100),15,RoundingMode.HALF_UP)).setScale(2,RoundingMode.HALF_UP); |
| | | } |
| | | |
| | | //一级子订单金额信息设值 |
| | |
| | | if(vo.getDiscountAlgorithm() == OrderItemConstants.DISCOUNT_ALGORITHM_TOTAL){ |
| | | actualTotal = project.getPrice(); |
| | | }else{ |
| | | actualTotal = project.getPrice().multiply(vo.getDiscount().divide(new BigDecimal(100),15,BigDecimal.ROUND_UP)).setScale(2,RoundingMode.HALF_UP); |
| | | actualTotal = project.getPrice().multiply(vo.getDiscount().divide(new BigDecimal(100),15,RoundingMode.HALF_UP)).setScale(2,RoundingMode.HALF_UP); |
| | | } |
| | | |
| | | //一级子订单金额信息设值 |
| | |
| | | orderItemSon.setCurPrice(orderItemSon.getProPrice().multiply(orderItemSon.getDiscount().divide(new BigDecimal(100),15,RoundingMode.HALF_UP)).setScale(2,RoundingMode.HALF_UP)); |
| | | } |
| | | |
| | | //优惠前小计=订单售价*数量 |
| | | BigDecimal total = promotionInfo.getDiscountAfterPrice().multiply(new BigDecimal(vo.getBuyNum())).setScale(2,RoundingMode.HALF_UP); |
| | | if(orderItemSon.getDiscountAlgorithm() == OrderItemConstants.DISCOUNT_ALGORITHM_TOTAL){ |
| | | orderItemSon.setTotal(orderItemSon.getCurPrice().multiply(new BigDecimal(vo.getBuyNum())).setScale(2,RoundingMode.HALF_UP)); |
| | | vo.setTotal(vo.getTotal().multiply(vo.getDiscount().divide(new BigDecimal(100),15,RoundingMode.HALF_UP)).setScale(2,RoundingMode.HALF_UP)); |
| | | vo.setDiscountMoney(vo.getTotal().divide(new BigDecimal(vo.getBuyNum()),5,RoundingMode.HALF_UP)); |
| | | orderItemSon.setTotal(promotionInfo.getDiscountAfterPrice().multiply(new BigDecimal(vo.getBuyNum())).setScale(2,RoundingMode.HALF_UP)); |
| | | orderItemSon.setTotal(vo.getTotal().multiply(vo.getDiscount().divide(new BigDecimal(100),15,RoundingMode.HALF_UP)).setScale(2,RoundingMode.HALF_UP)); |
| | | orderItemSon.setDiscountMoney(vo.getTotal().divide(new BigDecimal(vo.getBuyNum()),5,RoundingMode.HALF_UP)); |
| | | //折扣金额 |
| | | orderItemSon.setDiscountOrderPrice(total.subtract(orderItemSon.getTotal())); |
| | | }else{ |
| | | //优惠前小计=订单售价*数量 |
| | | orderItemSon.setTotal(orderItemSon.getCurPrice().multiply(new BigDecimal(vo.getBuyNum())).setScale(2,BigDecimal.ROUND_UP)); |
| | | orderItemSon.setTotal(total.multiply(orderItemSon.getDiscount().divide(new BigDecimal(100),15,RoundingMode.HALF_UP)).setScale(2,RoundingMode.HALF_UP)); |
| | | //折扣金额 |
| | | orderItemSon.setDiscountOrderPrice(total.subtract(orderItemSon.getTotal())); |
| | | orderItemSon.setDiscountMoney(orderItemSon.getCurPrice()); |
| | | } |
| | | //计算折扣金额 |
| | | vo.setDiscountOrderPrice(orderItemSon.getProPrice().multiply(BigDecimal.valueOf(vo.getBuyNum()).setScale(2,RoundingMode.HALF_UP)).subtract(orderItemSon.getTotal())); |
| | | |
| | | //优惠券抵扣金额 |
| | | orderItemSon.setDiscountPrice(BigDecimal.ZERO); |
| | | //优惠后小计=优惠前小计-优惠券抵扣金额 |
| | | orderItemSon.setActualTotal(orderItemSon.getTotal().subtract(orderItemSon.getDiscountPrice()).setScale(2, RoundingMode.HALF_UP)); |
| | | |
| | | |
| | | //可算积分 |
| | | if(integralTotal.compareTo(BigDecimal.ZERO) > 0){ |