From 6f54cebf07887237f5eb8efdf9d1d0b784dbaa49 Mon Sep 17 00:00:00 2001
From: puzhibing <393733352@qq.com>
Date: 星期二, 10 十二月 2024 10:05:20 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderServiceImpl.java |   53 +++++++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 45 insertions(+), 8 deletions(-)

diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderServiceImpl.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderServiceImpl.java
index a59f576..022167c 100644
--- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderServiceImpl.java
+++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderServiceImpl.java
@@ -1,5 +1,6 @@
 package com.ruoyi.order.service.impl;
 
+import cn.hutool.core.collection.CollectionUtil;
 import com.alibaba.fastjson2.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -14,18 +15,16 @@
 import com.ruoyi.order.enums.OrderType;
 import com.ruoyi.order.mapper.OrderGoodMapper;
 import com.ruoyi.order.mapper.OrderMapper;
+import com.ruoyi.order.model.Order;
+import com.ruoyi.order.model.OrderGood;
 import com.ruoyi.order.service.OrderService;
 import com.ruoyi.order.vo.OrderDetailVO;
 import com.ruoyi.order.vo.OrderGoodsVO;
 import com.ruoyi.order.vo.OrderVO;
-import com.ruoyi.other.api.domain.CouponInfo;
-import com.ruoyi.other.api.domain.Goods;
-import com.ruoyi.other.api.domain.OrderActivityInfo;
-import com.ruoyi.other.api.domain.Technician;
+import com.ruoyi.other.api.domain.*;
+import com.ruoyi.other.api.feignClient.ShopClient;
 import com.ruoyi.other.api.feignClient.TechnicianClient;
 import com.ruoyi.system.api.model.LoginUser;
-import model.Order;
-import model.OrderGood;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
@@ -54,6 +53,9 @@
     private TokenService tokenService;
     @Resource
     private TechnicianClient technicianClient;
+    @Resource
+    private ShopClient shopClient;
+
 
     @Override
     public List<OrderVO> selectOrderListByUserId(Integer status, Long userId) {
@@ -69,6 +71,11 @@
         if (order == null){
             throw new ServiceException("订单不存在");
         }
+        R<Shop> shopR = shopClient.getShopById(order.getShopId());
+        if (!R.isSuccess(shopR)){
+            throw new ServiceException("获取门店信息失败");
+        }
+
         // 商品
         List<OrderGood> orderGoods = orderGoodMapper.selectList(new LambdaQueryWrapper<OrderGood>()
                 .eq(OrderGood::getOrderId, orderId));
@@ -77,17 +84,17 @@
         for (OrderGood orderGood : orderGoods) {
             String goodJson = orderGood.getGoodJson();
             Goods goods = JSONObject.parseObject(goodJson, Goods.class);
-
             OrderGoodsVO orderGoodsVO = new OrderGoodsVO();
             orderGoodsVO.setGoodsId(orderGood.getGoodsId());
+            orderGoodsVO.setNum(orderGood.getNum());
             orderGoodsVO.setGoodsName(goods.getName());
             orderGoodsVO.setType(goods.getType());
-            orderGoodsVO.setNum(orderGood.getNum());
             orderGoodsVO.setGoodsPic(goods.getHomePagePicture());
             orderGoodsVO.setSellingPrice(goods.getSellingPrice());
             orderGoodsVO.setOriginalPrice(goods.getOriginalPrice());
             goodsList.add(orderGoodsVO);
         }
+
 
 
         // 收货地址
@@ -113,7 +120,24 @@
         }
 
         OrderDetailVO orderDetailVO = new OrderDetailVO();
+
+        if (CollectionUtil.isNotEmpty(orderGoods)){
+            String goodJson = orderGoods.get(0).getGoodJson();
+            Goods goods = JSONObject.parseObject(goodJson, Goods.class);
+            orderDetailVO.setDistributionMode(goods.getDistributionMode());
+        }
+
+        Technician technician = new Technician();
+        if (order.getTechnicianId() != null){
+            R<Technician> shopdetail = technicianClient.shopdetail(order.getTechnicianId());
+            if (shopdetail.getCode() != R.SUCCESS){
+                throw new ServiceException("获取技师信息失败");
+            }
+            technician = shopdetail.getData();
+        }
+        Shop shop = shopR.getData();
         orderDetailVO.setId(order.getId());
+        orderDetailVO.setOrderStatus(order.getOrderStatus());
         orderDetailVO.setPoint(order.getPoint());
         orderDetailVO.setAddressId(userAddress.getId());
         orderDetailVO.setRecieveName(userAddress.getRecieveName());
@@ -129,6 +153,12 @@
         orderDetailVO.setPointAmount(order.getGetPoint());
         orderDetailVO.setPaymentAmount(order.getPaymentAmount());
         orderDetailVO.setGoodsList(goodsList);
+        orderDetailVO.setShopName(shop.getName());
+        orderDetailVO.setShopAddress(shop.getAddress());
+        orderDetailVO.setLongitude(shop.getLongitude());
+        orderDetailVO.setLatitude(shop.getLatitude());
+        orderDetailVO.setShopId(shop.getId());
+        orderDetailVO.setTechnicianName(technician.getName());
         return orderDetailVO;
     }
 
@@ -184,4 +214,11 @@
             }
         }
     }
+
+
+
+    @Override
+    public void commission(Long orderId) {
+
+    }
 }

--
Gitblit v1.7.1