Explorar el Código

客户报备调整

傅行帆 hace 3 años
padre
commit
13b96bcf92

+ 19
- 0
src/main/java/com/yunzhi/marketing/controller/TaRecommendCustomerController.java Ver fichero

@@ -13,6 +13,7 @@ import com.yunzhi.marketing.center.taUser.entity.TaUser;
13 13
 import com.yunzhi.marketing.center.taUser.service.ITaUserService;
14 14
 import com.yunzhi.marketing.common.CommConstant;
15 15
 import com.yunzhi.marketing.common.StringUtils;
16
+import com.yunzhi.marketing.dto.AverageReportDTO;
16 17
 import com.yunzhi.marketing.dto.ChannelReportDTO;
17 18
 import com.yunzhi.marketing.entity.TaBuilding;
18 19
 import com.yunzhi.marketing.entity.TaPerson;
@@ -237,6 +238,23 @@ public class TaRecommendCustomerController extends BaseController {
237 238
         return taRecommendCustomerService.channelReportCust(channelReportDTO);
238 239
     }
239 240
 
241
+    /**
242
+     * 普通客户报备客户
243
+     *
244
+     * @param averageReportDTO
245
+     * @param request
246
+     * @return
247
+     */
248
+    @PostMapping("/wx/average/report")
249
+    @ApiOperation(value = "wx-普通客户报备客户", notes = "森哥看这里-wx-普通客户报备客户")
250
+    public ResponseBean averageReportCust(@RequestBody AverageReportDTO averageReportDTO, HttpServletRequest request) throws Exception {
251
+        String personId = getPersonId(request);
252
+        Integer orgId = getOrgId(request);
253
+        averageReportDTO.setPersonId(personId);
254
+        averageReportDTO.setOrgId(orgId);
255
+        return taRecommendCustomerService.averageReportCust(averageReportDTO);
256
+    }
257
+
240 258
 
241 259
     /**
242 260
      * 置业顾问报备客户
@@ -258,6 +276,7 @@ public class TaRecommendCustomerController extends BaseController {
258 276
      * @param request
259 277
      * @return
260 278
      */
279
+    @ApiOperation(value = "wx-置业顾问手动报备客户", notes = "森哥看这里-wx-置业顾问手动报备客户")
261 280
     @PostMapping("/wx/customer/manualReport")
262 281
     public ResponseBean manualReport(@RequestBody ChannelReportDTO reportCust, HttpServletRequest request) {
263 282
         Integer orgId = getOrgId(request);

+ 36
- 0
src/main/java/com/yunzhi/marketing/dto/AverageReportDTO.java Ver fichero

@@ -0,0 +1,36 @@
1
+package com.yunzhi.marketing.dto;
2
+
3
+import lombok.Data;
4
+
5
+@Data
6
+public class AverageReportDTO {
7
+
8
+    private String personId;
9
+
10
+    private Integer orgId;
11
+
12
+    /**
13
+     * 电话号码
14
+     */
15
+    private String phone;
16
+
17
+    /**
18
+     * 姓名
19
+     */
20
+    private String name;
21
+
22
+    /**
23
+     * 图片
24
+     */
25
+    private String picture;
26
+
27
+    /**
28
+     * 楼盘id
29
+     */
30
+    private String buildingId;
31
+
32
+    /**
33
+     * 性别
34
+     */
35
+    private Integer sex;
36
+}

+ 8
- 0
src/main/java/com/yunzhi/marketing/service/ITaRecommendCustomerService.java Ver fichero

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
4 4
 import com.baomidou.mybatisplus.extension.service.IService;
5 5
 import com.yunzhi.marketing.base.ResponseBean;
6 6
 import com.yunzhi.marketing.center.taUser.entity.TaUser;
7
+import com.yunzhi.marketing.dto.AverageReportDTO;
7 8
 import com.yunzhi.marketing.dto.ChannelReportDTO;
8 9
 import com.yunzhi.marketing.excel.AgentsRecommendCustomer;
9 10
 import com.yunzhi.marketing.excel.ExcelRecommendCustomer;
@@ -209,4 +210,11 @@ public interface ITaRecommendCustomerService extends IService<TaRecommendCustome
209 210
     ResponseBean getMarkingCustList(String openid, String keywords, int pageNumber, int pageSize, String buildingId);
210 211
 
211 212
     void manualReport(Integer orgId, TaPerson consultant, ChannelReportDTO reportCust) throws Exception;
213
+
214
+    /**
215
+     * 普通客户报备客户
216
+     * @param averageReportDTO
217
+     * @return
218
+     */
219
+    ResponseBean averageReportCust(AverageReportDTO averageReportDTO);
212 220
 }

