傅行帆 3 gadus atpakaļ
vecāks
revīzija
848a3c8b9a

+ 1
- 1
src/main/java/com/yunzhi/marketing/excel/redPacket/RedPacketVisitRecordtExport.java Parādīt failu

5
 import lombok.Data;
5
 import lombok.Data;
6
 
6
 
7
 /**
7
 /**
8
- * 红包访问记录导出实体
8
+ * 红包导出实体
9
  *
9
  *
10
  * @author gusy
10
  * @author gusy
11
  * @date 2020/6/7 15:46
11
  * @date 2020/6/7 15:46

+ 2
- 0
src/main/java/com/yunzhi/marketing/mapper/TaPersonVisitRecordMapper.java Parādīt failu

88
     List<TaPersonVisitRecord> selectTapersonFromShare();
88
     List<TaPersonVisitRecord> selectTapersonFromShare();
89
 
89
 
90
     Integer selectTodayVisitCount(@Param("orgId") Integer orgId,@Param("nowDate") LocalDateTime now);
90
     Integer selectTodayVisitCount(@Param("orgId") Integer orgId,@Param("nowDate") LocalDateTime now);
91
+
92
+    List<TaPersonVisitRecord> visitRecordByPersonIdNew(@Param("personId") String personId);
91
 }
93
 }

+ 59
- 0
src/main/java/com/yunzhi/marketing/xlk/controller/CustomerInfoController.java Parādīt failu

7
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
7
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
8
 import com.yunzhi.marketing.base.BaseController;
8
 import com.yunzhi.marketing.base.BaseController;
9
 import com.yunzhi.marketing.base.ResponseBean;
9
 import com.yunzhi.marketing.base.ResponseBean;
10
+import com.yunzhi.marketing.common.StringUtils;
11
+import com.yunzhi.marketing.entity.TaChannel;
12
+import com.yunzhi.marketing.entity.TaChannelPerson;
10
 import com.yunzhi.marketing.entity.TaPerson;
13
 import com.yunzhi.marketing.entity.TaPerson;
11
 import com.yunzhi.marketing.entity.TaRecommendCustomer;
14
 import com.yunzhi.marketing.entity.TaRecommendCustomer;
12
 import com.yunzhi.marketing.service.ITaPersonService;
15
 import com.yunzhi.marketing.service.ITaPersonService;
13
 import com.yunzhi.marketing.service.ITaRecommendCustomerService;
16
 import com.yunzhi.marketing.service.ITaRecommendCustomerService;
17
+import com.yunzhi.marketing.service.TaChannelPersonService;
18
+import com.yunzhi.marketing.service.TaChannelService;
14
 import com.yunzhi.marketing.xlk.entity.CustomerInfo;
19
 import com.yunzhi.marketing.xlk.entity.CustomerInfo;
15
 import com.yunzhi.marketing.xlk.entity.CustomerInfoModifyRecord;
20
 import com.yunzhi.marketing.xlk.entity.CustomerInfoModifyRecord;
16
 import com.yunzhi.marketing.xlk.service.ICustomerInfoModifyRecordService;
21
 import com.yunzhi.marketing.xlk.service.ICustomerInfoModifyRecordService;
17
 import com.yunzhi.marketing.xlk.service.ICustomerInfoService;
22
 import com.yunzhi.marketing.xlk.service.ICustomerInfoService;
23
+import com.yunzhi.marketing.xlk.vo.CustomerInfoVO;
18
 import io.swagger.annotations.Api;
24
 import io.swagger.annotations.Api;
19
 import io.swagger.annotations.ApiOperation;
25
 import io.swagger.annotations.ApiOperation;
26
+import lombok.Data;
20
 import org.slf4j.Logger;
27
 import org.slf4j.Logger;
21
 import org.slf4j.LoggerFactory;
28
 import org.slf4j.LoggerFactory;
22
 import org.springframework.beans.factory.annotation.Autowired;
29
 import org.springframework.beans.factory.annotation.Autowired;
53
     @Autowired
60
     @Autowired
54
     public ITaRecommendCustomerService iTaRecommendCustomerService;
61
     public ITaRecommendCustomerService iTaRecommendCustomerService;
55
 
62
 
63
+    @Autowired
64
+    private TaChannelPersonService taChannelPersonService;
65
+
66
+    @Autowired
67
+    private TaChannelService taChannelService;
68
+
56
     /**
69
     /**
57
      * 分页查询列表
70
      * 分页查询列表
58
      * @param pageNum
71
      * @param pageNum
229
         }
242
         }
230
         return responseBean;
243
         return responseBean;
231
     }
244
     }
245
+
246
+    /**
247
+     * 根据id查询对象
248
+     * @param
249
+     */
250
+    @ApiOperation(value = "admin-查询客户信息", notes = "admin-查询客户信息")
251
+    @RequestMapping(value="/admin/customerInfo/{customerId}",method= RequestMethod.GET)
252
+    public ResponseBean customerInfoPc(@PathVariable String customerId, @RequestHeader("authorization") String token){
253
+        ResponseBean responseBean = new ResponseBean();
254
+        CustomerInfoVO customerInfoVO = new CustomerInfoVO();
255
+        try {
256
+            LambdaQueryWrapper<CustomerInfo> lambdaQueryWrapper = new LambdaQueryWrapper<>();
257
+            lambdaQueryWrapper.eq(CustomerInfo::getCustomerId,customerId);
258
+
259
+            CustomerInfo customerInfo = iCustomerInfoService.getOne(lambdaQueryWrapper);
260
+
261
+            TaRecommendCustomer customer = iTaRecommendCustomerService.getById(customerId);
262
+            if (null == customerInfo && null == customer) {
263
+                return ResponseBean.error("请求客户不存在", ResponseBean.ERROR_UNAVAILABLE);
264
+            }
265
+            // 查看置业顾问信息
266
+            if (!StringUtils.isEmpty(customer.getRealtyConsultant())) {
267
+                TaPerson realtyPerson = taPersonService.getById(customer.getRealtyConsultant());
268
+                customerInfoVO.setRealtyConsultantPerson(realtyPerson);
269
+            }
270
+
271
+            // 获取渠道名字
272
+            LambdaQueryWrapper<TaChannelPerson> channelPersonLambdaQueryWrapper = new LambdaQueryWrapper<>();
273
+            channelPersonLambdaQueryWrapper.eq(TaChannelPerson::getPersonId,customer.getPersonId());
274
+            TaChannelPerson taChannelPerson = taChannelPersonService.getOne(channelPersonLambdaQueryWrapper);
275
+            if (null != taChannelPerson) {
276
+                TaChannel taChannel = taChannelService.getById(taChannelPerson.getChannelId());
277
+                customerInfoVO.setChannelName(taChannel.getChannelName());
278
+            }
279
+
280
+            customerInfoVO.setTaRecommendCustomer(customer);
281
+            customerInfoVO.setCustomerInfo(customerInfo);
282
+            iCustomerInfoService.getOtherInfo(customerInfoVO);
283
+            responseBean.addSuccess(customerInfoVO);
284
+        }catch (Exception e){
285
+            e.printStackTrace();
286
+            logger.error("customerInfoDelete -=- {}",e.toString());
287
+            responseBean.addError(e.getMessage());
288
+        }
289
+        return responseBean;
290
+    }
232
 }
