From dc600db1211ba96302c2f75b4dd224512aad89cf Mon Sep 17 00:00:00 2001
From: puzhibing <393733352@qq.com>
Date: 星期五, 19 一月 2024 15:32:09 +0800
Subject: [PATCH] 修改bug

---
 ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/impl/shop/ShopServiceImpl.java |   60 ++++++++++++++++++++++++++++++++++++------------------------
 1 files changed, 36 insertions(+), 24 deletions(-)

diff --git a/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/impl/shop/ShopServiceImpl.java b/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/impl/shop/ShopServiceImpl.java
index f8993e9..4877a1c 100644
--- a/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/impl/shop/ShopServiceImpl.java
+++ b/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/impl/shop/ShopServiceImpl.java
@@ -556,8 +556,21 @@
         if (StringUtils.isNotBlank(mgtShopPageDto.getShopTags())) {
             mgtShopPageDto.setShopTags(mgtShopPageDto.getShopTags().replace(",", "|"));
         }
+        List<Long> belongUserIds = null;
+        if(null != mgtShopPageDto.getDeptId()){
+            if(null != mgtShopPageDto.getBelongUserId()){
+                belongUserIds = new ArrayList<>();
+                belongUserIds.add(mgtShopPageDto.getBelongUserId());
+            }else{
+                R<List<SysUser>> r = sysUserService.getUsersByDeptId(mgtShopPageDto.getDeptId());
+                if(r.getCode() != 200){
+                    throw new RuntimeException(r.getMsg());
+                }
+                belongUserIds = r.getData().stream().map(SysUser::getUserId).collect(Collectors.toList());
+            }
+        }
         // 分页查询商铺信息
-        List<MgtShopPageVo> mgtShopPageVoList = shopMapper.pageMgtShop(page, mgtShopPageDto);
+        List<MgtShopPageVo> mgtShopPageVoList = shopMapper.pageMgtShop(page, mgtShopPageDto, belongUserIds);
         // 如果查询结果不为空
         if (!mgtShopPageVoList.isEmpty()) {
             // 创建签约用户ID集合和所属用户ID集合
@@ -599,8 +612,9 @@
                     shopPageVo.setSignUser(signUserMap.get(shopPageVo.getSignUserId()).getNickName());
                 }
                 if (belongUserMap!=null&&!belongUserMap.isEmpty()&&shopPageVo.getBelongUserId() != null) {
-                    shopPageVo.setBelongUser(belongUserMap.get(shopPageVo.getBelongUserId()).getNickName());
-                    shopPageVo.setBelongDept(belongUserMap.get(shopPageVo.getBelongUserId()).getDeptName());
+                    MgtSysSimpleUserVo mgtSysSimpleUserVo = belongUserMap.get(shopPageVo.getBelongUserId());
+                    shopPageVo.setBelongUser(null == mgtSysSimpleUserVo ? "" : mgtSysSimpleUserVo.getNickName());
+                    shopPageVo.setBelongDept(null == mgtSysSimpleUserVo ? "" : mgtSysSimpleUserVo.getDeptName());
                 }
             }
         }
@@ -905,21 +919,9 @@
             }
         }
 
-
-
         //分别查询
-        StaffHomeShopTotalVo staffHomeShopTotalVo = new StaffHomeShopTotalVo();
-        if(userIds!=null&&!userIds.isEmpty()){
-            staffHomeShopTotalVo = shopMapper.getStaffHomeTotal(userIds);
-        }else{
-            staffHomeShopTotalVo.setShopTotal(0);
-            staffHomeShopTotalVo.setAgencyTotal(0);
-            staffHomeShopTotalVo.setDealerTotal(0);
-        }
-        Integer shopTaskCount = 0;
-        if(shopIds!=null&&!shopIds.isEmpty()){
-            shopTaskCount = shopTaskService.getShopIngTotal(shopIds);
-        }
+        StaffHomeShopTotalVo staffHomeShopTotalVo = shopMapper.getStaffHomeTotal(userIds);
+        Integer shopTaskCount = shopTaskService.getShopIngTotal(shopIds);
         staffHomeShopTotalVo.setFollowMember(0);
         staffHomeShopTotalVo.setNewMember(0);
         staffHomeShopTotalVo.setShopTask(shopTaskCount);
@@ -1172,15 +1174,12 @@
             shopAuthenticationHftx = new ShopAuthenticationHftx();
             shopAuthenticationHftx.setIsDelete(0);
             shopAuthenticationHftx.setInsertTime(new Date());
-            shopAuthenticationHftx.setAuditStatus("U");
         }
         String auditStatus = shopAuthenticationHftx.getAuditStatus();
         BeanUtils.copyProperties(mgtShopHFTXAuthDto, shopAuthenticationHftx);
         shopAuthenticationHftx.setReqSeqId(IdUtils.simpleUUID());
-        if(Arrays.asList("N", "F").contains(shopAuthenticationHftx.getAuditStatus())){
-            shopAuthenticationHftx.setAuditStatus("");
-            shopAuthenticationHftx.setAuditDesc("");
-        }
+        shopAuthenticationHftx.setAuditStatus("");
+        shopAuthenticationHftx.setAuditDesc("");
         /**
          * 开始调起进件接口
          */
@@ -1517,12 +1516,11 @@
             userIdList.add(userId);
         }
 
-
         StaffShopSimpleTotalVo shopTotal = shopMapper.getStaffSimpleTotal(1,userIdList);
         StaffShopSimpleTotalVo agencyTotal = shopMapper.getStaffSimpleTotal(2,userIdList);
         shopTotal.setAgencyTotal(agencyTotal.getShopTotal());
         shopTotal.setOpenAgencyTotal(agencyTotal.getOpenShopTotal());
-        shopTotal.setCloseAgencyTotal(agencyTotal.getCloseAgencyTotal());
+        shopTotal.setCloseAgencyTotal(agencyTotal.getCloseShopTotal());
         return shopTotal;
     }
 
@@ -1916,4 +1914,18 @@
         Integer pageSize = merchantBasicdataSettlementDto.getPageSize();
         return HuiFuTianXiaUtil.getMerchantBasicdataSettlement(IdUtils.simpleUUID(), huifuId, startTime, endTime, pageNum.toString(), pageSize.toString());
     }
+
+
+
+    /**
+     * @description
+     * @author  jqs
+     * @date    2023/8/10 22:53
+     * @param cityCodes
+     * @return  List<Long>
+     */
+    @Override
+    public List<Shop> listShopByCityCode(List<String> cityCodes){
+        return shopMapper.listShopByCityCode(cityCodes);
+    }
 }

--
Gitblit v1.7.1