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

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

880
         }
880
         }
881
         switch (orderBy) {
881
         switch (orderBy) {
882
             case "price-asc":
882
             case "price-asc":
883
-                orderBy = "tbpt.start_price ASC";
883
+                orderBy = "tb.price ASC";
884
                 break;
884
                 break;
885
-            case "desc-asc":
886
-                orderBy = "tbpt.end_price DESC";
885
+            case "price-desc":
886
+                orderBy = "tb.price DESC";
887
                 break;
887
                 break;
888
             case "openingDate-asc":
888
             case "openingDate-asc":
889
                 orderBy = "tb.opening_date ASC";
889
                 orderBy = "tb.opening_date ASC";

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

439
         channelCustomer.setRemark(channelReportDTO.getRemark());
439
         channelCustomer.setRemark(channelReportDTO.getRemark());
440
         channelCustomer.setRealtyConsultant(channelReportDTO.getRealtyConsultant());
440
         channelCustomer.setRealtyConsultant(channelReportDTO.getRealtyConsultant());
441
         channelCustomerMapper.insert(channelCustomer);
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
         return ResponseBean.success(channelCustomer);
475
         return ResponseBean.success(channelCustomer);
443
     }
476
     }
444
 
477
 

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

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