|
@@ -7,7 +7,9 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
7
|
7
|
import com.yunzhi.marketing.base.ResponseBean;
|
8
|
8
|
import com.yunzhi.marketing.common.CommConstant;
|
9
|
9
|
import com.yunzhi.marketing.common.StringUtils;
|
|
10
|
+import com.yunzhi.marketing.entity.TaPerson;
|
10
|
11
|
import com.yunzhi.marketing.entity.TaRecommendCustomer;
|
|
12
|
+import com.yunzhi.marketing.mapper.TaPersonMapper;
|
11
|
13
|
import com.yunzhi.marketing.mapper.TaRecommendCustomerMapper;
|
12
|
14
|
import com.yunzhi.marketing.po.MineRecommendCustomerPO;
|
13
|
15
|
import com.yunzhi.marketing.po.TaRecommendCustomerPO;
|
|
@@ -45,6 +47,9 @@ public class ChannelCustomerServiceImpl extends ServiceImpl<ChannelCustomerMappe
|
45
|
47
|
|
46
|
48
|
@Autowired
|
47
|
49
|
private CustomerSignatoryMapper customerSignatoryMapper;
|
|
50
|
+
|
|
51
|
+ @Autowired
|
|
52
|
+ private TaPersonMapper taPersonMapper;
|
48
|
53
|
/**
|
49
|
54
|
* 审核
|
50
|
55
|
*
|
|
@@ -64,8 +69,19 @@ public class ChannelCustomerServiceImpl extends ServiceImpl<ChannelCustomerMappe
|
64
|
69
|
|
65
|
70
|
// 保存到访单
|
66
|
71
|
CustomerVisit customerVisit = channelCustomerDTO.getCustomerVisit();
|
67
|
|
- customerVisit.setCreateDate(LocalDateTime.now());
|
68
|
|
- customerVisitMapper.insert(customerVisit);
|
|
72
|
+ customerVisit.setBuildingId(customer.getBuildingId());
|
|
73
|
+ customerVisit.setName(customer.getName());
|
|
74
|
+ customerVisit.setRecommendPerson(customer.getRecommendPerson());
|
|
75
|
+ TaPerson recommendPerson = taPersonMapper.getById(customer.getRecommendPerson());
|
|
76
|
+ if (null != recommendPerson) {
|
|
77
|
+ customerVisit.setRealtyConsultantName(recommendPerson.getName());
|
|
78
|
+ }
|
|
79
|
+ customerVisit.setRealtyConsultant(channelCustomerDTO.getRealtyConsultant());
|
|
80
|
+ TaPerson channelPerson = taPersonMapper.getById(channelCustomerDTO.getRealtyConsultant());
|
|
81
|
+ if (null != channelPerson) {
|
|
82
|
+ customerVisit.setRealtyConsultantName(channelPerson.getName());
|
|
83
|
+ }
|
|
84
|
+ customerVisit.setOrgId(customer.getOrgId());
|
69
|
85
|
|
70
|
86
|
// 审核通过 先查看在ta_recommend_customer 手机号是否存在
|
71
|
87
|
LambdaQueryWrapper<TaRecommendCustomer> queryWrapper = new LambdaQueryWrapper<>();
|
|
@@ -95,22 +111,27 @@ public class ChannelCustomerServiceImpl extends ServiceImpl<ChannelCustomerMappe
|
95
|
111
|
// 审核通过
|
96
|
112
|
customer.setStatus("2");
|
97
|
113
|
customer.setCustomerId(taRecommendCustomer.getCustomerId());
|
|
114
|
+ customerVisit.setCustomerId(taRecommendCustomer.getCustomerId());
|
98
|
115
|
customer.setVisitDate(LocalDateTime.now());
|
99
|
116
|
channelCustomerMapper.updateById(customer);
|
100
|
|
- return ResponseBean.success("审核成功");
|
101
|
|
- }
|
102
|
|
-
|
103
|
|
- if (StringUtils.isEmpty(recommendCustomer.getRealtyConsultant()) &&
|
|
117
|
+ }else if (StringUtils.isEmpty(recommendCustomer.getRealtyConsultant()) &&
|
104
|
118
|
(StringUtils.isEmpty(recommendCustomer.getRecommendPerson()) || recommendCustomer.getRecommendPerson().equals(customer.getRecommendPerson()))){
|
105
|
119
|
// 审核通过
|
106
|
120
|
customer.setStatus("2");
|
107
|
121
|
customer.setCustomerId(recommendCustomer.getCustomerId());
|
|
122
|
+ customerVisit.setCustomerId(recommendCustomer.getCustomerId());
|
108
|
123
|
customer.setVisitDate(LocalDateTime.now());
|
|
124
|
+ customer.setRealtyConsultant(channelCustomerDTO.getRealtyConsultant());
|
109
|
125
|
channelCustomerMapper.updateById(customer);
|
110
|
|
- return ResponseBean.success("审核成功");
|
|
126
|
+ }else {
|
|
127
|
+ return ResponseBean.error("此客户是私客或已被报备", ResponseBean.ERROR_UNAVAILABLE);
|
111
|
128
|
}
|
112
|
129
|
|
113
|
|
- return ResponseBean.error("此客户是私客或已被报备", ResponseBean.ERROR_UNAVAILABLE);
|
|
130
|
+
|
|
131
|
+ customerVisit.setCreateDate(LocalDateTime.now());
|
|
132
|
+ customerVisitMapper.insert(customerVisit);
|
|
133
|
+
|
|
134
|
+ return ResponseBean.success("审核成功");
|
114
|
135
|
}
|
115
|
136
|
|
116
|
137
|
/**
|
|
@@ -122,9 +143,25 @@ public class ChannelCustomerServiceImpl extends ServiceImpl<ChannelCustomerMappe
|
122
|
143
|
*/
|
123
|
144
|
@Override
|
124
|
145
|
public ResponseBean markingChannelCustomer(MarkingChannelCustomerDTO params) {
|
|
146
|
+ CustomerVisit customerVisit = params.getCustomerVisit();
|
125
|
147
|
// 渠道推荐的客户
|
126
|
148
|
if ("report".equals(params.getType())) {
|
127
|
149
|
ChannelCustomer customer = channelCustomerMapper.selectById(params.getId());
|
|
150
|
+
|
|
151
|
+ customerVisit.setBuildingId(customer.getBuildingId());
|
|
152
|
+ customerVisit.setName(customer.getName());
|
|
153
|
+ customerVisit.setRecommendPerson(customer.getRecommendPerson());
|
|
154
|
+ TaPerson recommendPerson = taPersonMapper.getById(customer.getRecommendPerson());
|
|
155
|
+ if (null != recommendPerson) {
|
|
156
|
+ customerVisit.setRealtyConsultantName(recommendPerson.getName());
|
|
157
|
+ }
|
|
158
|
+ customerVisit.setRealtyConsultant(params.getRealtyConsultant());
|
|
159
|
+ TaPerson channelPerson = taPersonMapper.getById(params.getRealtyConsultant());
|
|
160
|
+ if (null != channelPerson) {
|
|
161
|
+ customerVisit.setRealtyConsultantName(channelPerson.getName());
|
|
162
|
+ }
|
|
163
|
+ customerVisit.setOrgId(customer.getOrgId());
|
|
164
|
+
|
128
|
165
|
// 审核通过 先查看在ta_recommend_customer 手机号是否存在
|
129
|
166
|
LambdaQueryWrapper<TaRecommendCustomer> queryWrapper = new LambdaQueryWrapper<>();
|
130
|
167
|
queryWrapper.eq(TaRecommendCustomer::getPhone,customer.getPhone());
|
|
@@ -155,6 +192,7 @@ public class ChannelCustomerServiceImpl extends ServiceImpl<ChannelCustomerMappe
|
155
|
192
|
customer.setStatus("2");
|
156
|
193
|
customer.setVisitDate(LocalDateTime.now());
|
157
|
194
|
customer.setCustomerId(taRecommendCustomer.getCustomerId());
|
|
195
|
+ customerVisit.setCustomerId(taRecommendCustomer.getCustomerId());
|
158
|
196
|
channelCustomerMapper.updateById(customer);
|
159
|
197
|
}else if (StringUtils.isEmpty(recommendCustomer.getRealtyConsultant()) &&
|
160
|
198
|
(StringUtils.isEmpty(recommendCustomer.getRecommendPerson()) || recommendCustomer.getRecommendPerson().equals(customer.getRecommendPerson()))){
|
|
@@ -162,6 +200,7 @@ public class ChannelCustomerServiceImpl extends ServiceImpl<ChannelCustomerMappe
|
162
|
200
|
customer.setStatus("2");
|
163
|
201
|
customer.setVisitDate(LocalDateTime.now());
|
164
|
202
|
customer.setCustomerId(recommendCustomer.getCustomerId());
|
|
203
|
+ customerVisit.setCustomerId(recommendCustomer.getCustomerId());
|
165
|
204
|
channelCustomerMapper.updateById(customer);
|
166
|
205
|
|
167
|
206
|
// 修改状态为确认到访状态
|
|
@@ -178,13 +217,13 @@ public class ChannelCustomerServiceImpl extends ServiceImpl<ChannelCustomerMappe
|
178
|
217
|
taRecommendCustomer.setVerifyStatus(CommConstant.VERIFY_AGREE);
|
179
|
218
|
taRecommendCustomer.setStatus(CommConstant.CUSTOMER_VISITE);
|
180
|
219
|
taRecommendCustomer.setCirculationTime(LocalDateTime.now());
|
|
220
|
+ customerVisit.setCustomerId(taRecommendCustomer.getCustomerId());
|
181
|
221
|
taRecommendCustomerMapper.updateById(taRecommendCustomer);
|
182
|
222
|
}else {
|
183
|
223
|
return ResponseBean.error("请输入正确的类型参数", ResponseBean.ERROR_UNAVAILABLE);
|
184
|
224
|
}
|
185
|
225
|
|
186
|
226
|
// 保存到访单
|
187
|
|
- CustomerVisit customerVisit = params.getCustomerVisit();
|
188
|
227
|
customerVisit.setCreateDate(LocalDateTime.now());
|
189
|
228
|
customerVisitMapper.insert(customerVisit);
|
190
|
229
|
|