From 15bfd012429367bf9b8f03bdc8bb101ae0bdfe4d Mon Sep 17 00:00:00 2001
From: Pu Zhibing <393733352@qq.com>
Date: 星期五, 21 三月 2025 15:26:39 +0800
Subject: [PATCH] 修改统计bug

---
 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java                       |   41 +++------
 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/CouponInfoController.java                 |    8 +
 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/OrderController.java                      |   17 ++-
 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/OrderExport.java                                  |    2 
 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/OrderPageList.java                                |    2 
 ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/AppUser.java                           |    4 +
 ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java                |   79 +++++++------------
 ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/BalanceChangeRecordServiceImpl.java |    6 +
 ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/UserCouponController.java             |    3 
 ruoyi-service/ruoyi-order/src/main/resources/mapper/order/OrderMapper.xml                                    |   45 +++++++---
 10 files changed, 103 insertions(+), 104 deletions(-)

diff --git a/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/AppUser.java b/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/AppUser.java
index c3b250c..bb22241 100644
--- a/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/AppUser.java
+++ b/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/AppUser.java
@@ -5,6 +5,7 @@
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fasterxml.jackson.annotation.JsonInclude;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
@@ -348,6 +349,9 @@
 
 
     public Integer getUserTotalPoint(){
+        if (totalPoint == null){
+            totalPoint = 0;
+        }
         if (lowerLevelSharePoint == null){
             lowerLevelSharePoint = 0;
         }
diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java
index 5c28093..5d9b385 100644
--- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java
+++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java
@@ -323,7 +323,11 @@
         //获取绑定上级
         if (user.getInviteUserId() != null) {
             AppUser byId = appUserService.getById(user.getInviteUserId());
-            user.setTopUser(byId);
+            if(null != byId){
+                user.setTopUser(byId);
+            }else{
+                user.setTopUser(new AppUser());
+            }
         }else {
             AppUser topUser = new AppUser();
             user.setTopUser(topUser);
@@ -371,7 +375,6 @@
                     .eq(AppUser::getDelFlag, 0)
                     .ne(AppUser::getStatus, 3)
                     .count();
-            vip1Count1 += count1;
 
             Long count2 = appUserService.lambdaQuery()
                     .eq(AppUser::getVipId, 2)
@@ -379,42 +382,36 @@
                     .eq(AppUser::getDelFlag, 0)
                     .ne(AppUser::getStatus, 3)
                     .count();
-            vip1Count2 += count2;
             Long count3 = appUserService.lambdaQuery()
                     .eq(AppUser::getVipId, 3)
                     .eq(AppUser::getInviteUserId, appUser.getId())
                     .eq(AppUser::getDelFlag, 0)
                     .ne(AppUser::getStatus, 3)
                     .count();
-            vip1Count3 += count3;
             Long count4 = appUserService.lambdaQuery()
                     .eq(AppUser::getVipId, 4)
                     .eq(AppUser::getInviteUserId, appUser.getId())
                     .eq(AppUser::getDelFlag, 0)
                     .ne(AppUser::getStatus, 3)
                     .count();
-            vip1Count4 += count4;
             Long count5 = appUserService.lambdaQuery()
                     .eq(AppUser::getVipId, 5)
                     .eq(AppUser::getInviteUserId, appUser.getId())
                     .eq(AppUser::getDelFlag, 0)
                     .ne(AppUser::getStatus, 3)
                     .count();
-            vip1Count5 += count5;
             Long count6 = appUserService.lambdaQuery()
                     .eq(AppUser::getVipId, 6)
                     .eq(AppUser::getInviteUserId, appUser.getId())
                     .eq(AppUser::getDelFlag, 0)
                     .ne(AppUser::getStatus, 3)
                     .count();
-            vip1Count6 += count6;
             Long count7 = appUserService.lambdaQuery()
                     .eq(AppUser::getVipId, 7)
                     .eq(AppUser::getInviteUserId, appUser.getId())
                     .eq(AppUser::getDelFlag, 0)
                     .ne(AppUser::getStatus, 3)
                     .count();
-            vip1Count7 += count7;
             appUser.setCount1(count1);
             appUser.setCount2(count2);
             appUser.setCount3(count3);
@@ -423,6 +420,7 @@
             appUser.setCount6(count6);
             appUser.setCount7(count7);
         }
+        
         user.setBottomUsers(list);
         user.setCount1(vip1Count1);
         user.setCount2(vip1Count2);
@@ -512,42 +510,23 @@
         ArrayList<Long> userIds = new ArrayList<>();
         userIds.add(userId);
         // 获取当前用户的所有下级
-        List<AppUser> allSubordinates = getAllSubordinates(userId);
-        // 统计下级中每种会员类型的人数
-        Map<Integer, Long> countMap = allSubordinates.stream()
-                .collect(Collectors.groupingBy(AppUser::getVipId, Collectors.counting()));
-        countMap.forEach((vipId, count) -> {
-            switch (vipId) {
-                case 1:
-                    Long count1 = user.getCount1() == null ? 0 : user.getCount1();
-                    user.setCount1(count1 + count);
-                    break;
-                case 2:
-                    Long count2 = user.getCount2() == null ? 0 : user.getCount2();
-                    user.setCount2(count2 + count);
-                    break;
-                case 3:
-                    Long count3 = user.getCount3() == null ? 0 : user.getCount3();
-                    user.setCount3(count3 + count);
-                    break;
-                case 4:
-                    Long count4 = user.getCount4() == null ? 0 : user.getCount4();
-                    user.setCount4(count4 + count);
-                    break;
-                case 5:
-                    Long count5 = user.getCount5() == null ? 0 : user.getCount5();
-                    user.setCount5(count5 + count);
-                    break;
-                case 6:
-                    Long count6 = user.getCount6() == null ? 0 : user.getCount6();
-                    user.setCount6(count6 + count);
-                    break;
-                case 7:
-                    Long count7 = user.getCount7() == null ? 0 : user.getCount7();
-                    user.setCount7(count7 + count);
-                    break;
-            }
-        });
+        List<AppUser> allSubordinates = appUserService.list(new LambdaQueryWrapper<AppUser>()
+                .eq(AppUser::getInviteUserId, user.getId()).eq(AppUser::getDelFlag, 0)
+                .ne(AppUser::getStatus, 3));
+        Long count1 = allSubordinates.stream().filter(s->s.getVipId() == 1).count();
+        user.setCount1(count1);
+        Long count2 = allSubordinates.stream().filter(s->s.getVipId() == 2).count();
+        user.setCount2(count2);
+        Long count3 = allSubordinates.stream().filter(s->s.getVipId() == 3).count();
+        user.setCount3(count3);
+        Long count4 = allSubordinates.stream().filter(s->s.getVipId() == 4).count();
+        user.setCount4(count4);
+        Long count5 = allSubordinates.stream().filter(s->s.getVipId() == 5).count();
+        user.setCount5(count5);
+        Long count6 = allSubordinates.stream().filter(s->s.getVipId() == 6).count();
+        user.setCount6(count6);
+        Long count7 = allSubordinates.stream().filter(s->s.getVipId() == 7).count();
+        user.setCount7(count7);
         List<UserSignRecord> list = userSignRecordService.lambdaQuery().eq(UserSignRecord::getSignDay, LocalDate.now())
                 .eq(UserSignRecord::getAppUserId,userId).list();
         if (!list.isEmpty()) {
@@ -742,11 +721,10 @@
                     record.setInviteUserName(byId1.getName());
                 }
             }
