|
@@ -183,8 +183,6 @@ public class TaRecommendCustomerServiceImpl extends ServiceImpl<TaRecommendCusto
|
183
|
183
|
taRecommendCustomer.setEntryType(CommConstant.ENTRY_INPUT);
|
184
|
184
|
taRecommendCustomer.setVerifyStatus(CommConstant.VERIFY_READY);
|
185
|
185
|
|
186
|
|
- // 报备日期是今天
|
187
|
|
- taRecommendCustomer.setReportDate(LocalDateTime.now());
|
188
|
186
|
|
189
|
187
|
String status = params.getString("status");
|
190
|
188
|
if (null == status) status = "1";
|
|
@@ -195,10 +193,10 @@ public class TaRecommendCustomerServiceImpl extends ServiceImpl<TaRecommendCusto
|
195
|
193
|
QueryWrapper<TaRecommendCustomer> queryWrapper = new QueryWrapper<>();
|
196
|
194
|
queryWrapper.eq("name", taRecommendCustomer.getName());
|
197
|
195
|
queryWrapper.eq("phone", taRecommendCustomer.getPhone());
|
198
|
|
- queryWrapper.ge("report_date", LocalDateTime.now().minusDays(10));
|
|
196
|
+ queryWrapper.eq("building_id",taRecommendCustomer.getBuildingId());
|
199
|
197
|
List<TaRecommendCustomer> result = taRecommendCustomerMapper.selectList(queryWrapper);
|
200
|
198
|
if (null != result && result.size() > 0) {
|
201
|
|
- return ResponseBean.error("当前客户尚在保护期, 不能再次推荐", ResponseBean.ERROR_ILLEGAL_PARAMS);
|
|
199
|
+ return ResponseBean.error("当前客户已被推荐, 不能再次推荐", ResponseBean.ERROR_ILLEGAL_PARAMS);
|
202
|
200
|
}
|
203
|
201
|
|
204
|
202
|
int row = taRecommendCustomerMapper.insert(taRecommendCustomer);
|
|
@@ -206,6 +204,83 @@ public class TaRecommendCustomerServiceImpl extends ServiceImpl<TaRecommendCusto
|
206
|
204
|
return ResponseBean.error("推荐客户失败", ResponseBean.ERROR_UNAVAILABLE);
|
207
|
205
|
}
|
208
|
206
|
|
|
207
|
+// // 找到销售经理,并推送消息
|
|
208
|
+// TaPerson saleMan = taPersonMapper.getSalesExecutive();
|
|
209
|
+// if (null != saleMan && !StringUtils.isEmpty(saleMan.getMiniOpenid())) {
|
|
210
|
+// // 发送消息
|
|
211
|
+// iMiniAppService.sendNewCustomerMessage(saleMan.getMiniOpenid(), CommConstant.MINIAPP_INDEX, taRecommendCustomer.getName(), taRecommendCustomer.getPhone(), "", taPerson.getName());
|
|
212
|
+// }
|
|
213
|
+
|
|
214
|
+ return ResponseBean.success(taRecommendCustomer);
|
|
215
|
+ }
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+ @Override
|
|
220
|
+ public ResponseBean reportCust(String paramStr, String openid) {
|
|
221
|
+ JSONObject params = JSONObject.parseObject(paramStr);
|
|
222
|
+ if (null == params) {
|
|
223
|
+ return ResponseBean.error("解析参数失败", ResponseBean.ERROR_ILLEGAL_PARAMS);
|
|
224
|
+ }
|
|
225
|
+ List<TaPerson> taPersons = getPersonsByOpenId(openid);
|
|
226
|
+ if (null == taPersons || taPersons.size() != 1) {
|
|
227
|
+ return ResponseBean.error("验证当前人员信息失败", ResponseBean.ERROR_UNAVAILABLE);
|
|
228
|
+ }
|
|
229
|
+ TaPerson taPerson = taPersons.get(0);
|
|
230
|
+
|
|
231
|
+ String checkResult = checkCustomerParams(params);
|
|
232
|
+ if (null != checkResult) {
|
|
233
|
+ return ResponseBean.error(checkResult, ResponseBean.ERROR_MISSING_PARAMS);
|
|
234
|
+ }
|
|
235
|
+
|
|
236
|
+ TaRecommendCustomer taRecommendCustomer = new TaRecommendCustomer();
|
|
237
|
+
|
|
238
|
+ taRecommendCustomer.setName(params.getString("name"));
|
|
239
|
+ taRecommendCustomer.setPicture(params.getString("picture"));
|
|
240
|
+ taRecommendCustomer.setPhone(params.getString("phone"));
|
|
241
|
+ taRecommendCustomer.setSex(params.getInteger("sex"));
|
|
242
|
+ taRecommendCustomer.setDescribe(params.getString("describe"));
|
|
243
|
+ taRecommendCustomer.setRealtyConsultant(params.getString("RealtyConsultant"));
|
|
244
|
+ taRecommendCustomer.setBuildingId(params.getString("buildingId"));
|
|
245
|
+ taRecommendCustomer.setReportRecommendStatus(CommConstant.REPORTED);
|
|
246
|
+ taRecommendCustomer.setCreateDate(LocalDateTime.now());
|
|
247
|
+
|
|
248
|
+ // 时间格式 yyyy-MM-dd
|
|
249
|
+ String at = params.getString("appointmentTime");
|
|
250
|
+ if (!StringUtils.isEmpty(at)) {
|
|
251
|
+ taRecommendCustomer.setAppointmentTime(DateUtils.day2LocalDateime(at));
|
|
252
|
+ }
|
|
253
|
+
|
|
254
|
+// taRecommendCustomer.setAppointmentTime((String) params.get("appointmentTime"));
|
|
255
|
+ taRecommendCustomer.setVisiteNum(params.getInteger("visiteNum"));
|
|
256
|
+ taRecommendCustomer.setIntention(params.getString("intention"));
|
|
257
|
+ taRecommendCustomer.setRealtyManageType(params.getString("realtyManageType"));
|
|
258
|
+ taRecommendCustomer.setDemandType(params.getString("demandType"));
|
|
259
|
+ taRecommendCustomer.setPriceRange(params.getString("priceRange"));
|
|
260
|
+ taRecommendCustomer.setEntryType(CommConstant.ENTRY_INPUT);
|
|
261
|
+ taRecommendCustomer.setVerifyStatus(CommConstant.VERIFY_AGREE);
|
|
262
|
+
|
|
263
|
+
|
|
264
|
+ String status = params.getString("status");
|
|
265
|
+ if (null == status) status = "1";
|
|
266
|
+ taRecommendCustomer.setStatus(status);
|
|
267
|
+ taRecommendCustomer.setRecommendPerson(taPerson.getPersonId());
|
|
268
|
+
|
|
269
|
+ // 报备有 10 天有效期
|
|
270
|
+ QueryWrapper<TaRecommendCustomer> queryWrapper = new QueryWrapper<>();
|
|
271
|
+ queryWrapper.eq("name", taRecommendCustomer.getName());
|
|
272
|
+ queryWrapper.eq("phone", taRecommendCustomer.getPhone());
|
|
273
|
+ queryWrapper.eq("building_id",taRecommendCustomer.getBuildingId());
|
|
274
|
+ List<TaRecommendCustomer> result = taRecommendCustomerMapper.selectList(queryWrapper);
|
|
275
|
+ if (null != result && result.size() > 0) {
|
|
276
|
+ return ResponseBean.error("当前客户已被报备, 不能再次报备", ResponseBean.ERROR_ILLEGAL_PARAMS);
|
|
277
|
+ }
|
|
278
|
+
|
|
279
|
+ int row = taRecommendCustomerMapper.insert(taRecommendCustomer);
|
|
280
|
+ if (row < 1) {
|
|
281
|
+ return ResponseBean.error("报备客户失败", ResponseBean.ERROR_UNAVAILABLE);
|
|
282
|
+ }
|
|
283
|
+
|
209
|
284
|
// 找到销售经理,并推送消息
|
210
|
285
|
TaPerson saleMan = taPersonMapper.getSalesExecutive();
|
211
|
286
|
if (null != saleMan && !StringUtils.isEmpty(saleMan.getMiniOpenid())) {
|
|
@@ -256,6 +331,24 @@ public class TaRecommendCustomerServiceImpl extends ServiceImpl<TaRecommendCusto
|
256
|
331
|
return taRecommendCustomerMapper.getCustomerList(page,building,name,tel,consultName,consultTel,entryType,verifyStatus,sex);
|
257
|
332
|
}
|
258
|
333
|
|
|
334
|
+ @Override
|
|
335
|
+ public IPage<TaPerson> getIndependentAgents(int pageNumber, int pageSize,String name,String tel){
|
|
336
|
+ IPage<TaPerson>page = new Page<>(pageNumber,pageSize);
|
|
337
|
+ return taRecommendCustomerMapper.getIndependentAgents(page,name,tel);
|
|
338
|
+ }
|
|
339
|
+
|
|
340
|
+ @Override
|
|
341
|
+ public IPage<TaRecommendCustomer> getRecCustomerList(int pageNumber, int pageSize,String building,String name,String tel,String consultName,String consultTel,String entryType,String verifyStatus,Integer sex){
|
|
342
|
+ IPage<TaRecommendCustomer>page = new Page<>(pageNumber,pageSize);
|
|
343
|
+ return taRecommendCustomerMapper.getCustomerList(page,building,name,tel,consultName,consultTel,entryType,verifyStatus,sex);
|
|
344
|
+ }
|
|
345
|
+
|
|
346
|
+ @Override
|
|
347
|
+ public IPage<TaRecommendCustomer> getRepCustomerList(int pageNumber, int pageSize,String building,String name,String tel,String consultName,String consultTel,String entryType,String verifyStatus,Integer sex){
|
|
348
|
+ IPage<TaRecommendCustomer>page = new Page<>(pageNumber,pageSize);
|
|
349
|
+ return taRecommendCustomerMapper.getCustomerList(page,building,name,tel,consultName,consultTel,entryType,verifyStatus,sex);
|
|
350
|
+ }
|
|
351
|
+
|
259
|
352
|
@Override
|
260
|
353
|
public TaRecommendCustomer getCustomerById(String customerId){
|
261
|
354
|
return taRecommendCustomerMapper.getCustomerById(customerId);
|