fuxingfan 3 лет назад
Родитель
Сommit
071c05aa2e

+ 5
- 0
src/main/java/com/yunzhi/marketing/common/CommConstant.java Просмотреть файл

@@ -268,6 +268,11 @@ public class CommConstant {
268 268
      * 报备
269 269
      * */
270 270
     public static final String ENTRY_VERIFY = "verify";
271
+
272
+    /**
273
+     * 渠道报备
274
+     */
275
+    public static final String ENTRY_CHANNEL_VERIFY = "channel_verify";
271 276
     //=================  客户入口类型 end =======================
272 277
 
273 278
     /**

+ 2
- 4
src/main/java/com/yunzhi/marketing/controller/TaRecommendCustomerController.java Просмотреть файл

@@ -52,7 +52,7 @@ import java.util.List;
52 52
  */
53 53
 @RestController
54 54
 @RequestMapping("/api")
55
-@Api(value = "项目类型", tags = "项目类型")
55
+@Api(value = "xlk - 项目类型", tags = "xlk - 项目类型")
56 56
 public class TaRecommendCustomerController extends BaseController {
57 57
 
58 58
     @Autowired
@@ -82,8 +82,6 @@ public class TaRecommendCustomerController extends BaseController {
82 82
     @Autowired
83 83
     private ITaUserService iTaUserService;
84 84
 
85
-
86
-
87 85
     /**
88 86
      * 驻场的客户列表
89 87
      *
@@ -94,7 +92,7 @@ public class TaRecommendCustomerController extends BaseController {
94 92
      * @return
95 93
      */
96 94
     @GetMapping("/wx/marking/customers")
97
-    @ApiOperation(value = "查询驻场的客户列表", notes = "查询驻场的客户列表")
95
+    @ApiOperation(value = "wx-查询驻场的客户列表", notes = "wx-查询驻场的客户列表")
98 96
     @ApiImplicitParams({
99 97
             @ApiImplicitParam(dataTypeClass = Integer.class, name = "pageNumber", paramType = "query", value = "第几页"),
100 98
             @ApiImplicitParam(dataTypeClass = Integer.class, name = "pageSize", paramType = "query", value = "一页多少行"),

+ 10
- 0
src/main/java/com/yunzhi/marketing/mapper/TaRecommendCustomerMapper.java Просмотреть файл

@@ -7,6 +7,7 @@ import com.yunzhi.marketing.entity.TaPersonBuilding;
7 7
 import com.yunzhi.marketing.entity.TaRecommendCustomer;
8 8
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
9 9
 import com.yunzhi.marketing.excel.*;
10
+import com.yunzhi.marketing.po.TaRecommendCustomerPO;
10 11
 import org.apache.ibatis.annotations.Mapper;
11 12
 import org.apache.ibatis.annotations.Param;
12 13
 
@@ -302,4 +303,13 @@ public interface TaRecommendCustomerMapper extends BaseMapper<TaRecommendCustome
302 303
      * @return
303 304
      */
304 305
     Map<String, Number> checkCustomerBy(@Param("orgId") Integer orgId, @Param("personId") String personId, @Param("consultBuildingIds") List<String> consultBuildingIds, @Param("buildingId") String buildingId);
306
+
307
+    /**
308
+     * 驻场客户列表
309
+     * @param page
310
+     * @param keywords
311
+     * @param buildingId
312
+     * @return
313
+     */
314
+    IPage<TaRecommendCustomerPO> getMarkingCustList(IPage<TaRecommendCustomerPO> page,@Param("keywords") String keywords,@Param("buildingId") String buildingId);
305 315
 }

+ 19
- 0
src/main/java/com/yunzhi/marketing/po/TaRecommendCustomerPO.java Просмотреть файл

@@ -0,0 +1,19 @@
1
+package com.yunzhi.marketing.po;
2
+
3
+import lombok.Data;
4
+
5
+@Data
6
+public class TaRecommendCustomerPO {
7
+
8
+    private String id;
9
+
10
+    private String name;
11
+
12
+    private String phone;
13
+
14
+    private String picture;
15
+
16
+    private String sex;
17
+
18
+    private String type;
19
+}

+ 12
- 5
src/main/java/com/yunzhi/marketing/service/impl/TaRecommendCustomerServiceImpl.java Просмотреть файл

@@ -19,6 +19,7 @@ import com.yunzhi.marketing.dto.ChannelReportDTO;
19 19
 import com.yunzhi.marketing.excel.AgentsRecommendCustomer;
20 20
 import com.yunzhi.marketing.excel.ExcelRecommendCustomer;
21 21
 import com.yunzhi.marketing.excel.ReporRecommendCustomer;
22
+import com.yunzhi.marketing.po.TaRecommendCustomerPO;
22 23
 import com.yunzhi.marketing.service.IMiniAppService;
23 24
 import com.yunzhi.marketing.service.ITaRecommendCustomerService;
24 25
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -443,14 +444,20 @@ public class TaRecommendCustomerServiceImpl extends ServiceImpl<TaRecommendCusto
443 444
         if (null == taPersons || taPersons.size() != 1) {
444 445
             return ResponseBean.error("验证当前人员信息失败", ResponseBean.ERROR_UNAVAILABLE);
445 446
         }
446
-
447 447
         TaPerson taPerson = taPersons.get(0);
448 448
 
449
-        IPage<TaRecommendCustomer> page = new Page<>();
450
-        page.setCurrent(pageNumber);
451
-        page.setSize(pageSize);
449
+        // 验证当前人员是否是驻场顾问
450
+        LambdaQueryWrapper<TaPersonBuilding> lambdaQueryWrapper = new LambdaQueryWrapper<>();
451
+        lambdaQueryWrapper.eq(TaPersonBuilding::getPersonId,taPerson.getPersonId());
452
+        lambdaQueryWrapper.eq(TaPersonBuilding::getBuildingId,buildingId);
453
+        TaPersonBuilding taPersonBuilding = taPersonBuildingMapper.selectOne(lambdaQueryWrapper);
454
+        if (null == taPersonBuilding) {
455
+            return ResponseBean.error("你不是此楼盘的驻场顾问", ResponseBean.ERROR_ILLEGAL_PARAMS);
456
+        }
452 457
 
453
-        IPage<TaRecommendCustomer> result = taRecommendCustomerMapper.selectPage(page, null);
458
+        // 查询出此楼盘下的职业顾问
459
+        IPage<TaRecommendCustomerPO> page = new Page<>(pageNumber,pageSize);
460
+        IPage<TaRecommendCustomerPO> result = taRecommendCustomerMapper.getMarkingCustList(page, keywords,buildingId);
454 461
         return ResponseBean.success(result);
455 462
     }
456 463
 

+ 14
- 0
src/main/java/com/yunzhi/marketing/xlk/controller/ChannelCustomerController.java Просмотреть файл

@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
7 7
 import com.yunzhi.marketing.base.BaseController;
8 8
 import com.yunzhi.marketing.base.ResponseBean;
9 9
 import com.yunzhi.marketing.xlk.dto.ChannelCustomerDTO;
10
+import com.yunzhi.marketing.xlk.dto.MarkingChannelCustomerDTO;
10 11
 import com.yunzhi.marketing.xlk.entity.ChannelCustomer;
11 12
 import com.yunzhi.marketing.xlk.service.IChannelCustomerService;
12 13
 import io.swagger.annotations.Api;
@@ -76,6 +77,19 @@ public class ChannelCustomerController extends BaseController {
76 77
         return iChannelCustomerService.auditCustomer(id,channelCustomerDTO);
77 78
     }
78 79
 
80
+
81
+    /**
82
+     * 驻场 确认到访
83
+     *
84
+     * @param
85
+     * @return
86
+     */
87
+    @ApiOperation(value = "wx-驻场确认到访", notes = "wx-驻场确认到访")
88
+    @RequestMapping(value="/wx/marking/channelCustomer",method= RequestMethod.PUT)
89
+    public ResponseBean channelCustomerUpdate(@RequestBody MarkingChannelCustomerDTO params){
90
+        return iChannelCustomerService.markingChannelCustomer(params);
91
+    }
92
+
79 93
     /**
80 94
      * 根据id查询对象
81 95
      * @param id  实体ID

+ 30
- 0
src/main/java/com/yunzhi/marketing/xlk/dto/MarkingChannelCustomerDTO.java Просмотреть файл

@@ -0,0 +1,30 @@
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
+
10
+/**
11
+ * <p>
12
+ * 渠道报备客户表 
13
+ * </p>
14
+ *
15
+ * @author jobob
16
+ * @since 2021-07-19
17
+ */
18
+@Data
19
+@EqualsAndHashCode(callSuper = false)
20
+@Accessors(chain = true)
21
+@TableName("xlk_channel_customer")
22
+public class MarkingChannelCustomerDTO implements Serializable {
23
+
24
+    private String id;
25
+    /**
26
+     * customer / channel  一个代表业务客户 一个代表渠道推荐客户
27
+     */
28
+   private String type;
29
+
30
+}

+ 9
- 0
src/main/java/com/yunzhi/marketing/xlk/service/IChannelCustomerService.java Просмотреть файл

@@ -3,6 +3,7 @@ package com.yunzhi.marketing.xlk.service;
3 3
 import com.baomidou.mybatisplus.extension.service.IService;
4 4
 import com.yunzhi.marketing.base.ResponseBean;
5 5
 import com.yunzhi.marketing.xlk.dto.ChannelCustomerDTO;
6
+import com.yunzhi.marketing.xlk.dto.MarkingChannelCustomerDTO;
6 7
 import com.yunzhi.marketing.xlk.entity.ChannelCustomer;
7 8
 
8 9
 /**
@@ -22,4 +23,12 @@ public interface IChannelCustomerService extends IService<ChannelCustomer> {
22 23
      * @return
23 24
      */
24 25
     ResponseBean auditCustomer(Integer id, ChannelCustomerDTO channelCustomerDTO);
26
+
27
+    /**
28
+     * 驻场确认到访
29
+     * @param id
30
+     * @param params
31
+     * @return
32
+     */
33
+    ResponseBean markingChannelCustomer(MarkingChannelCustomerDTO params);
25 34
 }

+ 90
- 5
src/main/java/com/yunzhi/marketing/xlk/service/impl/ChannelCustomerServiceImpl.java Просмотреть файл

@@ -3,17 +3,19 @@ package com.yunzhi.marketing.xlk.service.impl;
3 3
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
4 4
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
5 5
 import com.yunzhi.marketing.base.ResponseBean;
6
+import com.yunzhi.marketing.common.CommConstant;
6 7
 import com.yunzhi.marketing.common.StringUtils;
7 8
 import com.yunzhi.marketing.entity.TaRecommendCustomer;
8 9
 import com.yunzhi.marketing.mapper.TaRecommendCustomerMapper;
9 10
 import com.yunzhi.marketing.xlk.dto.ChannelCustomerDTO;
11
+import com.yunzhi.marketing.xlk.dto.MarkingChannelCustomerDTO;
10 12
 import com.yunzhi.marketing.xlk.entity.ChannelCustomer;
11 13
 import com.yunzhi.marketing.xlk.mapper.ChannelCustomerMapper;
12 14
 import com.yunzhi.marketing.xlk.service.IChannelCustomerService;
13 15
 import org.springframework.beans.factory.annotation.Autowired;
14 16
 import org.springframework.stereotype.Service;
15 17
 
16
-import java.util.List;
18
+import java.time.LocalDateTime;
17 19
 
18 20
 /**
19 21
  * <p>
@@ -53,16 +55,33 @@ public class ChannelCustomerServiceImpl extends ServiceImpl<ChannelCustomerMappe
53 55
         LambdaQueryWrapper<TaRecommendCustomer> queryWrapper = new LambdaQueryWrapper<>();
54 56
         queryWrapper.eq(TaRecommendCustomer::getPhone,customer.getPhone());
55 57
         queryWrapper.eq(TaRecommendCustomer::getBuildingId,customer.getBuildingId());
56
-        TaRecommendCustomer taRecommendCustomer = taRecommendCustomerMapper.selectOne(queryWrapper);
57
-        if (null == taRecommendCustomer) {
58
+        TaRecommendCustomer recommendCustomer = taRecommendCustomerMapper.selectOne(queryWrapper);
59
+        if (null == recommendCustomer) {
58 60
             // 审核通过
59 61
             customer.setStatus("2");
60 62
             channelCustomerMapper.updateById(customer);
63
+            // 进业务客户表
64
+            TaRecommendCustomer taRecommendCustomer = new TaRecommendCustomer();
65
+            taRecommendCustomer.setName(customer.getName());
66
+            taRecommendCustomer.setPicture(customer.getPicture());
67
+            taRecommendCustomer.setPhone(customer.getPhone());
68
+            taRecommendCustomer.setSex(customer.getSex());
69
+            taRecommendCustomer.setRecommendPerson(customer.getRecommendPerson());
70
+            taRecommendCustomer.setBuildingId(customer.getBuildingId());
71
+            taRecommendCustomer.setReportRecommendStatus(CommConstant.RECOMMENDED);
72
+            taRecommendCustomer.setVerifyStatus(CommConstant.VERIFY_AGREE);
73
+            taRecommendCustomer.setCreateDate(LocalDateTime.now());
74
+            taRecommendCustomer.setReportDate(LocalDateTime.now());
75
+            taRecommendCustomer.setOrgId(customer.getOrgId());
76
+            taRecommendCustomer.setPersonId(customer.getPersonId());
77
+            taRecommendCustomer.setEntryType(CommConstant.ENTRY_CHANNEL_VERIFY);
78
+            taRecommendCustomer.setStatus(CommConstant.CUSTOMER_REPORT);
79
+            taRecommendCustomerMapper.insert(taRecommendCustomer);
61 80
             return ResponseBean.success("审核成功");
62 81
         }
63 82
 
64
-        if (StringUtils.isEmpty(taRecommendCustomer.getRealtyConsultant()) &&
65
-                (StringUtils.isEmpty(taRecommendCustomer.getRecommendPerson()) || taRecommendCustomer.getRecommendPerson().equals(customer.getRecommendPerson()))){
83
+        if (StringUtils.isEmpty(recommendCustomer.getRealtyConsultant()) &&
84
+                (StringUtils.isEmpty(recommendCustomer.getRecommendPerson()) || recommendCustomer.getRecommendPerson().equals(customer.getRecommendPerson()))){
66 85
             // 审核通过
67 86
             customer.setStatus("2");
68 87
             channelCustomerMapper.updateById(customer);
@@ -71,4 +90,70 @@ public class ChannelCustomerServiceImpl extends ServiceImpl<ChannelCustomerMappe
71 90
 
72 91
         return ResponseBean.error("此客户是私客或已被报备", ResponseBean.ERROR_UNAVAILABLE);
73 92
     }
93
+
94
+    /**
95
+     * 驻场确认到访
96
+     *
97
+     * @param id
98
+     * @param params
99
+     * @return
100
+     */
101
+    @Override
102
+    public ResponseBean markingChannelCustomer(MarkingChannelCustomerDTO params) {
103
+        // 渠道推荐的客户
104
+        if ("channel".equals(params.getType())) {
105
+            ChannelCustomer customer = channelCustomerMapper.selectById(params.getId());
106
+            // 审核通过 先查看在ta_recommend_customer 手机号是否存在
107
+            LambdaQueryWrapper<TaRecommendCustomer> queryWrapper = new LambdaQueryWrapper<>();
108
+            queryWrapper.eq(TaRecommendCustomer::getPhone,customer.getPhone());
109
+            queryWrapper.eq(TaRecommendCustomer::getBuildingId,customer.getBuildingId());
110
+            TaRecommendCustomer recommendCustomer = taRecommendCustomerMapper.selectOne(queryWrapper);
111
+            if (null == recommendCustomer) {
112
+                // 审核通过
113
+                customer.setStatus("2");
114
+                channelCustomerMapper.updateById(customer);
115
+                // 进业务客户表
116
+                TaRecommendCustomer taRecommendCustomer = new TaRecommendCustomer();
117
+                taRecommendCustomer.setName(customer.getName());
118
+                taRecommendCustomer.setPicture(customer.getPicture());
119
+                taRecommendCustomer.setPhone(customer.getPhone());
120
+                taRecommendCustomer.setSex(customer.getSex());
121
+                taRecommendCustomer.setRecommendPerson(customer.getRecommendPerson());
122
+                taRecommendCustomer.setBuildingId(customer.getBuildingId());
123
+                taRecommendCustomer.setReportRecommendStatus(CommConstant.RECOMMENDED);
124
+                taRecommendCustomer.setVerifyStatus(CommConstant.VERIFY_AGREE);
125
+                taRecommendCustomer.setCreateDate(LocalDateTime.now());
126
+                taRecommendCustomer.setReportDate(LocalDateTime.now());
127
+                taRecommendCustomer.setOrgId(customer.getOrgId());
128
+                taRecommendCustomer.setPersonId(customer.getPersonId());
129
+                taRecommendCustomer.setEntryType(CommConstant.ENTRY_CHANNEL_VERIFY);
130
+                taRecommendCustomer.setStatus(CommConstant.CUSTOMER_VISITE);
131
+                taRecommendCustomerMapper.insert(taRecommendCustomer);
132
+                return ResponseBean.success("审核成功");
133
+            }
134
+
135
+            if (StringUtils.isEmpty(recommendCustomer.getRealtyConsultant()) &&
136
+                    (StringUtils.isEmpty(recommendCustomer.getRecommendPerson()) || recommendCustomer.getRecommendPerson().equals(customer.getRecommendPerson()))){
137
+                // 审核通过
138
+                customer.setStatus("2");
139
+                channelCustomerMapper.updateById(customer);
140
+
141
+                // 修改状态为确认到访状态
142
+                recommendCustomer.setRecommendPerson(customer.getRecommendPerson());
143
+                recommendCustomer.setVerifyStatus(CommConstant.VERIFY_AGREE);
144
+                recommendCustomer.setStatus(CommConstant.CUSTOMER_VISITE);
145
+                taRecommendCustomerMapper.updateById(recommendCustomer);
146
+                return ResponseBean.success("审核成功");
147
+            }
148
+        }else if ("customer".equals(params.getType())) {
149
+            // 置业顾问 经纪人推荐的客户
150
+            TaRecommendCustomer taRecommendCustomer = taRecommendCustomerMapper.selectById(params.getId());
151
+            taRecommendCustomer.setVerifyStatus(CommConstant.VERIFY_AGREE);
152
+            taRecommendCustomer.setStatus(CommConstant.CUSTOMER_VISITE);
153
+            taRecommendCustomerMapper.updateById(taRecommendCustomer);
154
+            return ResponseBean.success("审核成功");
155
+        }
156
+
157
+        return ResponseBean.error("此客户是私客或已被报备", ResponseBean.ERROR_UNAVAILABLE);
158
+    }
74 159
 }

+ 31
- 0
src/main/resources/mapper/TaRecommendCustomerMapper.xml Просмотреть файл

@@ -942,4 +942,35 @@ FROM
942 942
             AND t.person_id = #{personId}
943 943
             AND t.status > -1
944 944
     </select>
945
+    <select id="getMarkingCustList" resultType="com.yunzhi.marketing.po.TaRecommendCustomerPO">
946
+        SELECT
947
+            customer_id AS id,
948
+            name,
949
+            phone,
950
+            picture,
951
+            sex,
952
+            "customer" AS type
953
+        FROM
954
+            ta_recommend_customer
955
+        WHERE
956
+            building_id = #{buildingId}
957
+        <if test="keywords != null and keywords !=''">
958
+            and name like CONCAT('%',#{keywords}, '%')
959
+        </if>
960
+    UNION ALL
961
+        SELECT
962
+            channel_customer_id AS id,
963
+            NAME,
964
+            phone,
965
+            picture,
966
+            sex,
967
+            "channel" AS type
968
+        FROM
969
+            xlk_channel_customer
970
+        WHERE
971
+            building_id = #{buildingId}
972
+        <if test="keywords != null and keywords !=''">
973
+            and name like CONCAT('%',#{keywords}, '%')
974
+        </if>
975
+    </select>
945 976
 </mapper>