|
@@ -196,12 +196,29 @@ public class ChannelCustomerServiceImpl extends ServiceImpl<ChannelCustomerMappe
|
196
|
196
|
// 渠道推荐的客户
|
197
|
197
|
if ("report".equals(params.getType())) {
|
198
|
198
|
ChannelCustomer customer = channelCustomerMapper.selectById(params.getId());
|
|
199
|
+ TaBuilding building = taBuildingMapper.selectById(customer.getBuildingId());
|
199
|
200
|
|
200
|
201
|
customerVisit.setBuildingId(customer.getBuildingId());
|
201
|
202
|
customerVisit.setRecommendPerson(customer.getRecommendPerson());
|
202
|
203
|
TaPerson recommendPerson = taPersonMapper.getById(customer.getRecommendPerson());
|
203
|
204
|
if (null != recommendPerson) {
|
204
|
205
|
customerVisit.setRecommendName(recommendPerson.getName());
|
|
206
|
+
|
|
207
|
+ boolean isBroker = CommConstant.PERSON_BROKER.equals(customer.getRecommendPersonType());
|
|
208
|
+ if (isBroker) {
|
|
209
|
+ // 生成节点变更通知
|
|
210
|
+ BkNotice changeNotice = new BkNotice();
|
|
211
|
+ changeNotice.setOrgId(building.getOrgId().toString());
|
|
212
|
+ changeNotice.setInstitutionId(building.getInstitutionId());
|
|
213
|
+ changeNotice.setBuildingId(building.getBuildingId());
|
|
214
|
+ changeNotice.setBuildingName(building.getBuildingName());
|
|
215
|
+ changeNotice.setPersonId(recommendPerson.getPersonId());
|
|
216
|
+ changeNotice.setPersonName(StringUtils.ifNull(recommendPerson.getName(), recommendPerson.getNickname()));
|
|
217
|
+ changeNotice.setCustomerId(customer.getCustomerId());
|
|
218
|
+ changeNotice.setCustomerName(customer.getName());
|
|
219
|
+ changeNotice.setNoticeType(CommConstant.NOTICE_TYPE_STATUS_CHANGE);
|
|
220
|
+ changeNotice.setContent("状态 到访");
|
|
221
|
+ }
|
205
|
222
|
}
|
206
|
223
|
customerVisit.setRealtyConsultant(params.getRealtyConsultant());
|
207
|
224
|
TaPerson channelPerson = taPersonMapper.getById(params.getRealtyConsultant());
|
|
@@ -216,7 +233,6 @@ public class ChannelCustomerServiceImpl extends ServiceImpl<ChannelCustomerMappe
|
216
|
233
|
queryWrapper.eq(TaRecommendCustomer::getBuildingId,customer.getBuildingId());
|
217
|
234
|
TaRecommendCustomer recommendCustomer = taRecommendCustomerMapper.selectOne(queryWrapper);
|
218
|
235
|
if (null == recommendCustomer) {
|
219
|
|
- TaBuilding building = taBuildingMapper.selectById(customer.getBuildingId());
|
220
|
236
|
// 进业务客户表
|
221
|
237
|
TaRecommendCustomer taRecommendCustomer = new TaRecommendCustomer();
|
222
|
238
|
taRecommendCustomer.setName(customerVisit.getName());
|
|
@@ -267,6 +283,8 @@ public class ChannelCustomerServiceImpl extends ServiceImpl<ChannelCustomerMappe
|
267
|
283
|
} else {
|
268
|
284
|
return ResponseBean.error("该客户已到访", ResponseBean.ERROR_UNAVAILABLE);
|
269
|
285
|
}
|
|
286
|
+
|
|
287
|
+
|
270
|
288
|
}else if ("customer".equals(params.getType())) {
|
271
|
289
|
// 置业顾问 经纪人推荐的客户
|
272
|
290
|
TaRecommendCustomer taRecommendCustomer = taRecommendCustomerMapper.selectById(params.getId());
|
|
@@ -370,21 +388,50 @@ public class ChannelCustomerServiceImpl extends ServiceImpl<ChannelCustomerMappe
|
370
|
388
|
taRecommendCustomer.setRealtyConsultant(customerPreparatory.getRealtyConsultant());
|
371
|
389
|
taRecommendCustomerMapper.updateById(taRecommendCustomer);
|
372
|
390
|
|
|
391
|
+ TaBuilding taBuilding = taBuildingMapper.selectById(taRecommendCustomer.getBuildingId());
|
|
392
|
+ if (taBuilding == null) {
|
|
393
|
+ return ResponseBean.error("校验客户及楼盘信息异常", ResponseBean.ERROR_UNAVAILABLE);
|
|
394
|
+ }
|
|
395
|
+ customerPreparatory.setBuildingId(taRecommendCustomer.getBuildingId());
|
|
396
|
+
|
|
397
|
+ // 推荐人
|
|
398
|
+ customerPreparatory.setRecommendPerson(taRecommendCustomer.getRecommendPerson());
|
|
399
|
+ TaPerson recommendPerson = taPersonMapper.getById(taRecommendCustomer.getRecommendPerson());
|
|
400
|
+ if (null != recommendPerson) {
|
|
401
|
+ customerPreparatory.setRecommendName(recommendPerson.getName());
|
|
402
|
+ }
|
|
403
|
+
|
373
|
404
|
LambdaQueryWrapper<ChannelCustomer> channelCustomerLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
374
|
405
|
channelCustomerLambdaQueryWrapper.eq(ChannelCustomer::getCustomerId,params.getCustomerId());
|
375
|
406
|
ChannelCustomer customer = channelCustomerMapper.selectOne(channelCustomerLambdaQueryWrapper);
|
376
|
407
|
if (null != customer) {
|
377
|
408
|
customer.setPreparatoryDate(LocalDateTime.now());
|
378
|
409
|
channelCustomerMapper.updateById(customer);
|
|
410
|
+
|
|
411
|
+ boolean isBroker = CommConstant.PERSON_BROKER.equals(customer.getRecommendPersonType());
|
|
412
|
+ if (isBroker) {
|
|
413
|
+ // 生成节点变更通知
|
|
414
|
+ BkNotice changeNotice = new BkNotice();
|
|
415
|
+ changeNotice.setOrgId(taBuilding.getOrgId().toString());
|
|
416
|
+ changeNotice.setInstitutionId(taBuilding.getInstitutionId());
|
|
417
|
+ changeNotice.setBuildingId(taBuilding.getBuildingId());
|
|
418
|
+ changeNotice.setBuildingName(taBuilding.getBuildingName());
|
|
419
|
+ changeNotice.setPersonId(recommendPerson.getPersonId());
|
|
420
|
+ changeNotice.setPersonName(StringUtils.ifNull(recommendPerson.getName(), recommendPerson.getNickname()));
|
|
421
|
+ changeNotice.setCustomerId(customer.getCustomerId());
|
|
422
|
+ changeNotice.setCustomerName(customer.getName());
|
|
423
|
+ changeNotice.setNoticeType(CommConstant.NOTICE_TYPE_STATUS_CHANGE);
|
|
424
|
+ changeNotice.setContent("状态 认筹");
|
|
425
|
+ }
|
379
|
426
|
}
|
380
|
427
|
|
381
|
428
|
customerPreparatory.setCreateDate(LocalDateTime.now());
|
382
|
|
- customerPreparatory.setBuildingId(taRecommendCustomer.getBuildingId());
|
383
|
|
- customerPreparatory.setRecommendPerson(taRecommendCustomer.getRecommendPerson());
|
384
|
|
- TaPerson recommendPerson = taPersonMapper.getById(taRecommendCustomer.getRecommendPerson());
|
385
|
|
- if (null != recommendPerson) {
|
386
|
|
- customerPreparatory.setRealtyConsultantName(recommendPerson.getName());
|
387
|
|
- }
|
|
429
|
+// customerPreparatory.setBuildingId(taRecommendCustomer.getBuildingId());
|
|
430
|
+// customerPreparatory.setRecommendPerson(taRecommendCustomer.getRecommendPerson());
|
|
431
|
+// TaPerson recommendPerson = taPersonMapper.getById(taRecommendCustomer.getRecommendPerson());
|
|
432
|
+// if (null != recommendPerson) {
|
|
433
|
+// customerPreparatory.setRealtyConsultantName(recommendPerson.getName());
|
|
434
|
+// }
|
388
|
435
|
customerPreparatory.setRealtyConsultant(taRecommendCustomer.getRealtyConsultant());
|
389
|
436
|
TaPerson channelPerson = taPersonMapper.getById(taRecommendCustomer.getRealtyConsultant());
|
390
|
437
|
if (null != channelPerson) {
|
|
@@ -394,7 +441,7 @@ public class ChannelCustomerServiceImpl extends ServiceImpl<ChannelCustomerMappe
|
394
|
441
|
customerPreparatory.setCustomerId(taRecommendCustomer.getCustomerId());
|
395
|
442
|
if (StringUtils.isEmpty(customerPreparatory.getCustomerPreparatoryId())) {
|
396
|
443
|
customerPreparatoryMapper.insert(customerPreparatory);
|
397
|
|
- }else {
|
|
444
|
+ } else {
|
398
|
445
|
customerPreparatoryMapper.updateById(customerPreparatory);
|
399
|
446
|
}
|
400
|
447
|
|
|
@@ -571,6 +618,19 @@ public class ChannelCustomerServiceImpl extends ServiceImpl<ChannelCustomerMappe
|
571
|
618
|
if (null != params.getTotalCommission() && params.getTotalCommission() > 0) {
|
572
|
619
|
processCommission(params, customer, recommendPerson, bizType, taBuilding);
|
573
|
620
|
}
|
|
621
|
+ // 生成节点变更通知
|
|
622
|
+ BkNotice changeNotice = new BkNotice();
|
|
623
|
+ changeNotice.setOrgId(taBuilding.getOrgId().toString());
|
|
624
|
+ changeNotice.setInstitutionId(taBuilding.getInstitutionId());
|
|
625
|
+ changeNotice.setBuildingId(taBuilding.getBuildingId());
|
|
626
|
+ changeNotice.setBuildingName(taBuilding.getBuildingName());
|
|
627
|
+ changeNotice.setPersonId(recommendPerson.getPersonId());
|
|
628
|
+ changeNotice.setPersonName(StringUtils.ifNull(recommendPerson.getName(), recommendPerson.getNickname()));
|
|
629
|
+ changeNotice.setCustomerId(customer.getCustomerId());
|
|
630
|
+ changeNotice.setCustomerName(customer.getName());
|
|
631
|
+ changeNotice.setNoticeType(CommConstant.NOTICE_TYPE_STATUS_CHANGE);
|
|
632
|
+ changeNotice.setContent(String.format("状态 %s", getStatusDesc(bizType)));
|
|
633
|
+ bkNoticeMapper.insert(changeNotice);
|
574
|
634
|
}
|
575
|
635
|
|
576
|
636
|
channelCustomerMapper.updateById(customer);
|
|
@@ -638,21 +698,6 @@ public class ChannelCustomerServiceImpl extends ServiceImpl<ChannelCustomerMappe
|
638
|
698
|
bkAccountRecordMapper.insert(bkAccountRecord);
|
639
|
699
|
}
|
640
|
700
|
|
641
|
|
- // 生成节点变更通知
|
642
|
|
- BkNotice changeNotice = new BkNotice();
|
643
|
|
- changeNotice.setOrgId(taBuilding.getOrgId().toString());
|
644
|
|
- changeNotice.setInstitutionId(taBuilding.getInstitutionId());
|
645
|
|
- changeNotice.setBuildingId(taBuilding.getBuildingId());
|
646
|
|
- changeNotice.setBuildingName(taBuilding.getBuildingName());
|
647
|
|
- changeNotice.setPersonId(recommendPerson.getPersonId());
|
648
|
|
- changeNotice.setPersonName(StringUtils.ifNull(recommendPerson.getName(), recommendPerson.getNickname()));
|
649
|
|
- changeNotice.setCustomerId(customer.getCustomerId());
|
650
|
|
- changeNotice.setCustomerName(customer.getName());
|
651
|
|
- changeNotice.setNoticeType(CommConstant.NOTICE_TYPE_STATUS_CHANGE);
|
652
|
|
- changeNotice.setContent(String.format("状态 %s", getStatusDesc(bizType)));
|
653
|
|
- bkNoticeMapper.insert(changeNotice);
|
654
|
|
-
|
655
|
|
-
|
656
|
701
|
// 生成成交喜报
|
657
|
702
|
BkNotice bkNotice = bkNoticeMapper.getByPerson(CommConstant.NOTICE_TYPE_DEAL, recommendPerson.getName(), customer.getCustomerId());
|
658
|
703
|
if (null == bkNotice) {
|
|
@@ -696,9 +741,11 @@ public class ChannelCustomerServiceImpl extends ServiceImpl<ChannelCustomerMappe
|
696
|
741
|
BkAgentRule agentRule = bkAgentRuleMapper.getByCity(taBuilding.getCityId());
|
697
|
742
|
if (null == agentRule) return;
|
698
|
743
|
|
|
744
|
+ // 记录明细
|
699
|
745
|
bkInviteRecord.setReferralFee(agentRule.getReferralFee());
|
700
|
746
|
bkInviteRecordMapper.updateById(bkInviteRecord);
|
701
|
|
-
|
|
747
|
+ // 累积总额
|
|
748
|
+ taPersonMapper.setFieldIncrement(personId, "referral_fee", agentRule.getReferralFee());
|
702
|
749
|
}
|
703
|
750
|
|
704
|
751
|
private String getStatusDesc(String bizType) {
|