From 1789718f58e3374ce85357524ef80a84f3d70d6f Mon Sep 17 00:00:00 2001
From: jiangqs <jiangqs>
Date: 星期日, 25 六月 2023 18:36:01 +0800
Subject: [PATCH] 商户端统计

---
 ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/impl/shop/ShopServiceImpl.java |   83 ++++++++++++++++++++++++++++++++++++-----
 1 files changed, 72 insertions(+), 11 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 a84c332..99fc8de 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
@@ -17,10 +17,7 @@
 import com.ruoyi.shop.service.shop.*;
 import com.ruoyi.shop.service.task.ShopFileService;
 import com.ruoyi.system.api.constant.AppErrorConstant;
-import com.ruoyi.system.api.domain.dto.AppMemberBindingDto;
-import com.ruoyi.system.api.domain.dto.MgtBasePlatformDto;
-import com.ruoyi.system.api.domain.dto.MgtShopIdByCodeDto;
-import com.ruoyi.system.api.domain.dto.MgtUserIdByDept;
+import com.ruoyi.system.api.domain.dto.*;
 import com.ruoyi.system.api.domain.poji.config.SysTag;
 import com.ruoyi.system.api.domain.poji.member.Member;
 import com.ruoyi.system.api.domain.poji.shop.Shop;
@@ -37,6 +34,7 @@
 import java.math.BigDecimal;
 import java.text.ParseException;
 import java.util.*;
+import java.util.function.Function;
 import java.util.stream.Collectors;
 
 /**
@@ -89,7 +87,8 @@
     @Resource
     private ShopProportionService shopProportionService;
 
-    
+    @Resource
+    private RemoteConfigService remoteConfigService;
 
     /**
      * 获取商户详情
@@ -341,11 +340,58 @@
      */
     @Override
     public List<MgtShopPageVo> pageMgtShop(Page page, MgtShopPageDto mgtShopPageDto){
-        //处理标签为正则表达
-        if(StringUtils.isNotBlank(mgtShopPageDto.getShopTags())){
-            mgtShopPageDto.setShopTags(mgtShopPageDto.getShopTags().replace(",","|"));
+        if (StringUtils.isNotBlank(mgtShopPageDto.getShopTags())) {
+            mgtShopPageDto.setShopTags(mgtShopPageDto.getShopTags().replace(",", "|"));
         }
+        // 分页查询商铺信息
         List<MgtShopPageVo> mgtShopPageVoList = shopMapper.pageMgtShop(page, mgtShopPageDto);
+        // 如果查询结果不为空
+        if (!mgtShopPageVoList.isEmpty()) {
+            // 创建签约用户ID集合和所属用户ID集合
+            HashSet<Long> signUserIdSet = new HashSet<>();
+            HashSet<Long> belongUserIdSet = new HashSet<>();
+            // 遍历查询结果,将签约用户和所属用户添加到对应的集合中
+            for (MgtShopPageVo shopPageVo : mgtShopPageVoList) {
+                if (shopPageVo.getSignUserId() != null) {
+                    signUserIdSet.add(shopPageVo.getSignUserId());
+                }
+                if (shopPageVo.getBelongUserId() != null) {
+                    belongUserIdSet.add(shopPageVo.getBelongUserId());
+                }
+            }
+            MgtBaseBathDto mgtBaseBathDto;
+            Map<Long, MgtSysSimpleUserVo> signUserMap = null;
+            Map<Long, MgtSysSimpleUserVo> belongUserMap = null;
+            if(signUserIdSet!=null&&!signUserIdSet.isEmpty()){
+                String signUserString = String.join(",", signUserIdSet.stream().map(Object::toString).collect(Collectors.toList()));
+                mgtBaseBathDto = new MgtBaseBathDto();
+                mgtBaseBathDto.setIds(signUserString);
+                List<MgtSysSimpleUserVo> signUserVoList = remoteConfigService.listSimpleUserVo(mgtBaseBathDto).getData();
+                signUserMap = signUserVoList.stream()
+                        .collect(Collectors.toMap(MgtSysSimpleUserVo::getUserId, Function.identity()));
+            }
+            if(belongUserIdSet!=null&&!belongUserIdSet.isEmpty()){
+                // 将签约用户ID集合和所属用户ID集合转为字符串
+                String belongUserString = String.join(",", belongUserIdSet.stream().map(Object::toString).collect(Collectors.toList()));
+                // 查询签约用户和所属用户的详细信息
+                mgtBaseBathDto = new MgtBaseBathDto();
+                mgtBaseBathDto.setIds(belongUserString);
+                List<MgtSysSimpleUserVo> belongUserVoList = remoteConfigService.listSimpleUserVo(mgtBaseBathDto).getData();
+                belongUserMap = belongUserVoList.stream()
+                        .collect(Collectors.toMap(MgtSysSimpleUserVo::getUserId, Function.identity()));
+            }
+            // 遍历查询结果,将签约用户和所属用户的详细信息添加到商铺信息中
+            for (MgtShopPageVo shopPageVo : mgtShopPageVoList) {
+                if (signUserMap!=null&&!signUserMap.isEmpty()&&shopPageVo.getSignUserId() != null) {
+                    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());
+                }
+            }
+        }
+        // 返回商铺信息
         return mgtShopPageVoList;
     }
 
@@ -495,9 +541,8 @@
         merHomeShopTotalVo.setShopId(shopId);
         Shop shop = this.getById(shopId);
         merHomeShopTotalVo.setShopType(shop.getShopType());
-        Integer task = 0;
-        merHomeShopTotalVo.setTask(task);
-        merHomeShopTotalVo = remoteOrderService.getMerHomeTotal(merHomeShopTotalVo).getData();
+        MerHomeShopTotalVo orderVo = remoteOrderService.getMerHomeTotal(merHomeShopTotalVo).getData();
+
         return merHomeShopTotalVo;
     }
 
@@ -779,4 +824,20 @@
         List<Long> shopIdList = shopMapper.listShopIdByPlTotal(mgtBasePlatformDto);
         return shopIdList;
     }
+
+
+    /**
+     * @description  获取商户审核资料
+     * @author  jqs
+     * @date    2023/6/25 10:37
+     * @param authId
+     * @return  MgtShopAuthGetVo
+     */
+    @Override
+    public MgtShopAuthGetVo getMgtShopAuth(String authId){
+        MgtShopAuthGetVo shopAuthGetVo = new MgtShopAuthGetVo();
+        ShopAuthentication shopAuthentication = shopAuthenticationService.getById(authId);
+        BeanUtils.copyProperties(shopAuthentication, shopAuthGetVo);
+        return shopAuthGetVo;
+    }
 }

--
Gitblit v1.7.1