From a966dafb8877552267a94fe8c544c5ea72cf5650 Mon Sep 17 00:00:00 2001
From: huliguo <2023611923@qq.com>
Date: 星期一, 16 六月 2025 09:44:40 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/2.0' into 2.0

---
 ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/order/OrderServiceImpl.java |   73 +++++++++++++++++++++++++++++++-----
 1 files changed, 63 insertions(+), 10 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 1ab53ad..24d7837 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
@@ -181,6 +181,7 @@
         if(shop!=null&&shop.getShopStatus()!=1){
             throw new ServiceException(AppErrorConstant.SHOP_CLOSED);
         }
+        Shop belongShop = remoteShopService.getShop(shop.getBelongShopId()).getData();
         // 初始化订单对象
         AppSureOrderVo appSureOrderVo = new AppSureOrderVo();
         // 初始化订单商品列表
@@ -266,6 +267,14 @@
             ShopGoods shopGoods = remoteGoodsService.getShopGoods(appShopGoodsGetDto).getData();
             if (shopGoods != null) {
                 goodsPrice = shopGoods.getSalesPrice();
+            } else {
+                //经销商定制价格
+                appShopGoodsGetDto.setGoodsId(goods.getGoodsId());
+                appShopGoodsGetDto.setShopId(belongShop.getShopId());
+                shopGoods = remoteGoodsService.getShopGoods(appShopGoodsGetDto).getData();
+                if (1 == belongShop.getModifyPricePermission() && null != shopGoods) {
+                    goodsPrice = shopGoods.getSalesPrice();
+                }
             }
             appSureOrderGoodsVo.setGoodsPrice(goodsPrice);
             buyNumBig = BigDecimal.valueOf(buyNum);
@@ -449,6 +458,16 @@
         ShopGoods shopGoods = remoteGoodsService.getShopGoods(appShopGoodsGetDto).getData();
         if (shopGoods != null) {
             goodsPrice = shopGoods.getSalesPrice();
+        } else {
+            //经销商定制价格
+            Shop belongShop = remoteShopService.getShop(shop.getBelongShopId()).getData();
+            appShopGoodsGetDto = new AppShopGoodsGetDto();
+            appShopGoodsGetDto.setGoodsId(goods.getGoodsId());
+            appShopGoodsGetDto.setShopId(belongShop.getShopId());
+            shopGoods = remoteGoodsService.getShopGoods(appShopGoodsGetDto).getData();
+            if (1 == belongShop.getModifyPricePermission() && null != shopGoods) {
+                goodsPrice = shopGoods.getSalesPrice();
+            }
         }
         appPanicBuyVo.setGoodsPrice(goodsPrice);
         buyNumBig = BigDecimal.valueOf(buyNum);
@@ -588,6 +607,18 @@
             if (shopGoods != null) {
                 goodsPrice = shopGoods.getSalesPrice();
                 serviceNum = shopGoods.getServiceNum();
+            } else {
+                //经销商定制价格
+                Shop shop = remoteShopService.getShop(appPlaceOrderDto.getShopId()).getData();
+                Shop belongShop = remoteShopService.getShop(shop.getBelongShopId()).getData();
+                appShopGoodsGetDto = new AppShopGoodsGetDto();
+                appShopGoodsGetDto.setGoodsId(goods.getGoodsId());
+                appShopGoodsGetDto.setShopId(belongShop.getShopId());
+                shopGoods = remoteGoodsService.getShopGoods(appShopGoodsGetDto).getData();
+                if (1 == belongShop.getModifyPricePermission() && null != shopGoods) {
+                    goodsPrice = shopGoods.getSalesPrice();
+                    serviceNum = shopGoods.getServiceNum();
+                }
             }
             appSureOrderGoodsVo.setGoodsPrice(goodsPrice);
             // 计算商品总价
@@ -3032,9 +3063,27 @@
                 if (merMemberNoClearOrderVo.getUnPaidMoney() == null) {
                     merMemberNoClearOrderVo.setUnPaidMoney(zeroBig);
                 }
