Browse Source

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

张延森 3 years ago
parent
commit
f028674041

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

202
      * @return
202
      * @return
203
      */
203
      */
204
     @PostMapping("/wx/channel/report")
204
     @PostMapping("/wx/channel/report")
205
-    public ResponseBean channelReportCust(@RequestBody ChannelReportDTO channelReportDTO, HttpServletRequest request) {
205
+    public ResponseBean channelReportCust(@RequestBody ChannelReportDTO channelReportDTO, HttpServletRequest request) throws Exception {
206
         String openid = getOpenId(request);
206
         String openid = getOpenId(request);
207
         Integer orgId = getOrgId(request);
207
         Integer orgId = getOrgId(request);
208
         channelReportDTO.setOpenid(openid);
208
         channelReportDTO.setOpenid(openid);

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

195
      * @param channelReportDTO
195
      * @param channelReportDTO
196
      * @return
196
      * @return
197
      */
197
      */
198
-    ResponseBean channelReportCust(ChannelReportDTO channelReportDTO);
198
+    ResponseBean channelReportCust(ChannelReportDTO channelReportDTO) throws Exception;
199
 }
199
 }

+ 54
- 3
src/main/java/com/yunzhi/marketing/service/impl/TaRecommendCustomerServiceImpl.java View File

26
 import com.yunzhi.marketing.statistic.mapper.TaCustomerFollowUpRecordMapper;
26
 import com.yunzhi.marketing.statistic.mapper.TaCustomerFollowUpRecordMapper;
27
 import com.yunzhi.marketing.entity.*;
27
 import com.yunzhi.marketing.entity.*;
28
 import com.yunzhi.marketing.mapper.*;
28
 import com.yunzhi.marketing.mapper.*;
29
+import com.yunzhi.marketing.xlk.entity.BuildingChannel;
29
 import com.yunzhi.marketing.xlk.entity.ChannelCustomer;
30
 import com.yunzhi.marketing.xlk.entity.ChannelCustomer;
31
+import com.yunzhi.marketing.xlk.mapper.BuildingChannelMapper;
30
 import com.yunzhi.marketing.xlk.mapper.ChannelCustomerMapper;
32
 import com.yunzhi.marketing.xlk.mapper.ChannelCustomerMapper;
31
 import org.apache.commons.collections.CollectionUtils;
33
 import org.apache.commons.collections.CollectionUtils;
32
 import org.slf4j.Logger;
34
 import org.slf4j.Logger;
118
     @Autowired
120
     @Autowired
119
     private ChannelCustomerMapper channelCustomerMapper;
121
     private ChannelCustomerMapper channelCustomerMapper;
120
 
122
 
123
+    @Autowired
124
+    private BuildingChannelMapper buildingChannelMapper;
125
+
126
+    @Autowired
127
+    private TaChannelPersonMapper channelPersonMapper;
128
+
121
     @Override
129
     @Override
