jiangqs
2023-07-15 b0b52cbabf7a4bc8e00fc328d14ac05336d0221e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
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.MerAgencyTaskPageDto;
import com.ruoyi.shop.domain.dto.MgtShopTaskPageDto;
import com.ruoyi.shop.domain.dto.StaffAgencyPageDto;
import com.ruoyi.shop.domain.pojo.task.AgencyTaskRecord;
import com.ruoyi.shop.domain.pojo.task.TaskFile;
import com.ruoyi.shop.domain.vo.MerAgencyTaskRecordPageVo;
import com.ruoyi.shop.domain.vo.MgtAgencyTaskRecordPageVo;
import com.ruoyi.shop.domain.vo.StaffAgencyTaskRecordPageVo;
import com.ruoyi.shop.mapper.task.AgencyTaskRecordMapper;
import com.ruoyi.shop.service.task.AgencyTaskRecordService;
import com.ruoyi.shop.service.task.TaskFileService;
import com.ruoyi.system.api.domain.poji.sys.SysUser;
import com.ruoyi.system.api.service.RemoteUserService;
import org.springframework.stereotype.Service;
 
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
 
/**
 * <p>
 * 会员跟进任务记录 服务实现类
 * </p>
 *
 * @author jqs
 * @since 2023-05-07
 */
@Service
public class AgencyTaskRecordServiceImpl extends ServiceImpl<AgencyTaskRecordMapper, AgencyTaskRecord> implements AgencyTaskRecordService {
 
    @Resource
    private AgencyTaskRecordMapper agencyTaskRecordMapper;
 
    @Resource
    private TaskFileService taskFileService;
 
    @Resource
    private RemoteUserService remoteUserService;
    /**
     *
     * @param page
     * @param merAgencyTaskPageDto
     * @return
     */
    @Override
    public List<MerAgencyTaskRecordPageVo> pageMerAgencyTaskRecord (Page page, MerAgencyTaskPageDto merAgencyTaskPageDto){
        List<MerAgencyTaskRecordPageVo> merAgencyTaskRecordPageVoList = agencyTaskRecordMapper.pageMerAgencyTaskRecord(page, merAgencyTaskPageDto);
        if(merAgencyTaskRecordPageVoList!=null&&!merAgencyTaskRecordPageVoList.isEmpty()){
            Long followId;
            List<TaskFile> taskFileList;
            List<String> picture = new ArrayList<>();
            List<String> video = new ArrayList<>();
            List<String> audio = new ArrayList<>();
            //获取跟进详情文件
            for(MerAgencyTaskRecordPageVo merAgencyTaskRecordPageVo : merAgencyTaskRecordPageVoList){
                followId = merAgencyTaskRecordPageVo.getFollowId();
                taskFileList = taskFileService.listByFollowIdAndFollowType(followId,1);
                if(taskFileList!=null&&!taskFileList.isEmpty()){
                    picture = taskFileList.stream().map(k->k.getFileUrl()).collect(Collectors.toList());
                }
                taskFileList = taskFileService.listByFollowIdAndFollowType(followId,2);
                if(taskFileList!=null&&!taskFileList.isEmpty()){
                    video = taskFileList.stream().map(k->k.getFileUrl()).collect(Collectors.toList());
                }
                taskFileList = taskFileService.listByFollowIdAndFollowType(followId,3);
                if(taskFileList!=null&&!taskFileList.isEmpty()){
                    audio = taskFileList.stream().map(k->k.getFileUrl()).collect(Collectors.toList());
                }
                merAgencyTaskRecordPageVo.setPicture(picture);
                merAgencyTaskRecordPageVo.setVideo(video);
                merAgencyTaskRecordPageVo.setAudio(audio);
            }
        }
        return merAgencyTaskRecordPageVoList;
    }
 
 
    /**
     * 平台分页获取代理商跟进任务
     * @return
     */
    @Override
    public List<MgtAgencyTaskRecordPageVo> pageMgtAgencyFollow(MgtShopTaskPageDto mgtShopTaskPageDto){
        List<MgtAgencyTaskRecordPageVo> mgtAgencyTaskRecordPageVoList = agencyTaskRecordMapper.pageMgtAgencyFollow(mgtShopTaskPageDto);
        if(mgtAgencyTaskRecordPageVoList!=null&&!mgtAgencyTaskRecordPageVoList.isEmpty()){
            Long followId;
            List<TaskFile> taskFileList;
            List<String> picture = new ArrayList<>();
            List<String> video = new ArrayList<>();
            List<String> audio = new ArrayList<>();
            Long userId;
            SysUser sysUser;
            for(MgtAgencyTaskRecordPageVo mgtAgencyTaskRecordPageVo : mgtAgencyTaskRecordPageVoList){
                //获取任务用户信息
                userId = mgtAgencyTaskRecordPageVo.getUserId();
                sysUser = remoteUserService.getSysUser(userId).getData();
                mgtAgencyTaskRecordPageVo.setUserName(sysUser.getNickName());
                mgtAgencyTaskRecordPageVo.setUserPicture(sysUser.getAvatar());
                //获取任务详情文件
                followId = mgtAgencyTaskRecordPageVo.getFollowId();
                taskFileList = taskFileService.listByFollowIdAndFollowType(followId,1);
                if(taskFileList!=null&&!taskFileList.isEmpty()){
                    picture = taskFileList.stream().map(k->k.getFileUrl()).collect(Collectors.toList());
                }
                taskFileList = taskFileService.listByFollowIdAndFollowType(followId,2);
                if(taskFileList!=null&&!taskFileList.isEmpty()){
                    video = taskFileList.stream().map(k->k.getFileUrl()).collect(Collectors.toList());
                }
                taskFileList = taskFileService.listByFollowIdAndFollowType(followId,3);
                if(taskFileList!=null&&!taskFileList.isEmpty()){
                    audio = taskFileList.stream().map(k->k.getFileUrl()).collect(Collectors.toList());
                }
                mgtAgencyTaskRecordPageVo.setPicture(picture);
                mgtAgencyTaskRecordPageVo.setVideo(video);
                mgtAgencyTaskRecordPageVo.setAudio(audio);
            }
        }
        return mgtAgencyTaskRecordPageVoList;
    }
 
