傅行帆 3 år sedan
förälder
incheckning
22648b6dc4

+ 29
- 2
src/main/java/com/yunzhi/marketing/controller/TaRecommendCustomerController.java Visa fil

@@ -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.ChannelReportDTO;
16 17
 import com.yunzhi.marketing.entity.TaBuilding;
17 18
 import com.yunzhi.marketing.entity.TaPerson;
18 19
 import com.yunzhi.marketing.entity.TaRecommendCustomer;
@@ -180,7 +181,7 @@ public class TaRecommendCustomerController extends BaseController {
180 181
     }
181 182
 
182 183
     /**
183
-     * 推荐客户
184
+     * 普通客户推荐客户
184 185
      *
185 186
      * @param paramStr
186 187
      * @param request
@@ -194,7 +195,24 @@ public class TaRecommendCustomerController extends BaseController {
194 195
     }
195 196
 
196 197
     /**
197
-     * 报备客户
198
+     * 渠道顾问报备客户
199
+     *
200
+     * @param channelReportDTO
201
+     * @param request
202
+     * @return
203
+     */
204
+    @PostMapping("/wx/channel/report")
205
+    public ResponseBean channelReportCust(@RequestBody ChannelReportDTO channelReportDTO, HttpServletRequest request) {
206
+        String openid = getOpenId(request);
207
+        Integer orgId = getOrgId(request);
208
+        channelReportDTO.setOpenid(openid);
209
+        channelReportDTO.setOrgId(orgId);
210
+        return taRecommendCustomerService.channelReportCust(channelReportDTO);
211
+    }
212
+
213
+
214
+    /**
215
+     * 置业顾问报备客户
198 216
      *
199 217
      * @param paramStr
200 218
      * @param request
@@ -207,6 +225,15 @@ public class TaRecommendCustomerController extends BaseController {
207 225
         return taRecommendCustomerService.reportCust(paramStr, openid, orgId);
208 226
     }
209 227
 
228
+
229
+    /**
230
+     * 顾客列表
231
+     * @param pageNumber
232
+     * @param pageSize
233
+     * @param buildingId
234
+     * @param request
235
+     * @return
236
+     */
210 237
     @PostMapping("/wx/customer/recommend")
211 238
     public ResponseBean getUnSignedCustomerList(@RequestParam(value = "pageNumber", defaultValue = "1") Integer pageNumber,
212 239
                                                 @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,

+ 41
- 0
src/main/java/com/yunzhi/marketing/dto/ChannelReportDTO.java Visa fil

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

+ 8
- 0
src/main/java/com/yunzhi/marketing/service/ITaRecommendCustomerService.java Visa fil

@@ -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.ChannelReportDTO;
7 8
 import com.yunzhi.marketing.excel.AgentsRecommendCustomer;
8 9
 import com.yunzhi.marketing.excel.ExcelRecommendCustomer;
9 10
 import com.yunzhi.marketing.excel.ReporRecommendCustomer;
@@ -188,4 +189,11 @@ public interface ITaRecommendCustomerService extends IService<TaRecommendCustome
188 189
      * @throws Exception
189 190
      */
190 191
     List<TaRecommendCustomer> newCustomer(Integer orgId, TaPerson person, TaPerson recommender, TaPerson consultant, TaBuilding building, TaCustomerFrom from) throws Exception;
192
+
193
+    /**
194
+     * 渠道推荐客户
195
+     * @param channelReportDTO
196
+     * @return
197
+     */
198
+    ResponseBean channelReportCust(ChannelReportDTO channelReportDTO);
191 199
 }

+ 40
- 1
src/main/java/com/yunzhi/marketing/service/impl/TaRecommendCustomerServiceImpl.java Visa fil

@@ -1,6 +1,7 @@
1 1
 package com.yunzhi.marketing.service.impl;
2 2
 
3 3
 import com.alibaba.fastjson.JSONObject;
4
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
4 5
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
5 6
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
6 7
 import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -14,6 +15,7 @@ import com.yunzhi.marketing.common.DateUtils;
