傅行帆 3 年前
父节点
当前提交
693da41b2e

+ 3
- 3
src/main/java/com/yunzhi/marketing/service/impl/TaBuildingServiceImpl.java 查看文件

@@ -880,10 +880,10 @@ public class TaBuildingServiceImpl extends ServiceImpl<TaBuildingMapper, TaBuild
880 880
         }
881 881
         switch (orderBy) {
882 882
             case "price-asc":
883
-                orderBy = "tbpt.start_price ASC";
883
+                orderBy = "tb.price ASC";
884 884
                 break;
885
-            case "desc-asc":
886
-                orderBy = "tbpt.end_price DESC";
885
+            case "price-desc":
886
+                orderBy = "tb.price DESC";
887 887
                 break;
888 888
             case "openingDate-asc":
889 889
                 orderBy = "tb.opening_date ASC";

+ 33
- 0
src/main/java/com/yunzhi/marketing/service/impl/TaRecommendCustomerServiceImpl.java 查看文件

@@ -439,6 +439,39 @@ public class TaRecommendCustomerServiceImpl extends ServiceImpl<TaRecommendCusto
439 439
         channelCustomer.setRemark(channelReportDTO.getRemark());
440 440
         channelCustomer.setRealtyConsultant(channelReportDTO.getRealtyConsultant());
441 441
         channelCustomerMapper.insert(channelCustomer);
442
+
443
+        // 插入客户来源逻辑, 防止下面 if 里面的 return
444
+        // 首次报备的客户, 写入客户来源表
445
+        TaCustomerFrom customerFrom = null;
446
+        if (!StringUtils.isEmpty(channelCustomer.getBuildingId())) {
447
+            Map<String, Number> counter = taCustomerFromMapper.countPerson(channelCustomer.getOrgId(), channelCustomer.getBuildingId(), channelCustomer.getPersonId());
448
+            boolean orgFirst = counter.get("orgCount").longValue() < 1;
449
+            boolean projectFirst = counter.get("projectCount").longValue() < 1;
450
+            if (projectFirst) {
451
+                TaBuilding taBuilding = taBuildingMapper.selectById(channelCustomer.getBuildingId());
452
+
453
+                customerFrom = new TaCustomerFrom();
454
+                customerFrom.setPersonId(channelCustomer.getPersonId());
455
+                customerFrom.setCustomerId(channelCustomer.getCustomerId());
456
+                customerFrom.setPersonName(channelCustomer.getName());
457
+                customerFrom.setOrgId(channelCustomer.getOrgId());
458
+//              customerFrom.setSceneId(sceneId);
459
+                customerFrom.setIsOrgFirst(orgFirst);
460
+                QueryWrapper<TaCustomerFrom> fromQueryWrapper = new QueryWrapper<TaCustomerFrom>();
461
+                fromQueryWrapper.eq("person_id", channelCustomer.getPersonId());
462
+                fromQueryWrapper.eq("org_id", channelCustomer.getOrgId());
463
+                fromQueryWrapper.eq("building_id", channelCustomer.getBuildingId());
464
+                if (taCustomerFromMapper.selectList(fromQueryWrapper).size() < 1) {
465
+                    customerFrom.setIsProjectFirst(true);
466
+                }
467
+                customerFrom.setCreateDate(LocalDateTime.now());
468
+                customerFrom.setBuildingId(channelCustomer.getBuildingId());
469
+                customerFrom.setBuildingName(taBuilding.getBuildingName());
470
+                customerFrom.setSharePersonId(channelCustomer.getPersonId());
471
+                customerFrom.setSharePersonName(channelCustomer.getName());
472
+                taCustomerFromMapper.insert(customerFrom);
473
+            }
474
+        }
442 475
         return ResponseBean.success(channelCustomer);
443 476
     }
444 477
 

+ 10
- 1
src/main/java/com/yunzhi/marketing/xlk/service/impl/ChannelCustomerServiceImpl.java 查看文件

@@ -7,8 +7,10 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
7 7
 import com.yunzhi.marketing.base.ResponseBean;
