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 | 27 ++++++++++++++++++++++----- 1 files changed, 22 insertions(+), 5 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 fcbe4ed..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; @@ -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()); -- Gitblit v1.7.1