From 7dc4502634b3b5a982a9899dbf8e36d0b016231c Mon Sep 17 00:00:00 2001
From: Pu Zhibing <393733352@qq.com>
Date: 星期五, 06 十二月 2024 19:31:05 +0800
Subject: [PATCH] 新增售后接口

---
 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderServiceImpl.java |   40 +++++++++++++++++++++++++++++++++-------
 1 files changed, 33 insertions(+), 7 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..9bfd041 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,6 +15,8 @@
 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;
@@ -22,10 +25,9 @@
 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.feignClient.GoodsClient;
 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 +56,9 @@
     private TokenService tokenService;
     @Resource
     private TechnicianClient technicianClient;
+    @Resource
+    private GoodsClient goodsClient;
+
 
     @Override
     public List<OrderVO> selectOrderListByUserId(Integer status, Long userId) {
@@ -69,6 +74,7 @@
         if (order == null){
             throw new ServiceException("订单不存在");
         }
+
         // 商品
         List<OrderGood> orderGoods = orderGoodMapper.selectList(new LambdaQueryWrapper<OrderGood>()
                 .eq(OrderGood::getOrderId, orderId));
@@ -80,14 +86,17 @@
 
             OrderGoodsVO orderGoodsVO = new OrderGoodsVO();
             orderGoodsVO.setGoodsId(orderGood.getGoodsId());
-            orderGoodsVO.setGoodsName(goods.getName());
-            orderGoodsVO.setType(goods.getType());
             orderGoodsVO.setNum(orderGood.getNum());
-            orderGoodsVO.setGoodsPic(goods.getHomePagePicture());
-            orderGoodsVO.setSellingPrice(goods.getSellingPrice());
-            orderGoodsVO.setOriginalPrice(goods.getOriginalPrice());
+            if (goods != null){
+                orderGoodsVO.setGoodsName(goods.getName());
+                orderGoodsVO.setType(goods.getType());
+                orderGoodsVO.setGoodsPic(goods.getHomePagePicture());
+                orderGoodsVO.setSellingPrice(goods.getSellingPrice());
+                orderGoodsVO.setOriginalPrice(goods.getOriginalPrice());
+            }
             goodsList.add(orderGoodsVO);
         }
+
 
 
         // 收货地址
@@ -113,7 +122,17 @@
         }
 
         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());
+        }
+
+
+
         orderDetailVO.setId(order.getId());
+        orderDetailVO.setOrderStatus(order.getOrderStatus());
         orderDetailVO.setPoint(order.getPoint());
         orderDetailVO.setAddressId(userAddress.getId());
         orderDetailVO.setRecieveName(userAddress.getRecieveName());
@@ -184,4 +203,11 @@
             }
         }
     }
+
+
+
+    @Override
+    public void commission(Long orderId) {
+
+    }
 }

--
Gitblit v1.7.1