zhijiezhao пре 2 година
родитељ
комит
95cf02c243
1 измењених фајлова са 3 додато и 188 уклоњено
  1. 3 188
      src/main/java/com/caimei365/order/service/impl/SubmitServiceImpl.java

+ 3 - 188
src/main/java/com/caimei365/order/service/impl/SubmitServiceImpl.java

@@ -2373,88 +2373,9 @@ public class SubmitServiceImpl implements SubmitService {
                 // 商品税费
                 Double productTax = 0d;
                 Double discountTax = 0d;
-                // 商品是否处于活动状态
-                PromotionsVo promotions = null;
-                // 店铺促销优先
-                if (null == shopPromotions) {
-                    promotions = baseMapper.getPromotionByProductId(product.getProductId());
-                    if (null != promotions && 1 == promotions.getType() && 1 == promotions.getMode()) {
-                        //单品促销的优惠价时,touchPrice取当前sku的
-                        promotions.setTouchPrice(baseMapper.getTouchPriceBySku(skuId, promotions.getId()));
-                    }
-                }
-                //促销活动如果协销不可见,置为空
-                if (promotions != null && promotions.getSeen() != null && promotions.getSeen() == 2) {
-                    promotions = null;
-                }
-                // 计算单价
-                // 超级会员单价折扣计算
-                if (0 == orderProduct.getOrganizeId()) {
-                    if (null != svipProductPo && 1 == svipProductPo.getSvipProductFlag()) {
-                        // 超级会员优惠商品,不参与促销活动(普通机构购买该商品可参与店铺促销)/阶梯价/复购价
-                        if (svipUserFlag) {
-                            if (1 == svipProductPo.getSvipPriceType()) {
-                                // 折扣价
-                                discountPrice = MathUtil.div(MathUtil.mul(productPrice, svipProductPo.getSvipDiscount()), 100, 2).doubleValue();
-                            } else if (2 == svipProductPo.getSvipPriceType()) {
-                                // 直接优惠价
-                                discountPrice = svipProductPo.getSvipDiscountPrice();
-                            }
-                            // 商品超级会员优惠
-                            BigDecimal svipReduction = MathUtil.sub(productPrice, discountPrice);
-                            if (taxFlag) {
-                                // 商品税费超级会员优惠
-                                BigDecimal svipTaxReduction = MathUtil.div(MathUtil.mul(svipReduction, product.getTaxRate()), 100, 2);
-                                svipReduction = MathUtil.add(svipReduction, svipTaxReduction);
-                            }
-                            // 统计超级会员优惠
-                            product.setSvipReduction(svipReduction.doubleValue());
-                            svipShopReduction.set(MathUtil.add(svipShopReduction, MathUtil.mul(svipReduction, productNum)).doubleValue());
-                            svipFullReduction.set(MathUtil.add(svipFullReduction, MathUtil.mul(svipReduction, productNum)).doubleValue());
-                            // 保存订单商品svip数据
-                            product.setSvipPriceFlag(1);
-                            product.setSvipPriceType(svipProductPo.getSvipPriceType());
-                            product.setSvipDiscount(1 == svipProductPo.getSvipPriceType() ? svipProductPo.getSvipDiscount() : 0.00d);
-                        }
-                    }
-                    // 有单品优惠价促销活动
-                    else if (null != promotions || null != shopPromotions) {
-                        // 是否包含活动商品(受订单未支付自动关闭时间影响)  0 否 1 是
-                        hasActProductFlag = true;
-                        // 关闭阶梯价格,活动优先
-                        product.setLadderPriceFlag(0);
-                        product.setActProduct(1);
-                        if (null != promotions && promotions.getType() == 1 && promotions.getMode() == 1) {
-                            discountPrice = promotions.getTouchPrice();
-                        }
-                    }
-
-                    //有阶梯价
-                    else if (1 == product.getLadderPriceFlag()) {
-                        // 启用了阶梯价格
-                        List<LadderPriceVo> ladderPrices = baseMapper.getLadderPriceList(skuId);
-                        // 判断阶梯价格的购买数量校验
-                        int minBuyNumber = null != ladderPrices.get(0) ? ladderPrices.get(0).getBuyNum() : 0;
-                        if (productNum < minBuyNumber) {
-                            return ResponseJson.error("商品购买量低于最小起订量!", null);
-                        }
-                        //根据商品购买数量获取商品对应阶梯价格
-                        for (LadderPriceVo ladderPrice : ladderPrices) {
-                            if (productNum >= ladderPrice.getBuyNum()) {
-                                discountPrice = ladderPrice.getBuyPrice();
-                            }
-                        }
-                        product.setLadderPrices(ladderPrices);
-                        product.setActProduct(2);
-                    } else {
-                        // 复购价
-                        Double repurchase = baseMapper.getRepurchasePrice(skuId, shopOrder.getUserId());
-                        if (null != repurchase && repurchase > 0) {
-                            discountPrice = repurchase;
-                        }
-                        product.setActProduct(0);
-                    }
-                }
+                /**
+                 * 修改订单取消所有优惠,按修改金额为准
+                 */
                 if (MathUtil.compare(discountPrice, BigDecimal.ZERO) == 0) {
                     return ResponseJson.error("商品购买价格不能为0!", null);
                 }
@@ -2485,70 +2406,10 @@ public class SubmitServiceImpl implements SubmitService {
                 Double realProductFee = productFee;
                 // 单个商品总税费
                 Double taxFee = MathUtil.mul(discountTax, productNum).doubleValue();
-                if (hasActProductFlag && null != promotions) {
-                    // 单品促销
-                    if (0 == orderProduct.getOrganizeId()) {
-                        if (promotions.getType() == 1) {
-                            // 是否满足单品优惠条件(满足优惠价或者满减在这里进行设值)
-                            if (promotions.getMode() == 1 || MathUtil.compare(productFee, promotions.getTouchPrice()) >= 0) {
-                                // 满减
-                                if (promotions.getMode() == 2) {
-                                    if (promotions.getDiscount() != null && promotions.getDiscount() == 1) {
-                                        //叠加优惠计算
-                                        //叠加倍数
-                                        Double floor = Math.floor(MathUtil.div(productFee, promotions.getTouchPrice()).doubleValue());
-                                        promotionFullReduction.set(MathUtil.add(promotionFullReduction.get(), MathUtil.mul(promotions.getReducedPrice(), floor)).doubleValue());
-                                        productFee = MathUtil.sub(productFee, MathUtil.mul(promotions.getReducedPrice(), floor)).doubleValue();
-                                    } else {
-                                        // 统计订单总满减金额
-                                        promotionFullReduction.set(MathUtil.add(promotionFullReduction.get(), promotions.getReducedPrice()).doubleValue());
-                                        // 统计单个商品的折后金额
-                                        productFee = MathUtil.sub(productFee, promotions.getReducedPrice()).doubleValue();
-                                    }
-                                }
-                                // 添加到总促销
-                                if (!promotionsIds.contains(promotions.getId())) {
-                                    promotionsIds.add(promotions.getId());
-                                    promotions.setPromotionsId(promotions.getId());
-                                    promotionList.add(promotions);
-                                }
-                                product.setOrderPromotionsId(promotions.getId());
-                            }
-                            // 凑单优惠
-                        } else if (promotions.getType() == 2) {
-                            // 商品添加到总促销
-                            PromotionPriceVo promotionPrice = new PromotionPriceVo();
-                            promotionPrice.setProductId(product.getProductId());
-                            promotionPrice.setNumber(productNum);
-                            promotionPrice.setPrice(discountTaxPrice);
-                            if (null == promotions.getProductList()) {
-                                promotions.setProductList(new ArrayList<>());
-                            }
-                            promotions.getProductList().add(promotionPrice);
-                            if (!promotionsIds.contains(promotions.getId())) {
-                                promotionsIds.add(promotions.getId());
-                                promotions.setPromotionsId(promotions.getId());
-                                promotionList.add(promotions);
-                            } else {
-                                PromotionsVo finalPromotions = promotions;
-                                promotionList.forEach(promotionsTemp -> {
-                                    if (finalPromotions.getId().equals(promotionsTemp.getId())) {
-                                        promotionsTemp.getProductList().add(promotionPrice);
-                                    }
-                                });
-                            }
-                            product.setOrderPromotionsId(promotions.getId());
-                        }
-                    }
-                }
                 // 折后单价
                 product.setDiscountPrice(discountPrice);
                 // 折扣率 = 折后单价/机构价
                 product.setDiscount(discountRate);
-                if (svipPriceFlag || (null != promotions && promotions.getType() == 1 && promotions.getMode() == 1)) {
-                    // 超级会员价/单品优惠折扣率设置为100%
-                    product.setDiscount(100d);
-                }
                 // 单个商品的金额
                 product.setTotalAmount(productAmount);
                 // 单个商品的折后金额
@@ -2658,52 +2519,6 @@ public class SubmitServiceImpl implements SubmitService {
             orderProductList.add(product);
         }
 
-
-        if (0 == organizeId) {
-            if (null != shopPromotions) {
-                // 是否满足满减满赠
-                if (MathUtil.compare(shopPromotionFee.get(), shopPromotions.getTouchPrice()) >= 0) {
-                    // 是否包含活动商品(受订单未支付自动关闭时间影响)  0 否 1 是
-                    hasActProductFlag = true;
-                    // 满减
-                    if (shopPromotions.getMode() == 2) {
-                        if (shopPromotions.getDiscount() != null && shopPromotions.getDiscount() == 1) {
-                            //叠加优惠计算
-                            //叠加倍数
-                            Double floor = Math.floor(MathUtil.div(shopPromotionFee.get(), shopPromotions.getTouchPrice()).doubleValue());
-                            // 供应商满减金额
-                            shopOrder.setPromotionFullReduction(MathUtil.mul(shopPromotions.getReducedPrice(), floor).doubleValue());
-                            // 统计订单总满减金额
-                            promotionFullReduction.set(MathUtil.add(promotionFullReduction.get(), MathUtil.mul(shopPromotions.getReducedPrice(), floor)).doubleValue());
-                            // 统计店铺商品总金额
-                            shopProductFee.set(MathUtil.sub(shopProductFee.get(), MathUtil.mul(shopPromotions.getReducedPrice(), floor)).doubleValue());
-                            // 统计需要支付金额
-                            needPayAmount.set(MathUtil.sub(needPayAmount.get(), MathUtil.mul(shopPromotions.getReducedPrice(), floor)).doubleValue());
-                            // 统计需要支付金额
-                            shopAmount.set(MathUtil.sub(shopAmount.get(), MathUtil.mul(shopPromotions.getReducedPrice(), floor)).doubleValue());
-                        } else {
-                            // 供应商满减金额
-                            shopOrder.setPromotionFullReduction(shopPromotions.getReducedPrice());
-                            // 统计订单总满减金额
-                            promotionFullReduction.set(MathUtil.add(promotionFullReduction.get(), shopPromotions.getReducedPrice()).doubleValue());
-                            // 统计店铺商品总金额
-                            shopProductFee.set(MathUtil.sub(shopProductFee.get(), shopPromotions.getReducedPrice()).doubleValue());
-                            // 统计需要支付金额
-                            needPayAmount.set(MathUtil.sub(needPayAmount.get(), shopPromotions.getReducedPrice()).doubleValue());
-                            // 统计需要支付金额
-                            shopAmount.set(MathUtil.sub(shopAmount.get(), shopPromotions.getReducedPrice()).doubleValue());
-                        }
-                    }
-                    // 添加到总促销
-                    if (!promotionsIds.contains(shopPromotions.getId())) {
-                        promotionsIds.add(shopPromotions.getId());
-                        shopPromotions.setPromotionsId(shopPromotions.getId());
-                        promotionList.add(shopPromotions);
-                    }
-                    shopOrder.setOrderPromotionsId(shopPromotions.getId());
-                }
-            }
-        }
         // 佣金 采美应收
         shopOrder.setBrokerage(brokerage.get());
         // 可退款金额 = 余额抵扣金额