Browse Source

Merge branch 'develop' of http://git.ycjcjy.com/marketing/services into develop

Your Name 3 years ago
parent
commit
e1b3fccdaa

+ 19
- 0
src/main/java/com/yunzhi/marketing/controller/TaRecommendCustomerController.java View File

13
 import com.yunzhi.marketing.center.taUser.service.ITaUserService;
13
 import com.yunzhi.marketing.center.taUser.service.ITaUserService;
14
 import com.yunzhi.marketing.common.CommConstant;
14
 import com.yunzhi.marketing.common.CommConstant;
15
 import com.yunzhi.marketing.common.StringUtils;
15
 import com.yunzhi.marketing.common.StringUtils;
16
+import com.yunzhi.marketing.dto.AverageReportDTO;
16
 import com.yunzhi.marketing.dto.ChannelReportDTO;
17
 import com.yunzhi.marketing.dto.ChannelReportDTO;
17
 import com.yunzhi.marketing.entity.TaBuilding;
18
 import com.yunzhi.marketing.entity.TaBuilding;
18
 import com.yunzhi.marketing.entity.TaPerson;
19
 import com.yunzhi.marketing.entity.TaPerson;
237
         return taRecommendCustomerService.channelReportCust(channelReportDTO);
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
      * @param request
276
      * @param request
259
      * @return
277
      * @return
260
      */
278
      */
279
+    @ApiOperation(value = "wx-置业顾问手动报备客户", notes = "森哥看这里-wx-置业顾问手动报备客户")
261
     @PostMapping("/wx/customer/manualReport")
280
     @PostMapping("/wx/customer/manualReport")
262
     public ResponseBean manualReport(@RequestBody ChannelReportDTO reportCust, HttpServletRequest request) {
281
     public ResponseBean manualReport(@RequestBody ChannelReportDTO reportCust, HttpServletRequest request) {
263
         Integer orgId = getOrgId(request);
282
         Integer orgId = getOrgId(request);

+ 36
- 0
src/main/java/com/yunzhi/marketing/dto/AverageReportDTO.java View File

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
+}

+ 5
- 0
src/main/java/com/yunzhi/marketing/entity/TaRecommendCustomer.java View File

151
 
151
 
152
     private LocalDateTime verifyDate;
152
     private LocalDateTime verifyDate;
153
 
153
 
154
+    /**
155
+     * 流转使劲
156
+     */
157
+    private LocalDateTime circulationTime;
158
+
154
     /**
159
     /**
155
      * 组织结构id
160
      * 组织结构id
156
      */
161
      */

+ 32
- 0
src/main/java/com/yunzhi/marketing/job/CustomerTimeJob.java View File

1
+package com.yunzhi.marketing.job;
2
+
3
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
4
+import com.yunzhi.marketing.common.CommConstant;
5
+import com.yunzhi.marketing.entity.TaRecommendCustomer;
6
+import com.yunzhi.marketing.service.ITaRecommendCustomerService;
7
+import org.springframework.beans.factory.annotation.Autowired;
8
+
9
+import java.time.LocalDateTime;
10
+import java.util.List;
11
+
12
+public class CustomerTimeJob {
13
+
14
+    @Autowired
15
+    private ITaRecommendCustomerService taRecommendCustomerService;
16
+
17
+    //    @Scheduled(cron = "* 0/1 * * * ?")
18
+    private void customerTimeJob() {
19
+        LocalDateTime nowDate = LocalDateTime.now();
20
+        LocalDateTime beforeTime = nowDate.plusDays(-15);
21
+        LambdaQueryWrapper<TaRecommendCustomer> queryWrapper = new LambdaQueryWrapper<>();
22
+        queryWrapper.between(TaRecommendCustomer::getCirculationTime,beforeTime,nowDate);
23
+        queryWrapper.eq(TaRecommendCustomer::getVerifyStatus, CommConstant.VERIFY_AGREE);
24
+        List<TaRecommendCustomer> list = taRecommendCustomerService.list(queryWrapper);
25
+        list.forEach(e -> {
26
+            e.setBuildingId(null);
27
+            e.setRealtyConsultant(null);
28
+            e.setRecommendPerson(null);
29
+        });
30
+        taRecommendCustomerService.updateBatchById(list);
31
+    }
32
+}

+ 8
- 0
src/main/java/com/yunzhi/marketing/service/ITaRecommendCustomerService.java View File

4
 import com.baomidou.mybatisplus.extension.service.IService;
4
 import com.baomidou.mybatisplus.extension.service.IService;
5
 import com.yunzhi.marketing.base.ResponseBean;
5
 import com.yunzhi.marketing.base.ResponseBean;
6
 import com.yunzhi.marketing.center.taUser.entity.TaUser;
6
 import com.yunzhi.marketing.center.taUser.entity.TaUser;
7
+import com.yunzhi.marketing.dto.AverageReportDTO;
7
 import com.yunzhi.marketing.dto.ChannelReportDTO;
8
 import com.yunzhi.marketing.dto.ChannelReportDTO;
8
 import com.yunzhi.marketing.excel.AgentsRecommendCustomer;
9
 import com.yunzhi.marketing.excel.AgentsRecommendCustomer;
9
 import com.yunzhi.marketing.excel.ExcelRecommendCustomer;
10
 import com.yunzhi.marketing.excel.ExcelRecommendCustomer;
209
     ResponseBean getMarkingCustList(String openid, String keywords, int pageNumber, int pageSize, String buildingId);
210
     ResponseBean getMarkingCustList(String openid, String keywords, int pageNumber, int pageSize, String buildingId);
210
 
211
 
211
     void manualReport(Integer orgId, TaPerson consultant, ChannelReportDTO reportCust) throws Exception;
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
 }

