From 8cdadf81127b9d34a54d250a3abc878a8d5339c5 Mon Sep 17 00:00:00 2001
From: Pu Zhibing <393733352@qq.com>
Date: 星期五, 06 十二月 2024 19:31:25 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsEvaluateController.java |   28 ++++++++++++--
 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/OrderController.java         |   18 +++++++++
 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderServiceImpl.java      |   30 ++++++++------
 ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/vo/OrderDetailVO.java                   |   12 ++++++
 ruoyi-service/ruoyi-other/src/main/resources/mapper/other/TechnicianMapper.xml                  |    2 
 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsController.java         |    3 +
 6 files changed, 74 insertions(+), 19 deletions(-)

diff --git a/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/vo/OrderDetailVO.java b/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/vo/OrderDetailVO.java
index 3f9cd36..ece4111 100644
--- a/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/vo/OrderDetailVO.java
+++ b/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/vo/OrderDetailVO.java
@@ -65,4 +65,16 @@
     @ApiModelProperty(value = "配送方式(1=自提,2=快递)")
     private Integer distributionMode;
 
+    @ApiModelProperty(value = "门店名称")
+    private String shopName;
+
+    @ApiModelProperty(value = "门店地址")
+    private String shopAddress;
+
+    @ApiModelProperty(value = "经度")
+    private String longitude;
+
+    @ApiModelProperty(value = "纬度")
+    private String latitude;
+
 }
diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/OrderController.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/OrderController.java
index 5c9cab3..92505e4 100644
--- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/OrderController.java
+++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/OrderController.java
@@ -92,6 +92,7 @@
     })
     @GetMapping("/writeOff/{code}")
     public R<Void> writeOff(@PathVariable("code") String code){
+        // TODO 待完善
         return R.ok();
     }
 
@@ -104,9 +105,26 @@
     })
     @GetMapping("/cancel/{orderId}")
     public R<Void> cancel(@PathVariable("orderId") Long orderId){
+        // TODO 待完善
         return R.ok();
     }
 
+    /**
+     * 确认收货
+     */
+    @ApiOperation(value = "确认收货", tags = {"小程序-个人中心-我的订单-确认收货"})
+    @ApiImplicitParams({
+            @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"),
+    })
+    @GetMapping("/confirm/{orderId}")
+    public R<Void> confirm(@PathVariable("orderId") Long orderId){
+        // TODO 待完善
+        return R.ok();
+    }
+
+
+
+
 
 
 }
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 9bfd041..1d08221 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
@@ -21,11 +21,9 @@
 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.GoodsClient;
+import com.ruoyi.other.api.feignClient.ShopClient;
 import com.ruoyi.other.api.feignClient.TechnicianClient;
 import com.ruoyi.system.api.model.LoginUser;
 import org.springframework.stereotype.Service;
@@ -57,7 +55,7 @@
     @Resource
     private TechnicianClient technicianClient;
     @Resource
-    private GoodsClient goodsClient;
+    private ShopClient shopClient;
 
 
     @Override
@@ -74,6 +72,10 @@
         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>()
@@ -83,17 +85,14 @@
         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());
-            if (goods != null){
-                orderGoodsVO.setGoodsName(goods.getName());
-                orderGoodsVO.setType(goods.getType());
-                orderGoodsVO.setGoodsPic(goods.getHomePagePicture());
-                orderGoodsVO.setSellingPrice(goods.getSellingPrice());
-                orderGoodsVO.setOriginalPrice(goods.getOriginalPrice());
-            }
+            orderGoodsVO.setGoodsName(goods.getName());
+            orderGoodsVO.setType(goods.getType());
+            orderGoodsVO.setGoodsPic(goods.getHomePagePicture());
+            orderGoodsVO.setSellingPrice(goods.getSellingPrice());
+            orderGoodsVO.setOriginalPrice(goods.getOriginalPrice());
             goodsList.add(orderGoodsVO);
         }
 
@@ -129,6 +128,7 @@
             orderDetailVO.setDistributionMode(goods.getDistributionMode());
         }
 
+        Shop shop = shopR.getData();
 
 
         orderDetailVO.setId(order.getId());
@@ -148,6 +148,10 @@
         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());
         return orderDetailVO;
     }
 
diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsController.java
index 2c1c463..dd5e8c5 100644
--- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsController.java
+++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsController.java
@@ -87,6 +87,7 @@
         Goods goods = goodsService.getById(id);
         return R.ok(goods);
     }
-    
+
+
 }
 
diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsEvaluateController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsEvaluateController.java
index 0f3f1b2..52be078 100644
--- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsEvaluateController.java
+++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsEvaluateController.java
@@ -8,11 +8,10 @@
 import com.ruoyi.other.api.domain.Goods;
 import com.ruoyi.other.api.domain.GoodsEvaluate;
 import com.ruoyi.other.service.GoodsEvaluateService;
+import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 import javax.annotation.Resource;
 import java.util.List;
@@ -27,6 +26,7 @@
  */
 @RestController
 @RequestMapping("/goods-evaluate")
+@Api("评论")
 public class GoodsEvaluateController {
     @Resource
     private GoodsEvaluateService goodsEvaluateService;
@@ -34,7 +34,7 @@
     private AppUserClient appUserClient;
 
     @GetMapping("/goodsList")
-    @ApiOperation(value = "商品评价", tags = {"小程序-商品评价"})
+    @ApiOperation(value = "获取商品评价", tags = {"小程序-获取商品评价"})
     public R<List<GoodsEvaluate>> goodsList(@ApiParam("商品id") Integer goodsId){
         List<GoodsEvaluate> list = goodsEvaluateService.lambdaQuery().eq(GoodsEvaluate::getGoodsId, goodsId).list();
         for (GoodsEvaluate goodsEvaluate : list) {
@@ -45,5 +45,25 @@
         return R.ok(list);
     }
 
+    /**
+     * 发布商品评价
+     */
+    @PostMapping("/addGoodsEvaluate")
+    @ApiOperation(value = "发布商品评价", tags = {"小程序-发布商品评价"})
+    public R<Void> addGoodsEvaluate(GoodsEvaluate goodsEvaluate){
+        goodsEvaluateService.save(goodsEvaluate);
+        return R.ok();
+    }
+
+    /**
+     * 评论详情
+     */
+    @GetMapping("/detail/{id}")
+    @ApiOperation(value = "评论详情", tags = {"小程序-评论详情"})
+    public R<GoodsEvaluate> detail(@PathVariable("id") Long id){
+        GoodsEvaluate goodsEvaluate = goodsEvaluateService.getById(id);
+        return R.ok(goodsEvaluate);
+    }
+
 }
 
diff --git a/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/TechnicianMapper.xml b/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/TechnicianMapper.xml
index af52346..c20eb67 100644
--- a/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/TechnicianMapper.xml
+++ b/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/TechnicianMapper.xml
@@ -8,7 +8,7 @@
             tt.introduction,
             tt.home_picture,
             COUNT(tts.id) AS serviceCount,
-            AVG(ttsc.score) AS score
+            AVG( IFNULL(ttsc.score,0) ) AS score
         FROM
             t_technician tt
                 LEFT JOIN t_technician_subscribe tts ON tt.id = tts.technician_id and tts.`status` != 0

--
Gitblit v1.7.1