From e4eaabefaaa2ca95f809c47a11712c3bee56e1b5 Mon Sep 17 00:00:00 2001
From: luofl <1442745593@qq.com>
Date: 星期四, 20 二月 2025 15:07:09 +0800
Subject: [PATCH] 修改物流信息导入模板

---
 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java |   36 +++++++++++++++++++++++++++++-------
 1 files changed, 29 insertions(+), 7 deletions(-)

diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java
index 0a46602..d4e3f19 100644
--- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java
+++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java
@@ -15,6 +15,7 @@
 import com.ruoyi.common.security.utils.MD5Generator;
 import com.ruoyi.common.security.utils.SecurityUtils;
 import com.ruoyi.order.feignClient.OrderClient;
+import com.ruoyi.order.vo.OrderSaleNum;
 import com.ruoyi.order.vo.VerifiableShopVo;
 import com.ruoyi.other.api.domain.*;
 import com.ruoyi.other.mapper.ShopMapper;
@@ -688,14 +689,35 @@
     @ApiOperation(value = "门店统计", tags = {"管理后台-首页统计"})
     public R<ShopStatistics> shopStatistics(@ApiParam("门店id") Integer shopId) {
         ShopStatistics shopStatistics = shopMapper.getShopStatistics(shopId);
-        if(null == shopId){
-            shopId = 0;
+        List<Integer> shopIds;
+
+        shopIds = shopService.list(new LambdaQueryWrapper<Shop>()
+                        .eq(Shop::getDelFlag, 0)
+                        .eq(shopId !=null,Shop::getId, shopId))
+                .stream()
+                .map(Shop::getId)
+                .collect(Collectors.toList());
+
+
+        if (CollectionUtils.isEmpty(shopIds)){
+            shopStatistics.setTotalOrder(0);
+            shopStatistics.setServiceOrder(0);
+            shopStatistics.setGoodsOrder(0);
+        }else {
+            OrderSaleNum serviceOrderSaleNum = new OrderSaleNum();
+            serviceOrderSaleNum.setShopIds(shopIds);
+            serviceOrderSaleNum.setType(1);
+            Integer serviceOrder = orderClient.getShopSaleNumByShopIds(serviceOrderSaleNum).getData();
+
+            OrderSaleNum goodsOrderSaleNum = new OrderSaleNum();
+            goodsOrderSaleNum.setShopIds(shopIds);
+            goodsOrderSaleNum.setType(2);
+            Integer goodsOrder = orderClient.getShopSaleNumByShopIds(goodsOrderSaleNum).getData();
+
+            shopStatistics.setTotalOrder(serviceOrder + goodsOrder);
+            shopStatistics.setServiceOrder(serviceOrder);
+            shopStatistics.setGoodsOrder(goodsOrder);
         }
-        Integer serviceOrder = orderClient.getShopSaleNum(shopId, 1).getData();
-        Integer goodsOrder = orderClient.getShopSaleNum(shopId, 2).getData();
-        shopStatistics.setTotalOrder(serviceOrder + goodsOrder);
-        shopStatistics.setServiceOrder(serviceOrder);
-        shopStatistics.setGoodsOrder(goodsOrder);
         return R.ok(shopStatistics);
     }
     

--
Gitblit v1.7.1