+ 52
- 1
src/main/java/com/yunzhi/marketing/service/impl/TaRecommendCustomerServiceImpl.java View File

15
 import com.yunzhi.marketing.common.StringUtils;
15
 import com.yunzhi.marketing.common.StringUtils;
16
 import com.yunzhi.marketing.drainage.entity.TaDrainage;
16
 import com.yunzhi.marketing.drainage.entity.TaDrainage;
17
 import com.yunzhi.marketing.drainage.mapper.TaDrainageMapper;
17
 import com.yunzhi.marketing.drainage.mapper.TaDrainageMapper;
18
+import com.yunzhi.marketing.dto.AverageReportDTO;
18
 import com.yunzhi.marketing.dto.ChannelReportDTO;
19
 import com.yunzhi.marketing.dto.ChannelReportDTO;
19
 import com.yunzhi.marketing.excel.AgentsRecommendCustomer;
20
 import com.yunzhi.marketing.excel.AgentsRecommendCustomer;
20
 import com.yunzhi.marketing.excel.ExcelRecommendCustomer;
21
 import com.yunzhi.marketing.excel.ExcelRecommendCustomer;
532
             recommendCustomer.setVerifyStatus(CommConstant.VERIFY_AGREE);
533
             recommendCustomer.setVerifyStatus(CommConstant.VERIFY_AGREE);
533
             recommendCustomer.setStatus(CommConstant.CUSTOMER_REPORT);
534
             recommendCustomer.setStatus(CommConstant.CUSTOMER_REPORT);
534
             recommendCustomer.setRecommendPerson(consultant.getPersonId());
535
             recommendCustomer.setRecommendPerson(consultant.getPersonId());
536
+            recommendCustomer.setCirculationTime(LocalDateTime.now());
535
             customerFrom.setIsProjectFirst(true);
537
             customerFrom.setIsProjectFirst(true);
536
             customerFrom.setIsOrgFirst(true);
538
             customerFrom.setIsOrgFirst(true);
537
         }
539
         }
560
         return;
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
     private void fillSomeFieldsOfCustomer(TaRecommendCustomer customer, TaPerson recommender, LocalDateTime now) {
613
     private void fillSomeFieldsOfCustomer(TaRecommendCustomer customer, TaPerson recommender, LocalDateTime now) {
564
         customer.setVerifyStatus(CommConstant.VERIFY_AGREE);
614
         customer.setVerifyStatus(CommConstant.VERIFY_AGREE);
565
         customer.setStatus(CommConstant.CUSTOMER_REPORT);
615
         customer.setStatus(CommConstant.CUSTOMER_REPORT);
705
         taRecommendCustomer.setBuildingId(params.getString("intention"));
755
         taRecommendCustomer.setBuildingId(params.getString("intention"));
706
         taRecommendCustomer.setRealtyConsultant(params.getString("realtyConsultant"));
756
         taRecommendCustomer.setRealtyConsultant(params.getString("realtyConsultant"));
707
         taRecommendCustomer.setReportRecommendStatus(CommConstant.RECOMMENDED);
757
         taRecommendCustomer.setReportRecommendStatus(CommConstant.RECOMMENDED);
708
-        taRecommendCustomer.setVerifyStatus(CommConstant.VERIFY_AGREE);
758
+        taRecommendCustomer.setVerifyStatus(CommConstant.VERIFY_READY);
709
         taRecommendCustomer.setCreateDate(LocalDateTime.now());
759
         taRecommendCustomer.setCreateDate(LocalDateTime.now());
710
         taRecommendCustomer.setReportDate(LocalDateTime.now());
760
         taRecommendCustomer.setReportDate(LocalDateTime.now());
711
         taRecommendCustomer.setOrgId(orgId);
761
         taRecommendCustomer.setOrgId(orgId);
954
             }
1004
             }
955
         }
1005
         }
956
 
1006
 
1007
+        taRecommendCustomer.setCirculationTime(LocalDateTime.now());
957
         int row = taRecommendCustomerMapper.insert(taRecommendCustomer);
1008
         int row = taRecommendCustomerMapper.insert(taRecommendCustomer);
