From 968e374ed1c2ef0595b277fc44067fb61e063a41 Mon Sep 17 00:00:00 2001
From: huliguo <2023611923@qq.com>
Date: 星期五, 04 七月 2025 17:33:57 +0800
Subject: [PATCH] bug修改

---
 ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/order/OrderServiceImpl.java |   30 +++++++++++++++++++++---------
 1 files changed, 21 insertions(+), 9 deletions(-)

diff --git a/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/order/OrderServiceImpl.java b/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/order/OrderServiceImpl.java
index fcd22cb..41499eb 100644
--- a/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/order/OrderServiceImpl.java
+++ b/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/order/OrderServiceImpl.java
@@ -184,7 +184,7 @@
         if(shop!=null&&shop.getShopStatus()!=1){
             throw new ServiceException(AppErrorConstant.SHOP_CLOSED);
         }
-        Shop belongShop = remoteShopService.getShop(shop.getBelongShopId()).getData();
+//        Shop belongShop = remoteShopService.getShop(shop.getBelongShopId()).getData();
         // 初始化订单对象
         AppSureOrderVo appSureOrderVo = new AppSureOrderVo();
         // 初始化订单商品列表
@@ -268,15 +268,20 @@
             appShopGoodsGetDto.setGoodsId(goods.getGoodsId());
             appShopGoodsGetDto.setShopId(appSureOrderDto.getShopId());
             ShopGoods shopGoods = remoteGoodsService.getShopGoods(appShopGoodsGetDto).getData();
+            //商户是否定制价格
             if (shopGoods != null) {
                 goodsPrice = shopGoods.getSalesPrice();
-            } else {
+            }
+            //是否绑定经销商
+            if(shop.getBelongShopId()!=null &&shop.getShopType()==2){
                 //经销商定制价格
-                appShopGoodsGetDto.setGoodsId(goods.getGoodsId());
-                appShopGoodsGetDto.setShopId(belongShop.getShopId());
-                shopGoods = remoteGoodsService.getShopGoods(appShopGoodsGetDto).getData();
+                AppShopGoodsGetDto shopGoodsGetDto=new AppShopGoodsGetDto();
+                shopGoodsGetDto.setGoodsId(goods.getGoodsId());
+                shopGoodsGetDto.setShopId(shop.getBelongShopId());
+                Shop belongShop = remoteShopService.getShop(shop.getBelongShopId()).getData();
+                shopGoods = remoteGoodsService.getShopGoods(shopGoodsGetDto).getData();
                 if (1 == belongShop.getModifyPricePermission() && null != shopGoods) {
-                    goodsPrice = shopGoods.getSalesPrice();
+                    goodsPrice=shopGoods.getSalesPrice();
                 }
             }
             appSureOrderGoodsVo.setGoodsPrice(goodsPrice);
@@ -461,7 +466,9 @@
         ShopGoods shopGoods = remoteGoodsService.getShopGoods(appShopGoodsGetDto).getData();
         if (shopGoods != null) {
             goodsPrice = shopGoods.getSalesPrice();
-        } else {
+        }
+        //是否绑定经销商
+        if(shop.getBelongShopId()!=null &&shop.getShopType()==2){
             //经销商定制价格
             Shop belongShop = remoteShopService.getShop(shop.getBelongShopId()).getData();
             appShopGoodsGetDto = new AppShopGoodsGetDto();
@@ -577,6 +584,10 @@
         //使用优惠券
         StringJoiner memberCouponSJ = new StringJoiner(",");
         List<String> goodsNameList = new ArrayList<>();
+        Shop shop = remoteShopService.getShop(appPlaceOrderDto.getShopId()).getData();
+        if(shop!=null&&shop.getShopStatus()!=1){
+            throw new ServiceException(AppErrorConstant.SHOP_CLOSED);
+        }
         // 遍历购买的商品列表
         for (AppBuyGoodsDto appBuyGoodsDto : appBuyGoodsDtoList) {
             appSureOrderGoodsVo = new AppSureOrderGoodsVo();
@@ -610,9 +621,10 @@
             if (shopGoods != null) {
                 goodsPrice = shopGoods.getSalesPrice();
                 serviceNum = shopGoods.getServiceNum();
-            } else {
+            }
+            //是否绑定经销商
+            if(shop.getBelongShopId()!=null &&shop.getShopType()==2){
                 //经销商定制价格
-                Shop shop = remoteShopService.getShop(appPlaceOrderDto.getShopId()).getData();
                 Shop belongShop = remoteShopService.getShop(shop.getBelongShopId()).getData();
                 appShopGoodsGetDto = new AppShopGoodsGetDto();
                 appShopGoodsGetDto.setGoodsId(goods.getGoodsId());

--
Gitblit v1.7.1