|
@@ -15,6 +15,7 @@ import com.yunzhi.marketing.common.DateUtils;
|
15
|
15
|
import com.yunzhi.marketing.common.StringUtils;
|
16
|
16
|
import com.yunzhi.marketing.drainage.entity.TaDrainage;
|
17
|
17
|
import com.yunzhi.marketing.drainage.mapper.TaDrainageMapper;
|
|
18
|
+import com.yunzhi.marketing.dto.AverageReportDTO;
|
18
|
19
|
import com.yunzhi.marketing.dto.ChannelReportDTO;
|
19
|
20
|
import com.yunzhi.marketing.excel.AgentsRecommendCustomer;
|
20
|
21
|
import com.yunzhi.marketing.excel.ExcelRecommendCustomer;
|
|
@@ -532,6 +533,7 @@ public class TaRecommendCustomerServiceImpl extends ServiceImpl<TaRecommendCusto
|
532
|
533
|
recommendCustomer.setVerifyStatus(CommConstant.VERIFY_AGREE);
|
533
|
534
|
recommendCustomer.setStatus(CommConstant.CUSTOMER_REPORT);
|
534
|
535
|
recommendCustomer.setRecommendPerson(consultant.getPersonId());
|
|
536
|
+ recommendCustomer.setCirculationTime(LocalDateTime.now());
|
535
|
537
|
customerFrom.setIsProjectFirst(true);
|
536
|
538
|
customerFrom.setIsOrgFirst(true);
|
537
|
539
|
}
|
|
@@ -560,6 +562,54 @@ public class TaRecommendCustomerServiceImpl extends ServiceImpl<TaRecommendCusto
|
560
|
562
|
return;
|
561
|
563
|
}
|
562
|
564
|
|
|
565
|
+ /**
|
|
566
|
+ * 普通客户报备客户
|
|
567
|
+ *
|
|
568
|
+ * @param averageReportDTO
|
|
569
|
+ * @return
|
|
570
|
+ */
|
|
571
|
+ @Override
|
|
572
|
+ public ResponseBean averageReportCust(AverageReportDTO averageReportDTO) {
|
|
573
|
+
|
|
574
|
+
|
|
575
|
+ // 当前人员
|
|
576
|
+ TaPerson person = taPersonMapper.getById(averageReportDTO.getPersonId());
|
|
577
|
+
|
|
578
|
+ // 先查看在ta_recommend_customer 手机号是否存在
|
|
579
|
+ LambdaQueryWrapper<TaRecommendCustomer> queryWrapper = new LambdaQueryWrapper<>();
|
|
580
|
+ queryWrapper.eq(TaRecommendCustomer::getPhone,averageReportDTO.getPhone());
|
|
581
|
+ queryWrapper.eq(TaRecommendCustomer::getBuildingId,averageReportDTO.getBuildingId());
|
|
582
|
+ queryWrapper.isNull(TaRecommendCustomer::getRecommendPerson);
|
|
583
|
+ List<TaRecommendCustomer> taRecommendCustomers = taRecommendCustomerMapper.selectList(queryWrapper);
|
|
584
|
+ if (taRecommendCustomers.size() > 0) {
|
|
585
|
+ return ResponseBean.error("已存在的客户报备失败", ResponseBean.ERROR_UNAVAILABLE);
|
|
586
|
+ }
|
|
587
|
+
|
|
588
|
+ // 查询是否在渠道推荐表中
|
|
589
|
+ LambdaQueryWrapper<ChannelCustomer> channelCustomerLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
590
|
+ channelCustomerLambdaQueryWrapper.eq(ChannelCustomer::getBuildingId,averageReportDTO.getBuildingId());
|
|
591
|
+ channelCustomerLambdaQueryWrapper.ne(ChannelCustomer::getStatus,"3");
|
|
592
|
+ List<ChannelCustomer> channelCustomers = channelCustomerMapper.selectList(channelCustomerLambdaQueryWrapper);
|
|
593
|
+ List<ChannelCustomer> passCustomer = channelCustomers.stream().filter(e -> "2".equals(e.getStatus())).collect(Collectors.toList());
|
|
594
|
+ if (passCustomer.size() > 0) {
|
|
595
|
+ return ResponseBean.error("此用户已经被报备", ResponseBean.ERROR_UNAVAILABLE);
|
|
596
|
+ }
|
|
597
|
+
|
|
598
|
+ // 入渠道推荐客户表
|
|
599
|
+ ChannelCustomer channelCustomer = new ChannelCustomer();
|
|
600
|
+ channelCustomer.setBuildingId(averageReportDTO.getBuildingId());
|
|
601
|
+ channelCustomer.setName(averageReportDTO.getName());
|
|
602
|
+ channelCustomer.setPicture(averageReportDTO.getPicture());
|
|
603
|
+ channelCustomer.setPhone(averageReportDTO.getPhone());
|
|
604
|
+ channelCustomer.setSex(averageReportDTO.getSex());
|
|
605
|
+ channelCustomer.setRecommendPerson(averageReportDTO.getPersonId());
|
|
606
|
+ channelCustomer.setCreateDate(LocalDateTime.now());
|
|
607
|
+ channelCustomer.setStatus("1");
|
|
608
|
+ channelCustomer.setOrgId(averageReportDTO.getOrgId());
|
|
609
|
+ channelCustomerMapper.insert(channelCustomer);
|
|
610
|
+ return ResponseBean.success(channelCustomer);
|
|
611
|
+ }
|
|
612
|
+
|
563
|
613
|
private void fillSomeFieldsOfCustomer(TaRecommendCustomer customer, TaPerson recommender, LocalDateTime now) {
|
564
|
614
|
customer.setVerifyStatus(CommConstant.VERIFY_AGREE);
|
565
|
615
|
customer.setStatus(CommConstant.CUSTOMER_REPORT);
|
|
@@ -705,7 +755,7 @@ public class TaRecommendCustomerServiceImpl extends ServiceImpl<TaRecommendCusto
|
705
|
755
|
taRecommendCustomer.setBuildingId(params.getString("intention"));
|
706
|
756
|
taRecommendCustomer.setRealtyConsultant(params.getString("realtyConsultant"));
|
707
|
757
|
taRecommendCustomer.setReportRecommendStatus(CommConstant.RECOMMENDED);
|
708
|
|
- taRecommendCustomer.setVerifyStatus(CommConstant.VERIFY_AGREE);
|
|
758
|
+ taRecommendCustomer.setVerifyStatus(CommConstant.VERIFY_READY);
|
709
|
759
|
taRecommendCustomer.setCreateDate(LocalDateTime.now());
|
710
|
760
|
taRecommendCustomer.setReportDate(LocalDateTime.now());
|
711
|
761
|
taRecommendCustomer.setOrgId(orgId);
|
|
@@ -954,6 +1004,7 @@ public class TaRecommendCustomerServiceImpl extends ServiceImpl<TaRecommendCusto
|
954
|
1004
|
}
|
955
|
1005
|
}
|
956
|
1006
|
|
|
1007
|
+ taRecommendCustomer.setCirculationTime(LocalDateTime.now());
|
957
|
1008
|
int row = taRecommendCustomerMapper.insert(taRecommendCustomer);
|
958
|
1009
|
if (row < 1) {
|
959
|
1010
|
return ResponseBean.error("报备客户失败", ResponseBean.ERROR_UNAVAILABLE);
|