|
@@ -640,6 +640,7 @@ public class TaCustomerServiceImpl extends ServiceImpl<TaCustomerMapper, TaCusto
|
640
|
640
|
return false;
|
641
|
641
|
}
|
642
|
642
|
|
|
643
|
+
|
643
|
644
|
TaCustomer customer = taCustomerMapper.selectById(customerId);
|
644
|
645
|
if (null == customer) {
|
645
|
646
|
return false;
|
|
@@ -649,42 +650,50 @@ public class TaCustomerServiceImpl extends ServiceImpl<TaCustomerMapper, TaCusto
|
649
|
650
|
if (null == taMainUsherRecord) {
|
650
|
651
|
return false;
|
651
|
652
|
}
|
652
|
|
-
|
653
|
|
- //原本有人脸先删在增
|
654
|
|
- if (!StringUtils.isEmpty(customer.getAvatar())){
|
655
|
|
- //阿里云删除人脸
|
656
|
|
- cameraService.deleteFace(taMainUsherRecord.getPersonId());
|
657
|
|
- }
|
658
|
|
-
|
659
|
|
- if (StringUtils.isEmpty(params.getString("avatar"))) {
|
660
|
|
- customer.setAvatar(params.getString("avatar"));
|
661
|
|
- taMainUsherRecord.setAvatar(params.getString("avatar"));
|
|
653
|
+
|
|
654
|
+ Integer newPerson = params.getInteger("personId");
|
|
655
|
+ Integer orignPerson = taMainUsherRecord.getPersonId();
|
|
656
|
+ if (orignPerson != newPerson) {
|
662
|
657
|
//解除人脸关系
|
663
|
|
- QueryWrapper<TaCustomerMap> customerMapQueryWrapper = new QueryWrapper<>();
|
664
|
|
- customerMapQueryWrapper.eq("person_id",taMainUsherRecord.getPersonId());
|
665
|
|
- taCustomerMapMapper.delete(customerMapQueryWrapper);
|
666
|
|
- taMainUsherRecord.setPersonId(null);
|
667
|
|
- }else {
|
668
|
|
- customer.setAvatar(params.getString("avatar"));
|
669
|
|
- taMainUsherRecord.setAvatar(params.getString("avatar"));
|
670
|
|
- // 修改人脸并下发
|
671
|
|
- TaPerson taPerson = iTaPersonService.getByIdOrReal(taMainUsherRecord.getPersonId());
|
672
|
|
- if (null == taPerson) {
|
673
|
|
- return false;
|
|
658
|
+ if (null != orignPerson) {
|
|
659
|
+ QueryWrapper<TaCustomerMap> customerMapQueryWrapper = new QueryWrapper<>();
|
|
660
|
+ customerMapQueryWrapper.eq("customer_id", customerId);
|
|
661
|
+ customerMapQueryWrapper.eq("person_id", orignPerson);
|
|
662
|
+ taCustomerMapMapper.delete(customerMapQueryWrapper);
|
|
663
|
+ }
|
|
664
|
+
|
|
665
|
+ // 生成新的人脸关系
|
|
666
|
+ if (null != newPerson) {
|
|
667
|
+ QueryWrapper<TaCustomerMap> wrapper = new QueryWrapper<>();
|
|
668
|
+// wrapper.eq("customer_id", customerId);
|
|
669
|
+ wrapper.eq("person_id", newPerson);
|
|
670
|
+ List<TaCustomerMap> customerMapList = taCustomerMapMapper.selectList(wrapper);
|
|
671
|
+ if (null != customerMapList && customerMapList.size() > 0) {
|
|
672
|
+ Integer custId = customerMapList.get(0).getCustomerId();
|
|
673
|
+ if (customerMapList.size() > 1 || customerId != custId) {
|
|
674
|
+ log.error("数据异常, 人员 {} 没有映射到 客户 {}", newPerson, customerId);
|
|
675
|
+ return false;
|
|
676
|
+ }
|
|
677
|
+ } else {
|
|
678
|
+ TaCustomerMap taCustomerMap = new TaCustomerMap();
|
|
679
|
+ taCustomerMap.setPersonId(newPerson);
|
|
680
|
+ taCustomerMap.setCustomerId(customerId);
|
|
681
|
+ taCustomerMapMapper.insert(taCustomerMap);
|
|
682
|
+ }
|
674
|
683
|
}
|
675
|
|
- taPerson.setAvatar(params.getString("avatar"));
|
676
|
|
- iTaPersonService.updateById(taPerson);
|
677
|
|
- cameraService.dispatchPerson(taPerson);
|
678
|
684
|
}
|
679
|
|
-
|
|
685
|
+
|
|
686
|
+ customer.setAvatar(params.getString("avatar"));
|
680
|
687
|
customer.setPlateNumber(params.getString("plateNumber"));
|
681
|
688
|
customer.setCarModel(params.getString("carModel"));
|
682
|
689
|
customer.setCarColor(params.getString("carColor"));
|
683
|
690
|
customer.setCarImage(params.getString("carImage"));
|
|
691
|
+ taMainUsherRecord.setAvatar(params.getString("avatar"));
|
684
|
692
|
taMainUsherRecord.setPlateNumber(params.getString("plateNumber"));
|
685
|
693
|
taMainUsherRecord.setCarModel(params.getString("carModel"));
|
686
|
694
|
taMainUsherRecord.setColor(params.getString("carColor"));
|
687
|
695
|
taMainUsherRecord.setCarImage(params.getString("carImage"));
|
|
696
|
+ taMainUsherRecord.setPersonId(newPerson);
|
688
|
697
|
|
689
|
698
|
customer.setReceiver(params.getString("receiver"));
|
690
|
699
|
taMainUsherRecord.setReceiver(params.getString("receiver"));
|