Blame view

fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/pub/PubDistributeBizService.java 17.6 KB
364db3cc   张志伟   :sparkles:
1
2
  package cn.fw.valhalla.service.bus.pub;
  
b245c23a   张志伟   feature(*): 续保跟进调整
3
  import cn.fw.valhalla.common.constant.RoleCode;
b2c9b674   张志伟   feature(*): 对接活动系统
4
5
  import cn.fw.valhalla.common.utils.DateUtil;
  import cn.fw.valhalla.domain.db.customer.AffiliationRecord;
364db3cc   张志伟   :sparkles:
6
  import cn.fw.valhalla.domain.db.customer.Customer;
b245c23a   张志伟   feature(*): 续保跟进调整
7
  import cn.fw.valhalla.domain.db.follow.ClueTask;
b2c9b674   张志伟   feature(*): 对接活动系统
8
  import cn.fw.valhalla.domain.db.follow.FollowClue;
03d7ac84   张志伟   feature(*): 添加续保、...
9
  import cn.fw.valhalla.domain.db.pool.PublicPool;
1331548a   张志伟   :sparkles:
10
11
  import cn.fw.valhalla.domain.db.pool.StammkundePool;
  import cn.fw.valhalla.domain.db.pub.PubCluePool;
364db3cc   张志伟   :sparkles:
12
  import cn.fw.valhalla.domain.db.pub.PubStandStaffInfo;
1331548a   张志伟   :sparkles:
13
14
  import cn.fw.valhalla.domain.enums.*;
  import cn.fw.valhalla.domain.vo.setting.SettingVO;
03d7ac84   张志伟   feature(*): 添加续保、...
15
  import cn.fw.valhalla.rpc.ehr.EhrRpcService;
b245c23a   张志伟   feature(*): 续保跟进调整
16
  import cn.fw.valhalla.rpc.erp.UserService;
03d7ac84   张志伟   feature(*): 添加续保、...
17
  import cn.fw.valhalla.rpc.erp.dto.UserInfoDTO;
b245c23a   张志伟   feature(*): 续保跟进调整
18
  import cn.fw.valhalla.rpc.erp.dto.UserRoleDataRangeDTO;
29d5d4a0   张志伟   feature(*): 对接oop...
19
  import cn.fw.valhalla.rpc.mkt.MktRpcService;
b2c9b674   张志伟   feature(*): 对接活动系统
20
  import cn.fw.valhalla.rpc.mkt.dto.QualificationDTO;
364db3cc   张志伟   :sparkles:
21
22
23
  import cn.fw.valhalla.rpc.oop.OopService;
  import cn.fw.valhalla.rpc.oop.dto.ShopDTO;
  import cn.fw.valhalla.rpc.shirasawa.ShirasawaRpcService;
1331548a   张志伟   :sparkles:
24
25
  import cn.fw.valhalla.service.bus.setting.SettingBizService;
  import cn.fw.valhalla.service.data.*;
364db3cc   张志伟   :sparkles:
26
  import cn.hutool.core.collection.ListUtil;
1331548a   张志伟   :sparkles:
27
  import com.baomidou.mybatisplus.core.toolkit.Wrappers;
364db3cc   张志伟   :sparkles:
28
29
30
31
32
33
34
  import lombok.RequiredArgsConstructor;
  import lombok.extern.slf4j.Slf4j;
  import org.springframework.stereotype.Service;
  import org.springframework.transaction.annotation.Transactional;
  import org.springframework.util.CollectionUtils;
  import org.springframework.util.StringUtils;
  
1331548a   张志伟   :sparkles:
35
36
37
38
  import java.math.BigDecimal;
  import java.math.RoundingMode;
  import java.time.LocalDate;
  import java.util.*;
