chenjiahe
2024-08-01 15bcdca8e0b3574cd9d8f21a90ee8ce7701edc4f
订单折扣-促销子单-二级子单
1个文件已修改
21 ■■■■■ 已修改文件
phi_platform_user/src/main/java/com/hx/phip/util/api/OrderCreateUtil.java 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
phi_platform_user/src/main/java/com/hx/phip/util/api/OrderCreateUtil.java
@@ -961,7 +961,7 @@
        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);
        }
    //一级子订单金额信息设值
@@ -1190,7 +1190,7 @@
        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);
        }
    //一级子订单金额信息设值
@@ -2479,23 +2479,26 @@
                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){