|
@@ -3,16 +3,21 @@ package com.yunzhi.marketing.service.impl;
|
3
|
3
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
4
|
4
|
import com.yunzhi.marketing.base.ResponseBean;
|
5
|
5
|
import com.yunzhi.marketing.dto.StatisticsDTO;
|
|
6
|
+import com.yunzhi.marketing.entity.TaChannelPerson;
|
|
7
|
+import com.yunzhi.marketing.mapper.TaChannelPersonMapper;
|
6
|
8
|
import com.yunzhi.marketing.po.CustomerRankListVO;
|
7
|
9
|
import com.yunzhi.marketing.service.ChannelCustomerStatisticsService;
|
8
|
10
|
import com.yunzhi.marketing.xlk.entity.BuildingChannel;
|
9
|
11
|
import com.yunzhi.marketing.xlk.mapper.BuildingChannelMapper;
|
10
|
12
|
import com.yunzhi.marketing.xlk.mapper.ChannelCustomerMapper;
|
|
13
|
+import com.yunzhi.marketing.xlk.mapper.CustomerVisitMapper;
|
11
|
14
|
import org.ietf.jgss.ChannelBinding;
|
12
|
15
|
import org.springframework.beans.factory.annotation.Autowired;
|
13
|
16
|
import org.springframework.stereotype.Service;
|
14
|
17
|
|
|
18
|
+import java.util.HashMap;
|
15
|
19
|
import java.util.List;
|
|
20
|
+import java.util.Map;
|
16
|
21
|
|
17
|
22
|
@Service
|
18
|
23
|
public class ChannelCustomerStatisticsServiceImpl implements ChannelCustomerStatisticsService {
|
|
@@ -23,17 +28,53 @@ public class ChannelCustomerStatisticsServiceImpl implements ChannelCustomerStat
|
23
|
28
|
@Autowired
|
24
|
29
|
private ChannelCustomerMapper channelCustomerMapper;
|
25
|
30
|
|
|
31
|
+ @Autowired
|
|
32
|
+ private TaChannelPersonMapper channelPersonMapper;
|
|
33
|
+
|
|
34
|
+ @Autowired
|
|
35
|
+ private CustomerVisitMapper customerVisitMapper;
|
|
36
|
+
|
26
|
37
|
@Override
|
27
|
38
|
public ResponseBean getRanklist(StatisticsDTO statisticsDTo) {
|
28
|
|
- LambdaQueryWrapper<BuildingChannel> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
29
|
|
- lambdaQueryWrapper.eq(BuildingChannel::getBuildingId,statisticsDTo.getBuildingId());
|
30
|
|
- BuildingChannel buildingChannel = buildingChannelMapper.selectOne(lambdaQueryWrapper);
|
|
39
|
+ LambdaQueryWrapper<TaChannelPerson> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
40
|
+ lambdaQueryWrapper.eq(TaChannelPerson::getPersonId,statisticsDTo.getPersonId());
|
|
41
|
+ TaChannelPerson taChannelPerson = channelPersonMapper.selectOne(lambdaQueryWrapper);
|
31
|
42
|
|
32
|
|
- if (null == buildingChannel) {
|
33
|
|
- return ResponseBean.error("此楼盘未绑定渠道商", ResponseBean.ERROR_UNAVAILABLE);
|
|
43
|
+ if (null == taChannelPerson) {
|
|
44
|
+ return ResponseBean.error("此用户未绑定渠道商", ResponseBean.ERROR_UNAVAILABLE);
|
34
|
45
|
}
|
35
|
|
- statisticsDTo.setChannelId(buildingChannel.getChannelId());
|
|
46
|
+ statisticsDTo.setChannelId(taChannelPerson.getChannelId());
|
36
|
47
|
List<CustomerRankListVO> list = channelCustomerMapper.getRanklist(statisticsDTo);
|
37
|
48
|
return ResponseBean.success(list);
|
38
|
49
|
}
|
|
50
|
+
|
|
51
|
+ /**
|
|
52
|
+ * 获取销售简报
|
|
53
|
+ *
|
|
54
|
+ * @param statisticsDTo
|
|
55
|
+ * @return
|
|
56
|
+ */
|
|
57
|
+ @Override
|
|
58
|
+ public ResponseBean getBriefing(StatisticsDTO statisticsDTo) {
|
|
59
|
+ LambdaQueryWrapper<TaChannelPerson> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
60
|
+ lambdaQueryWrapper.eq(TaChannelPerson::getPersonId,statisticsDTo.getPersonId());
|
|
61
|
+ TaChannelPerson taChannelPerson = channelPersonMapper.selectOne(lambdaQueryWrapper);
|
|
62
|
+
|
|
63
|
+ if (null == taChannelPerson) {
|
|
64
|
+ return ResponseBean.error("此用户未绑定渠道商", ResponseBean.ERROR_UNAVAILABLE);
|
|
65
|
+ }
|
|
66
|
+ statisticsDTo.setChannelId(taChannelPerson.getChannelId());
|
|
67
|
+
|
|
68
|
+ // 获取新增客户
|
|
69
|
+ int newCustomerNum = channelCustomerMapper.getNewCustomer(statisticsDTo);
|
|
70
|
+ // 获取跟进客户
|
|
71
|
+ int followCustomerNum = customerVisitMapper.getFollowCustomer(statisticsDTo);
|
|
72
|
+ // 获取成交客户
|
|
73
|
+ int successCustomerNum = channelCustomerMapper.getSuccessCustomer(statisticsDTo);
|
|
74
|
+ Map<String,Object> map = new HashMap<>();
|
|
75
|
+ map.put("newCustomerNum",newCustomerNum);
|
|
76
|
+ map.put("followCustomerNum",followCustomerNum);
|
|
77
|
+ map.put("successCustomerNum",successCustomerNum);
|
|
78
|
+ return ResponseBean.success(map);
|
|
79
|
+ }
|
39
|
80
|
}
|