-                if(merMemberNoClearOrderVo.getUnPaidMoney().compareTo(zeroBig)<0){
+                if (merMemberNoClearOrderVo.getUnPaidMoney().compareTo(zeroBig) < 0) {
                     merMemberNoClearOrderVo.setUnPaidMoney(zeroBig);
                 }
+                List<MerCouponGoodsListVo> goodsList = new ArrayList<>();
+                orderGoodsService.listByOrderId(merMemberNoClearOrderVo.getOrderId()).forEach(orderGoodsVo -> {
+                    MerCouponGoodsListVo merCouponGoodsListVo = new MerCouponGoodsListVo();
+                    merCouponGoodsListVo.setGoodsId(orderGoodsVo.getGoodsId());
+                    merCouponGoodsListVo.setGoodsName(orderGoodsVo.getGoodsName());
+                    merCouponGoodsListVo.setGoodsNum(orderGoodsVo.getBuyNum());
+                    if (orderGoodsVo.getGoodsType() == 1) {
+                        merCouponGoodsListVo.setGoodsType("周期");
+                    } else if (orderGoodsVo.getGoodsType() == 2) {
+                        merCouponGoodsListVo.setGoodsType("服务");
+                    } else if (orderGoodsVo.getGoodsType() == 3) {
+                        merCouponGoodsListVo.setGoodsType("体验");
+                    } else if (orderGoodsVo.getGoodsType() == 4) {
+                        merCouponGoodsListVo.setGoodsType("单品");
+                    }
+                    goodsList.add(merCouponGoodsListVo);
+                });
+                merMemberNoClearOrderVo.setGoodsList(goodsList);
             }
         }
         return merMemberNoClearOrderVoList;
@@ -4801,17 +4850,17 @@
         if (memberGiftRecord.getGiftFrom() == 1) {
             BirthdayCard birthdayCard = remoteMemberService.getBirthdayCard().getData();
             //判断生日活动状态
-            if(birthdayCard!=null&&birthdayCard.getCardStatus()==1){
+            if (birthdayCard != null && birthdayCard.getCardStatus() == 1) {
                 shop = remoteShopService.getShop(shopId).getData();
                 //判断指定区域全部店铺
-                if(birthdayCard.getAreaFlag()==2&&birthdayCard.getShopFlag()==1&&!StringUtils.checkString(birthdayCard.getDesignatedArea(),shop.getShopCityCode())){
+                if (birthdayCard.getAreaFlag() == 2 && birthdayCard.getShopFlag() == 1 && !StringUtils.checkString(birthdayCard.getDesignatedArea(), shop.getShopCityCode())) {
                     throw new ServiceException(AppErrorConstant.VERIFY_SHOP_ERROR);
                 }
                 //判断指定店铺
-                if(birthdayCard.getShopFlag()==2&&!StringUtils.checkString(birthdayCard.getApplicableShop(),shopId.toString())){
+                if (birthdayCard.getShopFlag() == 2 && !StringUtils.checkString(birthdayCard.getApplicableShop(), shopId.toString())) {
                     throw new ServiceException(AppErrorConstant.VERIFY_SHOP_ERROR);
                 }
-            }else{
+            } else {
                 throw new ServiceException(AppErrorConstant.BIRTHDAY_CARD_ERROR);
             }
         }
@@ -4819,16 +4868,20 @@
         if (memberGiftRecord.getGiftFrom() == 2 && !memberGiftRecord.getShopId().equals(shopId)) {
             throw new ServiceException(AppErrorConstant.VERIFY_SHOP_ERROR);
         }
-
+    
         merVerifyAwardVo.setUserName(member.getRealName());
         merVerifyAwardVo.setUserMobile(member.getMobile());
-        if (memberGiftRecord.getGiftFrom() == 1) {
-            merVerifyAwardVo.setGiftFrom("平台生日卡");
+        if (1 == memberGiftRecord.getPrizeFrom()) {
+            if (memberGiftRecord.getGiftFrom() == 1) {
+                merVerifyAwardVo.setGiftFrom("平台生日卡");
+            } else {
+                merVerifyAwardVo.setGiftFrom("商户生日卡");
+            }
         } else {
-            merVerifyAwardVo.setGiftFrom("商户生日卡");
+            merVerifyAwardVo.setGiftFrom("平台抽奖");
         }
         merVerifyAwardVo.setGiftType(memberGiftRecord.getGiftType());
-        //礼物类型1优惠券2商品3现金4实物
+        //礼物类型1优惠券2商品3现金4实物5积分
         switch (memberGiftRecord.getGiftType()) {
             case 1:
                 merVerifyAwardVo.setGiftName(memberGiftRecord.getCouponName());

--
Gitblit v1.7.1