291
 }

+ 6
- 0
src/main/java/com/yunzhi/marketing/xlk/service/ICustomerInfoService.java Parādīt failu

2
 
2
 
3
 import com.baomidou.mybatisplus.extension.service.IService;
3
 import com.baomidou.mybatisplus.extension.service.IService;
4
 import com.yunzhi.marketing.xlk.entity.CustomerInfo;
4
 import com.yunzhi.marketing.xlk.entity.CustomerInfo;
5
+import com.yunzhi.marketing.xlk.vo.CustomerInfoVO;
5
 
6
 
6
 /**
7
 /**
7
  * <p>
8
  * <p>
13
  */
14
  */
14
 public interface ICustomerInfoService extends IService<CustomerInfo> {
15
 public interface ICustomerInfoService extends IService<CustomerInfo> {
15
 
16
 
17
+    /**
18
+     * 获取其他信息
19
+     * @param customerInfoVO
20
+     */
21
+    void getOtherInfo(CustomerInfoVO customerInfoVO);
16
 }
22
 }

+ 63
- 0
src/main/java/com/yunzhi/marketing/xlk/service/impl/CustomerInfoServiceImpl.java Parādīt failu

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.QueryWrapper;
4
+import com.baomidou.mybatisplus.core.metadata.IPage;
5
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
3
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
6
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
7
+import com.yunzhi.marketing.common.StringUtils;
8
+import com.yunzhi.marketing.drainage.entity.TaDrainage;
9
+import com.yunzhi.marketing.entity.*;
10
+import com.yunzhi.marketing.mapper.*;
11
+import com.yunzhi.marketing.service.IMiniAppService;
4
 import com.yunzhi.marketing.xlk.entity.CustomerInfo;
12
 import com.yunzhi.marketing.xlk.entity.CustomerInfo;
5
 import com.yunzhi.marketing.xlk.mapper.CustomerInfoMapper;
13
 import com.yunzhi.marketing.xlk.mapper.CustomerInfoMapper;
6
 import com.yunzhi.marketing.xlk.service.ICustomerInfoService;
14
 import com.yunzhi.marketing.xlk.service.ICustomerInfoService;
15
+import com.yunzhi.marketing.xlk.vo.CustomerInfoVO;
16
+import org.springframework.beans.factory.annotation.Autowired;
7
 import org.springframework.stereotype.Service;
17
 import org.springframework.stereotype.Service;
8
 
18
 
