|  |  | @ -117,16 +117,17 @@ public class CustomerService { | 
			
		
	
		
		
			
				
					
					|  |  |  |         insertCustomer.setExternalUserid(customerDTO.getExternalUserid()); |  |  |  |         insertCustomer.setExternalUserid(customerDTO.getExternalUserid()); | 
			
		
	
		
		
			
				
					
					|  |  |  |         String customerName = EmployeeService.filterEmoji(customerDTO.getName()); |  |  |  |         String customerName = EmployeeService.filterEmoji(customerDTO.getName()); | 
			
		
	
		
		
			
				
					
					|  |  |  |         insertCustomer.setName(customerName); |  |  |  |         insertCustomer.setName(customerName); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         insertCustomer.setCreateTime(opCustomer.getCreateTime()); | 
			
		
	
		
		
			
				
					
					|  |  |  |         if (null != opCustomer) { |  |  |  |         if (null != opCustomer) { | 
			
		
	
		
		
			
				
					
					|  |  |  |             //存在--1.处理客户导购关系。
 |  |  |  |             //存在--1.处理客户导购关系。
 | 
			
		
	
		
		
			
				
					
					|  |  |  |             sellerCustomerRelation(opCustomer, customerDTO.getStaffCode(), poiStore.getId(), poiStoreStaff.getUserId()); |  |  |  |             sellerCustomerRelation(opCustomer, customerDTO.getStaffCode(),opCustomer.getCreateTime(), poiStore.getId(), poiStoreStaff.getUserId()); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |             return opCustomer.getId(); |  |  |  |             return opCustomer.getId(); | 
			
		
	
		
		
			
				
					
					|  |  |  |         } else { |  |  |  |         } else { | 
			
		
	
		
		
			
				
					
					|  |  |  |             insertCustomer.setCreateBy(Constants.SYS_OPERATION); |  |  |  |             insertCustomer.setCreateBy(Constants.SYS_OPERATION); | 
			
		
	
		
		
			
				
					
					|  |  |  |             //不存在
 |  |  |  |             //不存在
 | 
			
		
	
		
		
			
				
					
					|  |  |  |             opCustomerDOMapper.insert(insertCustomer); |  |  |  |             opCustomerDOMapper.insert(insertCustomer); | 
			
		
	
		
		
			
				
					
					|  |  |  |             //添加关系
 |  |  |  |             //添加关系
 | 
			
		
	
		
		
			
				
					
					|  |  |  |             sellerCustomerRelation(insertCustomer, customerDTO.getStaffCode(), poiStore.getId(), poiStoreStaff.getUserId()); |  |  |  |             sellerCustomerRelation(insertCustomer, customerDTO.getStaffCode(),insertCustomer.getCreateTime(), poiStore.getId(), poiStoreStaff.getUserId()); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |             return insertCustomer.getId(); |  |  |  |             return insertCustomer.getId(); | 
			
		
	
		
		
			
				
					
					|  |  |  |         } |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
	
		
		
			
				
					|  |  | @ -203,9 +204,9 @@ public class CustomerService { | 
			
		
	
		
		
			
				
					
					|  |  |  |             } |  |  |  |             } | 
			
		
	
		
		
			
				
					
					|  |  |  |             if (poiStoreStaff != null) { |  |  |  |             if (poiStoreStaff != null) { | 
			
		
	
		
		
			
				
					
					|  |  |  |                 //存在--1.处理客户导购关系。
 |  |  |  |                 //存在--1.处理客户导购关系。
 | 
			
		
	
		
		
			
				
					
					|  |  |  |                 sellerCustomerRelation(opCustomer, turnBackDTOS.getEaCode(), poiStore.getStoreId(), poiStoreStaff.getId()); |  |  |  |                 sellerCustomerRelation(opCustomer, turnBackDTOS.getEaCode(),sdf.parse(turnBackDTOS.getJoinTime()), poiStore.getStoreId(), poiStoreStaff.getId()); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |             } else { |  |  |  |             } else { | 
			
		
	
		
		
			
				
					
					|  |  |  |                 storeCustomerRelation(opCustomer, poiStore.getStoreId()); |  |  |  |                 storeCustomerRelation(opCustomer,sdf.parse(turnBackDTOS.getJoinTime()), poiStore.getStoreId()); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |             } |  |  |  |             } | 
			
		
	
		
		
			
				
					
					|  |  |  |         } else { |  |  |  |         } else { | 
			
		
	
		
		
			
				
					
					|  |  |  |             insertCustomer.setCreateBy(Constants.SYS_OPERATION); |  |  |  |             insertCustomer.setCreateBy(Constants.SYS_OPERATION); | 
			
		
	
	
		
		
			
				
					|  |  | @ -219,9 +220,9 @@ public class CustomerService { | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |             if (poiStoreStaff != null) { |  |  |  |             if (poiStoreStaff != null) { | 
			
		
	
		
		
			
				
					
					|  |  |  |                 //添加关系
 |  |  |  |                 //添加关系
 | 
			
		
	
		
		
			
				
					
					|  |  |  |                 sellerCustomerRelation(insertCustomer, turnBackDTOS.getEaCode(), poiStore.getStoreId(), poiStoreStaff.getId()); |  |  |  |                 sellerCustomerRelation(insertCustomer, turnBackDTOS.getEaCode(),sdf.parse(turnBackDTOS.getJoinTime()), poiStore.getStoreId(), poiStoreStaff.getId()); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |             } else { |  |  |  |             } else { | 
			
		
	
		
		
			
				
					
					|  |  |  |                 storeCustomerRelation(insertCustomer, poiStore.getStoreId()); |  |  |  |                 storeCustomerRelation(insertCustomer, sdf.parse(turnBackDTOS.getJoinTime()),poiStore.getStoreId()); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |             } |  |  |  |             } | 
			
		
	
		
		
			
				
					
					|  |  |  |         } |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
	
		
		
			
				
					|  |  | @ -278,7 +279,7 @@ public class CustomerService { | 
			
		
	
		
		
			
				
					
					|  |  |  |      * @param opCustomer 客户的数据信息 |  |  |  |      * @param opCustomer 客户的数据信息 | 
			
		
	
		
		
			
				
					
					|  |  |  |      * @param staffCode  导购Code |  |  |  |      * @param staffCode  导购Code | 
			
		
	
		
		
			
				
					
					|  |  |  |      */ |  |  |  |      */ | 
			
		
	
		
		
			
				
					
					|  |  |  |     private void sellerCustomerRelation(OpCustomer opCustomer, String staffCode, long shopId, long sellerId) { |  |  |  |     private void sellerCustomerRelation(OpCustomer opCustomer, String staffCode,Date joinTime, long shopId, long sellerId) { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |         QueryWrapper<PoiStoreStaff> staf = new QueryWrapper<PoiStoreStaff>(); |  |  |  |         QueryWrapper<PoiStoreStaff> staf = new QueryWrapper<PoiStoreStaff>(); | 
			
		
	
		
		
			
				
					
					|  |  |  |         staf.eq("staff_code", staffCode).eq("status", 1).ne("user_id", 0).last("limit 1"); |  |  |  |         staf.eq("staff_code", staffCode).eq("status", 1).ne("user_id", 0).last("limit 1"); | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
	
		
		
			
				
					|  |  | @ -289,7 +290,7 @@ public class CustomerService { | 
			
		
	
		
		
			
				
					
					|  |  |  |         if (null == opSellerCustomerRelation) { |  |  |  |         if (null == opSellerCustomerRelation) { | 
			
		
	
		
		
			
				
					
					|  |  |  |             //不存在就添加
 |  |  |  |             //不存在就添加
 | 
			
		
	
		
		
			
				
					
					|  |  |  |             OpSellerCustomerRelation insertRelation = new OpSellerCustomerRelation(); |  |  |  |             OpSellerCustomerRelation insertRelation = new OpSellerCustomerRelation(); | 
			
		
	
		
		
			
				
					
					|  |  |  |             insertRelation.setCreateTime(new Date()); |  |  |  |             insertRelation.setCreateTime(joinTime); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |             insertRelation.setUpdateTime(new Date()); |  |  |  |             insertRelation.setUpdateTime(new Date()); | 
			
		
	
		
		
			
				
					
					|  |  |  |             insertRelation.setCustomerId(opCustomer.getId()); |  |  |  |             insertRelation.setCustomerId(opCustomer.getId()); | 
			
		
	
		
		
			
				
					
					|  |  |  |             insertRelation.setStoreId(shopId); |  |  |  |             insertRelation.setStoreId(shopId); | 
			
		
	
	
		
		
			
				
					|  |  | @ -312,14 +313,14 @@ public class CustomerService { | 
			
		
	
		
		
			
				
					
					|  |  |  |         } |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     private void storeCustomerRelation(OpCustomer opCustomer, long shopId) { |  |  |  |     private void storeCustomerRelation(OpCustomer opCustomer, Date joinTime,long shopId) { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |         QueryWrapper<OpSellerCustomerRelation> wrapper1 = new QueryWrapper<>(); |  |  |  |         QueryWrapper<OpSellerCustomerRelation> wrapper1 = new QueryWrapper<>(); | 
			
		
	
		
		
			
				
					
					|  |  |  |         wrapper1.eq("customer_id", opCustomer.getId()).eq("store_id", shopId).last("limit 1"); |  |  |  |         wrapper1.eq("customer_id", opCustomer.getId()).eq("store_id", shopId).last("limit 1"); | 
			
		
	
		
		
			
				
					
					|  |  |  |         OpSellerCustomerRelation opSellerCustomerRelation = opSellerCustomerRelationDOMapper.selectOne(wrapper1); |  |  |  |         OpSellerCustomerRelation opSellerCustomerRelation = opSellerCustomerRelationDOMapper.selectOne(wrapper1); | 
			
		
	
		
		
			
				
					
					|  |  |  |         if (null == opSellerCustomerRelation) { |  |  |  |         if (null == opSellerCustomerRelation) { | 
			
		
	
		
		
			
				
					
					|  |  |  |             //不存在就添加
 |  |  |  |             //不存在就添加
 | 
			
		
	
		
		
			
				
					
					|  |  |  |             OpSellerCustomerRelation insertRelation = new OpSellerCustomerRelation(); |  |  |  |             OpSellerCustomerRelation insertRelation = new OpSellerCustomerRelation(); | 
			
		
	
		
		
			
				
					
					|  |  |  |             insertRelation.setCreateTime(new Date()); |  |  |  |             insertRelation.setCreateTime(joinTime); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |             insertRelation.setUpdateTime(new Date()); |  |  |  |             insertRelation.setUpdateTime(new Date()); | 
			
		
	
		
		
			
				
					
					|  |  |  |             insertRelation.setCustomerId(opCustomer.getId()); |  |  |  |             insertRelation.setCustomerId(opCustomer.getId()); | 
			
		
	
		
		
			
				
					
					|  |  |  |             insertRelation.setStoreId(shopId); |  |  |  |             insertRelation.setStoreId(shopId); | 
			
		
	
	
		
		
			
				
					|  |  | 
 |