瀏覽代碼

1、更新接口,新增时 执行 删除原有联系人

liqihao 1 年之前
父節點
當前提交
a7c99ff790

+ 10 - 4
hx-customer/src/main/java/com/fjhx/customer/service/xiaoman/impl/XiaomanCustomerServiceImpl.java

@@ -125,11 +125,14 @@ public class XiaomanCustomerServiceImpl extends ServiceImpl<XiaomanCustomerMappe
     public void handleSaveOrUpdate(List<CustomerApiVo> customerApiVoList, Set<Long> allCustomer,boolean flag) {
         List<XiaomanCustomer> xiaomanCustomerList = new ArrayList<>(customerApiVoList);
         for (XiaomanCustomer customer : xiaomanCustomerList) {
-            if (allCustomer.contains(customer.getCompanyId())) {
-                processCustomer(customer, true,flag);
-            } else {
-                processCustomer(customer, false,flag);
+            if(customer.getCompanyId() == 16769466149910L){
+                if (allCustomer.contains(customer.getCompanyId())) {
+                    processCustomer(customer, true,flag);
+                } else {
+                    processCustomer(customer, false,flag);
+                }
             }
+
         }
     }
 
@@ -175,6 +178,9 @@ public class XiaomanCustomerServiceImpl extends ServiceImpl<XiaomanCustomerMappe
         extracted(vo, customer);
         //联系人
         if (!vo.getCustomers().isEmpty()){
+            //删除原有联系人
+            customerUserService.lambdaUpdate()
+                    .eq(CustomerUser::getCustomerId,customer.getId()).remove();
             for (CustomerInfoVo.Customer cus  : vo.getCustomers()){
                 if (StringUtils.isNotEmpty(cus.getEmail())){
                     CustomerUser customerUser = new CustomerUser();