122
     public ResponseBean getMyCustList(String openid, String keywords, int pageNumber, int pageSize) {
130
     public ResponseBean getMyCustList(String openid, String keywords, int pageNumber, int pageSize) {
123
         List<TaPerson> taPersons = getPersonsByOpenId(openid);
131
         List<TaPerson> taPersons = getPersonsByOpenId(openid);
351
      * @return
359
      * @return
352
      */
360
      */
353
     @Override
361
     @Override
354
-    public ResponseBean channelReportCust(ChannelReportDTO channelReportDTO) {
362
+    public ResponseBean channelReportCust(ChannelReportDTO channelReportDTO) throws Exception {
363
+
364
+        // 当前人员
365
+        List<TaPerson> persons = getPersonsByOpenId(channelReportDTO.getOpenid());
366
+        if (null == persons || persons.size() != 1) {
367
+            throw new Exception("当前人员 openid 异常");
368
+        }
369
+        TaPerson person = persons.get(0);
370
+
355
         // 先查看在ta_recommend_customer 手机号是否存在
371
         // 先查看在ta_recommend_customer 手机号是否存在
356
         LambdaQueryWrapper<TaRecommendCustomer> queryWrapper = new LambdaQueryWrapper<>();
372
         LambdaQueryWrapper<TaRecommendCustomer> queryWrapper = new LambdaQueryWrapper<>();
357
         queryWrapper.eq(TaRecommendCustomer::getPhone,channelReportDTO.getPhone());
373
         queryWrapper.eq(TaRecommendCustomer::getPhone,channelReportDTO.getPhone());
360
         if (taRecommendCustomers.size() > 0) {
376
         if (taRecommendCustomers.size() > 0) {
361
             return ResponseBean.error("已存在的客户报备失败", ResponseBean.ERROR_UNAVAILABLE);
377
             return ResponseBean.error("已存在的客户报备失败", ResponseBean.ERROR_UNAVAILABLE);
362
         }
378
         }
379
+        //查询此楼盘的渠道id
380
+        LambdaQueryWrapper<TaChannelPerson> channelPersonLambdaQueryWrapper = new LambdaQueryWrapper<>();
381
+        channelPersonLambdaQueryWrapper.eq(TaChannelPerson::getPersonId,person.getPersonId());
382
+        TaChannelPerson taChannelPeople = channelPersonMapper.selectOne(channelPersonLambdaQueryWrapper);
383
+        if (null == taChannelPeople) {
384
+            return ResponseBean.error("不是渠道用户请绑定", ResponseBean.ERROR_UNAVAILABLE);
385
+        }
386
+
387
+        // 查询这个楼盘的这个渠道的有效保护期
388
+        LambdaQueryWrapper<BuildingChannel> buildingChannelLambdaQueryWrapper = new LambdaQueryWrapper<>();
389
+        buildingChannelLambdaQueryWrapper.eq(BuildingChannel::getBuildingId,channelReportDTO.getBuildingId());
390
+        buildingChannelLambdaQueryWrapper.eq(BuildingChannel::getChannelId,taChannelPeople.getChannelId());
391
+        BuildingChannel buildingChannel = buildingChannelMapper.selectOne(buildingChannelLambdaQueryWrapper);
392
+
393
+        // 查询是否在渠道推荐表中
394
+        LambdaQueryWrapper<ChannelCustomer> channelCustomerLambdaQueryWrapper = new LambdaQueryWrapper<>();
395
+        channelCustomerLambdaQueryWrapper.eq(ChannelCustomer::getBuildingId,channelReportDTO.getBuildingId());
396
+        channelCustomerLambdaQueryWrapper.eq(ChannelCustomer::getChannelId,taChannelPeople.getChannelId());
397
+        channelCustomerLambdaQueryWrapper.ne(ChannelCustomer::getStatus,"3");
398
+        List<ChannelCustomer> channelCustomers = channelCustomerMapper.selectList(channelCustomerLambdaQueryWrapper);
399
+        List<ChannelCustomer> passCustomer = channelCustomers.stream().filter(e -> "2".equals(e.getStatus())).collect(Collectors.toList());
400
+        if (passCustomer.size() > 0) {
401
+            return ResponseBean.error("此用户已经被报备", ResponseBean.ERROR_UNAVAILABLE);
402
+        }
403
+
404
+        // 审核中的
405
+        for (ChannelCustomer customer : channelCustomers) {
406
+            // 过期时间
407
+            LocalDateTime expirDate = customer.getCreateDate().plusDays(buildingChannel.getExpirationDate());
408
+            LocalDateTime now = LocalDateTime.now();
409
+            if (now.isBefore(expirDate)) {
410
+                return ResponseBean.error("此用户已经被报备", ResponseBean.ERROR_UNAVAILABLE);
411
+            }
412
+        }
363
 
413
 
364
         // 入渠道推荐客户表
414
         // 入渠道推荐客户表
365
         ChannelCustomer channelCustomer = new ChannelCustomer();
415
         ChannelCustomer channelCustomer = new ChannelCustomer();
370
         channelCustomer.setSex(channelReportDTO.getSex());
420
         channelCustomer.setSex(channelReportDTO.getSex());
371
         channelCustomer.setRecommendPerson(channelReportDTO.getRealtyChannel());
421
         channelCustomer.setRecommendPerson(channelReportDTO.getRealtyChannel());
372
         channelCustomer.setCreateDate(LocalDateTime.now());
422
         channelCustomer.setCreateDate(LocalDateTime.now());
373
-        channelCustomer.setStatus("0");
423
+        channelCustomer.setStatus("1");
424
+        channelCustomer.setChannelId(taChannelPeople.getChannelId());
374
         channelCustomer.setOrgId(channelReportDTO.getOrgId());
425
         channelCustomer.setOrgId(channelReportDTO.getOrgId());
375
         channelCustomerMapper.insert(channelCustomer);
426
         channelCustomerMapper.insert(channelCustomer);
376
-        return null;
427
+        return ResponseBean.success(channelCustomer);
377
     }
428
     }
378
 
429
 
379
     private void fillSomeFieldsOfCustomer(TaRecommendCustomer customer, TaPerson recommender, LocalDateTime now) {
430
     private void fillSomeFieldsOfCustomer(TaRecommendCustomer customer, TaPerson recommender, LocalDateTime now) {

+ 18
- 66
src/main/java/com/yunzhi/marketing/xlk/controller/ChannelCustomerController.java View File

1
 package com.yunzhi.marketing.xlk.controller;
1
 package com.yunzhi.marketing.xlk.controller;
2
 
2
 
3
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
3
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4
 import com.baomidou.mybatisplus.core.metadata.IPage;
5
 import com.baomidou.mybatisplus.core.metadata.IPage;
5
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6
 import com.yunzhi.marketing.base.BaseController;
7
 import com.yunzhi.marketing.base.BaseController;
7
 import com.yunzhi.marketing.base.ResponseBean;
8
 import com.yunzhi.marketing.base.ResponseBean;
9
+import com.yunzhi.marketing.xlk.dto.ChannelCustomerDTO;
8
 import com.yunzhi.marketing.xlk.entity.ChannelCustomer;
10
 import com.yunzhi.marketing.xlk.entity.ChannelCustomer;
9
 import com.yunzhi.marketing.xlk.service.IChannelCustomerService;
11
 import com.yunzhi.marketing.xlk.service.IChannelCustomerService;
12
+import io.swagger.annotations.Api;
13
+import io.swagger.annotations.ApiOperation;
10
 import org.slf4j.Logger;
14
 import org.slf4j.Logger;
11
 import org.slf4j.LoggerFactory;
15
 import org.slf4j.LoggerFactory;
12
 import org.springframework.beans.factory.annotation.Autowired;
16
 import org.springframework.beans.factory.annotation.Autowired;
21
  * @since 2021-07-19
25
  * @since 2021-07-19
22
  */
26
  */
23
 @RestController
27
 @RestController
24
-@RequestMapping("/")
28
+@RequestMapping("/api")
29
+@Api(value = "渠道报备客户表", tags = "xlk-渠道报备客户表")
25
 public class ChannelCustomerController extends BaseController {
30
 public class ChannelCustomerController extends BaseController {
26
 
31
 
27
     private final Logger logger = LoggerFactory.getLogger(ChannelCustomerController.class);
32
     private final Logger logger = LoggerFactory.getLogger(ChannelCustomerController.class);
36
      * @param pageSize
41
      * @param pageSize
37
      * @return
42
      * @return
38
      */
43
      */
39
-    @RequestMapping(value="/channelCustomer",method= RequestMethod.GET)
44
+    @ApiOperation(value = "admin-渠道报备客户表", notes = "admin-渠道报备客户表")
45
+    @RequestMapping(value="/admin/channelCustomer",method= RequestMethod.GET)
40
     public ResponseBean channelCustomerList(@RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
46
     public ResponseBean channelCustomerList(@RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
41
                                             @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize){
47
                                             @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize){
42
         ResponseBean responseBean = new ResponseBean();
48
         ResponseBean responseBean = new ResponseBean();
43
         try {
49
         try {
44
             //使用分页插件
50
             //使用分页插件
45
 		    IPage<ChannelCustomer> pg = new Page<>(pageNum, pageSize);
51
 		    IPage<ChannelCustomer> pg = new Page<>(pageNum, pageSize);
46
-            QueryWrapper<ChannelCustomer> queryWrapper = new QueryWrapper<>();
47
-            queryWrapper.orderByDesc("create_date");
52
+            LambdaQueryWrapper<ChannelCustomer> queryWrapper = new LambdaQueryWrapper<>();
53
+            queryWrapper.eq(ChannelCustomer::getStatus,"1");
54
+            queryWrapper.orderByDesc(ChannelCustomer::getCreateDate);
48
 
55
 
49
             IPage<ChannelCustomer> result = iChannelCustomerService.page(pg, queryWrapper);
56
             IPage<ChannelCustomer> result = iChannelCustomerService.page(pg, queryWrapper);
50
             responseBean.addSuccess(result);
57
             responseBean.addSuccess(result);
57
     }
64
     }
58
 
65
 
59
     /**
66
     /**
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
-     * 修改对象
67
+     * 审核
105
      * @param id  实体ID
68
      * @param id  实体ID
106
-     * @param channelCustomer 实体对象
69
+     * @param channelCustomerDTO 实体对象
107
      * @return
70
      * @return
108
      */
71
      */
109
-    @RequestMapping(value="/channelCustomer/{id}",method= RequestMethod.PUT)
72
+    @ApiOperation(value = "admin-渠道报备客户审核", notes = "admin-渠道报备客户审核")
73
+    @RequestMapping(value="/admin/channelCustomer/{id}",method= RequestMethod.PUT)
110
     public ResponseBean channelCustomerUpdate(@PathVariable Integer id,
74
     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;
75
+                                        @RequestBody ChannelCustomerDTO channelCustomerDTO){
76
+        return iChannelCustomerService.auditCustomer(id,channelCustomerDTO);
125
     }
77
     }
126
 
78
 
127
     /**
79
     /**
128
      * 根据id查询对象
80
      * 根据id查询对象
129
      * @param id  实体ID
81
      * @param id  实体ID
130
      */
82
      */
131
-    @RequestMapping(value="/channelCustomer/{id}",method= RequestMethod.GET)
83
+    @RequestMapping(value="/admin/channelCustomer/{id}",method= RequestMethod.GET)
132
     public ResponseBean channelCustomerGet(@PathVariable Integer id){
84
     public ResponseBean channelCustomerGet(@PathVariable Integer id){
133
         ResponseBean responseBean = new ResponseBean();
85
         ResponseBean responseBean = new ResponseBean();
134
         try {
86
         try {

+ 22
- 0
src/main/java/com/yunzhi/marketing/xlk/controller/CurriculumController.java View File

253
         }
253
         }
254
         return responseBean;
254
         return responseBean;
255
     }
255
     }
256
+
257
+    /**
258
+     * 根据id查询对象
259
+     * @param id  实体ID
260
+     */
261
+    @ApiOperation(value = "wx-根据id查询课程表详情", notes = "wx-根据id查询课程表详情")
262
+    @RequestMapping(value="/wx/curriculum/{id}",method= RequestMethod.GET)
263
+    public ResponseBean curriculum(@PathVariable String id,
264
+                                      @RequestHeader("authorization") String token, HttpServletRequest request){
265
+        ResponseBean responseBean = new ResponseBean();
266
+        try {
267
+            Curriculum curriculum = iCurriculumService.getById(id);
268
+            curriculum.setLookNum(curriculum.getLookNum() + 1);
269
+            iCurriculumService.updateById(curriculum);
270
+            responseBean.addSuccess(curriculum);
271
+        }catch (Exception e){
272
+            e.printStackTrace();
273
+            logger.error("curriculumDelete -=- {}",e.toString());
274
+            responseBean.addError(e.getMessage());
275
+        }
276
+        return responseBean;
277
+    }
256
 }
278
 }

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

1
+package com.yunzhi.marketing.xlk.dto;
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 ChannelCustomerDTO implements Serializable {
24
+
25
+    /**
26
+     * 主键
27
+     */
28
+    private String channelCustomerId;
29
+
30
+    /**
31
+     * 审核结果 pass 通过  fail 失败
32
+     */
33
+    private String auditResult;
34
+
35
+}

+ 2
- 1
src/main/java/com/yunzhi/marketing/xlk/entity/ChannelCustomer.java View File

1
 package com.yunzhi.marketing.xlk.entity;
1
 package com.yunzhi.marketing.xlk.entity;
2
 
2
 
3
 import com.baomidou.mybatisplus.annotation.TableName;
3
 import com.baomidou.mybatisplus.annotation.TableName;
4
+import io.swagger.models.auth.In;
4
 import lombok.Data;
5
 import lombok.Data;
5
 import lombok.EqualsAndHashCode;
6
 import lombok.EqualsAndHashCode;
6
 import lombok.experimental.Accessors;
7
 import lombok.experimental.Accessors;
82
     /**
83
     /**
83
      * 渠道id
84
      * 渠道id
84
      */
85
      */
85
-    private String channelId;
86
+    private Integer channelId;
86
 
87
 
87
 
88
 
88
 }
89
 }

+ 9
- 0
src/main/java/com/yunzhi/marketing/xlk/service/IChannelCustomerService.java View File

1
 package com.yunzhi.marketing.xlk.service;
1
 package com.yunzhi.marketing.xlk.service;
2
 
2
 
3
 import com.baomidou.mybatisplus.extension.service.IService;
3
 import com.baomidou.mybatisplus.extension.service.IService;
4
+import com.yunzhi.marketing.base.ResponseBean;
5
+import com.yunzhi.marketing.xlk.dto.ChannelCustomerDTO;
4
 import com.yunzhi.marketing.xlk.entity.ChannelCustomer;
6
 import com.yunzhi.marketing.xlk.entity.ChannelCustomer;
5
 
7
 
6
 /**
8
 /**
13
  */
15
  */
14
 public interface IChannelCustomerService extends IService<ChannelCustomer> {
16
 public interface IChannelCustomerService extends IService<ChannelCustomer> {
15
 
17
 
18
+    /**
19
+     * 审核
20
+     * @param id
21
+     * @param channelCustomerDTO
22
+     * @return
23
+     */
24
+    ResponseBean auditCustomer(Integer id, ChannelCustomerDTO channelCustomerDTO);
16
 }
25
 }

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

1
 package com.yunzhi.marketing.xlk.service.impl;
1
 package com.yunzhi.marketing.xlk.service.impl;
2
 
2
 
3
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
3
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
4
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
5
+import com.yunzhi.marketing.base.ResponseBean;
6
+import com.yunzhi.marketing.common.StringUtils;
7
+import com.yunzhi.marketing.entity.TaRecommendCustomer;
8
+import com.yunzhi.marketing.mapper.TaRecommendCustomerMapper;
9
+import com.yunzhi.marketing.xlk.dto.ChannelCustomerDTO;
4
 import com.yunzhi.marketing.xlk.entity.ChannelCustomer;
10
 import com.yunzhi.marketing.xlk.entity.ChannelCustomer;
5
 import com.yunzhi.marketing.xlk.mapper.ChannelCustomerMapper;
11
 import com.yunzhi.marketing.xlk.mapper.ChannelCustomerMapper;
6
 import com.yunzhi.marketing.xlk.service.IChannelCustomerService;
12
 import com.yunzhi.marketing.xlk.service.IChannelCustomerService;
13
+import org.springframework.beans.factory.annotation.Autowired;
7
 import org.springframework.stereotype.Service;
14
 import org.springframework.stereotype.Service;
8
 
15
 
16
+import java.util.List;
17
+
9
 /**
18
 /**
10
  * <p>
19
  * <p>
11
  * 渠道报备客户表  服务实现类
20
  * 渠道报备客户表  服务实现类
17
 @Service
26
 @Service
18
 public class ChannelCustomerServiceImpl extends ServiceImpl<ChannelCustomerMapper, ChannelCustomer> implements IChannelCustomerService {
27
 public class ChannelCustomerServiceImpl extends ServiceImpl<ChannelCustomerMapper, ChannelCustomer> implements IChannelCustomerService {
19
 
28
 
29
+    @Autowired
30
+    private ChannelCustomerMapper channelCustomerMapper;
31
+
32
+    @Autowired
33
+    private TaRecommendCustomerMapper taRecommendCustomerMapper;
34
+
35
+    /**
36
+     * 审核
37
+     *
38
+     * @param id
39
+     * @param channelCustomerDTO
40
+     * @return
41
+     */
42
+    @Override
43
+    public ResponseBean auditCustomer(Integer id, ChannelCustomerDTO channelCustomerDTO) {
44
+        ChannelCustomer customer = channelCustomerMapper.selectById(id);
45
+        if ("fail".equals(channelCustomerDTO.getAuditResult())){
46
+            // 审核不通过
47
+            customer.setStatus("3");
48
+            channelCustomerMapper.updateById(customer);
49
+            return ResponseBean.success("审核成功");
50
+        }
51
+
52
+        // 审核通过 先查看在ta_recommend_customer 手机号是否存在
53
+        LambdaQueryWrapper<TaRecommendCustomer> queryWrapper = new LambdaQueryWrapper<>();
54
+        queryWrapper.eq(TaRecommendCustomer::getPhone,customer.getPhone());
55
+        queryWrapper.eq(TaRecommendCustomer::getBuildingId,customer.getBuildingId());
56
+        TaRecommendCustomer taRecommendCustomer = taRecommendCustomerMapper.selectOne(queryWrapper);
57
+        if (null == taRecommendCustomer) {
58
+            // 审核通过
59
+            customer.setStatus("2");
60
+            channelCustomerMapper.updateById(customer);
61
+            return ResponseBean.success("审核成功");
62
+        }
63
+
64
+        if (StringUtils.isEmpty(taRecommendCustomer.getRealtyConsultant()) &&
65
+                (StringUtils.isEmpty(taRecommendCustomer.getRecommendPerson()) || taRecommendCustomer.getRecommendPerson().equals(customer.getRecommendPerson()))){
66
+            // 审核通过
67
+            customer.setStatus("2");
68
+            channelCustomerMapper.updateById(customer);
69
+            return ResponseBean.success("审核成功");
70
+        }
71
+
72
+        return ResponseBean.error("此客户是私客或已被报备", ResponseBean.ERROR_UNAVAILABLE);
73
+    }
20
 }
74
 }