| 
					
				 | 
			
			
				@@ -15,6 +15,7 @@ using System.Linq; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 using System.Text; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 using System.Threading.Tasks; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 using System.Xml.Linq; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+using static Google.Protobuf.Reflection.SourceCodeInfo.Types; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 using static OASystem.Domain.Dtos.CRM.NewClientDataQueryDto; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 namespace OASystem.Infrastructure.Repositories.CRM 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -224,9 +225,16 @@ namespace OASystem.Infrastructure.Repositories.CRM 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 foreach (var item in NewClientDataView) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     Sys_SetData CategoryStr = _sqlSugar.Queryable<Sys_SetData>().Single(it => it.Id == item.Category); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    item.CategoryStr = CategoryStr != null ? CategoryStr.Name : null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (CategoryStr != null) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        item.CategoryStr = CategoryStr != null ? CategoryStr.Name : null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     Sys_SetData lvlStr = _sqlSugar.Queryable<Sys_SetData>().Single(it => it.Id == item.Lvlid); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    item.LvlidStr = lvlStr != null ? lvlStr.Name : null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (lvlStr != null) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        item.LvlidStr = lvlStr != null ? lvlStr.Name : null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 if (NewClientDataView.Count > 0) 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -343,7 +351,7 @@ namespace OASystem.Infrastructure.Repositories.CRM 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         foreach (var item in NewClientDataView) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             List<AscribedUser> AscribedUser = await _sqlSugar.SqlQueryable<AscribedUser> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                           ("select u1.UsersId as UserId ,u2.CnName,u1.NewClientDataId from Crm_ClientDataAndUser u1,Sys_Users u2 where u1.UsersId=u2.Id and NewClientDataId=" + item.Id + "   AND u1.ISDEL = 0").ToListAsync(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                           ("select u1.UsersId as UserId ,u2.CnName,u1.NewClientDataId from Crm_ClientDataAndUser u1,Sys_Users u2 where u1.UsersId=u2.Id and NewClientDataId=" + item.Id + " AND u1.ISDEL = 0").ToListAsync(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             item.AscribedUser = AscribedUser.Select(x=> x.UserId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             List<AscribedDepartment> AscribedDepartment = await _sqlSugar.SqlQueryable<AscribedDepartment> 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -359,6 +367,53 @@ namespace OASystem.Infrastructure.Repositories.CRM 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             Data = new { pageCount = count, totalPage = (int)totalPage, pageIndex = dto.PageIndex, pageSize = dto.PageSize, pageSource = NewClientDataView }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    else if (dto.PortType == 3) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        List<AscribedUser> AscribedUser = await _sqlSugar.SqlQueryable<AscribedUser> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                           ("select u1.UsersId as UserId ,u2.CnName,u1.NewClientDataId from Crm_ClientDataAndUser u1,Sys_Users u2 where u1.UsersId=u2.Id  AND u1.ISDEL = 0").ToListAsync(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        List<AscribedDepartment> AscribedDepartment = await _sqlSugar.SqlQueryable<AscribedDepartment> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                         ("select  d2.Id,d2.Name,d1.NewClientDataId  from Crm_ClientDataAndBusiness d1,Sys_SetData d2 where d1.SetDataId=d2.Id AND d1.ISDEL = 0").ToListAsync(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        List<NewClientDataIOSView> newClientDataIOSViews = new List<NewClientDataIOSView>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        foreach (var item in NewClientDataView) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                             
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            var ascribedUser = AscribedUser.Where(it => it.NewClientDataId == item.Id).Select(x => x.CnName).ToList(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            var ascribedDepartment = AscribedDepartment.Where(it => it.NewClientDataId == item.Id).Select(x => x.Name).ToList(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            newClientDataIOSViews.Add(new NewClientDataIOSView() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                Id = item.Id, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                RowNumber = item.RowNumber, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                CategoryStr = item.CategoryStr, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                LvlidStr = item.LvlidStr, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                AscribedUser = ascribedUser, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                AscribedDepartment = ascribedDepartment, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                Client = item.Client, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                Contact = item.Contact, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                Job = item.Job, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                Telephone = item.Telephone, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                Phone = item.Phone, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                Location = item.Location, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                Birthday = item.Birthday, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                Weight = item.Weight, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                PreDele = item.PreDele, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                FinlishedDele = item.FinlishedDele, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                Remark = item.Remark, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        result = new Result() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            Code = 0, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            Msg = "查询成功", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            Data = new { pageCount = count, totalPage = (int)totalPage, pageIndex = dto.PageIndex, pageSize = dto.PageSize, pageSource = newClientDataIOSViews }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 else 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 { 
			 |