14 15
 import com.yunzhi.marketing.common.StringUtils;
15 16
 import com.yunzhi.marketing.drainage.entity.TaDrainage;
16 17
 import com.yunzhi.marketing.drainage.mapper.TaDrainageMapper;
18
+import com.yunzhi.marketing.dto.ChannelReportDTO;
17 19
 import com.yunzhi.marketing.excel.AgentsRecommendCustomer;
18 20
 import com.yunzhi.marketing.excel.ExcelRecommendCustomer;
19 21
 import com.yunzhi.marketing.excel.ReporRecommendCustomer;
@@ -24,6 +26,8 @@ import com.yunzhi.marketing.statistic.entity.TaCustomerFollowUpRecord;
24 26
 import com.yunzhi.marketing.statistic.mapper.TaCustomerFollowUpRecordMapper;
25 27
 import com.yunzhi.marketing.entity.*;
26 28
 import com.yunzhi.marketing.mapper.*;
29
+import com.yunzhi.marketing.xlk.entity.ChannelCustomer;
30
+import com.yunzhi.marketing.xlk.mapper.ChannelCustomerMapper;
27 31
 import org.apache.commons.collections.CollectionUtils;
28 32
 import org.slf4j.Logger;
29 33
 import org.slf4j.LoggerFactory;
@@ -111,6 +115,9 @@ public class TaRecommendCustomerServiceImpl extends ServiceImpl<TaRecommendCusto
111 115
     @Autowired
112 116
     private TaSharePersonFromMapper taSharePersonFromMapper;
113 117
 
118
+    @Autowired
119
+    private ChannelCustomerMapper channelCustomerMapper;
120
+
114 121
     @Override
115 122
     public ResponseBean getMyCustList(String openid, String keywords, int pageNumber, int pageSize) {
116 123
         List<TaPerson> taPersons = getPersonsByOpenId(openid);
@@ -337,6 +344,38 @@ public class TaRecommendCustomerServiceImpl extends ServiceImpl<TaRecommendCusto
337 344
         return result;
338 345
     }
339 346
 
