bug
jiangqs
2023-08-31 dbff53150cdc807faa56c0d1a947d24b69f372b9
ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/impl/task/ShopTaskRecordServiceImpl.java
@@ -2,12 +2,13 @@
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.MgtAgencyTaskRecordPageVo;
import com.ruoyi.shop.domain.vo.MgtShopTaskRecordPageVo;
import com.ruoyi.shop.mapper.task.ShopTaskMapper;
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;
@@ -42,18 +43,17 @@
    /**
     * 平台分页获取平台跟进任务
     * @param page
     * @return
     */
    @Override
    public List<MgtShopTaskRecordPageVo> pageMgtShopFollow(Page page, MgtShopTaskPageDto mgtShopTaskPageDto){
        List<MgtShopTaskRecordPageVo> mgtShopTaskRecordPageVoList = shopTaskRecordMapper.pageMgtShopFollow(page, mgtShopTaskPageDto);
    public List<MgtShopTaskRecordPageVo> pageMgtShopFollow(MgtShopTaskPageDto mgtShopTaskPageDto){
        List<MgtShopTaskRecordPageVo> mgtShopTaskRecordPageVoList = shopTaskRecordMapper.pageMgtShopFollow(mgtShopTaskPageDto);
        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;
            for(MgtShopTaskRecordPageVo mgtShopTaskRecordPageVo : mgtShopTaskRecordPageVoList){
@@ -66,15 +66,36 @@
                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);
@@ -84,6 +105,139 @@
        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;
            SysUser sysUser;
            for(StaffMyShopTaskRecordPageVo staffMyShopTaskRecordPageVo : myShopTaskRecordPageVoList){
                //获取任务用户信息
                userId = staffMyShopTaskRecordPageVo.getUserId();
                sysUser = remoteUserService.getSysUser(userId).getData();
                staffMyShopTaskRecordPageVo.setUserName(sysUser.getNickName());
                staffMyShopTaskRecordPageVo.setUserPicture(sysUser.getAvatar());
                //获取任务详情文件
                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;
            SysUser sysUser;
            for(StaffMyShopTaskRecordPageVo staffMyShopTaskRecordPageVo : myShopTaskRecordPageVoList){
                //获取任务用户信息
                userId = staffMyShopTaskRecordPageVo.getUserId();
                sysUser = remoteUserService.getSysUser(userId).getData();
                staffMyShopTaskRecordPageVo.setUserName(sysUser.getNickName());
                staffMyShopTaskRecordPageVo.setUserPicture(sysUser.getAvatar());
                //获取任务详情文件
                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;
    }
}