From ea1a62ba6484d6c6cb1ca67dcea938a95ba18fc6 Mon Sep 17 00:00:00 2001
From: Pu Zhibing <393733352@qq.com>
Date: 星期一, 26 五月 2025 18:26:26 +0800
Subject: [PATCH] 新增加用户端接口

---
 ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/impl/task/ShopTaskRecordServiceImpl.java |  221 ++++++++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 209 insertions(+), 12 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 6ad00c5..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
@@ -1,20 +1,30 @@
 package com.ruoyi.shop.service.impl.task;
 
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.shop.domain.dto.FileDto;
 import com.ruoyi.shop.domain.dto.MgtShopTaskPageDto;
+import com.ruoyi.shop.domain.dto.StaffShopTaskPageDto;
 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;
 
 /**
@@ -35,7 +45,7 @@
     private TaskFileService taskFileService;
 
     @Resource
-    private RemoteUserService remoteUserService;
+    private RemoteConfigService remoteConfigService;
 
     /**
      * 平台分页获取平台跟进任务
@@ -47,30 +57,62 @@
         if(mgtShopTaskRecordPageVoList!=null&&!mgtShopTaskRecordPageVoList.isEmpty()){
             Long followId;
             List<TaskFile> taskFileList;
-            List<String> picture = new ArrayList<>();
-            List<String> video = new ArrayList<>();
-            List<String> audio = new ArrayList<>();
+            List<FileDto> picture = new ArrayList<>();
+            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);
                 if(taskFileList!=null&&!taskFileList.isEmpty()){
-                    picture = taskFileList.stream().map(k->k.getFileUrl()).collect(Collectors.toList());
+                    picture = taskFileList.stream()
+                            .map(taskFile -> {
+                                FileDto fileDto = new FileDto();
+                                fileDto.setFileName(taskFile.getFileName());
+                                fileDto.setFileUrl(taskFile.getFileUrl());
+                                return fileDto;
+                            })
+                            .collect(Collectors.toList());
                 }
                 taskFileList = taskFileService.listByFollowIdAndFollowType(followId,2);
                 if(taskFileList!=null&&!taskFileList.isEmpty()){
-                    video = taskFileList.stream().map(k->k.getFileUrl()).collect(Collectors.toList());
+                    video = taskFileList.stream()
+                            .map(taskFile -> {
+                                FileDto fileDto = new FileDto();
+                                fileDto.setFileName(taskFile.getFileName());
+                                fileDto.setFileUrl(taskFile.getFileUrl());
+                                return fileDto;
+                            })
+                            .collect(Collectors.toList());
                 }
                 taskFileList = taskFileService.listByFollowIdAndFollowType(followId,3);
                 if(taskFileList!=null&&!taskFileList.isEmpty()){
-                    audio = taskFileList.stream().map(k->k.getFileUrl()).collect(Collectors.toList());
+                    audio = taskFileList.stream()
+                            .map(taskFile -> {
+                                FileDto fileDto = new FileDto();
+                                fileDto.setFileName(taskFile.getFileName());
+                                fileDto.setFileUrl(taskFile.getFileUrl());
+                                return fileDto;
+                            })
+                            .collect(Collectors.toList());
                 }
                 mgtShopTaskRecordPageVo.setPicture(picture);
                 mgtShopTaskRecordPageVo.setVideo(video);
@@ -80,6 +122,161 @@
         return mgtShopTaskRecordPageVoList;
     }
 
+    /**
+     * @description  员工端分页获取我的跟进任务记录列表
+     * @author  jqs
+     * @date    2023/7/14 19:40
+     * @param page
+     * @param staffShopTaskPageDto
+     * @return  List<StaffMyShopTaskRecordPageVo>
+     */
+    @Override
+    public List<StaffMyShopTaskRecordPageVo> pageStaffMyShopTaskRecord(Page page, StaffShopTaskPageDto staffShopTaskPageDto){
+        List<StaffMyShopTaskRecordPageVo> myShopTaskRecordPageVoList = shopTaskRecordMapper.pageStaffMyShopTaskRecord(page, staffShopTaskPageDto);
+        if(myShopTaskRecordPageVoList!=null&&!myShopTaskRecordPageVoList.isEmpty()){
+            Long followId;
+            List<TaskFile> taskFileList;
+            List<FileDto> picture = new ArrayList<>();
+            List<FileDto> video = new ArrayList<>();
+            List<FileDto> audio = new ArrayList<>();
+            Long userId;
+            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();
+                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);
+                if(taskFileList!=null&&!taskFileList.isEmpty()){
+                    picture = taskFileList.stream()
+                            .map(taskFile -> {
+                                FileDto fileDto = new FileDto();
+                                fileDto.setFileName(taskFile.getFileName());
+                                fileDto.setFileUrl(taskFile.getFileUrl());
+                                return fileDto;
+                            })
+                            .collect(Collectors.toList());
+                }
+                taskFileList = taskFileService.listByFollowIdAndFollowType(followId,2);
+                if(taskFileList!=null&&!taskFileList.isEmpty()){
+                    video = taskFileList.stream()
+                            .map(taskFile -> {
+                                FileDto fileDto = new FileDto();
+                                fileDto.setFileName(taskFile.getFileName());
+                                fileDto.setFileUrl(taskFile.getFileUrl());
+                                return fileDto;
+                            })
+                            .collect(Collectors.toList());
+                }
+                taskFileList = taskFileService.listByFollowIdAndFollowType(followId,3);
+                if(taskFileList!=null&&!taskFileList.isEmpty()){
+                    audio = taskFileList.stream()
+                            .map(taskFile -> {
+                                FileDto fileDto = new FileDto();
+                                fileDto.setFileName(taskFile.getFileName());
+                                fileDto.setFileUrl(taskFile.getFileUrl());
+                                return fileDto;
+                            })
+                            .collect(Collectors.toList());
+                }
+                staffMyShopTaskRecordPageVo.setPicture(picture);
+                staffMyShopTaskRecordPageVo.setVideo(video);
+                staffMyShopTaskRecordPageVo.setAudio(audio);
+            }
+        }
+        return myShopTaskRecordPageVoList;
+    }
 
