9e476657
张志伟
|
1
2
|
package cn.fw.valhalla.service.bus.cust;
|
dac2e8b1
张志伟
|
3
|
import cn.fw.common.exception.BusinessException;
|
6c848e1d
张志伟
|
4
5
6
7
8
9
10
11
12
|
import cn.fw.common.web.auth.LoginAuthBean;
import cn.fw.common.web.auth.PassportAuthBean;
import cn.fw.data.base.domain.common.Message;
import cn.fw.passport.sdk.api.param.WxBCodeParam;
import cn.fw.starter.redis.redis.RedisUtil;
import cn.fw.third.push.sdk.api.para.im.BusinessType;
import cn.fw.third.push.sdk.api.para.im.MessageBusinessType;
import cn.fw.third.push.sdk.api.para.im.MsgPara;
import cn.fw.valhalla.common.constant.RoleCode;
|
03b7b995
张志伟
✨ 公共池后端逻辑 100%
|
13
|
import cn.fw.valhalla.common.utils.DateUtil;
|
6c848e1d
张志伟
|
14
15
16
|
import cn.fw.valhalla.common.utils.MessageFormatUtil;
import cn.fw.valhalla.common.utils.QRCodeKit;
import cn.fw.valhalla.common.utils.StringUtils;
|
03b7b995
张志伟
✨ 公共池后端逻辑 100%
|
17
|
import cn.fw.valhalla.domain.db.customer.AffiliationRecord;
|
6c848e1d
张志伟
|
18
19
|
import cn.fw.valhalla.domain.db.customer.Customer;
import cn.fw.valhalla.domain.db.customer.CustomerBaseInfo;
|
376d3231
张志伟
✨ 主动放弃跟进 100%
|
20
|
import cn.fw.valhalla.domain.db.follow.FollowTask;
|
9b497427
张志伟
|
21
|
import cn.fw.valhalla.domain.db.pool.CustomerCluePool;
|
8587e21d
张志伟
|
22
|
import cn.fw.valhalla.domain.db.pool.StammkundePool;
|
6c848e1d
张志伟
|
23
24
|
import cn.fw.valhalla.domain.dto.CustomerChangeDto;
import cn.fw.valhalla.domain.dto.CustomerDetailDto;
|
2b628098
张志伟
🚀 v1.0.1 服务顾问离职分配...
|
25
|
import cn.fw.valhalla.domain.enums.*;
|
6c848e1d
张志伟
|
26
27
28
|
import cn.fw.valhalla.domain.vo.customer.CustomerChangeInfoVO;
import cn.fw.valhalla.domain.vo.customer.CustomerChangeQrCodeVO;
import cn.fw.valhalla.rpc.angel.dto.InsuranceDTO;
|
03b7b995
张志伟
✨ 公共池后端逻辑 100%
|
29
|
import cn.fw.valhalla.rpc.erp.dto.PostUserDTO;
|
03b7b995
张志伟
✨ 公共池后端逻辑 100%
|
30
|
import cn.fw.valhalla.rpc.erp.dto.UserRoleDataRangeDTO;
|
6c848e1d
张志伟
|
31
32
33
|
import cn.fw.valhalla.rpc.member.MemberRpcService;
import cn.fw.valhalla.rpc.member.dto.MemberUserDTO;
import cn.fw.valhalla.rpc.oop.dto.ShopDTO;
|
6c848e1d
张志伟
|
34
35
36
|
import cn.fw.valhalla.rpc.passport.PassportService;
import cn.fw.valhalla.sdk.enums.CarUseTypeEnum;
import cn.fw.valhalla.sdk.enums.GenderEnum;
|
03b7b995
张志伟
✨ 公共池后端逻辑 100%
|
37
|
import cn.fw.valhalla.sdk.param.ChangeAdviserReq;
|
9b497427
张志伟
|
38
39
40
41
|
import cn.fw.valhalla.service.data.AffiliationRecordService;
import cn.fw.valhalla.service.data.CustomerCluePoolService;
import cn.fw.valhalla.service.data.FollowTaskService;
import cn.fw.valhalla.service.data.PublicPoolService;
|
8587e21d
张志伟
|
42
|
import cn.fw.valhalla.service.event.CustomerDefeatedEvent;
|
6c848e1d
张志伟
|
43
44
|
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
8587e21d
张志伟
|
45
|
import lombok.RequiredArgsConstructor;
|
9e476657
张志伟
|
46
|
import lombok.extern.slf4j.Slf4j;
|
6c848e1d
张志伟
|
47
|
import org.springframework.beans.BeanUtils;
|
fa966283
张志伟
📝 v1.0.1调整
|
48
|
import org.springframework.context.ApplicationEventPublisher;
|
9e476657
张志伟
|
49
|
import org.springframework.stereotype.Service;
|
6c848e1d
张志伟
|
50
|
import org.springframework.transaction.annotation.Transactional;
|
376d3231
张志伟
✨ 主动放弃跟进 100%
|
51
|
import org.springframework.util.CollectionUtils;
|
6c848e1d
张志伟
|
52
|
|
03b7b995
张志伟
✨ 公共池后端逻辑 100%
|
53
|
import java.time.LocalDateTime;
|
6c848e1d
张志伟
|
54
55
56
|
import java.util.*;
import static cn.fw.common.businessvalidator.Validator.BV;
|
9e476657
张志伟
|
57
58
59
60
61
62
63
64
65
|
/**
* @author : kurisu
* @className : CustomerChangeBizService
* @description : 档案变更服务
* @date: 2020-08-12 11:23
*/
@Slf4j
@Service
|
8587e21d
张志伟
|
66
|
@RequiredArgsConstructor
|
6c848e1d
张志伟
|
67
68
69
70
71
72
73
74
75
|
public class CustomerChangeBizService extends AbstractCustomerService {
public final String CUSTOMER_CHANGE_CODE = "valhalla:customer:change:key:{0}:{1}";
private final RedisUtil redisUtil;
/**
* 会员服务
*/
private final PassportService passportService;
private final MemberRpcService memberRpcService;
|
376d3231
张志伟
✨ 主动放弃跟进 100%
|
76
|
private final FollowTaskService followTaskService;
|
9b497427
张志伟
|
77
|
private final CustomerCluePoolService customerCluePoolService;
|
03b7b995
张志伟
✨ 公共池后端逻辑 100%
|
78
|
private final AffiliationRecordService affiliationRecordService;
|
27291f56
张志伟
|
79
|
private final PublicPoolService publicPoolService;
|
fa966283
张志伟
📝 v1.0.1调整
|
80
|
private final ApplicationEventPublisher eventPublisher;
|
6c848e1d
张志伟
|
81
|
|
6c848e1d
张志伟
|
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
|
/**
* 生成档案变更二维码
*
* @param user
* @param customerChangeDto
* @return
*/
public CustomerChangeQrCodeVO createQrCode(LoginAuthBean user, CustomerChangeDto customerChangeDto) {
String plateNo = customerChangeDto.getPlateNo();
String vin = customerChangeDto.getFrameNo();
ShopDTO shopDTO = queryDealId(user.getUserId(), RoleCode.FWGW);
BV.notNull(shopDTO, () -> "用户权限不正确");
if (customerChangeDto.getId() == null) {
customerChangeDto.setGroupId(shopDTO.getGroupId());
customerChangeDto.setDealerId(shopDTO.getDealerId());
customerChangeDto.setShopId(shopDTO.getId());
customerChangeDto.setAdviserId(user.getUserId());
} else {
Customer cust = customerService.queryById(customerChangeDto.getId());
customerChangeDto.setGroupId(cust.getGroupId());
customerChangeDto.setDealerId(shopDTO.getDealerId());
customerChangeDto.setShopId(cust.getShopId());
customerChangeDto.setAdviserId(cust.getAdviserId());
customerChangeDto.setModelCode(cust.getSpecCode());
}
String str = plateNo + vin + user.getUserId();
String key = MessageFormatUtil.MessageFormatTransfer(CUSTOMER_CHANGE_CODE, customerChangeDto.getShopId(), str);
try {
String customerString = JSON.toJSONString(customerChangeDto);
boolean flag = redisUtil.lock(key, 1000 * 15);
BV.isTrue(flag, "重复操作,请稍后重试");
int expires = 60 * 30;
String s = redisUtil.STRINGS.setEx(key, expires, customerString);
BV.isTrue(StringUtils.isValid(s), "操作失败,请稍后重试");
String code = createCode(key, expires, customerChangeDto.getDealerId());
return new CustomerChangeQrCodeVO(code, key);
} finally {
redisUtil.unlock(key);
}
}
/**
* 根据主键查询档案信息
*
* @param customerId
* @return
*/
public CustomerChangeInfoVO mpGetById(Long customerId) {
final CustomerChangeInfoVO detailVO = new CustomerChangeInfoVO();
Customer customer = customerService.queryById(customerId);
if (customer == null) {
return null;
}
CustomerDetailDto customerDetailDto = renderDto(customer);
BeanUtils.copyProperties(customerDetailDto, detailVO);
detailVO.setId(customer.getId());
Optional<InsuranceDTO> dtoOptional = queryInsuInfo(customerId);
dtoOptional.ifPresent(t -> {
detailVO.setInsurCompanyId(t.getInsurerId());
detailVO.setInsurCompanyName(t.getInsurerName());
detailVO.setInsurExpireDate(t.getExpiryDate());
});
return detailVO;
}
/**
* 用户维护的基础信息查询
*
* @param user
* @param key
* @return
*/
public CustomerChangeInfoVO getInfo(PassportAuthBean user, String key) {
String s = redisUtil.STRINGS.get(key);
BV.isTrue(StringUtils.isValid(s), "二维码已失效");
CustomerChangeDto dto = JSON.parseObject(s, CustomerChangeDto.class);
final CustomerChangeInfoVO vo = new CustomerChangeInfoVO();
BeanUtils.copyProperties(dto, vo);
MemberUserDTO userDto = memberRpcService.user(user.getUserId());
if (userDto != null) {
vo.setMobile(userDto.getPhone());
}
this.sendMsg(vo.getAdviserId(), false, key);
return vo;
}
/**
* 档案修改
*
* @param saveDto
* @return
*/
@Transactional(rollbackFor = Exception.class)
|
376d3231
张志伟
✨ 主动放弃跟进 100%
|
177
|
public Long updateOrSave(PassportAuthBean user, CustomerChangeDto saveDto) {
|
6c848e1d
张志伟
|
178
179
180
|
final String key = saveDto.getKey();
final Long adviserId = saveDto.getAdviserId();
saveDto.setMemberId(user.getUserId());
|
376d3231
张志伟
✨ 主动放弃跟进 100%
|
181
|
Long nid;
|
6c848e1d
张志伟
|
182
183
184
185
186
187
188
189
190
191
192
|
CustomerBaseInfo baseInfo = new CustomerBaseInfo();
BeanUtils.copyProperties(saveDto, baseInfo);
baseInfo.setId(null);
baseInfo.setGender(GenderEnum.ofValue(saveDto.getGender()));
baseInfo.setUpdateTime(new Date());
//客户主动修改信息
if (StringUtils.isEmpty(key)) {
Customer customer = customerService.queryById(saveDto.getId());
baseInfo.setId(customer.getBaseId());
|
376d3231
张志伟
✨ 主动放弃跟进 100%
|
193
194
|
customerBaseInfoService.updateById(baseInfo);
return customer.getId();
|
6c848e1d
张志伟
|
195
196
197
198
199
200
201
|
}
//车牌号有档案
if (Objects.nonNull(saveDto.getMotoId())) {
//vin有档案
if (Objects.nonNull(saveDto.getId())) {
//档案和行驶证不一致 作废旧档案 更新档案
|
376d3231
张志伟
✨ 主动放弃跟进 100%
|
202
203
|
boolean bool = saveDto.getId().equals(saveDto.getMotoId());
if (!bool) {
|
39e85d50
张志伟
|
204
205
|
stammkundePoolService.reject(saveDto.getId(), saveDto.getGroupId());
customerService.forbidden(saveDto.getMotoId());
|
6c848e1d
张志伟
|
206
207
208
209
210
211
212
213
214
|
}
Customer customer = customerService.queryById(saveDto.getId());
BV.notNull(customer, "档案信息异常");
baseInfo.setId(customer.getBaseId());
customerBaseInfoService.updateById(baseInfo);
BeanUtils.copyProperties(saveDto, customer);
customer.setUseType(CarUseTypeEnum.ofValue(saveDto.getUseType()));
customer.setUpdateTime(new Date());
customer.setYn(Boolean.TRUE);
|
376d3231
张志伟
✨ 主动放弃跟进 100%
|
215
|
nid = this.edit(customer);
|
6c848e1d
张志伟
|
216
|
} else {
|
39e85d50
张志伟
|
217
218
|
stammkundePoolService.reject(saveDto.getId(), saveDto.getGroupId());
customerService.forbidden(saveDto.getMotoId());
|
6c848e1d
张志伟
|
219
220
221
222
|
Customer customer = new Customer();
BeanUtils.copyProperties(saveDto, customer);
customer.setUseType(CarUseTypeEnum.ofValue(saveDto.getUseType()));
customer.setSpecCode(saveDto.getModelCode());
|
376d3231
张志伟
✨ 主动放弃跟进 100%
|
223
|
nid = create(customer, baseInfo);
|
6c848e1d
张志伟
|
224
225
226
227
|
}
} else {
//vin有档案 行驶证车主和vin档案车主一致的情况app直接替换车牌不会到这个流程
if (Objects.nonNull(saveDto.getId())) {
|
39e85d50
张志伟
|
228
|
stammkundePoolService.reject(saveDto.getId(), saveDto.getGroupId());
|
6c848e1d
张志伟
|
229
230
231
232
233
234
235
|
customerService.forbidden(saveDto.getId());
saveDto.setId(null);
}
Customer customer = new Customer();
BeanUtils.copyProperties(saveDto, customer);
customer.setUseType(CarUseTypeEnum.ofValue(saveDto.getUseType()));
customer.setSpecCode(saveDto.getModelCode());
|
376d3231
张志伟
✨ 主动放弃跟进 100%
|
236
237
|
nid = create(customer, baseInfo);
if (Objects.nonNull(saveDto.getId())) {
|
9b497427
张志伟
|
238
|
changeTaskFollower(saveDto.getMotoId(), customer.getId(), customer.getGroupId());
|
376d3231
张志伟
✨ 主动放弃跟进 100%
|
239
|
}
|
6c848e1d
张志伟
|
240
241
242
243
244
245
|
}
if (StringUtils.isValid(key)) {
redisUtil.KEYS.del(key);
this.sendMsg(adviserId, true, key);
}
|
376d3231
张志伟
✨ 主动放弃跟进 100%
|
246
|
return nid;
|
6c848e1d
张志伟
|
247
248
|
}
|
6c848e1d
张志伟
|
249
|
/**
|
03b7b995
张志伟
✨ 公共池后端逻辑 100%
|
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
|
* 变更档案标签
*
* @param cusId
* @param tags
* @return
*/
@Transactional(rollbackFor = Exception.class)
public int updateTagById(Long cusId, String tags) {
Customer customer = customerService.queryById(cusId);
BV.notNull(customer, "档案信息异常");
customer.setTags(tags);
customer.setUpdateTime(new Date());
int updateCount = customerService.getBaseMapper().updateById(customer);
if (updateCount > 0) {
customerChangeHandler(customer);
}
return updateCount;
}
/**
* 更新保有客专属服务顾问
*
* @param changeAdviserReq 新的服务顾问
* @return 是否成功
*/
@Transactional(rollbackFor = Exception.class)
public Boolean changeAdviser(ChangeAdviserReq changeAdviserReq) {
Customer customer = customerService.queryById(changeAdviserReq.getCusId());
if (Objects.isNull(customer)) {
return true;
}
Long adviserId = changeAdviserReq.getAdviserId();
|
a37fe1c7
张志伟
|
282
|
if (adviserId.equals(customer.getAdviserId())) {
|
8e6e239d
张志伟
|
283
284
|
return true;
}
|
03b7b995
张志伟
✨ 公共池后端逻辑 100%
|
285
|
List<UserRoleDataRangeDTO> dataRange = userService.getUserRoleDataRange(adviserId, RoleCode.FWGW);
|
9b497427
张志伟
|
286
|
if (CollectionUtils.isEmpty(dataRange) || Objects.isNull(dataRange.get(0).getRangeValue())) {
|
03b7b995
张志伟
✨ 公共池后端逻辑 100%
|
287
288
289
290
291
292
293
294
|
return true;
}
Long shopId = dataRange.get(0).getRangeValue();
boolean updated = customerService.update(Wrappers.<Customer>lambdaUpdate()
.set(Customer::getAdviserId, adviserId)
.set(Customer::getShopId, shopId)
.eq(Customer::getId, changeAdviserReq.getCusId()));
|
e0e33af7
张志伟
|
295
296
|
BV.isTrue(updated, () -> "变更档案服务顾问失败,请重试");
if (Objects.nonNull(customer.getAdviserId()) && Objects.nonNull(customer.getShopId())) {
|
03b7b995
张志伟
✨ 公共池后端逻辑 100%
|
297
298
299
|
AffiliationRecord entity = createEntity(customer, adviserId, shopId);
entity.setReason(DefeatReasonEnum.SYS.getName());
affiliationRecordService.save(entity);
|
9307577e
张志伟
|
300
301
302
303
304
305
|
StammkundePool pool = stammkundePoolService.getOne(Wrappers.<StammkundePool>lambdaQuery()
.eq(StammkundePool::getCustomerId, customer.getId())
.eq(StammkundePool::getGroupId, customer.getGroupId())
.eq(StammkundePool::getAdviserId, customer.getAdviserId())
.eq(StammkundePool::getAktiv, Boolean.TRUE)
);
|
dac2e8b1
张志伟
|
306
|
if (Objects.nonNull(pool)) {
|
9307577e
张志伟
|
307
|
stammkundePoolService.reject(customer.getId(), customer.getGroupId());
|
27291f56
张志伟
|
308
|
}
|
03b7b995
张志伟
✨ 公共池后端逻辑 100%
|
309
|
}
|
e0e33af7
张志伟
|
310
311
312
313
|
if (Objects.isNull(customer.getAdviserId()) && Objects.isNull(customer.getShopId())) {
publicPoolService.removeByCustomerId(customer.getId(), customer.getGroupId());
create(customer, adviserId, true);
}
|
03b7b995
张志伟
✨ 公共池后端逻辑 100%
|
314
315
316
317
|
return updated;
}
/**
|
dac2e8b1
张志伟
|
318
|
* 二次分配更换跟进人
|
03b7b995
张志伟
✨ 公共池后端逻辑 100%
|
319
320
321
322
323
|
*
* @param task
* @return
*/
@Transactional(rollbackFor = Exception.class)
|
dac2e8b1
张志伟
|
324
|
public StammkundePool changeFollowUser(FollowTask task) throws BusinessException {
|
03b7b995
张志伟
✨ 公共池后端逻辑 100%
|
325
326
327
|
Customer customer = customerService.getById(task.getCustomerId());
if (Objects.isNull(customer)) {
log.info("档案信息异常,custId: [{}]", task.getCustomerId());
|
03b7b995
张志伟
✨ 公共池后端逻辑 100%
|
328
|
}
|
8587e21d
张志伟
|
329
330
331
332
333
334
335
|
BV.notNull(customer, () -> "档案信息不存在");
List<PostUserDTO> userList = userService.getUserByRole(customer.getShopId(), RoleCode.FWGW);
BV.isNotEmpty(userList, () -> "更换跟进人员失败:没有更多服务顾问");
Collections.shuffle(userList);
PostUserDTO userDTO = userList.get(0);
boolean bool = userDTO.getId().equals(task.getFinishUser()) && userList.size() <= 1;
|
dac2e8b1
张志伟
|
336
337
338
|
if (bool) {
return null;
}
|
8587e21d
张志伟
|
339
340
|
if (userDTO.getId().equals(task.getFinishUser())) {
userDTO = userList.get(1);
|
03b7b995
张志伟
✨ 公共池后端逻辑 100%
|
341
|
}
|
8587e21d
张志伟
|
342
343
344
345
346
347
348
|
customer.setAdviserId(userDTO.getUserId());
customer.setShopId(customer.getShopId());
customerService.updateById(customer);
AffiliationRecord entity = createEntity(customer, userDTO.getUserId(), customer.getShopId());
entity.setReason(DefeatReasonEnum.OVERDUE.getName());
affiliationRecordService.save(entity);
|
9b497427
张志伟
|
349
|
StammkundePool stammkundePool = rejectAndNew(customer, userDTO.getUserId());
|
8587e21d
张志伟
|
350
351
352
353
|
stammkundePool.setSources(StammkundeSourcesEnum.REDISTRIBUTION);
stammkundePool.setPoolStatus(StammkundeStatusEnum.TWICE);
stammkundePool.setAktiv(Boolean.FALSE);
stammkundePool.setCreateTime(new Date());
|
63fa6795
张志伟
|
354
|
stammkundePool.setGroupId(customer.getGroupId());
|
8587e21d
张志伟
|
355
356
357
|
stammkundePoolService.save(stammkundePool);
eventPublisher.publishEvent(new CustomerDefeatedEvent(task.getClueId(), task.getCustomerId(), task.getType()));
return stammkundePool;
|
03b7b995
张志伟
✨ 公共池后端逻辑 100%
|
358
359
|
}
|
03b7b995
张志伟
✨ 公共池后端逻辑 100%
|
360
361
362
363
364
365
366
367
|
/**
* 更换跟进人
*
* @param task
* @return
*/
@Transactional(rollbackFor = Exception.class)
|
bf3704cc
张志伟
|
368
|
public PostUserDTO changeInsFollowUser(FollowTask task) throws BusinessException {
|
03b7b995
张志伟
✨ 公共池后端逻辑 100%
|
369
370
371
|
Customer customer = customerService.getById(task.getCustomerId());
if (Objects.isNull(customer)) {
log.info("档案信息异常,custId: [{}]", task.getCustomerId());
|
03b7b995
张志伟
✨ 公共池后端逻辑 100%
|
372
|
}
|
9b497427
张志伟
|
373
|
BV.notNull(customer, () -> "档案信息不存在");
|
03b7b995
张志伟
✨ 公共池后端逻辑 100%
|
374
|
|
9b497427
张志伟
|
375
376
|
List<PostUserDTO> userList = userService.getUserByRole(task.getFinishUser(), RoleCode.XBGJ);
BV.isNotEmpty(userList, () -> "更换跟进人员失败:没有更多续保跟进员");
|
03b7b995
张志伟
✨ 公共池后端逻辑 100%
|
377
378
|
Collections.shuffle(userList);
PostUserDTO userDTO = userList.get(0);
|
9b497427
张志伟
|
379
|
boolean bool = userDTO.getId().equals(task.getFollowUser()) && userList.size() <= 0;
|
dac2e8b1
张志伟
|
380
381
382
|
if (bool) {
return null;
}
|
03b7b995
张志伟
✨ 公共池后端逻辑 100%
|
383
384
385
|
if (userDTO.getId().equals(task.getFollowUser())) {
userDTO = userList.get(1);
}
|
bf3704cc
张志伟
|
386
|
return userDTO;
|
fa966283
张志伟
📝 v1.0.1调整
|
387
388
|
}
|
03b7b995
张志伟
✨ 公共池后端逻辑 100%
|
389
|
/**
|
6c848e1d
张志伟
|
390
|
* 修改档案
|
376d3231
张志伟
✨ 主动放弃跟进 100%
|
391
|
*
|
6c848e1d
张志伟
|
392
393
394
|
* @param customer
* @return
*/
|
376d3231
张志伟
✨ 主动放弃跟进 100%
|
395
396
397
|
private Long edit(Customer customer) {
boolean updated = customerService.updateById(customer);
if (updated) {
|
758162a4
张志伟
|
398
|
customerChangeHandler(customer);
|
6c848e1d
张志伟
|
399
|
}
|
376d3231
张志伟
✨ 主动放弃跟进 100%
|
400
|
return customer.getId();
|
6c848e1d
张志伟
|
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
|
}
private String createCode(String key, int expires, Long dealerId) {
final WxBCodeParam param = new WxBCodeParam();
final Map<String, String> map = new HashMap<>(1);
map.put("customerKey", key);
param.setParam(map);
param.setPage("pgCas/CarArchives/index");
param.setExpires(expires);
param.setDealerId(dealerId);
final byte[] bytes = passportService.getWxBCode(param);
if (Objects.isNull(bytes)) {
return null;
}
return QRCodeKit.byte2Base64String(bytes);
}
/**
* 消息发送
*
* @param targetUserId
* @param done
*/
private void sendMsg(Long targetUserId, boolean done, String key) {
try {
String text = "档案变更通知";
Map<String, Object> ext = new HashMap<>(3);
ext.put("type", MessageBusinessType.CUSTOMER_CHANGE_STATUS.getMsg());
ext.put("done", done);
ext.put("key", key);
final MsgPara msgPara = MsgPara.getCustomMsg(text, "", ext,
0, targetUserId, false).setBusinessType(BusinessType.INTERNAL_NOTIFICATION).build();
final Message<Integer> msg = imSendMessage.sendMsg(msgPara);
log.info("给[{}]推送im消息结果:[{}]", targetUserId, msg.getResult());
} catch (Exception e) {
e.printStackTrace();
}
}
|
376d3231
张志伟
✨ 主动放弃跟进 100%
|
441
|
|
9b497427
张志伟
|
442
443
444
445
446
447
448
449
|
private void changeTaskFollower(Long motoId, Long curId, Long groupId) {
CustomerCluePool cluePool = customerCluePoolService.queryByRefererId(motoId, groupId, FollowTypeEnum.FM);
if (Objects.nonNull(cluePool)) {
boolean equals = ClueStatusEnum.ONGOING.equals(cluePool.getClueStatus()) || ClueStatusEnum.WAITING.equals(cluePool.getClueStatus());
if (equals) {
cluePool.setRefererId(curId);
customerCluePoolService.updateById(cluePool);
}
|
376d3231
张志伟
✨ 主动放弃跟进 100%
|
450
|
}
|
9b497427
张志伟
|
451
452
453
454
455
456
|
cluePool = customerCluePoolService.queryByRefererId(motoId, groupId, FollowTypeEnum.RM);
if (Objects.nonNull(cluePool)) {
boolean equals = ClueStatusEnum.ONGOING.equals(cluePool.getClueStatus()) || ClueStatusEnum.WAITING.equals(cluePool.getClueStatus());
if (equals) {
cluePool.setRefererId(curId);
customerCluePoolService.updateById(cluePool);
|
376d3231
张志伟
✨ 主动放弃跟进 100%
|
457
|
}
|
9b497427
张志伟
|
458
459
460
461
462
463
464
465
466
|
}
cluePool = customerCluePoolService.queryByRefererId(motoId, groupId, FollowTypeEnum.IR);
if (Objects.nonNull(cluePool)) {
boolean equals = ClueStatusEnum.ONGOING.equals(cluePool.getClueStatus()) || ClueStatusEnum.WAITING.equals(cluePool.getClueStatus());
if (equals) {
cluePool.setRefererId(curId);
customerCluePoolService.updateById(cluePool);
}
}
|
03b7b995
张志伟
✨ 公共池后端逻辑 100%
|
467
|
|
172cb4a3
张志伟
|
468
|
List<FollowTask> list = followTaskService.getListByCustomerId(motoId, null);
|
27291f56
张志伟
|
469
470
471
|
if (CollectionUtils.isEmpty(list)) {
return;
}
|
9b497427
张志伟
|
472
|
list.forEach(r -> r.setCustomerId(curId));
|
03b7b995
张志伟
✨ 公共池后端逻辑 100%
|
473
474
475
|
followTaskService.updateBatchById(list);
}
|
e0e33af7
张志伟
|
476
477
478
479
480
481
482
483
484
485
486
487
488
|
private void create(Customer customer, Long adviserId, boolean publicPool) {
StammkundePool stammkundePool = rejectAndNew(customer, adviserId);
stammkundePool.setSources(StammkundeSourcesEnum.SYSTEMATIC);
if (publicPool) {
stammkundePool.setSources(StammkundeSourcesEnum.PUBLIC_POOL);
}
stammkundePool.setPoolStatus(StammkundeStatusEnum.KUNDE);
stammkundePool.setAktiv(Boolean.TRUE);
stammkundePool.setActivationTime(new Date());
stammkundePool.setCreateTime(new Date());
stammkundePoolService.save(stammkundePool);
}
|
03b7b995
张志伟
✨ 公共池后端逻辑 100%
|
489
490
491
492
493
494
495
496
497
498
499
500
|
private AffiliationRecord createEntity(Customer customer, Long adviserId, Long shopId) {
AffiliationRecord record = new AffiliationRecord();
record.setCustomerId(customer.getId());
record.setType(CustomerChangeTypeEnum.DEFEAT);
record.setDefeatTime(DateUtil.localDateTime2Date(LocalDateTime.now()));
record.setOriginUserId(customer.getAdviserId());
record.setOriginShopId(customer.getShopId());
record.setCurUserId(adviserId);
record.setCurShopId(shopId);
record.setCreateTime(DateUtil.localDateTime2Date(LocalDateTime.now()));
return record;
}
|
9e476657
张志伟
|
501
|
}
|