+ 50
- 1
src/main/java/com/yunzhi/marketing/service/impl/TaRecommendCustomerServiceImpl.java Ver fichero

@@ -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;
@@ -560,6 +561,54 @@ public class TaRecommendCustomerServiceImpl extends ServiceImpl<TaRecommendCusto
560 561
         return;
561 562
     }
562 563
 
564
+    /**
565
+     * 普通客户报备客户
566
+     *
567
+     * @param averageReportDTO
568
+     * @return
569
+     */
570
+    @Override
571
+    public ResponseBean averageReportCust(AverageReportDTO averageReportDTO) {
572
+
573
+
574
+        // 当前人员
575
+        TaPerson person = taPersonMapper.getById(averageReportDTO.getPersonId());
576
+
577
+        // 先查看在ta_recommend_customer 手机号是否存在
578
+        LambdaQueryWrapper<TaRecommendCustomer> queryWrapper = new LambdaQueryWrapper<>();
579
+        queryWrapper.eq(TaRecommendCustomer::getPhone,averageReportDTO.getPhone());
580
+        queryWrapper.eq(TaRecommendCustomer::getBuildingId,averageReportDTO.getBuildingId());
581
+        queryWrapper.isNull(TaRecommendCustomer::getRecommendPerson);
582
+        List<TaRecommendCustomer> taRecommendCustomers = taRecommendCustomerMapper.selectList(queryWrapper);
583
+        if (taRecommendCustomers.size() > 0) {
584
+            return ResponseBean.error("已存在的客户报备失败", ResponseBean.ERROR_UNAVAILABLE);
585
+        }
586
+
587
+        // 查询是否在渠道推荐表中
588
+        LambdaQueryWrapper<ChannelCustomer> channelCustomerLambdaQueryWrapper = new LambdaQueryWrapper<>();
589
+        channelCustomerLambdaQueryWrapper.eq(ChannelCustomer::getBuildingId,averageReportDTO.getBuildingId());
590
+        channelCustomerLambdaQueryWrapper.ne(ChannelCustomer::getStatus,"3");
591
+        List<ChannelCustomer> channelCustomers = channelCustomerMapper.selectList(channelCustomerLambdaQueryWrapper);
592
+        List<ChannelCustomer> passCustomer = channelCustomers.stream().filter(e -> "2".equals(e.getStatus())).collect(Collectors.toList());
593
+        if (passCustomer.size() > 0) {
594
+            return ResponseBean.error("此用户已经被报备", ResponseBean.ERROR_UNAVAILABLE);
595
+        }
596
+
597
+        // 入渠道推荐客户表
598
+        ChannelCustomer channelCustomer = new ChannelCustomer();
599
+        channelCustomer.setBuildingId(averageReportDTO.getBuildingId());
600
+        channelCustomer.setName(averageReportDTO.getName());
601
+        channelCustomer.setPicture(averageReportDTO.getPicture());
602
+        channelCustomer.setPhone(averageReportDTO.getPhone());
603
+        channelCustomer.setSex(averageReportDTO.getSex());
604
+        channelCustomer.setRecommendPerson(averageReportDTO.getPersonId());
605
+        channelCustomer.setCreateDate(LocalDateTime.now());
606
+        channelCustomer.setStatus("1");
607
+        channelCustomer.setOrgId(averageReportDTO.getOrgId());
608
+        channelCustomerMapper.insert(channelCustomer);
609
+        return ResponseBean.success(channelCustomer);
610
+    }
611
+
563 612
     private void fillSomeFieldsOfCustomer(TaRecommendCustomer customer, TaPerson recommender, LocalDateTime now) {
564 613
         customer.setVerifyStatus(CommConstant.VERIFY_AGREE);
565 614
         customer.setStatus(CommConstant.CUSTOMER_REPORT);
@@ -705,7 +754,7 @@ public class TaRecommendCustomerServiceImpl extends ServiceImpl<TaRecommendCusto
705 754
         taRecommendCustomer.setBuildingId(params.getString("intention"));
706 755
         taRecommendCustomer.setRealtyConsultant(params.getString("realtyConsultant"));
707 756
         taRecommendCustomer.setReportRecommendStatus(CommConstant.RECOMMENDED);
708
-        taRecommendCustomer.setVerifyStatus(CommConstant.VERIFY_AGREE);
757
+        taRecommendCustomer.setVerifyStatus(CommConstant.VERIFY_READY);
709 758
         taRecommendCustomer.setCreateDate(LocalDateTime.now());
710 759
         taRecommendCustomer.setReportDate(LocalDateTime.now());
711 760
         taRecommendCustomer.setOrgId(orgId);

+ 5
- 0
src/main/java/com/yunzhi/marketing/xlk/dto/ChannelCustomerDTO.java Ver fichero

@@ -32,4 +32,9 @@ public class ChannelCustomerDTO implements Serializable {
32 32
      */
33 33
     private String auditResult;
34 34
 
35
+    /**
36
+     * 置业顾问
37
+     */
38
+    private String realtyConsultant;
39
+
35 40
 }

+ 5
- 0
src/main/java/com/yunzhi/marketing/xlk/dto/MarkingChannelCustomerDTO.java Ver fichero

@@ -27,4 +27,9 @@ public class MarkingChannelCustomerDTO implements Serializable {
27 27
      */
28 28
    private String type;
29 29
 
30
+    /**
31
+     * 置业顾问personiD
32
+     */
33
+   private String realtyConsultant;
34
+
30 35
 }

+ 4
- 1
src/main/java/com/yunzhi/marketing/xlk/service/impl/ChannelCustomerServiceImpl.java Ver fichero

@@ -77,6 +77,7 @@ public class ChannelCustomerServiceImpl extends ServiceImpl<ChannelCustomerMappe
77 77
             taRecommendCustomer.setPersonId(customer.getPersonId());
78 78
             taRecommendCustomer.setEntryType(CommConstant.ENTRY_VERIFY);
79 79
             taRecommendCustomer.setStatus(CommConstant.CUSTOMER_REPORT);
80
+            taRecommendCustomer.setRealtyConsultant(channelCustomerDTO.getRealtyConsultant());
80 81
             taRecommendCustomerMapper.insert(taRecommendCustomer);
81 82
             return ResponseBean.success("审核成功");
82 83
         }
