|
@@ -39,6 +39,7 @@ import java.util.List;
|
39
|
39
|
@Slf4j
|
40
|
40
|
@Service
|
41
|
41
|
public class TaMainUsherRecordServiceImpl extends ServiceImpl<TaMainUsherRecordMapper, TaMainUsherRecord> implements ITaMainUsherRecordService {
|
|
42
|
+
|
42
|
43
|
@Autowired
|
43
|
44
|
private TaMainUsherRecordMapper taMainUsherRecordMapper;
|
44
|
45
|
|
|
@@ -72,6 +73,9 @@ public class TaMainUsherRecordServiceImpl extends ServiceImpl<TaMainUsherRecordM
|
72
|
73
|
@Autowired
|
73
|
74
|
ICameraService cameraService;
|
74
|
75
|
|
|
76
|
+ @Autowired
|
|
77
|
+ SMSUtils smsUtils;
|
|
78
|
+
|
75
|
79
|
@Override
|
76
|
80
|
public boolean updateNormal(List<TaMainUsherRecord> records) {
|
77
|
81
|
if (records == null || records.size() == 0) return true;
|
|
@@ -205,7 +209,14 @@ public class TaMainUsherRecordServiceImpl extends ServiceImpl<TaMainUsherRecordM
|
205
|
209
|
add("您有新客户来访, 请及时接待!");
|
206
|
210
|
}};
|
207
|
211
|
|
208
|
|
- miniApp.sendTPLMessage(tplId, openid, page, data);
|
|
212
|
+// miniApp.sendTPLMessage(tplId, openid, page, data);
|
|
213
|
+ if (miniApp.sendTPLMessage(tplId, openid, page, data).getCode() == -1) {
|
|
214
|
+ // 没有 formid 发短信
|
|
215
|
+ String tel = sysUserMapper.getPhoneByOpenid(openid);
|
|
216
|
+ if (null != tel) {
|
|
217
|
+ smsUtils.sendVisitor(tel, StringUtils.ifNull(visitorName, ""));
|
|
218
|
+ }
|
|
219
|
+ }
|
209
|
220
|
} else {
|
210
|
221
|
// 否则, 给原置业发消息, 给接待置业发消息
|
211
|
222
|
|
|
@@ -221,9 +232,14 @@ public class TaMainUsherRecordServiceImpl extends ServiceImpl<TaMainUsherRecordM
|
221
|
232
|
add(phone);
|
222
|
233
|
add("您有新客户来访, 已被安排给 " + usr1.getUsername() + " 接待!");
|
223
|
234
|
}};
|
224
|
|
- miniApp.sendTPLMessage(tplId, rcOpenid, page, dt1);
|
225
|
|
-
|
226
|
|
-
|
|
235
|
+// miniApp.sendTPLMessage(tplId, rcOpenid, page, dt1);
|
|
236
|
+ if (miniApp.sendTPLMessage(tplId, rcOpenid, page, dt1).getCode() == -1) {
|
|
237
|
+ // 没有 formid 发短信
|
|
238
|
+ String tel = sysUserMapper.getPhoneByOpenid(rcOpenid);
|
|
239
|
+ if (null != tel) {
|
|
240
|
+ smsUtils.sendVisitor(tel, StringUtils.ifNull(visitorName, ""));
|
|
241
|
+ }
|
|
242
|
+ }
|
227
|
243
|
|
228
|
244
|
// 代理置业
|
229
|
245
|
SysUser usr2 = sysUserMapper.selectById(realConsultant);
|
|
@@ -232,7 +248,14 @@ public class TaMainUsherRecordServiceImpl extends ServiceImpl<TaMainUsherRecordM
|
232
|
248
|
add(phone);
|
233
|
249
|
add(usr2.getUsername() + " 有新客户来访, 请协助接待一下!");
|
234
|
250
|
}};
|
235
|
|
- miniApp.sendTPLMessage(tplId, openid, page, dt2);
|
|
251
|
+// miniApp.sendTPLMessage(tplId, openid, page, dt2);
|
|
252
|
+ if (miniApp.sendTPLMessage(tplId, openid, page, dt2).getCode() == -1) {
|
|
253
|
+ // 没有 formid 发短信
|
|
254
|
+ String tel = sysUserMapper.getPhoneByOpenid(openid);
|
|
255
|
+ if (null != tel) {
|
|
256
|
+ smsUtils.sendVisitor(tel, StringUtils.ifNull(visitorName, ""));
|
|
257
|
+ }
|
|
258
|
+ }
|
236
|
259
|
}
|
237
|
260
|
}
|
238
|
261
|
|
|
@@ -247,7 +270,7 @@ public class TaMainUsherRecordServiceImpl extends ServiceImpl<TaMainUsherRecordM
|
247
|
270
|
|
248
|
271
|
@Override
|
249
|
272
|
public boolean newRecordByMiniapp(TaMainUsherRecord taMainUsherRecord) throws Exception {
|
250
|
|
- Integer consultantId = taMainUsherRecord.getConsultantId();
|
|
273
|
+// Integer consultantId = taMainUsherRecord.getConsultantId();
|
251
|
274
|
//if (null == consultantId || consultantId < 1) {
|
252
|
275
|
// throw new Exception("置业顾问不能为空");
|
253
|
276
|
//}
|
|
@@ -256,149 +279,82 @@ public class TaMainUsherRecordServiceImpl extends ServiceImpl<TaMainUsherRecordM
|
256
|
279
|
throw new Exception("客户电话不能为空");
|
257
|
280
|
}
|
258
|
281
|
|
|
282
|
+ TaCustomer taCustomer = getOrNewCustomerBy(taMainUsherRecord);
|
259
|
283
|
taMainUsherRecord.setStatus(StatusUtils.Normal);
|
260
|
|
-
|
261
|
|
- // 是否更新了置业
|
262
|
|
- TaCustomer taCustomer = null;
|
263
|
|
- if (null != taMainUsherRecord.getCustomerId()) {
|
264
|
|
- taCustomer = iTaCustomerService.getById(taMainUsherRecord.getCustomerId());
|
265
|
|
- } else if (null != taMainUsherRecord.getPhone() || null != taMainUsherRecord.getPlateNumber()) {
|
266
|
|
- // 尝试使用手机号去查找
|
267
|
|
- taCustomer = iTaCustomerService.getByPhoneOrPlate(taMainUsherRecord.getPhone(), taMainUsherRecord.getPlateNumber());
|
268
|
|
- } else if (null != taMainUsherRecord.getAvatar()) {
|
269
|
|
- // 依据人脸查询
|
270
|
|
- JSONObject result = aliFaceUtils.searchFace(taMainUsherRecord.getAvatar());
|
271
|
|
- if (null != result) {
|
272
|
|
- Integer personId = Integer.valueOf(result.getString("personId"));
|
273
|
|
- taCustomer = iTaCustomerService.getSameByPerson(personId);
|
|
284
|
+ taMainUsherRecord.setVisiteDate(LocalDateTime.now());
|
|
285
|
+ taMainUsherRecord.setCustomerId(taCustomer.getCustomerId());
|
|
286
|
+
|
|
287
|
+ TaMainUsherRecord taMainUsherRecordToday = getTodayRecord(taCustomer.getCustomerId());
|
|
288
|
+
|
|
289
|
+ if (null == taMainUsherRecordToday) {
|
|
290
|
+ int row = taMainUsherRecordMapper.insert(taMainUsherRecord);
|
|
291
|
+ if (row < 1) {
|
|
292
|
+ log.error("新增跟进记录失败");
|
|
293
|
+ return false;
|
274
|
294
|
}
|
275
|
|
- }
|
276
|
|
-
|
277
|
|
- if (null == taCustomer){
|
278
|
|
- // 新增客户
|
279
|
|
- TaCustomer taCustomerNew = iTaCustomerService.newCustByMainUsher(taMainUsherRecord, true);
|
280
|
|
-
|
281
|
|
- taMainUsherRecord.setVisiteDate(LocalDateTime.now());
|
282
|
|
- taMainUsherRecord.setCustomerId(taCustomerNew.getCustomerId());
|
283
|
|
- return taMainUsherRecordMapper.insert(taMainUsherRecord) > 0;
|
|
295
|
+ return updateByMiniapp(taMainUsherRecord, taCustomer);
|
284
|
296
|
}else {
|
285
|
|
-
|
286
|
|
- TaMainUsherRecord taMainUsherRecordToday = getTodayRecord(taCustomer.getCustomerId());
|
287
|
|
-
|
288
|
|
- if (null == taMainUsherRecordToday) {
|
289
|
|
- int row = taMainUsherRecordMapper.insert(taMainUsherRecord);
|
290
|
|
- if (row < 1) {
|
291
|
|
- log.error("新增跟进记录失败");
|
292
|
|
- return false;
|
293
|
|
- }
|
294
|
|
- return updateByMiniapp(taMainUsherRecord);
|
295
|
|
- }else {
|
296
|
|
- taMainUsherRecordToday = newRecordByCust(taCustomer, sysUserMapper.selectById(taCustomer.getConsultantId()));
|
297
|
|
-
|
298
|
|
- if (!StringUtils.isEmpty(taMainUsherRecord.getPhone())){
|
299
|
|
- taMainUsherRecordToday.setPhone(taMainUsherRecord.getPhone());
|
300
|
|
- }
|
301
|
|
-
|
302
|
|
- if (!StringUtils.isEmpty(taMainUsherRecord.getPersonName())){
|
303
|
|
- taMainUsherRecordToday.setPersonName(taMainUsherRecord.getPersonName());
|
304
|
|
- }
|
305
|
|
- if (!StringUtils.isEmpty(taMainUsherRecord.getPurpose())){
|
306
|
|
- taMainUsherRecordToday.setPurpose(taMainUsherRecord.getPurpose());
|
307
|
|
- }
|
308
|
|
- if (!taMainUsherRecord.getAppointment()){
|
309
|
|
- taMainUsherRecordToday.setAppointment(taMainUsherRecord.getAppointment());
|
310
|
|
- taMainUsherRecordToday.setAppointmentId(taMainUsherRecord.getAppointmentId());
|
311
|
|
- }
|
312
|
|
- if (null != taMainUsherRecord.getPersonNum()){
|
313
|
|
- taMainUsherRecordToday.setPersonNum(taMainUsherRecord.getPersonNum());
|
314
|
|
- }
|
315
|
|
- if (!StringUtils.isEmpty(taMainUsherRecord.getCarModel())){
|
316
|
|
- taMainUsherRecordToday.setCarModel(taMainUsherRecord.getCarModel());
|
317
|
|
- }
|
318
|
|
- if (!StringUtils.isEmpty(taMainUsherRecord.getPlateNumber())){
|
319
|
|
- taMainUsherRecordToday.setPlateNumber(taMainUsherRecord.getPlateNumber());
|
320
|
|
- }
|
321
|
|
- if (!StringUtils.isEmpty(taMainUsherRecord.getColor())){
|
322
|
|
- taMainUsherRecordToday.setColor(taMainUsherRecord.getColor());
|
323
|
|
- }
|
324
|
|
- if (!StringUtils.isEmpty(taMainUsherRecord.getAvatar())){
|
325
|
|
- taMainUsherRecordToday.setAvatar(taMainUsherRecord.getAvatar());
|
326
|
|
- }
|
327
|
|
- return updateByMiniapp(taMainUsherRecordToday);
|
|
297
|
+// taMainUsherRecordToday = newRecordByCust(taCustomer, sysUserMapper.selectById(taCustomer.getConsultantId()));
|
|
298
|
+ if (!StringUtils.isEmpty(taMainUsherRecord.getPhone())){
|
|
299
|
+ taMainUsherRecordToday.setPhone(taMainUsherRecord.getPhone());
|
|
300
|
+ }
|
|
301
|
+
|
|
302
|
+ if (!StringUtils.isEmpty(taMainUsherRecord.getPersonName())){
|
|
303
|
+ taMainUsherRecordToday.setPersonName(taMainUsherRecord.getPersonName());
|
|
304
|
+ }
|
|
305
|
+ if (!StringUtils.isEmpty(taMainUsherRecord.getPurpose())){
|
|
306
|
+ taMainUsherRecordToday.setPurpose(taMainUsherRecord.getPurpose());
|
|
307
|
+ }
|
|
308
|
+ if (!taMainUsherRecord.getAppointment()){
|
|
309
|
+ taMainUsherRecordToday.setAppointment(taMainUsherRecord.getAppointment());
|
|
310
|
+ taMainUsherRecordToday.setAppointmentId(taMainUsherRecord.getAppointmentId());
|
|
311
|
+ }
|
|
312
|
+ if (null != taMainUsherRecord.getPersonNum()){
|
|
313
|
+ taMainUsherRecordToday.setPersonNum(taMainUsherRecord.getPersonNum());
|
328
|
314
|
}
|
|
315
|
+ if (!StringUtils.isEmpty(taMainUsherRecord.getCarModel())){
|
|
316
|
+ taMainUsherRecordToday.setCarModel(taMainUsherRecord.getCarModel());
|
|
317
|
+ }
|
|
318
|
+ if (!StringUtils.isEmpty(taMainUsherRecord.getPlateNumber())){
|
|
319
|
+ taMainUsherRecordToday.setPlateNumber(taMainUsherRecord.getPlateNumber());
|
|
320
|
+ }
|
|
321
|
+ if (!StringUtils.isEmpty(taMainUsherRecord.getColor())){
|
|
322
|
+ taMainUsherRecordToday.setColor(taMainUsherRecord.getColor());
|
|
323
|
+ }
|
|
324
|
+ if (!StringUtils.isEmpty(taMainUsherRecord.getAvatar())){
|
|
325
|
+ taMainUsherRecordToday.setAvatar(taMainUsherRecord.getAvatar());
|
|
326
|
+ }
|
|
327
|
+
|
|
328
|
+ // todo 可能有问题
|
|
329
|
+ taMainUsherRecordToday.setReceiver(taMainUsherRecord.getReceiver());
|
|
330
|
+
|
|
331
|
+ return updateByMiniapp(taMainUsherRecordToday, taCustomer);
|
329
|
332
|
}
|
330
|
|
-
|
331
|
|
-
|
332
|
333
|
}
|
333
|
334
|
|
334
|
335
|
@Override
|
335
|
|
- public boolean updateByMiniapp(TaMainUsherRecord taMainUsherRecord) throws Exception {
|
336
|
|
- Integer consultantId = taMainUsherRecord.getConsultantId();
|
337
|
|
- //if (null == consultantId || consultantId < 1) {
|
338
|
|
- // throw new Exception("置业顾问不能为空");
|
339
|
|
- //}
|
340
|
|
-
|
|
336
|
+ public boolean updateByMiniapp(TaMainUsherRecord taMainUsherRecord, TaCustomer taCustomer) throws Exception {
|
341
|
337
|
if (StringUtils.isEmpty(taMainUsherRecord.getPhone())) {
|
342
|
338
|
throw new Exception("客户电话不能为空");
|
343
|
339
|
}
|
344
|
340
|
|
345
|
|
- taMainUsherRecord.setStatus(StatusUtils.Normal);
|
346
|
|
-
|
347
|
|
- // 是否更新了置业
|
348
|
|
- TaCustomer taCustomer = null;
|
349
|
|
- if (null != taMainUsherRecord.getCustomerId()) {
|
350
|
|
- taCustomer = iTaCustomerService.getById(taMainUsherRecord.getCustomerId());
|
351
|
|
- } else if (null != taMainUsherRecord.getPhone() || null != taMainUsherRecord.getPlateNumber()) {
|
352
|
|
- // 尝试使用手机号去查找
|
353
|
|
- taCustomer = iTaCustomerService.getByPhoneOrPlate(taMainUsherRecord.getPhone(), taMainUsherRecord.getPlateNumber());
|
354
|
|
- } else if (null != taMainUsherRecord.getAvatar()) {
|
355
|
|
- // 依据人脸查询
|
356
|
|
- JSONObject result = aliFaceUtils.searchFace(taMainUsherRecord.getAvatar());
|
357
|
|
- if (null != result) {
|
358
|
|
- Integer personId = Integer.valueOf(result.getString("personId"));
|
359
|
|
- taCustomer = iTaCustomerService.getSameByPerson(personId);
|
360
|
|
- }
|
|
341
|
+ if (null == taCustomer) {
|
|
342
|
+ taCustomer = getOrNewCustomerBy(taMainUsherRecord);
|
361
|
343
|
}
|
362
|
344
|
|
363
|
|
- if (null == taCustomer && null == taMainUsherRecord.getCustomerId()) {
|
364
|
|
- taCustomer = iTaCustomerService.newCustByMainUsher(taMainUsherRecord, false);
|
|
345
|
+ taMainUsherRecord.setStatus(StatusUtils.Normal);
|
|
346
|
+ taMainUsherRecord.setVisiteDate(LocalDateTime.now());
|
|
347
|
+ taMainUsherRecord.setCustomerId(taCustomer.getCustomerId());
|
|
348
|
+ int row = 0;
|
|
349
|
+ if (null == taMainUsherRecord.getRecId()) {
|
|
350
|
+ row = taMainUsherRecordMapper.insert(taMainUsherRecord);
|
|
351
|
+ } else {
|
|
352
|
+ row = taMainUsherRecordMapper.updateById(taMainUsherRecord);
|
365
|
353
|
}
|
366
|
354
|
|
|
355
|
+ Integer consultantId = taMainUsherRecord.getConsultantId();
|
367
|
356
|
Integer originConsultant = taCustomer.getConsultantId();
|
368
|
357
|
|
369
|
|
- // 是否需要更新客户信息
|
370
|
|
- // 只更新空内容
|
371
|
|
- if (StringUtils.isEmpty(taCustomer.getCustomerName()) || StringUtils.isEmpty(taCustomer.getPhone()) || StringUtils.isEmpty(taCustomer.getAvatar())
|
372
|
|
- || StringUtils.isEmpty(taCustomer.getPlateNumber() )) {
|
373
|
|
- if (StringUtils.isEmpty(taCustomer.getCustomerName())) {
|
374
|
|
- taCustomer.setCustomerName(taMainUsherRecord.getPersonName());
|
375
|
|
- }
|
376
|
|
-
|
377
|
|
- if (StringUtils.isEmpty(taCustomer.getPhone())) {
|
378
|
|
- taCustomer.setPhone(taMainUsherRecord.getPhone());
|
379
|
|
- }
|
380
|
|
-
|
381
|
|
- if (null == taCustomer.getSex()) {
|
382
|
|
- taCustomer.setSex(taMainUsherRecord.getSex());
|
383
|
|
- }
|
384
|
|
-
|
385
|
|
- if (StringUtils.isEmpty(taCustomer.getAvatar())) {
|
386
|
|
- taCustomer.setAvatar(taMainUsherRecord.getAvatar());
|
387
|
|
- }
|
388
|
|
-
|
389
|
|
- if (StringUtils.isEmpty(taCustomer.getPlateNumber())) {
|
390
|
|
- taCustomer.setPlateNumber(taMainUsherRecord.getPlateNumber());
|
391
|
|
- }
|
392
|
|
-
|
393
|
|
- if (StringUtils.isEmpty(taCustomer.getCarModel())) {
|
394
|
|
- taCustomer.setCarModel(taMainUsherRecord.getCarModel());
|
395
|
|
- }
|
396
|
|
-
|
397
|
|
- iTaCustomerService.updateById(taCustomer);
|
398
|
|
- }
|
399
|
|
-
|
400
|
|
- int row = taMainUsherRecordMapper.updateById(taMainUsherRecord);
|
401
|
|
-
|
402
|
358
|
// 更新人员信息
|
403
|
359
|
iTaPersonService.updateByMainUsher(taMainUsherRecord);
|
404
|
360
|
|
|
@@ -431,7 +387,13 @@ public class TaMainUsherRecordServiceImpl extends ServiceImpl<TaMainUsherRecordM
|
431
|
387
|
dt1.add(taCustomer.getPhone());
|
432
|
388
|
dt1.add("您有新客户来访, 已被安排给 " + proxyUser.getUsername() + " 接待!");
|
433
|
389
|
|
434
|
|
- miniApp.sendTPLMessage(tplId, rcOpenid, page, dt1);
|
|
390
|
+// miniApp.sendTPLMessage(tplId, rcOpenid, page, dt1);
|
|
391
|
+ if (miniApp.sendTPLMessage(tplId, rcOpenid, page, dt1).getCode() == -1) { // 没有 formid 发短信
|
|
392
|
+ String phone = sysUserMapper.getPhoneByOpenid(rcOpenid);
|
|
393
|
+ if (null != phone) {
|
|
394
|
+ smsUtils.sendVisitor(phone, StringUtils.ifNull(taCustomer.getCustomerName(), ""));
|
|
395
|
+ }
|
|
396
|
+ }
|
435
|
397
|
|
436
|
398
|
// 通知临时置业
|
437
|
399
|
List<Object> dt2 = new ArrayList<Object>();
|
|
@@ -439,7 +401,13 @@ public class TaMainUsherRecordServiceImpl extends ServiceImpl<TaMainUsherRecordM
|
439
|
401
|
dt2.add(taCustomer.getPhone());
|
440
|
402
|
dt2.add(rcUser.getUsername() + " 有新客户来访, 请协助接待一下!");
|
441
|
403
|
|
442
|
|
- miniApp.sendTPLMessage(tplId, proxyOpenid, page, dt2);
|
|
404
|
+// miniApp.sendTPLMessage(tplId, proxyOpenid, page, dt2);
|
|
405
|
+ if (miniApp.sendTPLMessage(tplId, proxyOpenid, page, dt2).getCode() == -1) { // 没有 formid 发短信
|
|
406
|
+ String phone = sysUserMapper.getPhoneByOpenid(proxyOpenid);
|
|
407
|
+ if (null != phone) {
|
|
408
|
+ smsUtils.sendVisitor(phone, StringUtils.ifNull(taCustomer.getCustomerName(), ""));
|
|
409
|
+ }
|
|
410
|
+ }
|
443
|
411
|
}
|
444
|
412
|
|
445
|
413
|
//通知前端
|
|
@@ -451,6 +419,65 @@ public class TaMainUsherRecordServiceImpl extends ServiceImpl<TaMainUsherRecordM
|
451
|
419
|
return row > 0;
|
452
|
420
|
}
|
453
|
421
|
|
|
422
|
+ private TaCustomer getOrNewCustomerBy(TaMainUsherRecord taMainUsherRecord) throws Exception {
|
|
423
|
+ // 是否更新了置业
|
|
424
|
+ TaCustomer taCustomer = null;
|
|
425
|
+ if (null != taMainUsherRecord.getCustomerId()) {
|
|
426
|
+ taCustomer = iTaCustomerService.getById(taMainUsherRecord.getCustomerId());
|
|
427
|
+ } else if (null != taMainUsherRecord.getPhone() || null != taMainUsherRecord.getPlateNumber()) {
|
|
428
|
+ // 尝试使用手机号去查找
|
|
429
|
+ taCustomer = iTaCustomerService.getByPhoneOrPlate(taMainUsherRecord.getPhone(), taMainUsherRecord.getPlateNumber());
|
|
430
|
+ } else if (null != taMainUsherRecord.getPersonId()) {
|
|
431
|
+ // 依据人员ID 查询
|
|
432
|
+ TaPerson taPerson = iTaPersonService.getById(taMainUsherRecord.getPersonId());
|
|
433
|
+ taCustomer = taCustomerMapper.getCustomerOf(taPerson.getPersonId(), taPerson.getRealId());
|
|
434
|
+ }
|
|
435
|
+
|
|
436
|
+ if (null != taMainUsherRecord.getAvatar() && null == taCustomer) {
|
|
437
|
+ // 依据人脸查询
|
|
438
|
+ JSONObject result = aliFaceUtils.searchFace(taMainUsherRecord.getAvatar());
|
|
439
|
+ if (null != result) {
|
|
440
|
+ Integer personId = Integer.valueOf(result.getString("personId"));
|
|
441
|
+ taCustomer = iTaCustomerService.getSameByPerson(personId);
|
|
442
|
+ }
|
|
443
|
+ }
|
|
444
|
+
|
|
445
|
+ if (null == taCustomer) {
|
|
446
|
+ taCustomer = iTaCustomerService.newCustByMainUsher(taMainUsherRecord, true);
|
|
447
|
+ } else {
|
|
448
|
+ // 是否需要更新客户信息
|
|
449
|
+ // 只更新空内容
|
|
450
|
+ taCustomer.setReceiver(taMainUsherRecord.getReceiver());
|
|
451
|
+ if (StringUtils.isEmpty(taCustomer.getCustomerName())) {
|
|
452
|
+ taCustomer.setCustomerName(taMainUsherRecord.getPersonName());
|
|
453
|
+ }
|
|
454
|
+
|
|
455
|
+ if (StringUtils.isEmpty(taCustomer.getPhone())) {
|
|
456
|
+ taCustomer.setPhone(taMainUsherRecord.getPhone());
|
|
457
|
+ }
|
|
458
|
+
|
|
459
|
+ if (null == taCustomer.getSex()) {
|
|
460
|
+ taCustomer.setSex(taMainUsherRecord.getSex());
|
|
461
|
+ }
|
|
462
|
+
|
|
463
|
+ if (StringUtils.isEmpty(taCustomer.getAvatar())) {
|
|
464
|
+ taCustomer.setAvatar(taMainUsherRecord.getAvatar());
|
|
465
|
+ }
|
|
466
|
+
|
|
467
|
+ if (StringUtils.isEmpty(taCustomer.getPlateNumber())) {
|
|
468
|
+ taCustomer.setPlateNumber(taMainUsherRecord.getPlateNumber());
|
|
469
|
+ }
|
|
470
|
+
|
|
471
|
+ if (StringUtils.isEmpty(taCustomer.getCarModel())) {
|
|
472
|
+ taCustomer.setCarModel(taMainUsherRecord.getCarModel());
|
|
473
|
+ }
|
|
474
|
+
|
|
475
|
+ iTaCustomerService.updateById(taCustomer);
|
|
476
|
+ }
|
|
477
|
+
|
|
478
|
+ return taCustomer;
|
|
479
|
+ }
|
|
480
|
+
|
454
|
481
|
@Override
|
455
|
482
|
public boolean deleteRecord(Integer id) {
|
456
|
483
|
UpdateWrapper<TaMainUsherRecord> updateWrapper = new UpdateWrapper<>();
|
|
@@ -615,6 +642,28 @@ public class TaMainUsherRecordServiceImpl extends ServiceImpl<TaMainUsherRecordM
|
615
|
642
|
return taMainUsherRecord;
|
616
|
643
|
}
|
617
|
644
|
|
|
645
|
+ /**
|
|
646
|
+ * 合并 source 到 target, 并且删除 source
|
|
647
|
+ * @param source
|
|
648
|
+ * @param target
|
|
649
|
+ * @return
|
|
650
|
+ */
|
|
651
|
+ @Override
|
|
652
|
+ public TaMainUsherRecord mergeAndDelete(TaMainUsherRecord source, TaMainUsherRecord target) {
|
|
653
|
+ if (null == source) return target;
|
|
654
|
+ if (null == target) return source;
|
|
655
|
+
|
|
656
|
+ // 合并为空的字段
|
|
657
|
+ target.setPersonId(ifIntNvl(target.getPersonId(), source.getPersonId()));
|
|
658
|
+ target.setPersonName(StringUtils.ifNull(target.getPersonName(), source.getPersonName()));
|
|
659
|
+
|
|
660
|
+ return null;
|
|
661
|
+ }
|
|
662
|
+
|
|
663
|
+ private Integer ifIntNvl(Integer a, Integer b) {
|
|
664
|
+ return null == a ? b : a;
|
|
665
|
+ }
|
|
666
|
+
|
618
|
667
|
private TaMainUsherRecord newRecordByPerson(TaPerson taPerson) {
|
619
|
668
|
TaMainUsherRecord taMainUsherRecord = new TaMainUsherRecord();
|
620
|
669
|
taMainUsherRecord.setPersonName(taPerson.getName());
|