Преглед изворни кода

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

Your Name пре 3 година
родитељ
комит
e1b3fccdaa

+ 19
- 0
src/main/java/com/yunzhi/marketing/controller/TaRecommendCustomerController.java Прегледај датотеку

@@ -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 Прегледај датотеку

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

+ 5
- 0
src/main/java/com/yunzhi/marketing/entity/TaRecommendCustomer.java Прегледај датотеку

@@ -151,6 +151,11 @@ public class TaRecommendCustomer implements Serializable {
151 151
 
152 152
     private LocalDateTime verifyDate;
153 153
 
154
+    /**
155
+     * 流转使劲
156
+     */
157
+    private LocalDateTime circulationTime;
158
+
154 159
     /**
155 160
      * 组织结构id
156 161
      */

+ 32
- 0
src/main/java/com/yunzhi/marketing/job/CustomerTimeJob.java Прегледај датотеку

@@ -0,0 +1,32 @@
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 Прегледај датотеку

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

+ 52
- 1
src/main/java/com/yunzhi/marketing/service/impl/TaRecommendCustomerServiceImpl.java Прегледај датотеку

@@ -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;
@@ -532,6 +533,7 @@ public class TaRecommendCustomerServiceImpl extends ServiceImpl<TaRecommendCusto
532 533
             recommendCustomer.setVerifyStatus(CommConstant.VERIFY_AGREE);
533 534
             recommendCustomer.setStatus(CommConstant.CUSTOMER_REPORT);
534 535
             recommendCustomer.setRecommendPerson(consultant.getPersonId());
536
+            recommendCustomer.setCirculationTime(LocalDateTime.now());
535 537
             customerFrom.setIsProjectFirst(true);
536 538
             customerFrom.setIsOrgFirst(true);
537 539
         }
@@ -560,6 +562,54 @@ public class TaRecommendCustomerServiceImpl extends ServiceImpl<TaRecommendCusto
560 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 613
     private void fillSomeFieldsOfCustomer(TaRecommendCustomer customer, TaPerson recommender, LocalDateTime now) {
564 614
         customer.setVerifyStatus(CommConstant.VERIFY_AGREE);
565 615
         customer.setStatus(CommConstant.CUSTOMER_REPORT);
@@ -705,7 +755,7 @@ public class TaRecommendCustomerServiceImpl extends ServiceImpl<TaRecommendCusto
705 755
         taRecommendCustomer.setBuildingId(params.getString("intention"));
706 756
         taRecommendCustomer.setRealtyConsultant(params.getString("realtyConsultant"));
707 757
         taRecommendCustomer.setReportRecommendStatus(CommConstant.RECOMMENDED);
708
-        taRecommendCustomer.setVerifyStatus(CommConstant.VERIFY_AGREE);
758
+        taRecommendCustomer.setVerifyStatus(CommConstant.VERIFY_READY);
709 759
         taRecommendCustomer.setCreateDate(LocalDateTime.now());
710 760
         taRecommendCustomer.setReportDate(LocalDateTime.now());
711 761
         taRecommendCustomer.setOrgId(orgId);
@@ -954,6 +1004,7 @@ public class TaRecommendCustomerServiceImpl extends ServiceImpl<TaRecommendCusto
954 1004
             }
955 1005
         }
956 1006
 
1007
+        taRecommendCustomer.setCirculationTime(LocalDateTime.now());
957 1008
         int row = taRecommendCustomerMapper.insert(taRecommendCustomer);
958 1009
         if (row < 1) {
959 1010
             return ResponseBean.error("报备客户失败", ResponseBean.ERROR_UNAVAILABLE);

+ 5
- 0
src/main/java/com/yunzhi/marketing/xlk/dto/ChannelCustomerDTO.java Прегледај датотеку

@@ -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 Прегледај датотеку

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

+ 8
- 1
src/main/java/com/yunzhi/marketing/xlk/service/impl/ChannelCustomerServiceImpl.java Прегледај датотеку

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