|
@@ -1,6 +1,5 @@
|
1
|
1
|
package com.huiju.estateagents.service.impl;
|
2
|
2
|
|
3
|
|
-import ch.qos.logback.core.status.StatusUtil;
|
4
|
3
|
import com.alibaba.fastjson.JSONObject;
|
5
|
4
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
6
|
5
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
@@ -23,10 +22,11 @@ import com.huiju.estateagents.mapper.*;
|
23
|
22
|
import com.huiju.estateagents.service.IMiniAppService;
|
24
|
23
|
import com.huiju.estateagents.service.ITaRecommendCustomerService;
|
25
|
24
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
25
|
+import com.huiju.estateagents.statistic.entity.TaCustomerFollowUpRecord;
|
|
26
|
+import com.huiju.estateagents.statistic.mapper.TaCustomerFollowUpRecordMapper;
|
26
|
27
|
import org.springframework.beans.factory.annotation.Autowired;
|
27
|
28
|
import org.springframework.stereotype.Service;
|
28
|
29
|
|
29
|
|
-import javax.naming.spi.ResolveResult;
|
30
|
30
|
import java.time.LocalDateTime;
|
31
|
31
|
import java.util.HashMap;
|
32
|
32
|
import java.util.List;
|
|
@@ -63,6 +63,9 @@ public class TaRecommendCustomerServiceImpl extends ServiceImpl<TaRecommendCusto
|
63
|
63
|
|
64
|
64
|
@Autowired
|
65
|
65
|
private TdCityMapper cityMapper;
|
|
66
|
+
|
|
67
|
+ @Autowired
|
|
68
|
+ private TaCustomerFollowUpRecordMapper customerFollowUpRecordMapper;
|
66
|
69
|
|
67
|
70
|
@Override
|
68
|
71
|
public ResponseBean getMyCustList(String openid, String keywords, int pageNumber, int pageSize) {
|
|
@@ -579,4 +582,105 @@ public class TaRecommendCustomerServiceImpl extends ServiceImpl<TaRecommendCusto
|
579
|
582
|
public List<AgentsRecommendCustomer> getIndependentAgentsExport(Integer orgId, Integer pageCode, Integer pageSize) {
|
580
|
583
|
return taRecommendCustomerMapper.getIndependentAgentsExport(orgId, pageCode, pageSize);
|
581
|
584
|
}
|
|
585
|
+
|
|
586
|
+ /**
|
|
587
|
+ * 查询我的客户人数集合
|
|
588
|
+ *
|
|
589
|
+ * @param openid
|
|
590
|
+ * @return
|
|
591
|
+ */
|
|
592
|
+ @Override
|
|
593
|
+ public ResponseBean getMyCustStatistics(String openid) {
|
|
594
|
+ List<TaPerson> taPersons = getPersonsByOpenId(openid);
|
|
595
|
+ if (null == taPersons || taPersons.size() != 1) {
|
|
596
|
+ return ResponseBean.error("验证当前人员信息失败", ResponseBean.ERROR_UNAVAILABLE);
|
|
597
|
+ }
|
|
598
|
+
|
|
599
|
+ TaPerson taPerson = taPersons.get(0);
|
|
600
|
+ List<Map<String,Object>> list = taRecommendCustomerMapper.getMyCustStatistics(taPerson.getPersonId(),taPerson.getUserId(),taPerson.getOrgId());
|
|
601
|
+ return ResponseBean.success(list);
|
|
602
|
+ }
|
|
603
|
+
|
|
604
|
+ /**
|
|
605
|
+ * 分页查询我的跟进客户集合
|
|
606
|
+ *
|
|
607
|
+ * @param pageNumber
|
|
608
|
+ * @param pageSize
|
|
609
|
+ * @param openid
|
|
610
|
+ * @param name
|
|
611
|
+ * @param phone
|
|
612
|
+ * @param status
|
|
613
|
+ * @return
|
|
614
|
+ */
|
|
615
|
+ @Override
|
|
616
|
+ public ResponseBean getMyCustFollowOrClinch(Integer pageNumber, Integer pageSize, String openid, String type, String name, String phone, Integer status) {
|
|
617
|
+ List<TaPerson> taPersons = getPersonsByOpenId(openid);
|
|
618
|
+ if (null == taPersons || taPersons.size() != 1) {
|
|
619
|
+ return ResponseBean.error("验证当前人员信息失败", ResponseBean.ERROR_UNAVAILABLE);
|
|
620
|
+ }
|
|
621
|
+
|
|
622
|
+ TaPerson taPerson = taPersons.get(0);
|
|
623
|
+
|
|
624
|
+ IPage<TaRecommendCustomer> page = new Page<>();
|
|
625
|
+ page.setCurrent(pageNumber);
|
|
626
|
+ page.setSize(pageSize);
|
|
627
|
+
|
|
628
|
+ //分页获取跟进客户status != 4的为跟进客户, status = 4的为成交客户 根据type区分 follow 跟进 clinch 成交
|
|
629
|
+ IPage<TaRecommendCustomer> result = taRecommendCustomerMapper.getMyCustFollowOrClinch(page, taPerson.getPersonId(),taPerson.getUserId(),taPerson.getOrgId(), type,name,phone,status);
|
|
630
|
+ return ResponseBean.success(result);
|
|
631
|
+ }
|
|
632
|
+
|
|
633
|
+ /**
|
|
634
|
+ * 获取盘客工具下我的客户详情
|
|
635
|
+ *
|
|
636
|
+ * @param customerId
|
|
637
|
+ * @param openid
|
|
638
|
+ * @return
|
|
639
|
+ */
|
|
640
|
+ @Override
|
|
641
|
+ public ResponseBean getMyCustDetail(String customerId, String openid) {
|
|
642
|
+ List<TaPerson> taPersons = getPersonsByOpenId(openid);
|
|
643
|
+ if (null == taPersons || taPersons.size() != 1) {
|
|
644
|
+ return ResponseBean.error("验证当前人员信息失败", ResponseBean.ERROR_UNAVAILABLE);
|
|
645
|
+ }
|
|
646
|
+
|
|
647
|
+ TaPerson taPerson = taPersons.get(0);
|
|
648
|
+ TaRecommendCustomer taRecommendCustomer = taRecommendCustomerMapper.getMyCustDetailById(customerId);
|
|
649
|
+ //添加跟进行为
|
|
650
|
+ addCustomerFpllowUp(taPerson,taRecommendCustomer,"查看客户详情");
|
|
651
|
+ return ResponseBean.success(taRecommendCustomer);
|
|
652
|
+ }
|
|
653
|
+
|
|
654
|
+ /**
|
|
655
|
+ * 更新我的客户基本信息
|
|
656
|
+ *
|
|
657
|
+ * @param taRecommendCustomer
|
|
658
|
+ * @param openid
|
|
659
|
+ * @return
|
|
660
|
+ */
|
|
661
|
+ @Override
|
|
662
|
+ public ResponseBean updateMyCust(TaRecommendCustomer taRecommendCustomer, String openid) {
|
|
663
|
+ List<TaPerson> taPersons = getPersonsByOpenId(openid);
|
|
664
|
+ if (null == taPersons || taPersons.size() != 1) {
|
|
665
|
+ return ResponseBean.error("验证当前人员信息失败", ResponseBean.ERROR_UNAVAILABLE);
|
|
666
|
+ }
|
|
667
|
+
|
|
668
|
+ TaPerson taPerson = taPersons.get(0);
|
|
669
|
+ taRecommendCustomerMapper.updateById(taRecommendCustomer);
|
|
670
|
+ //添加跟进行为
|
|
671
|
+ addCustomerFpllowUp(taPerson,taRecommendCustomer,"编辑客户信息");
|
|
672
|
+ return ResponseBean.success(taRecommendCustomer);
|
|
673
|
+ }
|
|
674
|
+
|
|
675
|
+ //添加跟进行为
|
|
676
|
+ private void addCustomerFpllowUp(TaPerson taPerson,TaRecommendCustomer taRecommendCustomer,String recordType) {
|
|
677
|
+ TaCustomerFollowUpRecord taCustomerFollowUpRecord = new TaCustomerFollowUpRecord();
|
|
678
|
+ taCustomerFollowUpRecord.setOrgId(taPerson.getOrgId());
|
|
679
|
+ taCustomerFollowUpRecord.setCreateDate(LocalDateTime.now());
|
|
680
|
+ taCustomerFollowUpRecord.setCustomerId(taRecommendCustomer.getCustomerId());
|
|
681
|
+ taCustomerFollowUpRecord.setRecordType(recordType);
|
|
682
|
+ taCustomerFollowUpRecord.setFollowerId(taPerson.getPersonId());
|
|
683
|
+ taCustomerFollowUpRecord.setCustomerSex(taRecommendCustomer.getSex());
|
|
684
|
+ customerFollowUpRecordMapper.insert(taCustomerFollowUpRecord);
|
|
685
|
+ }
|
582
|
686
|
}
|