liyong
4 天以前 be5783c8a7e13bbc76d33c95643d75779cce21db
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
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
package cn.iocoder.yudao.module.crm.service.customer;
 
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.customer.*;
import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO;
import cn.iocoder.yudao.module.crm.service.customer.bo.CrmCustomerCreateReqBO;
import jakarta.validation.Valid;
 
import java.time.LocalDateTime;
import java.util.Collection;
import java.util.List;
import java.util.Map;
 
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap;
 
/**
 * 客户 Service 接口
 *
 * @author Wanwan
 */
public interface CrmCustomerService {
 
    /**
     * 创建客户
     *
     * @param createReqVO 创建信息
     * @param userId      用户编号
     * @return 编号
     */
    Long createCustomer(@Valid CrmCustomerSaveReqVO createReqVO, Long userId);
 
    /**
     * 更新客户
     *
     * @param updateReqVO 更新信息
     */
    void updateCustomer(@Valid CrmCustomerSaveReqVO updateReqVO);
 
    /**
     * 更新客户的跟进状态
     *
     * @param id         编号
     * @param dealStatus 跟进状态
     */
    void updateCustomerDealStatus(Long id, Boolean dealStatus);
 
    /**
     * 更新客户相关的跟进信息
     *
     * @param id                 编号
     * @param contactNextTime    下次联系时间
     * @param contactLastContent 最后联系内容
     */
    void updateCustomerFollowUp(Long id, LocalDateTime contactNextTime, String contactLastContent);
 
    /**
     * 删除客户
     *
     * @param id 编号
     */
    void deleteCustomer(Long id);
 
    /**
     * 获得客户
     *
     * @param id 编号
     * @return 客户
     */
    CrmCustomerDO getCustomer(Long id);
 
    /**
     * 获得客户列表
     *
     * @param ids 客户编号数组
     * @return 客户列表
     * @author ljlleo
     */
    List<CrmCustomerDO> getCustomerList(Collection<Long> ids);
 
    /**
     * 获得所有客户列表
     *
     * @return 客户列表
     */
    List<CrmCustomerDO> getCustomerList();
 
    /**
     * 获得客户 Map
     *
     * @param ids 客户编号数组
     * @return 客户 Map
     */
    default Map<Long, CrmCustomerDO> getCustomerMap(Collection<Long> ids) {
        return convertMap(getCustomerList(ids), CrmCustomerDO::getId);
    }
 
    /**
     * 获得客户分页
     *
     * @param pageReqVO 分页查询
     * @param userId    用户编号
     * @return 客户分页
     */
    PageResult<CrmCustomerDO> getCustomerPage(CrmCustomerPageReqVO pageReqVO, Long userId);
 
    /**
     * 获得放入公海提醒的客户分页
     *
     * @param pageVO 分页查询
     * @param userId 用户编号
     * @return 客户分页
     */
    PageResult<CrmCustomerDO> getPutPoolRemindCustomerPage(CrmCustomerPageReqVO pageVO, Long userId);
 
    /**
     * 获得待进入公海的客户数量
     *
     * @param userId 用户编号
     * @return 提醒数量
     */
    Long getPutPoolRemindCustomerCount(Long userId);
 
    /**
     * 获得今日需联系客户数量
     *
     * @param userId 用户编号
     * @return 提醒数量
     */
    Long getTodayContactCustomerCount(Long userId);
 
    /**
     * 获得分配给我的客户数量
     *
     * @param userId 用户编号
     * @return 提醒数量
     */
    Long getFollowCustomerCount(Long userId);
 
    /**
     * 校验客户是否存在
     *
     * @param id 编号
     */
    void validateCustomer(Long id);
 
    /**
     * 客户转移
     *
     * @param reqVO  请求
     * @param userId 用户编号
     */
    void transferCustomer(CrmCustomerTransferReqVO reqVO, Long userId);
 
    /**
     * 锁定/解锁客户
     *
     * @param lockReqVO 更新信息
     * @param userId    用户编号
     */
    void lockCustomer(@Valid CrmCustomerLockReqVO lockReqVO, Long userId);
 
    /**
     * 创建客户
     *
     * @param customerCreateReq 请求信息
     * @param userId            用户编号
     * @return 客户列表
     */
    Long createCustomer(CrmCustomerCreateReqBO customerCreateReq, Long userId);
 
    /**
     * 批量导入客户
     *
     * @param importCustomers 导入客户列表
     * @param importReqVO     请求
     * @return 导入结果
     */
    CrmCustomerImportRespVO importCustomerList(List<CrmCustomerImportExcelVO> importCustomers, CrmCustomerImportReqVO importReqVO);
 
    // ==================== 公海相关操作 ====================
 
    /**
     * 客户放入公海
     *
     * @param id 客户编号
     */
    void putCustomerPool(Long id);
 
    /**
     * 领取公海客户
     *
     * @param ids         要领取的客户编号数组
     * @param ownerUserId 负责人
     * @param isReceive   是/否领取;true - 领取;false - 分配
     */
    void receiveCustomer(List<Long> ids, Long ownerUserId, Boolean isReceive);
 
    /**
     * 【系统】客户自动掉入公海
     *
     * @return 掉入公海数量
     */
    int autoPutCustomerPool();
 
}