19
+import java.util.List;
20
+
9
 /**
21
 /**
10
  * <p>
22
  * <p>
11
  * 客户基本信息表  服务实现类
23
  * 客户基本信息表  服务实现类
17
 @Service
29
 @Service
18
 public class CustomerInfoServiceImpl extends ServiceImpl<CustomerInfoMapper, CustomerInfo> implements ICustomerInfoService {
30
 public class CustomerInfoServiceImpl extends ServiceImpl<CustomerInfoMapper, CustomerInfo> implements ICustomerInfoService {
19
 
31
 
32
+    @Autowired
33
+    TaPersonMapper taPersonMapper;
34
+
35
+    @Autowired
36
+    TaRecommendCustomerMapper taRecommendCustomerMapper;
37
+
38
+    @Autowired
39
+    private TdWxDictMapper tdWxDictMapper;
40
+
41
+    @Autowired
42
+    TaPersonVisitRecordMapper taPersonVisitRecordMapper;
43
+
44
+    @Autowired
45
+    private TaPersonFromRecordMapper taPersonFromRecordMapper;
46
+
47
+    @Autowired
48
+    private TaBuildingDynamicMapper taBuildingDynamicMapper;
49
+
50
+    /**
51
+     * 获取其他信息
52
+     *
53
+     * @param customerInfoVO
54
+     */
55
+    @Override
56
+    public void getOtherInfo(CustomerInfoVO customerInfoVO) {
57
+        if (StringUtils.isEmpty(customerInfoVO.getTaRecommendCustomer().getPersonId())) {
58
+            return;
59
+        }
60
+
61
+        // 获取person用户信息
62
+        String personId = customerInfoVO.getTaRecommendCustomer().getPersonId();
63
+        TaPerson taPerson = taPersonMapper.getById(personId);
64
+        if (!StringUtils.isEmpty(personId)) {
65
+            List<TaPersonVisitRecord> records = taPersonVisitRecordMapper.visitRecordByPersonIdNew(personId);
66
+            records.forEach(e -> {
67
+                //获取活动标题
68
+                if ("activity".equals(e.getEventType()) && null != e.getTargetId()) {
69
+                    TaBuildingDynamic taBuildingDynamic = taBuildingDynamicMapper.selectById(e.getTargetId());
70
+                    if (null != taBuildingDynamic) {
71
+                        e.setActivityName(taBuildingDynamic.getTitle());
72
+                    }
73
+
74
+                }
75
+            });
76
+            customerInfoVO.setPersonVisitRecords(records);
77
+            customerInfoVO.setVisitTimes(records.size());
78
+            customerInfoVO.setPersonIntentions(taRecommendCustomerMapper.getCustomerIntentions(personId, null));
79
+//            customerInfoVO.setDuration(taPersonVisitRecordMapper.getDurationByPersonId(personId));
80
+//            customerInfoVO.setVisitTime(taPersonVisitRecordMapper.getFirstVisitTimeByPersonId(personId));
81
+        }
82
+    }
20
 }
83
 }

+ 28
- 0
src/main/java/com/yunzhi/marketing/xlk/vo/CustomerInfoVO.java Parādīt failu

1
+package com.yunzhi.marketing.xlk.vo;
2
+
3
+import com.yunzhi.marketing.entity.PersonIntention;
4
+import com.yunzhi.marketing.entity.TaPerson;
5
+import com.yunzhi.marketing.entity.TaPersonVisitRecord;
6
+import com.yunzhi.marketing.entity.TaRecommendCustomer;
7
+import com.yunzhi.marketing.xlk.entity.CustomerInfo;
8
+import lombok.Data;
9
+
10
+import java.util.List;
11
+
12
+@Data
13
+public class CustomerInfoVO {
14
+
15
+    private CustomerInfo customerInfo;
16
+
17
+    private TaRecommendCustomer taRecommendCustomer;
18
+
19
+    private List<TaPersonVisitRecord> personVisitRecords;
20
+
21
+    private  List<PersonIntention> personIntentions;
22
+
23
+    private Integer visitTimes;
24
+
25
+    private TaPerson realtyConsultantPerson;
26
+
27
+    private String channelName;
28
+}

+ 9
- 0
src/main/resources/mapper/TaPersonVisitRecordMapper.xml Parādīt failu

41
         order by t.visit_time desc
41
         order by t.visit_time desc
42
     </select>
42
     </select>
43
 
43
 
44
+    <select id="visitRecordByPersonIdNew" resultType="com.yunzhi.marketing.entity.TaPersonVisitRecord">
45
+        select
46
+        t.* ,
47
+        b.parent_type_id from ta_person_visit_record t
48
+        left join td_biz_event_type b on t.event_type = b.type_id
49
+        where t.person_id = #{personId}
50
+        order by t.visit_time desc
51
+    </select>
52
+
44
     <select id="selectAll" resultType="com.yunzhi.marketing.entity.TaPersonVisitRecord">
53
     <select id="selectAll" resultType="com.yunzhi.marketing.entity.TaPersonVisitRecord">
45
         SELECT
54
         SELECT
46
             tpvr.record_id as recordId,
55
             tpvr.record_id as recordId,