| 
														
															@@ -21,10 +21,7 @@ import com.fs.crm.domain.*; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import com.fs.crm.dto.CrmCustomerAssignCompanyDTO; 
														 | 
														
														 | 
														
															 import com.fs.crm.dto.CrmCustomerAssignCompanyDTO; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import com.fs.crm.dto.CrmCustomerAssignUserDTO; 
														 | 
														
														 | 
														
															 import com.fs.crm.dto.CrmCustomerAssignUserDTO; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import com.fs.crm.enums.CustomerLogEnum; 
														 | 
														
														 | 
														
															 import com.fs.crm.enums.CustomerLogEnum; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-import com.fs.crm.mapper.CrmCustomerAssignMapper; 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-import com.fs.crm.mapper.CrmCustomerLogsMapper; 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-import com.fs.crm.mapper.CrmCustomerMapper; 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-import com.fs.crm.mapper.CrmCustomerUserMapper; 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+import com.fs.crm.mapper.*; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import com.fs.crm.param.*; 
														 | 
														
														 | 
														
															 import com.fs.crm.param.*; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import com.fs.crm.service.ICrmCustomerService; 
														 | 
														
														 | 
														
															 import com.fs.crm.service.ICrmCustomerService; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import com.fs.crm.service.ICrmMsgService; 
														 | 
														
														 | 
														
															 import com.fs.crm.service.ICrmMsgService; 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -36,10 +33,12 @@ import com.fs.system.service.ISysDictTypeService; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import lombok.Synchronized; 
														 | 
														
														 | 
														
															 import lombok.Synchronized; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import org.springframework.beans.BeanUtils; 
														 | 
														
														 | 
														
															 import org.springframework.beans.BeanUtils; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import org.springframework.beans.factory.annotation.Autowired; 
														 | 
														
														 | 
														
															 import org.springframework.beans.factory.annotation.Autowired; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import org.springframework.stereotype.Service; 
														 | 
														
														 | 
														
															 import org.springframework.stereotype.Service; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import org.springframework.transaction.annotation.Transactional; 
														 | 
														
														 | 
														
															 import org.springframework.transaction.annotation.Transactional; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import java.util.*; 
														 | 
														
														 | 
														
															 import java.util.*; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+import java.util.concurrent.CompletableFuture; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 /** 
														 | 
														
														 | 
														
															 /** 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  * 客户Service业务层处理 
														 | 
														
														 | 
														
															  * 客户Service业务层处理 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -70,10 +69,14 @@ public class CrmCustomerServiceImpl extends ServiceImpl<CrmCustomerMapper, CrmCu 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     @Autowired 
														 | 
														
														 | 
														
															     @Autowired 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     private CrmCustomerAssignMapper assignMapper; 
														 | 
														
														 | 
														
															     private CrmCustomerAssignMapper assignMapper; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     @Autowired 
														 | 
														
														 | 
														
															     @Autowired 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    private CrmCustomerAssistMapper assistMapper; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    @Autowired 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     private JpushService jpushService; 
														 | 
														
														 | 
														
															     private JpushService jpushService; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															     @Autowired 
														 | 
														
														 | 
														
															     @Autowired 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     private ISysDictTypeService dictTypeService; 
														 | 
														
														 | 
														
															     private ISysDictTypeService dictTypeService; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    @Autowired 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    private ThreadPoolTaskExecutor threadPoolTaskExecutor; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     /** 
														 | 
														
														 | 
														
															     /** 
														 | 
													
												
											
												
													
														| 
														 | 
														
															      * 查询客户 
														 | 
														
														 | 
														
															      * 查询客户 
														 | 
													
												
											
												
													
														| 
														 | 
														
															      * 
														 | 
														
														 | 
														
															      * 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -259,7 +262,21 @@ public class CrmCustomerServiceImpl extends ServiceImpl<CrmCustomerMapper, CrmCu 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															     @Override 
														 | 
														
														 | 
														
															     @Override 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     public List<CrmMyCustomerListQueryVO> selectCrmMyCustomerListQuery(CrmMyCustomerListQueryParam param) { 
														 | 
														
														 | 
														
															     public List<CrmMyCustomerListQueryVO> selectCrmMyCustomerListQuery(CrmMyCustomerListQueryParam param) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        return crmCustomerMapper.selectCrmMyCustomerListQuery(param); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        List<CrmMyCustomerListQueryVO> vos = crmCustomerMapper.selectCrmMyCustomerListQuery(param); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        if (vos != null && !vos.isEmpty()){ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            List<CompletableFuture<Void>> futures = new ArrayList<>(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            vos.forEach(vo -> { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                CompletableFuture<Void> future = CompletableFuture.runAsync(() -> { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                    List<String> companyUserName = assistMapper.selectCompanyUserNameByCustomerId(vo.getCustomerId()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                    vo.setAssistUser(companyUserName); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                }, threadPoolTaskExecutor); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                futures.add(future); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            }); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            // 等待所有任务完成 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            CompletableFuture.allOf(futures.toArray(new CompletableFuture[0])).join(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        return vos; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     } 
														 | 
														
														 | 
														
															     } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															     @Override 
														 | 
														
														 | 
														
															     @Override 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -378,6 +395,8 @@ public class CrmCustomerServiceImpl extends ServiceImpl<CrmCustomerMapper, CrmCu 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         customer.setPoolTime(new Date()); 
														 | 
														
														 | 
														
															         customer.setPoolTime(new Date()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         customer.setCustomerUserId(0L); 
														 | 
														
														 | 
														
															         customer.setCustomerUserId(0L); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         crmCustomerMapper.updateCrmCustomer(customer); 
														 | 
														
														 | 
														
															         crmCustomerMapper.updateCrmCustomer(customer); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        //删除该客户所有协作人 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        assistMapper.deleteCrmCustomerAssistByCustomerId(crmCustomerUser.getCustomerId()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         //写日志 
														 | 
														
														 | 
														
															         //写日志 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         CrmCustomerLogs logs=new CrmCustomerLogs(); 
														 | 
														
														 | 
														
															         CrmCustomerLogs logs=new CrmCustomerLogs(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         logs.setCustomerId(customer.getCustomerId()); 
														 | 
														
														 | 
														
															         logs.setCustomerId(customer.getCustomerId()); 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -777,6 +796,46 @@ public class CrmCustomerServiceImpl extends ServiceImpl<CrmCustomerMapper, CrmCu 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         return R.ok("分配成功"); 
														 | 
														
														 | 
														
															         return R.ok("分配成功"); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     } 
														 | 
														
														 | 
														
															     } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    @Override 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    public R assistToUser(String opeUserName, Long opeUserId, CrmCustomeAssignParam param) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        Integer index=0; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        for(CrmCustomerAssignUserDTO userDTO:param.getUsers()){ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            CompanyUser companyUser=companyUserMapper.selectCompanyUserById(userDTO.getCompanyUserId()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            for(int i=0;i<userDTO.getCount();i++){ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                CrmCustomer customer=crmCustomerMapper.selectCrmCustomerById(param.getCustomerIds().get(index)); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                CrmCustomerAssist customerAssist=new CrmCustomerAssist(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                customerAssist.setCompanyId(param.getCompanyId()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                customerAssist.setCompanyUserId(userDTO.getCompanyUserId()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                customerAssist.setCompanyUserName(companyUser.getNickName()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                customerAssist.setCustomerId(customer.getCustomerId()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                customerAssist.setCreateTime(new Date()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                assistMapper.insertCrmCustomerAssist(customerAssist); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                //写日志 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                CrmCustomerLogs logs=new CrmCustomerLogs(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                logs.setCustomerId(customer.getCustomerId()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                logs.setCreateTime(new Date()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                logs.setLogsType(CustomerLogEnum.ASSIST_USER.getValue()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                logs.setTitle(CustomerLogEnum.ASSIST_USER.getDesc()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                logs.setRemark(opeUserName+"为客户"+customer.getCustomerName()+"添加协作人:" + companyUser.getNickName()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                logs.setCompanyUserId(userDTO.getCompanyUserId()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                logsMapper.insertCrmCustomerLogs(logs); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                if(StringUtils.isNotEmpty(companyUser.getJpushId())){ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                    Map<String, String> extrasMap=new HashMap<>(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                    extrasMap.put("customerId",customer.getCustomerId().toString()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                    extrasMap.put("type","1"); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                    try { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                        jpushService.sendRegisterIdPush("客户消息","您收到 一个客户协作邀请",extrasMap,companyUser.getJpushId()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                    } catch (APIConnectionException e) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                    } catch (APIRequestException e) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                    } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                index++; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        return R.ok(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     @Override 
														 | 
														
														 | 
														
															     @Override 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     public int updateCrmCustomerSource(CrmCustomerEditSourceParam param) { 
														 | 
														
														 | 
														
															     public int updateCrmCustomerSource(CrmCustomerEditSourceParam param) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         return crmCustomerMapper.updateCrmCustomerSource(param); 
														 | 
														
														 | 
														
															         return crmCustomerMapper.updateCrmCustomerSource(param); 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -870,4 +929,26 @@ public class CrmCustomerServiceImpl extends ServiceImpl<CrmCustomerMapper, CrmCu 
														 | 
													
												
											
												
													
														| 
														 | 
														
															    public List<CrmCustomerListVO> selectCrmCustomer1(){ 
														 | 
														
														 | 
														
															    public List<CrmCustomerListVO> selectCrmCustomer1(){ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         return crmCustomerMapper.selectCrmCustomer1(); 
														 | 
														
														 | 
														
															         return crmCustomerMapper.selectCrmCustomer1(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															    } 
														 | 
														
														 | 
														
															    } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    @Override 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    public List<CrmMyCustomerListQueryVO> selectCrmMyAssistListQuery(CrmMyCustomerListQueryParam param) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        List<CrmMyCustomerListQueryVO> vos = crmCustomerMapper.selectCrmMyAssistListQuery(param); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        if (vos != null && !vos.isEmpty()){ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            List<CompletableFuture<Void>> futures = new ArrayList<>(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            vos.forEach(vo -> { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                CompletableFuture<Void> future = CompletableFuture.runAsync(() -> { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                    CompanyUser companyUser = companyUserMapper.selectCompanyUserById(vo.getCompanyUserId()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                    ArrayList<String> list = new ArrayList<>(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                    list.add(companyUser.getNickName()+"(" + companyUser.getUserId() + ")"); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                    vo.setAssistUser(list); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                }, threadPoolTaskExecutor); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                futures.add(future); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            }); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            // 等待所有任务完成 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            CompletableFuture.allOf(futures.toArray(new CompletableFuture[0])).join(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        return vos; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 } 
														 | 
														
														 | 
														
															 } 
														 |