364db3cc   张志伟   :sparkles:
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
  import java.util.stream.Collectors;
  
  /**
   * 公共池站岗分配
   *
   * @author : kurisu
   * @version : 1.0
   * @className : PubDBizService
   * @description : 公共池站岗分配
   * @date : 2023-03-11 15:55
   */
  @RequiredArgsConstructor
  @Service
  @Slf4j
  public class PubDistributeBizService {
364db3cc   张志伟   :sparkles:
54
      private final OopService oopService;
b245c23a   张志伟   feature(*): 续保跟进调整
55
      private final UserService userService;
03d7ac84   张志伟   feature(*): 添加续保、...
56
      private final EhrRpcService ehrRpcService;
b2c9b674   张志伟   feature(*): 对接活动系统
57
      private final FollowClueService followClueService;
b245c23a   张志伟   feature(*): 续保跟进调整
58
      private final ClueTaskService clueTaskService;
364db3cc   张志伟   :sparkles:
59
60
61
62
      private final ShirasawaRpcService shirasawaRpcService;
      private final PublicPoolService publicPoolService;
      private final CustomerService customerService;
      private final PubStandStaffInfoService pubStandStaffInfoService;
1331548a   张志伟   :sparkles:
63
64
65
      private final PubCluePoolService pubCluePoolService;
      private final SettingBizService settingBizService;
      private final StammkundePoolService stammkundePoolService;
29d5d4a0   张志伟   feature(*): 对接oop...
66
      private final MktRpcService mktRpcService;
b2c9b674   张志伟   feature(*): 对接活动系统
67
      private final AffiliationRecordService affiliationRecordService;
364db3cc   张志伟   :sparkles:
68
  
efdaf957   张志伟   feature(*): bug修复
69
  
364db3cc   张志伟   :sparkles:
70
71
72
      /**
       * 分配
       *
1331548a   张志伟   :sparkles:
73
       * @param id 公共站岗id
364db3cc   张志伟   :sparkles:
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
       * @return
       */
      @Transactional(rollbackFor = Exception.class)
      public Boolean distribute(Long id) {
          PubStandStaffInfo staffInfo = pubStandStaffInfoService.getById(id);
          if (Objects.isNull(staffInfo)) {
              return true;
          }
          if (staffInfo.getNoInvolved() || !staffInfo.getLining()) {
              return true;
          }
          Boolean checked = checkStaff(staffInfo);
          if (null == checked) {
              return false;
          } else if (!checked) {
              return true;
          }
efdaf957   张志伟   feature(*): bug修复
91
92
          boolean can_distributable = distributable(staffInfo.getStaffId(), staffInfo.getGroupId());
          if (!can_distributable) {
1331548a   张志伟   :sparkles:
93
94
              staffInfo.setLining(false);
              staffInfo.setQueueable(false);
39281d58   张志伟   feature(*): 修改人员站岗信息
95
              staffInfo.setReasonOfNoLining("被暂停分配资格");
1331548a   张志伟   :sparkles:
96
97
              pubStandStaffInfoService.updateById(staffInfo);
              return true;
364db3cc   张志伟   :sparkles:
98
          }
efdaf957   张志伟   feature(*): bug修复
99
          Boolean distributed = distribute4Staff(staffInfo);
c2c96eeb   张志伟   feature(*): 公共池站岗联调
100
101
102
          if (Boolean.TRUE.equals(distributed)) {
              staffInfo.setLining(false);
              staffInfo.setQueueable(false);
39281d58   张志伟   feature(*): 修改人员站岗信息
103
              staffInfo.setReasonOfNoLining("跟进待办未完成");
c2c96eeb   张志伟   feature(*): 公共池站岗联调
104
105
106
              pubStandStaffInfoService.updateById(staffInfo);
          }
          return distributed;
364db3cc   张志伟   :sparkles:
107
108
109
110
111
112
113
114
115
116
117
118
119
120
      }
  
      /**
       * 检查人员状态
       *
       * @return
       */
      public Boolean checkStaff(PubStandStaffInfo staffInfo) {
          Boolean aBoolean = shirasawaRpcService.hasOngoingFollow(staffInfo.getStaffId());
          if (null == aBoolean) {
              return null;
          }
          if (Boolean.TRUE.equals(aBoolean)) {
              staffInfo.setLining(false);
1331548a   张志伟   :sparkles:
121
              staffInfo.setQueueable(false);
39281d58   张志伟   feature(*): 修改人员站岗信息
122
              staffInfo.setReasonOfNoLining("跟进待办未完成");
364db3cc   张志伟   :sparkles:
123
124
125
126
127
128
129
              pubStandStaffInfoService.updateById(staffInfo);
              return false;
          }
          return true;
      }
  
      /**
03d7ac84   张志伟   feature(*): 添加续保、...
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
       * 线索开始跟进后建立专属线索关系(如果能的话)
       *
       * @param pubClue
       */
      @Transactional(rollbackFor = Exception.class)
      public void distributeFromClue(final PubCluePool pubClue) {
          Customer customer = customerService.queryByEngineNo(pubClue.getVin(), pubClue.getGroupId());
          if (Objects.isNull(customer)) {
              return;
          }
          PublicPool publicPool = publicPoolService.queryByVin(pubClue.getVin(), pubClue.getGroupId());
          if (Objects.isNull(publicPool)) {
              return;
          }
          if (Objects.nonNull(customer.getAdviserId())) {
              return;
          }
          Optional<SettingVO> settingVO = settingBizService.querySettingByType(FollowTypeEnum.OT, SettingTypeEnum.PUBLIC_VALID_DAY, pubClue.getGroupId(), null);
          int publicValidDay = settingVO.map(SettingVO::getDetailValue).orElse(60);
          pubClue.setDeadline(LocalDate.now().plusDays(publicValidDay));
  
          UserInfoDTO user = ehrRpcService.user(pubClue.getAdviserId());
          if (Objects.nonNull(user)) {
              pubClue.setAdviserName(user.getUserName());
          }
          ShopDTO shop = oopService.shop(pubClue.getShopId());
          if (Objects.nonNull(shop)) {
              pubClue.setShopName(shop.getShortName());
          }
          createPubRelation(pubClue, customer.getId());
      }
  
      /**
364db3cc   张志伟   :sparkles:
163
164
165
166
167
168
169
170
171
172
173
174
175
       * 查询门店
       *
       * @param staffInfo
       * @return
       */
      private List<Long> getShopIds(final PubStandStaffInfo staffInfo) {
          List<Long> shopIdList = ListUtil.toList();
          PubStandRang standRang = Optional.ofNullable(staffInfo.getStandRang()).orElse(PubStandRang.SHOP);
          switch (standRang) {
              case SHOP:
                  shopIdList = ListUtil.toList(staffInfo.getShopId());
                  break;
              case AREA:
29d5d4a0   张志伟   feature(*): 对接oop...
176
                  shopIdList = oopService.areaShops(staffInfo.getGroupId(), staffInfo.getAreaCode())
364db3cc   张志伟   :sparkles:
177
178
179
180
181
182
183
184
185
186
187
                          .stream().map(ShopDTO::getId)
                          .filter(r -> !r.equals(staffInfo.getShopId()))
                          .collect(Collectors.toList());
                  break;
              default:
                  break;
          }
          return shopIdList;
      }
  
      /**
efdaf957   张志伟   feature(*): bug修复
188
       * 查询是否满足分配条件
1331548a   张志伟   :sparkles:
189
190
191
192
193
       *
       * @param userId
       * @param groupId
       * @return
       */
efdaf957   张志伟   feature(*): bug修复
194
      private boolean distributable(Long userId, Long groupId) {
1331548a   张志伟   :sparkles:
195
196
197
198
199
200
201
          int count = pubCluePoolService.count(Wrappers.<PubCluePool>lambdaQuery()
                  .eq(PubCluePool::getAdviserId, userId)
                  .eq(PubCluePool::getGroupId, groupId)
          );
  
          Optional<SettingVO> minimumClueCountSetting = settingBizService.querySettingByType(FollowTypeEnum.OT, SettingTypeEnum.MINIMUM_CLUE_COUNT, groupId, null);
          int initCount = minimumClueCountSetting.map(SettingVO::getDetailValue).orElse(50);
97e9f0cc   张志伟   feature(*): bug修复
202
          if (count > initCount) {
1331548a   张志伟   :sparkles:
203
204
205
206
207
208
              Optional<SettingVO> settingVO = settingBizService.querySettingByType(FollowTypeEnum.OT, SettingTypeEnum.MINIMUM_CONVERSION_RATE, groupId, null);
              int minimum_conversion_rate = settingVO.map(SettingVO::getDetailValue).orElse(2000);
              BigDecimal rate = BigDecimal.valueOf(minimum_conversion_rate).divide(BigDecimal.valueOf(1000_0), 2, RoundingMode.HALF_UP);
  
              Optional<SettingVO> increaseCountSetting = settingBizService.querySettingByType(FollowTypeEnum.OT, SettingTypeEnum.INCREASE_COUNT, groupId, null);
              int increaseCount = increaseCountSetting.map(SettingVO::getDetailValue).orElse(10);
efdaf957   张志伟   feature(*): bug修复
209
210
211
              if (count % increaseCount != 0) {
                  return true;
              }
1331548a   张志伟   :sparkles:
212
213
214
              List<PubCluePool> list = pubCluePoolService.list(Wrappers.<PubCluePool>lambdaQuery()
                      .eq(PubCluePool::getGroupId, groupId)
                      .eq(PubCluePool::getAdviserId, userId)
1331548a   张志伟   :sparkles:
215
216
217
218
219
220
                      .ge(PubCluePool::getStartTime, LocalDate.now().minusDays(60L).atStartOfDay())
              );
  
              if (!CollectionUtils.isEmpty(list)) {
                  long completeCount = list.stream().filter(r -> PublicClueStateEnum.COMPLETE.equals(r.getState())).count();
                  BigDecimal actuallyRate = BigDecimal.valueOf(completeCount).divide(BigDecimal.valueOf(list.size()), 2, RoundingMode.HALF_UP);
efdaf957   张志伟   feature(*): bug修复
221
                  return actuallyRate.compareTo(rate) >= 0;
1331548a   张志伟   :sparkles:
222
              }
efdaf957   张志伟   feature(*): bug修复
223
              return true;
1331548a   张志伟   :sparkles:
224
          }
efdaf957   张志伟   feature(*): bug修复
225
          return true;
1331548a   张志伟   :sparkles:
226
227
228
229
230
231
      }
  
      /**
       * 分配指定数量的客户
       *
       * @param staffInfo
1331548a   张志伟   :sparkles:
232
233
       * @return
       */
efdaf957   张志伟   feature(*): bug修复
234
      private Boolean distribute4Staff(PubStandStaffInfo staffInfo) {
1331548a   张志伟   :sparkles:
235
236
237
238
239
240
241
242
          List<Long> list = getShopIds(staffInfo);
          if (CollectionUtils.isEmpty(list)) {
              return false;
          }
          List<String> vinList = publicPoolService.queryIdListByShops(list);
          if (CollectionUtils.isEmpty(vinList)) {
              return false;
          }
efdaf957   张志伟   feature(*): bug修复
243
          List<String> vinArr = getBeDistributeVin(staffInfo, vinList, 1);
1331548a   张志伟   :sparkles:
244
245
246
247
248
249
250
          if (StringUtils.isEmpty(vinArr)) {
              return false;
          }
          return createClue(vinArr, staffInfo);
      }
  
      /**
364db3cc   张志伟   :sparkles:
251
252
253
254
       * 分配给人员 档案
       *
       * @param staffInfo
       * @param vinList
1331548a   张志伟   :sparkles:
255
       * @param count
364db3cc   张志伟   :sparkles:
256
257
       * @return
       */
1331548a   张志伟   :sparkles:
258
259
      private List<String> getBeDistributeVin(PubStandStaffInfo staffInfo, List<String> vinList, int count) {
          List<String> vinArr = null;
364db3cc   张志伟   :sparkles:
260
261
262
          PubStandType standType = Optional.ofNullable(staffInfo.getStandType()).orElse(PubStandType.PUB);
          switch (standType) {
              case PUB:
b245c23a   张志伟   feature(*): 续保跟进调整
263
                  vinArr = determinePub(vinList, staffInfo, count);
364db3cc   张志伟   :sparkles:
264
265
                  break;
              case ACTIVITY:
1331548a   张志伟   :sparkles:
266
                  vinArr = determineMkt(vinList, staffInfo, count);
364db3cc   张志伟   :sparkles:
267
268
269
270
                  break;
              default:
                  break;
          }
1331548a   张志伟   :sparkles:
271
          return vinArr;
364db3cc   张志伟   :sparkles:
272
273
274
      }
  
      /**
b245c23a   张志伟   feature(*): 续保跟进调整
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
       * 分配档案
       *
       * @param vinList
       * @param staffInfo
       * @param count
       * @return
       */
      private List<String> determinePub(List<String> vinList, PubStandStaffInfo staffInfo, int count) {
          List<String> list = new ArrayList<>();
          for (String vin : vinList) {
              if (list.size() >= count) {
                  break;
              }
              Customer customer = customerService.queryByFrameNo(vin, staffInfo.getGroupId());
              if (Objects.isNull(customer)) {
                  continue;
              }
              boolean hasDefeat = affiliationRecordService.count(Wrappers.<AffiliationRecord>lambdaQuery()
                      .eq(AffiliationRecord::getCustomerId, customer.getId())
                      .eq(AffiliationRecord::getOriginUserId, staffInfo.getStaffId())
                      .ge(AffiliationRecord::getDefeatTime, DateUtil.localDate2Date(LocalDate.now().minusMonths(12L)))
              ) > 1;
              if (hasDefeat) {
                  continue;
              }
              FollowClue clue = followClueService.getOne(Wrappers.<FollowClue>lambdaQuery()
                              .eq(FollowClue::getVin, vin)
                              .eq(FollowClue::getClueType, FollowTypeEnum.IR)
                              .eq(FollowClue::getClueState, ClueStatusEnum.ONGOING)
                      , Boolean.FALSE
              );
              if (Objects.nonNull(clue)) {
8bf465d6   张志伟   feature(*): 修改人员站岗信息
307
                  ClueTask clueTask = clueTaskService.queryOngoingTaskByClueId(clue.getId(), clue.getClueType());
b245c23a   张志伟   feature(*): 续保跟进调整
308
309
310
311
312
313
314
315
316
317
318
319
                  Long followUser = clueTask.getFollowUser();
                  List<UserRoleDataRangeDTO> roleDataRange = userService.getUserRoleDataRange(followUser, RoleCode.FWGW);
                  if (!staffInfo.getStaffId().equals(followUser) && !CollectionUtils.isEmpty(roleDataRange)) {
                      continue;
                  }
              }
              list.add(vin);
          }
          return list;
      }
  
      /**
364db3cc   张志伟   :sparkles:
320
321
322
323
       * 查询档案用户能否参与活动
       *
       * @param vinList
       * @param staffInfo
1331548a   张志伟   :sparkles:
324
       * @param count
364db3cc   张志伟   :sparkles:
325
326
       * @return
       */
1331548a   张志伟   :sparkles:
327
328
      private List<String> determineMkt(List<String> vinList, PubStandStaffInfo staffInfo, int count) {
          List<String> list = new ArrayList<>();
364db3cc   张志伟   :sparkles:
329
          for (String vin : vinList) {
b245c23a   张志伟   feature(*): 续保跟进调整
330
              if (list.size() >= count) {
1331548a   张志伟   :sparkles:
331
332
                  break;
              }
b2c9b674   张志伟   feature(*): 对接活动系统
333
334
335
336
337
338
339
              Customer customer = customerService.queryByFrameNo(vin, staffInfo.getGroupId());
              if (Objects.isNull(customer)) {
                  continue;
              }
              boolean hasDefeat = affiliationRecordService.count(Wrappers.<AffiliationRecord>lambdaQuery()
                      .eq(AffiliationRecord::getCustomerId, customer.getId())
                      .eq(AffiliationRecord::getOriginUserId, staffInfo.getStaffId())
b245c23a   张志伟   feature(*): 续保跟进调整
340
                      .ge(AffiliationRecord::getDefeatTime, DateUtil.localDate2Date(LocalDate.now().minusMonths(12L)))
b2c9b674   张志伟   feature(*): 对接活动系统
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
              ) > 1;
              if (hasDefeat) {
                  continue;
              }
              boolean hasInsFollow = followClueService.count(Wrappers.<FollowClue>lambdaQuery()
                      .eq(FollowClue::getVin, vin)
                      .eq(FollowClue::getClueType, FollowTypeEnum.IR)
                      .eq(FollowClue::getClueState, ClueStatusEnum.ONGOING)
              ) > 0;
              QualificationDTO dto = QualificationDTO.createWithCustomer(customer);
              dto.setShopId(staffInfo.getShopId());
              dto.setLoseClue(Boolean.FALSE);
              dto.setRenewalClue(hasInsFollow);
              dto.setActivityNo(staffInfo.getIdCode());
              try {
                  Thread.sleep(450);
              } catch (InterruptedException e) {
                  log.info("节流失败");
              }
              Boolean canJoinActivity = mktRpcService.queryQualifications(dto);
              if (Boolean.TRUE.equals(canJoinActivity)) {
1331548a   张志伟   :sparkles:
362
                  list.add(vin);
364db3cc   张志伟   :sparkles:
363
364
              }
          }
1331548a   张志伟   :sparkles:
365
          return list;
364db3cc   张志伟   :sparkles:
366
367
368
369
      }
  
      /**
       * 创建线索和分配记录
1331548a   张志伟   :sparkles:
370
371
       *
       * @param vinArr
364db3cc   张志伟   :sparkles:
372
373
374
       * @param staffInfo
       * @return
       */
1331548a   张志伟   :sparkles:
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
      private boolean createClue(List<String> vinArr, PubStandStaffInfo staffInfo) {
          List<PubCluePool> clueList = new ArrayList<>();
          List<StammkundePool> stammkundePoolList = new ArrayList<>();
          final Long groupId = staffInfo.getGroupId();
          Optional<SettingVO> settingVO = settingBizService.querySettingByType(FollowTypeEnum.OT, SettingTypeEnum.PUBLIC_VALID_DAY, groupId, null);
          int publicValidDay = settingVO.map(SettingVO::getDetailValue).orElse(60);
          final Long staffId = staffInfo.getStaffId();
          final Long shopId = staffInfo.getShopId();
          for (String vin : vinArr) {
              Customer customer = customerService.queryByFrameNo(vin, groupId);
              if (Objects.isNull(customer) || Objects.nonNull(customer.getAdviserId())) {
                  continue;
              }
              PubCluePool pool = new PubCluePool();
              pool.setVin(vin);
              pool.setStartTime(LocalDate.now());
              pool.setDeadline(LocalDate.now().plusDays(publicValidDay));
              pool.setState(PublicClueStateEnum.ONGOING);
              pool.setBegun(Boolean.FALSE);
              pool.setSourceType(staffInfo.getStandType());
              pool.setAdviserId(staffId);
              pool.setAdviserName(staffInfo.getStaffName());
              pool.setShopId(shopId);
              pool.setShopName(staffInfo.getShopName());
              pool.setGroupId(groupId);
              clueList.add(pool);
  
              StammkundePool stammkundePool = new StammkundePool();
              stammkundePool.setCustomerId(customer.getId());
              stammkundePool.setShopId(shopId);
              stammkundePool.setGroupId(groupId);
              stammkundePool.setAktiv(Boolean.FALSE);
              stammkundePool.setCreateTime(new Date());
              stammkundePool.setAdviserId(staffId);
              stammkundePool.setAdviserName(staffInfo.getStaffName());
              stammkundePool.setSources(StammkundeSourcesEnum.PUBLIC_POOL);
              stammkundePool.setPoolStatus(StammkundeStatusEnum.PUBLIC);
              stammkundePoolList.add(stammkundePool);
          }
          if (CollectionUtils.isEmpty(clueList)) {
364db3cc   张志伟   :sparkles:
415
416
              return false;
          }
1331548a   张志伟   :sparkles:
417
418
419
          customerService.afterDistributePubClue(vinArr, staffId, shopId, groupId);
          pubCluePoolService.saveBatch(clueList);
          stammkundePoolService.saveBatch(stammkundePoolList);
33a55d43   张志伟   feature(*): bug修复
420
          publicPoolService.removeBatchByVin(vinArr, groupId);
364db3cc   张志伟   :sparkles:
421
422
          return true;
      }
1331548a   张志伟   :sparkles:
423
  
03d7ac84   张志伟   feature(*): 添加续保、...
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
      private void createPubRelation(PubCluePool pool, Long customerId) {
          Long staffId = pool.getAdviserId();
          Long shopId = pool.getShopId();
          Long groupId = pool.getGroupId();
          String vin = pool.getVin();
  
          StammkundePool stammkundePool = new StammkundePool();
          stammkundePool.setCustomerId(customerId);
          stammkundePool.setShopId(shopId);
          stammkundePool.setGroupId(groupId);
          stammkundePool.setAktiv(Boolean.FALSE);
          stammkundePool.setCreateTime(new Date());
          stammkundePool.setAdviserId(staffId);
          stammkundePool.setAdviserName(pool.getAdviserName());
          stammkundePool.setSources(StammkundeSourcesEnum.PUBLIC_POOL);
          stammkundePool.setPoolStatus(StammkundeStatusEnum.PUBLIC);
  
          customerService.afterDistributePubClue(Collections.singletonList(vin), staffId, shopId, groupId);
          pubCluePoolService.save(pool);
          stammkundePoolService.save(stammkundePool);
          publicPoolService.removeByVin(vin, groupId);
      }
364db3cc   张志伟   :sparkles:
446
  }