-            if (record.getShopId()!=null){
-                R<Shop> shopById = shopClient.getShopById(record.getShopId());
-                if (shopById.getData()!=null){
-                    record.setShopName(shopById.getData().getName());
-                }
+            Shop shop1 = shopClient.getServiceProvider(record.getId()).getData();
+            if(null != shop1){
+                record.setShopName(shop1.getName());
+                record.setShopId(shop1.getId());
             }
             record.setTotalPoint(record.getUserTotalPoint());
         }
@@ -975,9 +953,10 @@
         Long userid = tokenService.getLoginUser().getUserid();
         SysUser sysUser = sysUserClient.getSysUser(userid).getData();
         AppUser byId = appUserService.getById(id);
-        Shop shop1 = shopClient.getServiceProvider(id).getData();
+        Shop shop1 = shopClient.getServiceProvider(byId.getId()).getData();
         if(null != shop1){
             byId.setShopName(shop1.getName());
+            byId.setShopId(shop1.getId());
         }
         R<List<Shop>> shopByUserId = shopClient.getShopByUserId(id);
         if (shopByUserId.getData() != null) {
diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/UserCouponController.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/UserCouponController.java
index 623e0be..a796064 100644
--- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/UserCouponController.java
+++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/UserCouponController.java
@@ -218,6 +218,9 @@
         if (data==null){
             return  R.fail("当前优惠券不存在,请刷新后重试");
         }
+        if(data.getDelFlag() == 1 || data.getShelfStatus() == 0){
+            return  R.fail("当前优惠券不存在,请刷新后重试");
+        }
         long count = userCouponService.count(new LambdaQueryWrapper<UserCoupon>().eq(UserCoupon::getCouponId, couponId).eq(UserCoupon::getDelFlag, 0));
         if(data.getSendNum() <= count){
             return R.fail("当前优惠券已全部领取完毕");
diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/BalanceChangeRecordServiceImpl.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/BalanceChangeRecordServiceImpl.java
index 2c0fe35..637469f 100644
--- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/BalanceChangeRecordServiceImpl.java
+++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/BalanceChangeRecordServiceImpl.java
@@ -97,10 +97,12 @@
 
             BigDecimal beforeAmount = changeRecord.getBeforeAmount();
             BigDecimal afterAmount = changeRecord.getAfterAmount();
-
-            if (beforeAmount.compareTo(afterAmount) > 0){
+    
+            if(changeRecord.getChangeType() == 2){
                 BigDecimal changeAmount = changeRecord.getChangeAmount();
                 totalWithdraw = totalWithdraw.add(changeAmount);
+            }
+            if (beforeAmount.compareTo(afterAmount) > 0){
                 walletStatisticsDetail.setFlag(2);
             }else {
                 walletStatisticsDetail.setFlag(1);
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 88ce37f..ef43ba7 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
@@ -317,13 +317,17 @@
 
         Long userid = tokenService.getLoginUser().getUserid();
         SysUser sysUser = sysUserClient.getSysUser(userid).getData();
-        List<Order> orderList = orderService.list(new LambdaQueryWrapper<Order>()
-                .ne(Order::getOrderStatus, 5)
-                .eq(sysUser.getRoleType() == 2, Order::getShopId, sysUser.getObjectId())
+        LambdaQueryWrapper<Order> wrapper = new LambdaQueryWrapper<Order>()
+                .in(Order::getOrderStatus, Arrays.asList(1, 2, 3, 4, 7, 8))
+                .eq(Order::getPayStatus, 2)
+                .eq(Order::getDelFlag, 0)
                 .between(Order::getCreateTime, LocalDateTime.parse(startTime, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")), LocalDateTime.parse(endTime, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")))
-                .orderByAsc(Order::getCreateTime));
-
-
+                .orderByAsc(Order::getCreateTime);
+        if(sysUser.getRoleType() == 2){
+            //门店只拥有服务订单和自提商品订单
+            wrapper.eq(Order::getShopId, sysUser.getObjectId()).eq(Order::getOrderType, 1).or().eq(Order::getOrderType, 2).eq(Order::getDistributionMode, 1);
+        }
+        List<Order> orderList = orderService.list(wrapper);
         Map<String, List<Order>> map = orderList.stream()
                 .collect(Collectors.groupingBy(
                         item -> item.getCreateTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")),
@@ -555,7 +559,6 @@
      */
     @GetMapping("/exportExpress")
     public void exportExpress(HttpServletResponse response, OrderPageList orderPage) {
-
         //搜索条件,用户姓名
         if (StringUtils.isNotEmpty(orderPage.getUserName())) {
             List<AppUser> data = appUserClient.getAppUserByNameNoFilter(orderPage.getUserName()).getData();
diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/OrderExport.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/OrderExport.java
index d6d3b3b..d521575 100644
--- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/OrderExport.java
+++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/OrderExport.java
@@ -62,7 +62,7 @@
     /**
      * 订单类型
      */
-    @Excel(name = "订单类型", readConverterExp = "1=服务,2=单品")
+    @Excel(name = "订单类型", readConverterExp = "1=服务,2=单品(自提),3=单品(快递)")
     private String orderType;
 
 
diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/OrderPageList.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/OrderPageList.java
index 986d3f4..5756133 100644
--- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/OrderPageList.java
+++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/OrderPageList.java
@@ -23,7 +23,7 @@
 	private String userName;
 	@ApiModelProperty("联系电话")
 	private String phone;
-	@ApiModelProperty("商品类型(1=服务,2=单品)")
+	@ApiModelProperty("商品类型(1=服务,2=单品-自提,3=单品-快递)")
 	private Integer goodsType;
 	@ApiModelProperty("支付方式(1=微信,2=余额,3=积分)")
 	private Integer paymentType;
diff --git a/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/OrderMapper.xml b/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/OrderMapper.xml
index 9544291..9a95ea0 100644
--- a/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/OrderMapper.xml
+++ b/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/OrderMapper.xml
@@ -57,7 +57,7 @@
             DATE_FORMAT(create_time, '%Y-%m-%d %H:%i:%s') as createTime,
             DATE_FORMAT(after_sale_time, '%Y-%m-%d %H:%i:%s') as afterSaleTime,
             app_user_id as appUserId,
-            order_type as goodsType,
+            CASE WHEN order_type = 1 THEN 1 WHEN order_type = 2 and distribution_mode = 1 THEN 2 ELSE 3 END as goodsType,
             pay_method as paymentType,
             total_amount as orderMoney,
             point,
@@ -69,7 +69,7 @@
             deliver_province_code,
             deliver_city,
             deliver_city_code
-        from t_order where del_flag = 0
+        from t_order where del_flag = 0 and pay_status = 2
         <if test="null != item.code and '' != item.code">
             and order_number like CONCAT('%', #{item.code}, '%')
         </if>
@@ -79,8 +79,14 @@
                 #{tem}
             </foreach>
         </if>
-        <if test="null != item.goodsType">
+        <if test="null != item.goodsType and 1 == item.goodsType">
             and order_type = #{item.goodsType}
+        </if>
+        <if test="null != item.goodsType and 2 == item.goodsType">
+            and order_type = 2 and distribution_mode = 1
+        </if>
+        <if test="null != item.goodsType and 3 == item.goodsType">
+            and order_type = 2 and distribution_mode = 2
         </if>
         <if test="null != item.paymentType">
             and pay_method = #{item.paymentType}
@@ -110,9 +116,9 @@
         coalesce( SUM( CASE WHEN tor.order_type = 2 and tor.order_status!=5 THEN tor.total_amount ELSE 0 END ),0) as
         singleTotalMoney
         FROM
-        t_order tor where 1 = 1 AND tor.del_flag = 0
+        t_order tor where tor.del_flag = 0 and tor.order_status in (1, 2, 3, 4, 7, 8) and tor.pay_status = 2
         <if test="null != shopId">
-            and tor.shop_id = #{shopId}
+            and tor.shop_id = #{shopId} and (if(tor.order_type = 2, tor.distribution_mode = 1, 1 = 1))
         </if>
     </select>
 
@@ -149,19 +155,24 @@
         ifnull(count(1), 0)
         from t_order a
         where del_flag = 0 and pay_status = 2 and order_status in (1, 2, 3, 4, 7, 8)
-        and shop_id in
-        <foreach collection="shopIds" item="shopId" separator="," open="(" close=")" index="index">
-            #{shopId}
-        </foreach>
-        <if test="null != type">
-            and order_type = #{type}
+        <if test="null != shopIds and shopIds.size() > 0">
+            and shop_id in
+            <foreach collection="shopIds" item="shopId" separator="," open="(" close=")" index="index">
+                #{shopId}
+            </foreach>
+        </if>
+        <if test="null != type and 1 == type">
+            and a.order_type = #{type}
+        </if>
+        <if test="null != type and 2 == type">
+            and a.order_type = #{type} and a.distribution_mode = 1
         </if>
     </select>
     <select id="getOrderExportList" resultType="com.ruoyi.order.vo.OrderExport">
         SELECT
             o.order_status,
             o.order_number,
-            o.order_type,
+            CASE WHEN o.order_type = 1 THEN 1 WHEN o.order_type = 2 and o.distribution_mode = 1 THEN 2 ELSE 3 END as orderType,
             case when o.order_type = 1 then 1 else o.distribution_mode end as distributionMode,
             o.address_Json,
             o.create_time,
@@ -189,8 +200,14 @@
                 #{tem}
             </foreach>
         </if>
-        <if test="null != item.goodsType">
-            and o.order_type = #{item.goodsType}
+        <if test="null != item.goodsType and 1 == item.goodsType">
+            and order_type = #{item.goodsType}
+        </if>
+        <if test="null != item.goodsType and 2 == item.goodsType">
+            and order_type = 2 and distribution_mode = 1
+        </if>
+        <if test="null != item.goodsType and 3 == item.goodsType">
+            and order_type = 2 and distribution_mode = 2
         </if>
         <if test="null != item.paymentType">
             and o.pay_method = #{item.paymentType}
diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/CouponInfoController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/CouponInfoController.java
index 4d139a9..d154540 100644
--- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/CouponInfoController.java
+++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/CouponInfoController.java
@@ -161,19 +161,21 @@
         Long userid = tokenService.getLoginUserApplet().getUserid();
         AppUser appUserById = appUserClient.getAppUserById(userid);
         LocalDateTime now = LocalDateTime.now();
-
-
         //查出全部可领取的优惠劵
         List<CouponInfo> list = couponInfoService.lambdaQuery()
                 .le(CouponInfo::getSendStartTime, now)
                 .ge(CouponInfo::getSendEndTime, now)
                 .eq(CouponInfo::getPersonType, 1)
+                .eq(CouponInfo::getDelFlag, 0)
+                .eq(CouponInfo::getShelfStatus, 1)
                 .list();
         //查出指定人员可领取优惠券
         List<CouponInfo> list1 = couponInfoService.lambdaQuery()
                 .le(CouponInfo::getSendStartTime, now)
                 .ge(CouponInfo::getSendEndTime, now)
                 .eq(CouponInfo::getPersonType, 2)
+                .eq(CouponInfo::getDelFlag, 0)
+                .eq(CouponInfo::getShelfStatus, 1)
                 .apply("FIND_IN_SET('" + appUserById.getId() + "', person_ids)")
                 .list();
         //查出指定会员可领取优惠劵
@@ -181,6 +183,8 @@
                 .le(CouponInfo::getSendStartTime, now)
                 .ge(CouponInfo::getSendEndTime, now)
                 .eq(CouponInfo::getPersonType, 3)
+                .eq(CouponInfo::getDelFlag, 0)
+                .eq(CouponInfo::getShelfStatus, 1)
                 .apply("FIND_IN_SET('" + appUserById.getVipId() + "', vip_ids)").list();
         List<CouponInfo> returnList = new ArrayList<>();
         returnList.addAll(list);
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 ac90511..4355f98 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
@@ -702,33 +702,20 @@
     @ApiOperation(value = "门店统计", tags = {"管理后台-首页统计"})
     public R<ShopStatistics> shopStatistics(@ApiParam("门店id") Integer shopId) {
         ShopStatistics shopStatistics = shopMapper.getShopStatistics(shopId);
-        List<Integer> 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);
-        }
+    
+        OrderSaleNum serviceOrderSaleNum = new OrderSaleNum();
+        serviceOrderSaleNum.setShopIds(null == shopId ? new ArrayList<>() : Arrays.asList(shopId));
+        serviceOrderSaleNum.setType(1);
+        Integer serviceOrder = orderClient.getShopSaleNumByShopIds(serviceOrderSaleNum).getData();
+    
+        OrderSaleNum goodsOrderSaleNum = new OrderSaleNum();
+        goodsOrderSaleNum.setShopIds(null == shopId ? new ArrayList<>() : Arrays.asList(shopId));
+        goodsOrderSaleNum.setType(2);
+        Integer goodsOrder = orderClient.getShopSaleNumByShopIds(goodsOrderSaleNum).getData();
+    
+        shopStatistics.setTotalOrder(serviceOrder + goodsOrder);
+        shopStatistics.setServiceOrder(serviceOrder);
+        shopStatistics.setGoodsOrder(goodsOrder);
         return R.ok(shopStatistics);
     }
     

--
Gitblit v1.7.1