From 1ca4c6c6c7861c07980ad0dcd8d5df4b0219bfdc Mon Sep 17 00:00:00 2001
From: jiangqs <jiangqs>
Date: 星期三, 06 九月 2023 19:01:48 +0800
Subject: [PATCH] bug

---
 ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/impl/task/ShopTaskRecordServiceImpl.java |   65 ++++++++++++++++++++++++++------
 1 files changed, 52 insertions(+), 13 deletions(-)

diff --git a/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/impl/task/ShopTaskRecordServiceImpl.java b/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/impl/task/ShopTaskRecordServiceImpl.java
index c10086e..ff4827b 100644
--- a/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/impl/task/ShopTaskRecordServiceImpl.java
+++ b/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/impl/task/ShopTaskRecordServiceImpl.java
@@ -8,17 +8,23 @@
 import com.ruoyi.shop.domain.pojo.task.ShopTaskRecord;
 import com.ruoyi.shop.domain.pojo.task.TaskFile;
 import com.ruoyi.shop.domain.vo.MgtShopTaskRecordPageVo;
+import com.ruoyi.shop.domain.vo.StaffAgencyTaskRecordPageVo;
 import com.ruoyi.shop.domain.vo.StaffMyShopTaskRecordPageVo;
 import com.ruoyi.shop.mapper.task.ShopTaskRecordMapper;
 import com.ruoyi.shop.service.task.ShopTaskRecordService;
 import com.ruoyi.shop.service.task.TaskFileService;
+import com.ruoyi.system.api.domain.poji.sys.SysStaff;
 import com.ruoyi.system.api.domain.poji.sys.SysUser;
+import com.ruoyi.system.api.service.RemoteConfigService;
 import com.ruoyi.system.api.service.RemoteUserService;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
 import java.util.ArrayList;
+import java.util.HashSet;
 import java.util.List;