    /**
     * @description  员工端分页获取经销商跟进任务记录列表
     * @author  jqs
     * @date    2023/7/14 19:24
     * @param page
     * @param staffAgencyPageDto
     * @return  List<StaffAgencyTaskRecordPageVo>
     */
    @Override
    public List<StaffAgencyTaskRecordPageVo> pageStaffAgencyTaskRecord(Page page, StaffAgencyPageDto staffAgencyPageDto){
        List<StaffAgencyTaskRecordPageVo> agencyTaskRecordPageVoList = agencyTaskRecordMapper.pageStaffAgencyTaskRecord(page, staffAgencyPageDto);
        if(agencyTaskRecordPageVoList!=null&&!agencyTaskRecordPageVoList.isEmpty()){
            Long followId;
            List<TaskFile> taskFileList;
            List<String> picture = new ArrayList<>();
            List<String> video = new ArrayList<>();
            List<String> audio = new ArrayList<>();
            Long userId;
            SysUser sysUser;
            for(StaffAgencyTaskRecordPageVo staffAgencyTaskRecordPageVo : agencyTaskRecordPageVoList){
                //获取任务用户信息
                userId = staffAgencyTaskRecordPageVo.getUserId();
                sysUser = remoteUserService.getSysUser(userId).getData();
                staffAgencyTaskRecordPageVo.setUserName(sysUser.getNickName());
                staffAgencyTaskRecordPageVo.setUserPicture(sysUser.getAvatar());
                //获取任务详情文件
                followId = staffAgencyTaskRecordPageVo.getFollowId();
                taskFileList = taskFileService.listByFollowIdAndFollowType(followId,1);
                if(taskFileList!=null&&!taskFileList.isEmpty()){
                    picture = taskFileList.stream().map(k->k.getFileUrl()).collect(Collectors.toList());
                }
                taskFileList = taskFileService.listByFollowIdAndFollowType(followId,2);
                if(taskFileList!=null&&!taskFileList.isEmpty()){
                    video = taskFileList.stream().map(k->k.getFileUrl()).collect(Collectors.toList());
                }
                taskFileList = taskFileService.listByFollowIdAndFollowType(followId,3);
                if(taskFileList!=null&&!taskFileList.isEmpty()){
                    audio = taskFileList.stream().map(k->k.getFileUrl()).collect(Collectors.toList());
                }
                staffAgencyTaskRecordPageVo.setPicture(picture);
                staffAgencyTaskRecordPageVo.setVideo(video);
                staffAgencyTaskRecordPageVo.setAudio(audio);
            }
        }
 
        return agencyTaskRecordPageVoList;
    }
 
 
}