-
+    /**
+     * @description  员工端分页获取商户跟进任务记录列表
+     * @author  jqs
+     * @date    2023/7/15 17:05
+     * @param page
+     * @param staffShopTaskPageDto
+     * @return  List<StaffMyShopTaskRecordPageVo>
+     */
+    @Override
+    public List<StaffMyShopTaskRecordPageVo> pageStaffShopTaskRecord(Page page, StaffShopTaskPageDto staffShopTaskPageDto){
+        List<StaffMyShopTaskRecordPageVo> myShopTaskRecordPageVoList = shopTaskRecordMapper.pageStaffShopTaskRecord(page, staffShopTaskPageDto);
+        if(myShopTaskRecordPageVoList!=null&&!myShopTaskRecordPageVoList.isEmpty()){
+            Long followId;
+            List<TaskFile> taskFileList;
+            List<FileDto> picture = new ArrayList<>();
+            List<FileDto> video = new ArrayList<>();
+            List<FileDto> audio = new ArrayList<>();
+            Long userId;
+            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();
+                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);
+                if(taskFileList!=null&&!taskFileList.isEmpty()){
+                    picture = taskFileList.stream()
+                            .map(taskFile -> {
+                                FileDto fileDto = new FileDto();
+                                fileDto.setFileName(taskFile.getFileName());
+                                fileDto.setFileUrl(taskFile.getFileUrl());
+                                return fileDto;
+                            })
+                            .collect(Collectors.toList());
+                }
+                taskFileList = taskFileService.listByFollowIdAndFollowType(followId,2);
+                if(taskFileList!=null&&!taskFileList.isEmpty()){
+                    video = taskFileList.stream()
+                            .map(taskFile -> {
+                                FileDto fileDto = new FileDto();
+                                fileDto.setFileName(taskFile.getFileName());
+                                fileDto.setFileUrl(taskFile.getFileUrl());
+                                return fileDto;
+                            })
+                            .collect(Collectors.toList());
+                }
+                taskFileList = taskFileService.listByFollowIdAndFollowType(followId,3);
+                if(taskFileList!=null&&!taskFileList.isEmpty()){
+                    audio = taskFileList.stream()
+                            .map(taskFile -> {
+                                FileDto fileDto = new FileDto();
+                                fileDto.setFileName(taskFile.getFileName());
+                                fileDto.setFileUrl(taskFile.getFileUrl());
+                                return fileDto;
+                            })
+                            .collect(Collectors.toList());
+                }
+                staffMyShopTaskRecordPageVo.setPicture(picture);
+                staffMyShopTaskRecordPageVo.setVideo(video);
+                staffMyShopTaskRecordPageVo.setAudio(audio);
+            }
+        }
+        return myShopTaskRecordPageVoList;
+    }
 }

--
Gitblit v1.7.1