+import java.util.Map;
+import java.util.function.Function;
 import java.util.stream.Collectors;
 
 /**
@@ -39,7 +45,7 @@
     private TaskFileService taskFileService;
 
     @Resource
-    private RemoteUserService remoteUserService;
+    private RemoteConfigService remoteConfigService;
 
     /**
      * 平台分页获取平台跟进任务
@@ -55,13 +61,24 @@
             List<FileDto> video = new ArrayList<>();
             List<FileDto> audio = new ArrayList<>();
             Long userId;
-            SysUser sysUser;
+            SysStaff sysStaff;
+            HashSet<Long> userIdSet = new HashSet<>();
+            for(MgtShopTaskRecordPageVo mgtShopTaskRecordPageVo : mgtShopTaskRecordPageVoList){
+                userIdSet.add(mgtShopTaskRecordPageVo.getUserId());
+            }
+            List<Long> useIdList = new ArrayList<>(userIdSet);
+            List<SysStaff> sysStaffList = remoteConfigService.listSysStaffByIds(useIdList).getData();
+            Map<Long,SysStaff> sysStaffMap = sysStaffList.stream()
+                    .collect(Collectors.toMap(SysStaff::getUserId, Function.identity()));
             for(MgtShopTaskRecordPageVo mgtShopTaskRecordPageVo : mgtShopTaskRecordPageVoList){
                 //获取任务用户信息
                 userId = mgtShopTaskRecordPageVo.getUserId();
-                sysUser = remoteUserService.getSysUser(userId).getData();
-                mgtShopTaskRecordPageVo.setUserName(sysUser.getNickName());
-                mgtShopTaskRecordPageVo.setUserPicture(sysUser.getAvatar());
+                sysStaff = sysStaffMap.get(userId);
+                if(sysStaff!=null){
+                    mgtShopTaskRecordPageVo.setUserName(sysStaff.getStaffName());
+                    mgtShopTaskRecordPageVo.setUserPicture(sysStaff.getStaffAvatar());
+                    mgtShopTaskRecordPageVo.setUserPosition(sysStaff.getStaffPost());
+                }
                 //获取任务详情文件
                 followId = mgtShopTaskRecordPageVo.getFollowId();
                 taskFileList = taskFileService.listByFollowIdAndFollowType(followId,1);
@@ -123,13 +140,24 @@
             List<FileDto> video = new ArrayList<>();
             List<FileDto> audio = new ArrayList<>();
             Long userId;
-            SysUser sysUser;
+            SysStaff sysStaff;
+            HashSet<Long> userIdSet = new HashSet<>();
+            for(StaffMyShopTaskRecordPageVo staffMyShopTaskRecordPageVo : myShopTaskRecordPageVoList){
+                userIdSet.add(staffMyShopTaskRecordPageVo.getUserId());
+            }
+            List<Long> useIdList = new ArrayList<>(userIdSet);
+            List<SysStaff> sysStaffList = remoteConfigService.listSysStaffByIds(useIdList).getData();
+            Map<Long,SysStaff> sysStaffMap = sysStaffList.stream()
+                    .collect(Collectors.toMap(SysStaff::getUserId, Function.identity()));
             for(StaffMyShopTaskRecordPageVo staffMyShopTaskRecordPageVo : myShopTaskRecordPageVoList){
                 //获取任务用户信息
                 userId = staffMyShopTaskRecordPageVo.getUserId();
-                sysUser = remoteUserService.getSysUser(userId).getData();
-                staffMyShopTaskRecordPageVo.setUserName(sysUser.getNickName());
-                staffMyShopTaskRecordPageVo.setUserPicture(sysUser.getAvatar());
+                sysStaff = sysStaffMap.get(userId);
+                if(sysStaff!=null){
+                    staffMyShopTaskRecordPageVo.setUserName(sysStaff.getStaffName());
+                    staffMyShopTaskRecordPageVo.setUserPicture(sysStaff.getStaffAvatar());
+                    staffMyShopTaskRecordPageVo.setUserPosition(sysStaff.getStaffPost());
+                }
                 //获取任务详情文件
                 followId = staffMyShopTaskRecordPageVo.getFollowId();
                 taskFileList = taskFileService.listByFollowIdAndFollowType(followId,1);
@@ -191,13 +219,24 @@
             List<FileDto> video = new ArrayList<>();
             List<FileDto> audio = new ArrayList<>();
             Long userId;
-            SysUser sysUser;
+            SysStaff sysStaff;
+            HashSet<Long> userIdSet = new HashSet<>();
+            for(StaffMyShopTaskRecordPageVo staffMyShopTaskRecordPageVo : myShopTaskRecordPageVoList){
+                userIdSet.add(staffMyShopTaskRecordPageVo.getUserId());
+            }
+            List<Long> useIdList = new ArrayList<>(userIdSet);
+            List<SysStaff> sysStaffList = remoteConfigService.listSysStaffByIds(useIdList).getData();
+            Map<Long,SysStaff> sysStaffMap = sysStaffList.stream()
+                    .collect(Collectors.toMap(SysStaff::getUserId, Function.identity()));
             for(StaffMyShopTaskRecordPageVo staffMyShopTaskRecordPageVo : myShopTaskRecordPageVoList){
                 //获取任务用户信息
                 userId = staffMyShopTaskRecordPageVo.getUserId();
-                sysUser = remoteUserService.getSysUser(userId).getData();
-                staffMyShopTaskRecordPageVo.setUserName(sysUser.getNickName());
-                staffMyShopTaskRecordPageVo.setUserPicture(sysUser.getAvatar());
+                sysStaff = sysStaffMap.get(userId);
+                if(sysStaff!=null){
+                    staffMyShopTaskRecordPageVo.setUserName(sysStaff.getStaffName());
+                    staffMyShopTaskRecordPageVo.setUserPicture(sysStaff.getStaffAvatar());
+                    staffMyShopTaskRecordPageVo.setUserPosition(sysStaff.getStaffPost());
+                }
                 //获取任务详情文件
                 followId = staffMyShopTaskRecordPageVo.getFollowId();
                 taskFileList = taskFileService.listByFollowIdAndFollowType(followId,1);

--
Gitblit v1.7.1