8 8
 import com.yunzhi.marketing.common.CommConstant;
9 9
 import com.yunzhi.marketing.common.StringUtils;
10
+import com.yunzhi.marketing.entity.TaBuilding;
10 11
 import com.yunzhi.marketing.entity.TaPerson;
11 12
 import com.yunzhi.marketing.entity.TaRecommendCustomer;
13
+import com.yunzhi.marketing.mapper.TaBuildingMapper;
12 14
 import com.yunzhi.marketing.mapper.TaPersonMapper;
13 15
 import com.yunzhi.marketing.mapper.TaRecommendCustomerMapper;
14 16
 import com.yunzhi.marketing.po.MineRecommendCustomerPO;
@@ -50,6 +52,9 @@ public class ChannelCustomerServiceImpl extends ServiceImpl<ChannelCustomerMappe
50 52
 
51 53
     @Autowired
52 54
     private TaPersonMapper taPersonMapper;
55
+
56
+    @Autowired
57
+    private TaBuildingMapper taBuildingMapper;
53 58
     /**
54 59
      * 审核
55 60
      *
@@ -88,14 +93,16 @@ public class ChannelCustomerServiceImpl extends ServiceImpl<ChannelCustomerMappe
88 93
         queryWrapper.eq(TaRecommendCustomer::getBuildingId,customer.getBuildingId());
89 94
         TaRecommendCustomer recommendCustomer = taRecommendCustomerMapper.selectOne(queryWrapper);
90 95
         if (null == recommendCustomer) {
96
+            TaBuilding building = taBuildingMapper.selectById(customer.getBuildingId());
91 97
             // 进业务客户表
92 98
             TaRecommendCustomer taRecommendCustomer = new TaRecommendCustomer();
93
-            taRecommendCustomer.setName(customerVisit.getName());
99
+            taRecommendCustomer.setName(customer.getName());
94 100
             taRecommendCustomer.setPicture(customer.getPicture());
95 101
             taRecommendCustomer.setPhone(customer.getPhone());
96 102
             taRecommendCustomer.setSex(customer.getSex());
97 103
             taRecommendCustomer.setRecommendPerson(customer.getRecommendPerson());
98 104
             taRecommendCustomer.setBuildingId(customer.getBuildingId());
105
+            taRecommendCustomer.setIntention(building.getBuildingName());
99 106
             taRecommendCustomer.setReportRecommendStatus(CommConstant.RECOMMENDED);
100 107
             taRecommendCustomer.setVerifyStatus(CommConstant.VERIFY_AGREE);
101 108
             taRecommendCustomer.setCreateDate(LocalDateTime.now());
@@ -175,6 +182,7 @@ public class ChannelCustomerServiceImpl extends ServiceImpl<ChannelCustomerMappe
175 182
             queryWrapper.eq(TaRecommendCustomer::getBuildingId,customer.getBuildingId());
176 183
             TaRecommendCustomer recommendCustomer = taRecommendCustomerMapper.selectOne(queryWrapper);
177 184
             if (null == recommendCustomer) {
185
+                TaBuilding building = taBuildingMapper.selectById(customer.getBuildingId());
178 186
                 // 进业务客户表
179 187
                 TaRecommendCustomer taRecommendCustomer = new TaRecommendCustomer();
180 188
                 taRecommendCustomer.setName(customerVisit.getName());
@@ -183,6 +191,7 @@ public class ChannelCustomerServiceImpl extends ServiceImpl<ChannelCustomerMappe
183 191
                 taRecommendCustomer.setSex(customer.getSex());
184 192
                 taRecommendCustomer.setRecommendPerson(customer.getRecommendPerson());
185 193
                 taRecommendCustomer.setBuildingId(customer.getBuildingId());
194
+                taRecommendCustomer.setIntention(building.getBuildingName());
186 195
                 taRecommendCustomer.setReportRecommendStatus(CommConstant.RECOMMENDED);
187 196
                 taRecommendCustomer.setVerifyStatus(CommConstant.VERIFY_AGREE);
188 197
                 taRecommendCustomer.setCreateDate(LocalDateTime.now());