|
@@ -547,99 +547,63 @@ public class TaRecommendCustomerServiceImpl extends ServiceImpl<TaRecommendCusto
|
547
|
547
|
// 查询置业授权的楼盘
|
548
|
548
|
QueryWrapper<TaPersonBuilding> query2 = new QueryWrapper<>();
|
549
|
549
|
query2.eq("user_id", consultant.getUserId());
|
550
|
|
- query2.eq("building_id", reportCust.getBuildingId());
|
551
|
550
|
List<TaPersonBuilding> taPersonBuildingList = taPersonBuildingMapper.selectList(query2);
|
552
|
551
|
if (taPersonBuildingList.size() < 1) {
|
553
|
|
- // 报备其他楼盘的客户
|
554
|
|
- // 查询楼盘下是否有该客户
|
555
|
|
- QueryWrapper<TaRecommendCustomer> query3 = new QueryWrapper<>();
|
556
|
|
- query3.eq("phone", phone);
|
557
|
|
- query3.eq("building_id", reportCust.getBuildingId());
|
558
|
|
- query3.eq("org_id", orgId);
|
559
|
|
- List<TaRecommendCustomer> lst = list(query3);
|
560
|
|
- if (lst.size() > 0) {
|
561
|
|
- throw new Exception("当前人员是已被报备");
|
562
|
|
- } else {
|
563
|
|
- // 如果表中无此人员数据
|
564
|
|
- recommendCustomer = new TaRecommendCustomer();
|
565
|
|
-
|
566
|
|
- recommendCustomer.setOrgId(orgId);
|
567
|
|
- recommendCustomer.setName(reportCust.getName());
|
568
|
|
- recommendCustomer.setPicture(null != custPerson ? custPerson.getAvatarurl() : null);
|
569
|
|
- recommendCustomer.setPhone(phone);
|
570
|
|
- recommendCustomer.setSex(reportCust.getSex());
|
571
|
|
-// recommendCustomer.setRealtyConsultant();
|
572
|
|
- recommendCustomer.setBuildingId(reportCust.getBuildingId());
|
573
|
|
- TaBuilding building = taBuildingMapper.selectById(reportCust.getBuildingId());
|
574
|
|
- recommendCustomer.setIntention(building.getBuildingName());
|
575
|
|
- recommendCustomer.setReportRecommendStatus(CommConstant.VERIFY_AGREE);
|
576
|
|
- recommendCustomer.setCreateDate(LocalDateTime.now());
|
577
|
|
- recommendCustomer.setReportDate(LocalDateTime.now());
|
578
|
|
- recommendCustomer.setPersonId(null != custPerson ? custPerson.getPersonId() : null);
|
579
|
|
- recommendCustomer.setEntryType(CommConstant.ENTRY_VERIFY);
|
580
|
|
- recommendCustomer.setVerifyStatus(CommConstant.VERIFY_AGREE);
|
581
|
|
- recommendCustomer.setStatus(CommConstant.CUSTOMER_VISITE);
|
582
|
|
- recommendCustomer.setRecommendPerson(consultant.getPersonId());
|
583
|
|
- recommendCustomer.setCirculationTime(LocalDateTime.now());
|
584
|
|
- recommendCustomer.setInstitutionId(building.getInstitutionId());
|
585
|
|
- customerFrom.setIsProjectFirst(true);
|
586
|
|
- customerFrom.setIsOrgFirst(true);
|
587
|
|
- }
|
588
|
|
- }else {
|
589
|
|
- TaPersonBuilding taPersonBuilding = taPersonBuildingList.get(0);
|
590
|
|
-
|
591
|
|
- // 查询楼盘下是否有该客户
|
592
|
|
- QueryWrapper<TaRecommendCustomer> query3 = new QueryWrapper<>();
|
593
|
|
- query3.eq("phone", phone);
|
594
|
|
- query3.eq("building_id", taPersonBuilding.getBuildingId());
|
595
|
|
- query3.eq("org_id", orgId);
|
596
|
|
- List<TaRecommendCustomer> lst = list(query3);
|
597
|
|
- if (lst.size() > 0) {
|
598
|
|
- TaRecommendCustomer orign = lst.get(0);
|
599
|
|
- if (!StringUtils.isEmpty(orign.getRealtyConsultant())) {
|
600
|
|
- // 如果当前人员已经是当前置业的私客
|
601
|
|
- if (orign.getRealtyConsultant().equals(consultantUser)) {
|
602
|
|
- return;
|
603
|
|
- } else {
|
604
|
|
- throw new Exception("当前人员是其他置业的私客");
|
605
|
|
- }
|
|
552
|
+ throw new Exception("置业未绑定楼盘");
|
|
553
|
+ }
|
|
554
|
+ TaPersonBuilding taPersonBuilding = taPersonBuildingList.get(0);
|
|
555
|
+
|
|
556
|
+ // 查询楼盘下是否有该客户
|
|
557
|
+ QueryWrapper<TaRecommendCustomer> query3 = new QueryWrapper<>();
|
|
558
|
+ query3.eq("phone", phone);
|
|
559
|
+ query3.eq("building_id", taPersonBuilding.getBuildingId());
|
|
560
|
+ query3.eq("org_id", orgId);
|
|
561
|
+ List<TaRecommendCustomer> lst = list(query3);
|
|
562
|
+ if (lst.size() > 0) {
|
|
563
|
+ TaRecommendCustomer orign = lst.get(0);
|
|
564
|
+ if (!StringUtils.isEmpty(orign.getRealtyConsultant())) {
|
|
565
|
+ // 如果当前人员已经是当前置业的私客
|
|
566
|
+ if (orign.getRealtyConsultant().equals(consultantUser)) {
|
|
567
|
+ return;
|
606
|
568
|
} else {
|
607
|
|
- // 如果是项目公客, 则直接绑定为当前置业的私客
|
608
|
|
- orign.setRealtyConsultant(consultantUser);
|
609
|
|
- orign.setVerifyStatus(CommConstant.VERIFY_AGREE);
|
610
|
|
- orign.setStatus(CommConstant.CUSTOMER_VISITE);
|
611
|
|
- orign.setEntryType(CommConstant.ENTRY_VERIFY);
|
612
|
|
- orign.setReportDate(LocalDateTime.now());
|
613
|
|
- recommendCustomer = orign;
|
614
|
|
-// updateById(orign);
|
615
|
|
-// return;
|
|
569
|
+ throw new Exception("当前人员是其他置业的私客");
|
616
|
570
|
}
|
617
|
571
|
} else {
|
618
|
|
- // 如果表中无此人员数据
|
619
|
|
- recommendCustomer = new TaRecommendCustomer();
|
620
|
|
-
|
621
|
|
- recommendCustomer.setOrgId(orgId);
|
622
|
|
- recommendCustomer.setName(reportCust.getName());
|
623
|
|
- recommendCustomer.setPicture(null != custPerson ? custPerson.getAvatarurl() : null);
|
624
|
|
- recommendCustomer.setPhone(phone);
|
625
|
|
- recommendCustomer.setSex(reportCust.getSex());
|
626
|
|
- recommendCustomer.setRealtyConsultant(consultantUser);
|
627
|
|
- recommendCustomer.setBuildingId(taPersonBuilding.getBuildingId());
|
628
|
|
- TaBuilding building = taBuildingMapper.selectById(taPersonBuilding.getBuildingId());
|
629
|
|
- recommendCustomer.setIntention(building.getBuildingName());
|
630
|
|
- recommendCustomer.setReportRecommendStatus(CommConstant.VERIFY_AGREE);
|
631
|
|
- recommendCustomer.setCreateDate(LocalDateTime.now());
|
632
|
|
- recommendCustomer.setReportDate(LocalDateTime.now());
|
633
|
|
- recommendCustomer.setPersonId(null != custPerson ? custPerson.getPersonId() : null);
|
634
|
|
- recommendCustomer.setEntryType(CommConstant.ENTRY_VERIFY);
|
635
|
|
- recommendCustomer.setVerifyStatus(CommConstant.VERIFY_AGREE);
|
636
|
|
- recommendCustomer.setStatus(CommConstant.CUSTOMER_VISITE);
|
637
|
|
- recommendCustomer.setRecommendPerson(consultant.getPersonId());
|
638
|
|
- recommendCustomer.setCirculationTime(LocalDateTime.now());
|
639
|
|
- recommendCustomer.setInstitutionId(building.getInstitutionId());
|
640
|
|
- customerFrom.setIsProjectFirst(true);
|
641
|
|
- customerFrom.setIsOrgFirst(true);
|
|
572
|
+ // 如果是项目公客, 则直接绑定为当前置业的私客
|
|
573
|
+ orign.setRealtyConsultant(consultantUser);
|
|
574
|
+ orign.setVerifyStatus(CommConstant.VERIFY_AGREE);
|
|
575
|
+ orign.setStatus(CommConstant.CUSTOMER_VISITE);
|
|
576
|
+ orign.setEntryType(CommConstant.ENTRY_VERIFY);
|
|
577
|
+ orign.setReportDate(LocalDateTime.now());
|
|
578
|
+ recommendCustomer = orign;
|
|
579
|
+// updateById(orign);
|
|
580
|
+// return;
|
642
|
581
|
}
|
|
582
|
+ } else {
|
|
583
|
+ // 如果表中无此人员数据
|
|
584
|
+ recommendCustomer = new TaRecommendCustomer();
|
|
585
|
+
|
|
586
|
+ recommendCustomer.setOrgId(orgId);
|
|
587
|
+ recommendCustomer.setName(reportCust.getName());
|
|
588
|
+ recommendCustomer.setPicture(null != custPerson ? custPerson.getAvatarurl() : null);
|
|
589
|
+ recommendCustomer.setPhone(phone);
|
|
590
|
+ recommendCustomer.setSex(reportCust.getSex());
|
|
591
|
+ recommendCustomer.setRealtyConsultant(consultantUser);
|
|
592
|
+ recommendCustomer.setBuildingId(taPersonBuilding.getBuildingId());
|
|
593
|
+ TaBuilding building = taBuildingMapper.selectById(taPersonBuilding.getBuildingId());
|
|
594
|
+ recommendCustomer.setIntention(building.getBuildingName());
|
|
595
|
+ recommendCustomer.setReportRecommendStatus(CommConstant.VERIFY_AGREE);
|
|
596
|
+ recommendCustomer.setCreateDate(LocalDateTime.now());
|
|
597
|
+ recommendCustomer.setReportDate(LocalDateTime.now());
|
|
598
|
+ recommendCustomer.setPersonId(null != custPerson ? custPerson.getPersonId() : null);
|
|
599
|
+ recommendCustomer.setEntryType(CommConstant.ENTRY_VERIFY);
|
|
600
|
+ recommendCustomer.setVerifyStatus(CommConstant.VERIFY_AGREE);
|
|
601
|
+ recommendCustomer.setStatus(CommConstant.CUSTOMER_VISITE);
|
|
602
|
+ recommendCustomer.setRecommendPerson(consultant.getPersonId());
|
|
603
|
+ recommendCustomer.setCirculationTime(LocalDateTime.now());
|
|
604
|
+ recommendCustomer.setInstitutionId(building.getInstitutionId());
|
|
605
|
+ customerFrom.setIsProjectFirst(true);
|
|
606
|
+ customerFrom.setIsOrgFirst(true);
|
643
|
607
|
}
|
644
|
608
|
|
645
|
609
|
if (StringUtils.isEmpty(recommendCustomer.getCustomerId())) {
|