958
         if (row < 1) {
1009
         if (row < 1) {
959
             return ResponseBean.error("报备客户失败", ResponseBean.ERROR_UNAVAILABLE);
1010
             return ResponseBean.error("报备客户失败", ResponseBean.ERROR_UNAVAILABLE);

+ 5
- 0
src/main/java/com/yunzhi/marketing/xlk/dto/ChannelCustomerDTO.java View File

32
      */
32
      */
33
     private String auditResult;
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 View File

27
      */
27
      */
28
    private String type;
28
    private String type;
29
 
29
 
30
+    /**
31
+     * 置业顾问personiD
32
+     */
33
+   private String realtyConsultant;
34
+
30
 }
35
 }

+ 8
- 1
src/main/java/com/yunzhi/marketing/xlk/service/impl/ChannelCustomerServiceImpl.java View File

77
             taRecommendCustomer.setPersonId(customer.getPersonId());
77
             taRecommendCustomer.setPersonId(customer.getPersonId());
78
             taRecommendCustomer.setEntryType(CommConstant.ENTRY_VERIFY);
78
             taRecommendCustomer.setEntryType(CommConstant.ENTRY_VERIFY);
79
             taRecommendCustomer.setStatus(CommConstant.CUSTOMER_REPORT);
79
             taRecommendCustomer.setStatus(CommConstant.CUSTOMER_REPORT);
80
+            taRecommendCustomer.setRealtyConsultant(channelCustomerDTO.getRealtyConsultant());
81
+            taRecommendCustomer.setCirculationTime(LocalDateTime.now());
80
             taRecommendCustomerMapper.insert(taRecommendCustomer);
82
             taRecommendCustomerMapper.insert(taRecommendCustomer);
81
             return ResponseBean.success("审核成功");
83
             return ResponseBean.success("审核成功");
82
         }
84
         }
95
     /**
97
     /**
96
      * 驻场确认到访
98
      * 驻场确认到访
97
      *
99
      *
98
-     * @param id
100
+     * @param
99
      * @param params
101
      * @param params
100
      * @return
102
      * @return
101
      */
103
      */
129
                 taRecommendCustomer.setPersonId(customer.getPersonId());
131
                 taRecommendCustomer.setPersonId(customer.getPersonId());
130
                 taRecommendCustomer.setEntryType(CommConstant.ENTRY_VERIFY);
132
                 taRecommendCustomer.setEntryType(CommConstant.ENTRY_VERIFY);
131
                 taRecommendCustomer.setStatus(CommConstant.CUSTOMER_VISITE);
133
                 taRecommendCustomer.setStatus(CommConstant.CUSTOMER_VISITE);
134
+                taRecommendCustomer.setRealtyConsultant(params.getRealtyConsultant());
135
+                taRecommendCustomer.setCirculationTime(LocalDateTime.now());
132
                 taRecommendCustomerMapper.insert(taRecommendCustomer);
136
                 taRecommendCustomerMapper.insert(taRecommendCustomer);
133
                 return ResponseBean.success("审核成功");
137
                 return ResponseBean.success("审核成功");
134
             }
138
             }
143
                 recommendCustomer.setRecommendPerson(customer.getRecommendPerson());
147
                 recommendCustomer.setRecommendPerson(customer.getRecommendPerson());
144
                 recommendCustomer.setVerifyStatus(CommConstant.VERIFY_AGREE);
148
                 recommendCustomer.setVerifyStatus(CommConstant.VERIFY_AGREE);
145
                 recommendCustomer.setStatus(CommConstant.CUSTOMER_VISITE);
149
                 recommendCustomer.setStatus(CommConstant.CUSTOMER_VISITE);
150
+                recommendCustomer.setRealtyConsultant(params.getRealtyConsultant());
151
+                recommendCustomer.setCirculationTime(LocalDateTime.now());
146
                 taRecommendCustomerMapper.updateById(recommendCustomer);
152
                 taRecommendCustomerMapper.updateById(recommendCustomer);
147
                 return ResponseBean.success("审核成功");
153
                 return ResponseBean.success("审核成功");
148
             }
154
             }
151
             TaRecommendCustomer taRecommendCustomer = taRecommendCustomerMapper.selectById(params.getId());
157
             TaRecommendCustomer taRecommendCustomer = taRecommendCustomerMapper.selectById(params.getId());
152
             taRecommendCustomer.setVerifyStatus(CommConstant.VERIFY_AGREE);
158
             taRecommendCustomer.setVerifyStatus(CommConstant.VERIFY_AGREE);
153
             taRecommendCustomer.setStatus(CommConstant.CUSTOMER_VISITE);
159
             taRecommendCustomer.setStatus(CommConstant.CUSTOMER_VISITE);
160
+            taRecommendCustomer.setCirculationTime(LocalDateTime.now());
154
             taRecommendCustomerMapper.updateById(taRecommendCustomer);
161
             taRecommendCustomerMapper.updateById(taRecommendCustomer);
155
             return ResponseBean.success("审核成功");
162
             return ResponseBean.success("审核成功");
156
         }
163
         }