@@ -95,7 +96,7 @@ public class ChannelCustomerServiceImpl extends ServiceImpl<ChannelCustomerMappe
95 96
     /**
96 97
      * 驻场确认到访
97 98
      *
98
-     * @param id
99
+     * @param
99 100
      * @param params
100 101
      * @return
101 102
      */
@@ -129,6 +130,7 @@ public class ChannelCustomerServiceImpl extends ServiceImpl<ChannelCustomerMappe
129 130
                 taRecommendCustomer.setPersonId(customer.getPersonId());
130 131
                 taRecommendCustomer.setEntryType(CommConstant.ENTRY_VERIFY);
131 132
                 taRecommendCustomer.setStatus(CommConstant.CUSTOMER_VISITE);
133
+                taRecommendCustomer.setRealtyConsultant(params.getRealtyConsultant());
132 134
                 taRecommendCustomerMapper.insert(taRecommendCustomer);
133 135
                 return ResponseBean.success("审核成功");
134 136
             }
@@ -143,6 +145,7 @@ public class ChannelCustomerServiceImpl extends ServiceImpl<ChannelCustomerMappe
143 145
                 recommendCustomer.setRecommendPerson(customer.getRecommendPerson());
144 146
                 recommendCustomer.setVerifyStatus(CommConstant.VERIFY_AGREE);
145 147
                 recommendCustomer.setStatus(CommConstant.CUSTOMER_VISITE);
148
+                recommendCustomer.setRealtyConsultant(params.getRealtyConsultant());
146 149
                 taRecommendCustomerMapper.updateById(recommendCustomer);
147 150
                 return ResponseBean.success("审核成功");
148 151
             }