Pu Zhibing
2024-12-06 7dc4502634b3b5a982a9899dbf8e36d0b016231c
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;
@@ -24,6 +25,7 @@
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 org.springframework.stereotype.Service;
@@ -54,6 +56,8 @@
    private TokenService tokenService;
    @Resource
    private TechnicianClient technicianClient;
    @Resource
    private GoodsClient goodsClient;
    @Override
@@ -70,6 +74,7 @@
        if (order == null){
            throw new ServiceException("订单不存在");
        }
        // 商品
        List<OrderGood> orderGoods = orderGoodMapper.selectList(new LambdaQueryWrapper<OrderGood>()
                .eq(OrderGood::getOrderId, orderId));
@@ -81,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);
        }
        // 收货地址
@@ -114,6 +122,15 @@
        }
        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());