347
+    /**
348
+     * 渠道推荐客户
349
+     *
350
+     * @param channelReportDTO
351
+     * @return
352
+     */
353
+    @Override
354
+    public ResponseBean channelReportCust(ChannelReportDTO channelReportDTO) {
355
+        // 先查看在ta_recommend_customer 手机号是否存在
356
+        LambdaQueryWrapper<TaRecommendCustomer> queryWrapper = new LambdaQueryWrapper<>();
357
+        queryWrapper.eq(TaRecommendCustomer::getPhone,channelReportDTO.getPhone());
358
+        queryWrapper.eq(TaRecommendCustomer::getBuildingId,channelReportDTO.getBuildingId());
359
+        List<TaRecommendCustomer> taRecommendCustomers = taRecommendCustomerMapper.selectList(queryWrapper);
360
+        if (taRecommendCustomers.size() > 0) {
361
+            return ResponseBean.error("已存在的客户报备失败", ResponseBean.ERROR_UNAVAILABLE);
362
+        }
363
+
364
+        // 入渠道推荐客户表
365
+        ChannelCustomer channelCustomer = new ChannelCustomer();
366
+        channelCustomer.setBuildingId(channelReportDTO.getBuildingId());
367
+        channelCustomer.setName(channelReportDTO.getName());
368
+        channelCustomer.setPicture(channelReportDTO.getPicture());
369
+        channelCustomer.setPhone(channelReportDTO.getPhone());
370
+        channelCustomer.setSex(channelReportDTO.getSex());
371
+        channelCustomer.setRecommendPerson(channelReportDTO.getRealtyChannel());
372
+        channelCustomer.setCreateDate(LocalDateTime.now());
373
+        channelCustomer.setStatus("0");
374
+        channelCustomer.setOrgId(channelReportDTO.getOrgId());
375
+        channelCustomerMapper.insert(channelCustomer);
376
+        return null;
377
+    }
378
+
340 379
     private void fillSomeFieldsOfCustomer(TaRecommendCustomer customer, TaPerson recommender, LocalDateTime now) {
341 380
         customer.setVerifyStatus(CommConstant.VERIFY_AGREE);
342 381
         customer.setStatus(CommConstant.CUSTOMER_REPORT);
@@ -482,7 +521,7 @@ public class TaRecommendCustomerServiceImpl extends ServiceImpl<TaRecommendCusto
482 521
         taRecommendCustomer.setBuildingId(params.getString("intention"));
483 522
         taRecommendCustomer.setRealtyConsultant(params.getString("realtyConsultant"));
484 523
         taRecommendCustomer.setReportRecommendStatus(CommConstant.RECOMMENDED);
485
-        taRecommendCustomer.setVerifyStatus(CommConstant.VERIFY_READY);
524
+        taRecommendCustomer.setVerifyStatus(CommConstant.VERIFY_AGREE);
486 525
         taRecommendCustomer.setCreateDate(LocalDateTime.now());
487 526
         taRecommendCustomer.setReportDate(LocalDateTime.now());
488 527
         taRecommendCustomer.setOrgId(orgId);

+ 143
- 0
src/main/java/com/yunzhi/marketing/xlk/controller/ChannelCustomerController.java Visa fil

@@ -0,0 +1,143 @@
1
+package com.yunzhi.marketing.xlk.controller;
2
+
3
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4
+import com.baomidou.mybatisplus.core.metadata.IPage;
5
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6
+import com.yunzhi.marketing.base.BaseController;
7
+import com.yunzhi.marketing.base.ResponseBean;
8
+import com.yunzhi.marketing.xlk.entity.ChannelCustomer;
9
+import com.yunzhi.marketing.xlk.service.IChannelCustomerService;
10
+import org.slf4j.Logger;
11
+import org.slf4j.LoggerFactory;
12
+import org.springframework.beans.factory.annotation.Autowired;
13
+import org.springframework.web.bind.annotation.*;
14
+
15
+/**
16
+ * <p>
17
+    * 渠道报备客户表  前端控制器
18
+    * </p>
19
+ *
20
+ * @author jobob
21
+ * @since 2021-07-19
22
+ */
23
+@RestController
24
+@RequestMapping("/")
25
+public class ChannelCustomerController extends BaseController {
26
+
27
+    private final Logger logger = LoggerFactory.getLogger(ChannelCustomerController.class);
28
+
29
+    @Autowired
30
+    public IChannelCustomerService iChannelCustomerService;
31
+
32
+
33
+    /**
34
+     * 分页查询列表
35
+     * @param pageNum
36
+     * @param pageSize
37
+     * @return
38
+     */
39
+    @RequestMapping(value="/channelCustomer",method= RequestMethod.GET)
40
+    public ResponseBean channelCustomerList(@RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
41
+                                            @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize){
42
+        ResponseBean responseBean = new ResponseBean();
43
+        try {
44
+            //使用分页插件
45
+		    IPage<ChannelCustomer> pg = new Page<>(pageNum, pageSize);
46
+            QueryWrapper<ChannelCustomer> queryWrapper = new QueryWrapper<>();
47
+            queryWrapper.orderByDesc("create_date");
48
+
49
+            IPage<ChannelCustomer> result = iChannelCustomerService.page(pg, queryWrapper);
50
+            responseBean.addSuccess(result);
51
+        }catch (Exception e){
52
+            e.printStackTrace();
53
+            logger.error("channelCustomerList -=- {}",e.toString());
54
+            responseBean.addError(e.getMessage());
55
+        }
56
+        return responseBean;
57
+    }
58
+
59
+    /**
60
+     * 保存对象
61
+     * @param channelCustomer 实体对象
62
+     * @return
63
+     */
64
+    @RequestMapping(value="/channelCustomer",method= RequestMethod.POST)
65
+    public ResponseBean channelCustomerAdd(@RequestBody ChannelCustomer channelCustomer){
66
+        ResponseBean responseBean = new ResponseBean();
67
+        try {
68
+            if (iChannelCustomerService.save(channelCustomer)){
69
+                responseBean.addSuccess(channelCustomer);
70
+            }else {
71
+                responseBean.addError("fail");
72
+            }
73
+        }catch (Exception e){
74
+            e.printStackTrace();
75
+            logger.error("channelCustomerAdd -=- {}",e.toString());
76
+            responseBean.addError(e.getMessage());
77
+        }
78
+        return responseBean;
79
+    }
80
+
81
+    /**
82
+     * 根据id删除对象
83
+     * @param id  实体ID
84
+     */
85
+    @ResponseBody
86
+    @RequestMapping(value="/channelCustomer/{id}", method= RequestMethod.DELETE)
87
+    public ResponseBean channelCustomerDelete(@PathVariable Integer id){
88
+        ResponseBean responseBean = new ResponseBean();
89
+        try {
90
+            if(iChannelCustomerService.removeById(id)){
91
+                responseBean.addSuccess("success");
92
+            }else {
93
+                responseBean.addError("fail");
94
+            }
95
+        }catch (Exception e){
96
+            e.printStackTrace();
97
+            logger.error("channelCustomerDelete -=- {}",e.toString());
98
+            responseBean.addError(e.getMessage());
99
+        }
100
+        return responseBean;
101
+    }
102
+
103
+    /**
104
+     * 修改对象
105
+     * @param id  实体ID
106
+     * @param channelCustomer 实体对象
107
+     * @return
108
+     */
109
+    @RequestMapping(value="/channelCustomer/{id}",method= RequestMethod.PUT)
110
+    public ResponseBean channelCustomerUpdate(@PathVariable Integer id,
111
+                                        @RequestBody ChannelCustomer channelCustomer){
112
+        ResponseBean responseBean = new ResponseBean();
113
+        try {
114
+            if (iChannelCustomerService.updateById(channelCustomer)){
115
+                responseBean.addSuccess(channelCustomer);
116
+            }else {
117
+                responseBean.addError("fail");
118
+            }
119
+        }catch (Exception e){
120
+            e.printStackTrace();
121
+            logger.error("channelCustomerUpdate -=- {}",e.toString());
122
+            responseBean.addError(e.getMessage());
123
+        }
124
+        return responseBean;
125
+    }
126
+
127
+    /**
128
+     * 根据id查询对象
129
+     * @param id  实体ID
130
+     */
131
+    @RequestMapping(value="/channelCustomer/{id}",method= RequestMethod.GET)
132
+    public ResponseBean channelCustomerGet(@PathVariable Integer id){
133
+        ResponseBean responseBean = new ResponseBean();
134
+        try {
135
+            responseBean.addSuccess(iChannelCustomerService.getById(id));
136
+        }catch (Exception e){
137
+            e.printStackTrace();
138
+            logger.error("channelCustomerDelete -=- {}",e.toString());
139
+            responseBean.addError(e.getMessage());
140
+        }
141
+        return responseBean;
142
+    }
143
+}

+ 88
- 0
src/main/java/com/yunzhi/marketing/xlk/entity/ChannelCustomer.java Visa fil

@@ -0,0 +1,88 @@
1
+package com.yunzhi.marketing.xlk.entity;
2
+
3
+import com.baomidou.mybatisplus.annotation.TableName;
4
+import lombok.Data;
5
+import lombok.EqualsAndHashCode;
6
+import lombok.experimental.Accessors;
7
+
8
+import java.io.Serializable;
9
+import java.time.LocalDateTime;
10
+
11
+/**
12
+ * <p>
13
+ * 渠道报备客户表 
14
+ * </p>
15
+ *
16
+ * @author jobob
17
+ * @since 2021-07-19
18
+ */
19
+@Data
20
+@EqualsAndHashCode(callSuper = false)
21
+@Accessors(chain = true)
22
+@TableName("xlk_channel_customer")
23
+public class ChannelCustomer implements Serializable {
24
+
25
+    private static final long serialVersionUID = 1L;
26
+
27
+    /**
28
+     * 主键
29
+     */
30
+    private String channelCustomerId;
31
+
32
+    /**
33
+     * 创建时间
34
+     */
35
+    private LocalDateTime createDate;
36
+
37
+    /**
38
+     * 公司id
39
+     */
40
+    private Integer orgId;
41
+
42
+    /**
43
+     * 楼盘id
44
+     */
45
+    private String buildingId;
46
+
47
+    /**
48
+     * 电话
49
+     */
50
+    private String phone;
51
+
52
+    /**
53
+     * 昵称
54
+     */
55
+    private String name;
56
+
57
+    /**
58
+     * 头像
59
+     */
60
+    private String picture;
61
+
62
+    /**
63
+     * 性别
64
+     */
65
+    private Integer sex;
66
+
67
+    /**
68
+     * personId
69
+     */
70
+    private String personId;
71
+
72
+    /**
73
+     * 推荐人 personid
74
+     */
75
+    private String recommendPerson;
76
+
77
+    /**
78
+     * 状态 1是审核中 2是审核通过 3是审核不通过
79
+     */
80
+    private String status;
81
+
82
+    /**
83
+     * 渠道id
84
+     */
85
+    private String channelId;
86
+
87
+
88
+}

+ 18
- 0
src/main/java/com/yunzhi/marketing/xlk/mapper/ChannelCustomerMapper.java Visa fil

@@ -0,0 +1,18 @@
1
+package com.yunzhi.marketing.xlk.mapper;
2
+
3
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4
+import com.yunzhi.marketing.xlk.entity.ChannelCustomer;
5
+import org.apache.ibatis.annotations.Mapper;
6
+
7
+/**
8
+ * <p>
9
+ * 渠道报备客户表  Mapper 接口
10
+ * </p>
11
+ *
12
+ * @author jobob
13
+ * @since 2021-07-19
14
+ */
15
+@Mapper
16
+public interface ChannelCustomerMapper extends BaseMapper<ChannelCustomer> {
17
+
18
+}

+ 16
- 0
src/main/java/com/yunzhi/marketing/xlk/service/IChannelCustomerService.java Visa fil

@@ -0,0 +1,16 @@
1
+package com.yunzhi.marketing.xlk.service;
2
+
3
+import com.baomidou.mybatisplus.extension.service.IService;
4
+import com.yunzhi.marketing.xlk.entity.ChannelCustomer;
5
+
6
+/**
7
+ * <p>
8
+ * 渠道报备客户表  服务类
9
+ * </p>
10
+ *
11
+ * @author jobob
12
+ * @since 2021-07-19
13
+ */
14
+public interface IChannelCustomerService extends IService<ChannelCustomer> {
15
+
16
+}

+ 20
- 0
src/main/java/com/yunzhi/marketing/xlk/service/impl/ChannelCustomerServiceImpl.java Visa fil

@@ -0,0 +1,20 @@
1
+package com.yunzhi.marketing.xlk.service.impl;
2
+
3
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
4
+import com.yunzhi.marketing.xlk.entity.ChannelCustomer;
5
+import com.yunzhi.marketing.xlk.mapper.ChannelCustomerMapper;
6
+import com.yunzhi.marketing.xlk.service.IChannelCustomerService;
7
+import org.springframework.stereotype.Service;
8
+
9
+/**
10
+ * <p>
11
+ * 渠道报备客户表  服务实现类
12
+ * </p>
13
+ *
14
+ * @author jobob
15
+ * @since 2021-07-19
16
+ */
17
+@Service
18
+public class ChannelCustomerServiceImpl extends ServiceImpl<ChannelCustomerMapper, ChannelCustomer> implements IChannelCustomerService {
19
+
20
+}

+ 5
- 0
src/main/resources/mapper/xlk/ChannelCustomerMapper.xml Visa fil

@@ -0,0 +1,5 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
+<mapper namespace="com.yunzhi.marketing.xlk.mapper.ChannelCustomerMapper">
4
+
5
+</mapper>