Your Name 3 yıl önce
ebeveyn
işleme
fe1c281060

+ 7
- 0
src/main/java/com/yunzhi/marketing/controller/MiniAppController.java Dosyayı Görüntüle

@@ -111,6 +111,9 @@ public class MiniAppController extends BaseController {
111 111
     @Autowired
112 112
     private TaSalesBatchMapper taSalesBatchMapper;
113 113
 
114
+    @Autowired
115
+    public TaChannelService taChannelService;
116
+
114 117
     /**
115 118
      * 验证接入
116 119
      */
@@ -248,6 +251,10 @@ public class MiniAppController extends BaseController {
248 251
             taPerson.setMiniappId(appid);
249 252
             taPersonService.updateById(taPerson);
250 253
 
254
+            if (CommConstant.PERSON_ESTATE_CHANNEL.equals(taPerson.getPersonType())) {
255
+                taPerson.setChannelList(taChannelService.getListByPerson(taPerson));
256
+            }
257
+
251 258
             // 增加积分线程 --- 3.5.23版本授权手机分享者增加积分,单纯分享不增加积分
252 259
 //            ExecutorService threadPool = Executors.newCachedThreadPool();
253 260
 //            threadPool.execute(() -> {

+ 1
- 1
src/main/java/com/yunzhi/marketing/controller/TaPersonController.java Dosyayı Görüntüle

@@ -220,7 +220,7 @@ public class TaPersonController extends BaseController {
220 220
         if(StringUtils.isEmpty(channelCode)){
221 221
             person.setPersonType(CommConstant.PERSON_ESTATE_AGENT);
222 222
         }else {
223
-            person.setPersonType(CommConstant.PERSON_ESTATE_AGENT);
223
+            person.setPersonType(CommConstant.PERSON_ESTATE_CHANNEL);
224 224
             QueryWrapper<TaChannel> queryWrapper = new QueryWrapper();
225 225
             queryWrapper.eq("channel_code",channelCode);
226 226
             queryWrapper.eq("org_id",orgId);

+ 5
- 9
src/main/java/com/yunzhi/marketing/controller/TaRecommendCustomerController.java Dosyayı Görüntüle

@@ -228,11 +228,11 @@ public class TaRecommendCustomerController extends BaseController {
228 228
      * @return
229 229
      */
230 230
     @PostMapping("/wx/channel/report")
231
-    @ApiOperation(value = "森哥看这里-wx-渠道顾问报备客户", notes = "森哥看这里-wx-渠道顾问报备客户")
231
+    @ApiOperation(value = "wx-渠道顾问报备客户", notes = "森哥看这里-wx-渠道顾问报备客户")
232 232
     public ResponseBean channelReportCust(@RequestBody ChannelReportDTO channelReportDTO, HttpServletRequest request) throws Exception {
233
-        String openid = getOpenId(request);
233
+        String personId = getPersonId(request);
234 234
         Integer orgId = getOrgId(request);
235
-        channelReportDTO.setOpenid(openid);
235
+        channelReportDTO.setPersonId(personId);
236 236
         channelReportDTO.setOrgId(orgId);
237 237
         return taRecommendCustomerService.channelReportCust(channelReportDTO);
238 238
     }
@@ -567,12 +567,8 @@ public class TaRecommendCustomerController extends BaseController {
567 567
     @GetMapping("/wx/customer/recommend/mine")
568 568
     public ResponseBean getWxCustomersIRecommended(@RequestParam int pageNumber, @RequestParam int pageSize, HttpServletRequest request) {
569 569
         Integer orgId = getOrgId(request);
570
-        String openid = getOpenId(request);
571
-        List<TaPerson> taPersons = taPersonService.getPersonsByOpenId(openid);
572
-        if (null == taPersons || taPersons.size() != 1) {
573
-            return ResponseBean.error("验证人员信息失败", ResponseBean.ERROR_UNAVAILABLE);
574
-        }
575
-        TaPerson person = taPersons.get(0);
570
+        String personId = getPersonId(request);
571
+        TaPerson person = taPersonService.getById(personId);
576 572
         try {
577 573
             return ResponseBean.success(taRecommendCustomerService.getCustomersIRecommended(pageNumber, pageSize, person.getPersonId(), orgId, null));
578 574
         } catch (Exception e) {

+ 1
- 1
src/main/java/com/yunzhi/marketing/dto/ChannelReportDTO.java Dosyayı Görüntüle

@@ -5,7 +5,7 @@ import lombok.Data;
5 5
 @Data
6 6
 public class ChannelReportDTO {
7 7
 
8
-    private String openid;
8
+    private String personId;
9 9
 
10 10
     private Integer orgId;
11 11
 

+ 6
- 0
src/main/java/com/yunzhi/marketing/entity/TaPerson.java Dosyayı Görüntüle

@@ -347,4 +347,10 @@ public class TaPerson implements Serializable {
347 347
      */
348 348
     @TableField(exist = false)
349 349
     private String id;
350
+
351
+    /**
352
+     * 经济所属渠道列表
353
+     */
354
+    @TableField(exist = false)
355
+    private List<TaChannel> channelList;
350 356
 }

+ 3
- 0
src/main/java/com/yunzhi/marketing/mapper/TaChannelMapper.java Dosyayı Görüntüle

@@ -3,6 +3,7 @@ package com.yunzhi.marketing.mapper;
3 3
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4 4
 import com.baomidou.mybatisplus.core.metadata.IPage;
5 5
 import com.yunzhi.marketing.entity.TaChannel;
6
+import com.yunzhi.marketing.entity.TaPerson;
6 7
 import com.yunzhi.marketing.entity.TaPersonBuilding;
7 8
 import com.yunzhi.marketing.entity.TsActivityDaily;
8 9
 import com.yunzhi.marketing.excel.ActivityStatistics.ChannelAddRegistNum;
@@ -72,4 +73,6 @@ public interface TaChannelMapper extends BaseMapper<TaChannel> {
72 73
     List<ChannelVisitNum> getChannelVisitNumListExport(@Param("orgId") Integer orgId,@Param("channelId") Integer channelId,@Param("targetId") String targetId,@Param("targetType") String targetType,@Param("buildingId") String buildingId,@Param("startDate") LocalDate startDate,@Param("endDate") LocalDate endDate);
73 74
 
74 75
     List<ChannelVisitPersonNum> getChannelPersonNumListExport(@Param("orgId") Integer orgId,@Param("channelId") Integer channelId,@Param("targetId") String targetId,@Param("targetType") String targetType,@Param("buildingId") String buildingId,@Param("startDate") LocalDate startDate,@Param("endDate") LocalDate endDate);
76
+
77
+    List<TaChannel> getListByPerson(@Param("params") TaPerson taPerson);
75 78
 }

+ 3
- 0
src/main/java/com/yunzhi/marketing/service/TaChannelService.java Dosyayı Görüntüle

@@ -3,6 +3,7 @@ package com.yunzhi.marketing.service;
3 3
 import com.baomidou.mybatisplus.extension.service.IService;
4 4
 import com.yunzhi.marketing.base.ResponseBean;
5 5
 import com.yunzhi.marketing.entity.TaChannel;
6
+import com.yunzhi.marketing.entity.TaPerson;
6 7
 import com.yunzhi.marketing.entity.TaPersonBuilding;
7 8
 import com.yunzhi.marketing.excel.ActivityStatistics.ChannelAddRegistNum;
8 9
 import com.yunzhi.marketing.excel.ActivityStatistics.ChannelVisitNum;
@@ -118,4 +119,6 @@ public interface TaChannelService extends IService<TaChannel> {
118 119
      * @return
119 120
      */
120 121
     List<ChannelVisitPersonNum> getPersonNumListExport(Integer orgId, Integer channelId, String targetId, String targetType, String buildingId, LocalDate startDate, LocalDate endDate);
122
+
123
+    List<TaChannel> getListByPerson(TaPerson taPerson);
121 124
 }

+ 6
- 0
src/main/java/com/yunzhi/marketing/service/impl/TaChannelServiceImpl.java Dosyayı Görüntüle

@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
6 6
 import com.yunzhi.marketing.base.ResponseBean;
7 7
 import com.yunzhi.marketing.common.StringUtils;
8 8
 import com.yunzhi.marketing.entity.TaChannel;
9
+import com.yunzhi.marketing.entity.TaPerson;
9 10
 import com.yunzhi.marketing.entity.TaPersonBuilding;
10 11
 import com.yunzhi.marketing.entity.TsActivityDaily;
11 12
 import com.yunzhi.marketing.excel.ActivityStatistics.ChannelAddRegistNum;
@@ -219,4 +220,9 @@ public class TaChannelServiceImpl extends ServiceImpl<TaChannelMapper, TaChannel
219 220
     public List<ChannelVisitPersonNum> getPersonNumListExport(Integer orgId, Integer channelId, String targetId, String targetType, String buildingId, LocalDate startDate, LocalDate endDate) {
220 221
         return taChannelMapper.getChannelPersonNumListExport(orgId, channelId, targetId, targetType, buildingId,startDate,endDate);
221 222
     }
223
+
224
+    @Override
225
+    public List<TaChannel> getListByPerson(TaPerson taPerson) {
226
+        return taChannelMapper.getListByPerson(taPerson);
227
+    }
222 228
 }

+ 2
- 6
src/main/java/com/yunzhi/marketing/service/impl/TaRecommendCustomerServiceImpl.java Dosyayı Görüntüle

@@ -363,11 +363,7 @@ public class TaRecommendCustomerServiceImpl extends ServiceImpl<TaRecommendCusto
363 363
     public ResponseBean channelReportCust(ChannelReportDTO channelReportDTO) throws Exception {
364 364
 
365 365
         // 当前人员
366
-        List<TaPerson> persons = getPersonsByOpenId(channelReportDTO.getOpenid());
367
-        if (null == persons || persons.size() != 1) {
368
-            throw new Exception("当前人员 openid 异常");
369
-        }
370
-        TaPerson person = persons.get(0);
366
+        TaPerson person = taPersonMapper.getById(channelReportDTO.getPersonId());
371 367
 
372 368
         // 先查看在ta_recommend_customer 手机号是否存在
373 369
         LambdaQueryWrapper<TaRecommendCustomer> queryWrapper = new LambdaQueryWrapper<>();
@@ -420,7 +416,7 @@ public class TaRecommendCustomerServiceImpl extends ServiceImpl<TaRecommendCusto
420 416
         channelCustomer.setPicture(channelReportDTO.getPicture());
421 417
         channelCustomer.setPhone(channelReportDTO.getPhone());
422 418
         channelCustomer.setSex(channelReportDTO.getSex());
423
-        channelCustomer.setRecommendPerson(channelReportDTO.getRealtyChannel());
419
+        channelCustomer.setRecommendPerson(channelReportDTO.getPersonId());
424 420
         channelCustomer.setCreateDate(LocalDateTime.now());
425 421
         channelCustomer.setStatus("1");
426 422
         channelCustomer.setChannelId(taChannelPeople.getChannelId());

+ 19
- 5
src/main/java/com/yunzhi/marketing/xlk/controller/ChannelCustomerController.java Dosyayı Görüntüle

@@ -17,6 +17,8 @@ import org.slf4j.LoggerFactory;
17 17
 import org.springframework.beans.factory.annotation.Autowired;
18 18
 import org.springframework.web.bind.annotation.*;
19 19
 
20
+import javax.servlet.http.HttpServletRequest;
21
+
20 22
 /**
21 23
  * <p>
22 24
     * 渠道报备客户表  前端控制器
@@ -45,16 +47,28 @@ public class ChannelCustomerController extends BaseController {
45 47
     @ApiOperation(value = "admin-渠道报备客户表", notes = "admin-渠道报备客户表")
46 48
     @RequestMapping(value="/admin/channelCustomer",method= RequestMethod.GET)
47 49
     public ResponseBean channelCustomerList(@RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
48
-                                            @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize){
50
+                                            @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
51
+                                            @RequestParam(value ="buildingId", required = false) String buildingId,
52
+                                            @RequestParam(value ="name", required = false) String name,
53
+                                            @RequestParam(value ="phone", required = false) String phone,
54
+                                            @RequestParam(value ="recommendPersonName", required = false) String recommendPersonName,
55
+                                            @RequestParam(value ="recommendPhone", required = false) String recommendPhone,
56
+                                            @RequestParam(value ="status", required = false) String status,
57
+                                            HttpServletRequest request){
58
+        Integer orgId = getOrgId(request);
49 59
         ResponseBean responseBean = new ResponseBean();
50 60
         try {
51 61
             //使用分页插件
52 62
 		    IPage<ChannelCustomer> pg = new Page<>(pageNum, pageSize);
53
-            LambdaQueryWrapper<ChannelCustomer> queryWrapper = new LambdaQueryWrapper<>();
54
-            queryWrapper.eq(ChannelCustomer::getStatus,"1");
55
-            queryWrapper.orderByDesc(ChannelCustomer::getCreateDate);
56 63
 
57
-            IPage<ChannelCustomer> result = iChannelCustomerService.page(pg, queryWrapper);
64
+            IPage<ChannelCustomer> result = iChannelCustomerService.getProfileList(pg,
65
+                    orgId,
66
+                    buildingId,
67
+                    name,
68
+                    phone,
69
+                    recommendPersonName,
70
+                    recommendPhone,
71
+                    status);
58 72
             responseBean.addSuccess(result);
59 73
         }catch (Exception e){
60 74
             e.printStackTrace();

+ 21
- 0
src/main/java/com/yunzhi/marketing/xlk/entity/ChannelCustomer.java Dosyayı Görüntüle

@@ -1,5 +1,8 @@
1 1
 package com.yunzhi.marketing.xlk.entity;
2 2
 
3
+import com.baomidou.mybatisplus.annotation.IdType;
4
+import com.baomidou.mybatisplus.annotation.TableField;
5
+import com.baomidou.mybatisplus.annotation.TableId;
3 6
 import com.baomidou.mybatisplus.annotation.TableName;
4 7
 import io.swagger.models.auth.In;
5 8
 import lombok.Data;
@@ -28,6 +31,7 @@ public class ChannelCustomer implements Serializable {
28 31
     /**
29 32
      * 主键
30 33
      */
34
+    @TableId(value = "channel_customer_id", type = IdType.UUID)
31 35
     private String channelCustomerId;
32 36
 
33 37
     /**
@@ -45,6 +49,13 @@ public class ChannelCustomer implements Serializable {
45 49
      */
46 50
     private String buildingId;
47 51
 
52
+
53
+    /**
54
+     * 楼盘名称
55
+     */
56
+    @TableField(exist = false)
57
+    private String buildingName;
58
+
48 59
     /**
49 60
      * 电话
50 61
      */
@@ -85,5 +96,15 @@ public class ChannelCustomer implements Serializable {
85 96
      */
86 97
     private Integer channelId;
87 98
 
99
+    /**
100
+     * 推荐人姓名
101
+     */
102
+    @TableField(exist = false)
103
+    private String recommendPersonName;
88 104
 
105
+    /**
106
+     * 推荐人手机
107
+     */
108
+    @TableField(exist = false)
109
+    private String recommendPhone;
89 110
 }

+ 11
- 0
src/main/java/com/yunzhi/marketing/xlk/mapper/ChannelCustomerMapper.java Dosyayı Görüntüle

@@ -1,8 +1,10 @@
1 1
 package com.yunzhi.marketing.xlk.mapper;
2 2
 
3 3
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4
+import com.baomidou.mybatisplus.core.metadata.IPage;
4 5
 import com.yunzhi.marketing.xlk.entity.ChannelCustomer;
5 6
 import org.apache.ibatis.annotations.Mapper;
7
+import org.apache.ibatis.annotations.Param;
6 8
 
7 9
 /**
8 10
  * <p>
@@ -15,4 +17,13 @@ import org.apache.ibatis.annotations.Mapper;
15 17
 @Mapper
16 18
 public interface ChannelCustomerMapper extends BaseMapper<ChannelCustomer> {
17 19
 
20
+    IPage<ChannelCustomer> getProfileList(IPage<ChannelCustomer> pg,
21
+                                          @Param("orgId") Integer orgId,
22
+                                          @Param("buildingId") String buildingId,
23
+                                          @Param("name") String name,
24
+                                          @Param("phone") String phone,
25
+                                          @Param("recommendPersonName") String recommendPersonName,
26
+                                          @Param("recommendPhone") String recommendPhone,
27
+                                          @Param("status") String status);
28
+
18 29
 }

+ 10
- 0
src/main/java/com/yunzhi/marketing/xlk/service/IChannelCustomerService.java Dosyayı Görüntüle

@@ -1,5 +1,6 @@
1 1
 package com.yunzhi.marketing.xlk.service;
2 2
 
3
+import com.baomidou.mybatisplus.core.metadata.IPage;
3 4
 import com.baomidou.mybatisplus.extension.service.IService;
4 5
 import com.yunzhi.marketing.base.ResponseBean;
5 6
 import com.yunzhi.marketing.xlk.dto.ChannelCustomerDTO;
@@ -38,4 +39,13 @@ public interface IChannelCustomerService extends IService<ChannelCustomer> {
38 39
      * @return
39 40
      */
40 41
     ResponseBean invalidCustomerUpdate(MarkingChannelCustomerDTO params);
42
+
43
+    IPage<ChannelCustomer> getProfileList(IPage<ChannelCustomer> pg,
44
+                                          Integer orgId,
45
+                                          String buildingId,
46
+                                          String name,
47
+                                          String phone,
48
+                                          String recommendPersonName,
49
+                                          String recommendPhone,
50
+                                          String status);
41 51
 }

+ 13
- 0
src/main/java/com/yunzhi/marketing/xlk/service/impl/ChannelCustomerServiceImpl.java Dosyayı Görüntüle

@@ -1,6 +1,7 @@
1 1
 package com.yunzhi.marketing.xlk.service.impl;
2 2
 
3 3
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
4
+import com.baomidou.mybatisplus.core.metadata.IPage;
4 5
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
5 6
 import com.yunzhi.marketing.base.ResponseBean;
6 7
 import com.yunzhi.marketing.common.CommConstant;
@@ -192,4 +193,16 @@ public class ChannelCustomerServiceImpl extends ServiceImpl<ChannelCustomerMappe
192 193
         }
193 194
         return ResponseBean.error("无效操作", ResponseBean.ERROR_UNAVAILABLE);
194 195
     }
196
+
197
+    @Override
198
+    public IPage<ChannelCustomer> getProfileList(IPage<ChannelCustomer> pg,
199
+                                                 Integer orgId,
200
+                                                 String buildingId,
201
+                                                 String name,
202
+                                                 String phone,
203
+                                                 String recommendPersonName,
204
+                                                 String recommendPhone,
205
+                                                 String status) {
206
+        return channelCustomerMapper.getProfileList(pg, orgId, buildingId, name, phone, recommendPersonName, recommendPhone, status);
207
+    }
195 208
 }

+ 10
- 0
src/main/resources/mapper/TaChannelMapper.xml Dosyayı Görüntüle

@@ -461,5 +461,15 @@
461 461
         group by t.person_id
462 462
         order by t.create_date desc
463 463
     </select>
464
+    <select id="getListByPerson" resultType="com.yunzhi.marketing.entity.TaChannel">
465
+        SELECT
466
+            t.*
467
+        FROM
468
+            ta_channel t
469
+                INNER JOIN ta_channel_person s ON t.channel_id = s.channel_id
470
+        WHERE
471
+            t.org_id = #{params.orgId}
472
+          AND s.person_id = #{params.personId}
473
+    </select>
464 474
 
465 475
 </mapper>

+ 36
- 0
src/main/resources/mapper/xlk/ChannelCustomerMapper.xml Dosyayı Görüntüle

@@ -2,4 +2,40 @@
2 2
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3 3
 <mapper namespace="com.yunzhi.marketing.xlk.mapper.ChannelCustomerMapper">
4 4
 
5
+    <select id="getProfileList" resultType="com.yunzhi.marketing.xlk.entity.ChannelCustomer">
6
+        SELECT
7
+            t.*,
8
+            s.building_name,
9
+            m.nickname AS recommend_person_name,
10
+            m.phone AS recommend_person_phone
11
+        FROM
12
+            xlk_channel_customer t
13
+                LEFT JOIN ta_building s ON t.building_id = s.building_id
14
+                INNER JOIN ta_person m ON t.recommend_person = m.person_id
15
+        WHERE
16
+            t.org_id = #{orgId}
17
+          <if test="buildingId != null and buildingId != ''">
18
+              AND t.building_id = #{buildingId}
19
+          </if>
20
+          <if test="name != null and name != ''">
21
+              AND t.`name` LIKE CONCAT( '%', #{name}, '%' )
22
+          </if>
23
+          <if test="phone != null and phone != ''">
24
+            AND t.phone LIKE CONCAT( '%', #{phone}, '%' )
25
+          </if>
26
+          <if test="recommendPersonName != null and recommendPersonName != ''">
27
+            AND m.nickname LIKE CONCAT( '%', #{recommendPersonName}, '%' )
28
+          </if>
29
+          <if test="recommendPhone != null and recommendPhone != ''">
30
+            AND m.phone LIKE CONCAT( '%', #{recommendPhone}, '%' )
31
+          </if>
32
+          <if test="status != null and status != ''">
33
+            AND t.`status` = #{status}
34
+          </if>
35
+          <if test="status == null or status == ''">
36
+            AND t.`status` &gt; -1
37
+          </if>
38
+            ORDER BY
39
+                t.create_date DESC
40
+    </select>
5 41
 </mapper>