| 
					
				 | 
			
			
				@@ -2598,7 +2598,9 @@ FROM 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   ) Temp "); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             RefAsync<int> total = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            var groupData = await _sqlSugar.SqlQueryable<MarketingSalesGroupList>(sql).ToPageListAsync(_dto.PageIndex, _dto.PageSize, total); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            var groupData = await _sqlSugar.SqlQueryable<MarketingSalesGroupList>(sql) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                .Where(x => x.GroupSales > 0)  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                .ToPageListAsync(_dto.PageIndex, _dto.PageSize, total); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             return Ok(JsonView(true, "操作成功!", groupData, total)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -2668,6 +2670,18 @@ FROM 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 From Grp_DelegationInfo di 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 Left Join Sys_SetData sd On di.TeamDid = sd.Id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 Where di.Isdel = 0  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+And ( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  SELECT 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    CAST( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      COALESCE(SUM(ItemSumPrice * Rate), 0) AS DECIMAL(12, 2) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    ) AS GroupSales 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  FROM 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    Fin_ForeignReceivables fr 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  WHERE 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    fr.IsDel = 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    AND di.Id = fr.Diid 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    AND AddingWay IN (0, 1, 2) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+) > 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  {userSql}  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 And VisitDate Between '{beginDt}' And  '{endDt}' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 Group By [Name] 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -2681,6 +2695,18 @@ Order By Count Desc"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 From Grp_DelegationInfo di 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 Left Join Sys_SetData sd On di.TeamLevSId = sd.Id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 Where di.Isdel = 0  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+And ( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  SELECT 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    CAST( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      COALESCE(SUM(ItemSumPrice * Rate), 0) AS DECIMAL(12, 2) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    ) AS GroupSales 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  FROM 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    Fin_ForeignReceivables fr 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  WHERE 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    fr.IsDel = 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    AND di.Id = fr.Diid 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    AND AddingWay IN (0, 1, 2) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+) > 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  {userSql}  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 And VisitDate Between '{beginDt}' And  '{endDt}' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 Group By [Name] 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -2696,6 +2722,18 @@ Order By Count Desc"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 From Grp_DelegationInfo di 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 Left Join Sys_SetData sd On di.TeamDid = sd.Id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 Where di.Isdel = 0  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+And ( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  SELECT 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    CAST( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      COALESCE(SUM(ItemSumPrice * Rate), 0) AS DECIMAL(12, 2) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    ) AS GroupSales 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  FROM 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    Fin_ForeignReceivables fr 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  WHERE 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    fr.IsDel = 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    AND di.Id = fr.Diid 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    AND AddingWay IN (0, 1, 2) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+) > 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  {userSql}  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 And VisitDate Between '{beginDt}' And  '{endDt}' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 Group By [Name] 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -2709,6 +2747,18 @@ Order By Count Desc"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 From Grp_DelegationInfo di 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 Left Join Sys_SetData sd On di.TeamLevSId = sd.Id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 Where di.Isdel = 0  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+And ( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  SELECT 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    CAST( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      COALESCE(SUM(ItemSumPrice * Rate), 0) AS DECIMAL(12, 2) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    ) AS GroupSales 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  FROM 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    Fin_ForeignReceivables fr 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  WHERE 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    fr.IsDel = 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    AND di.Id = fr.Diid 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    AND AddingWay IN (0, 1, 2) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+) > 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  {userSql}  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 And VisitDate Between '{beginDt}' And  '{endDt}' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 Group By [Name] 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -2778,6 +2828,18 @@ Order By Count Desc"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	From Grp_DelegationInfo di 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	Left Join Sys_Users u On di.JietuanOperator = u.Id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	Where di.Isdel = 0  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	And ( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      SELECT 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        CAST( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          COALESCE(SUM(ItemSumPrice * Rate), 0) AS DECIMAL(12, 2) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        ) AS GroupSales 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      FROM 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Fin_ForeignReceivables fr 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      WHERE 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        fr.IsDel = 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        AND di.Id = fr.Diid 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        AND AddingWay IN (0, 1, 2) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    ) > 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      {userSql}  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	And VisitDate Between '{beginDt}' And  '{endDt}' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	Group By CnName"); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -2883,7 +2945,9 @@ FROM 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       AND VisitDate Between '{beginDt}' And  '{endDt}' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   ) Temp "); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             RefAsync<int> total = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            var groupData = await _sqlSugar.SqlQueryable<MarketingSalesGroupList>(sql).ToPageListAsync(_dto.PageIndex, _dto.PageSize, total); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            var groupData = await _sqlSugar.SqlQueryable<MarketingSalesGroupList>(sql) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                .Where(x => x.GroupSales > 0) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                .ToPageListAsync(_dto.PageIndex, _dto.PageSize, total); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             #endregion 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             #region 客户类型、客户等级 统计 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -2894,6 +2958,18 @@ FROM 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 From Grp_DelegationInfo di 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 Left Join Sys_SetData sd On di.TeamDid = sd.Id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 Where di.Isdel = 0  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+And ( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  SELECT 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    CAST( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      COALESCE(SUM(ItemSumPrice * Rate), 0) AS DECIMAL(12, 2) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    ) AS GroupSales 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  FROM 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    Fin_ForeignReceivables fr 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  WHERE 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    fr.IsDel = 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    AND di.Id = fr.Diid 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    AND AddingWay IN (0, 1, 2) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+) > 0  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  {userSql}  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 And VisitDate Between '{beginDt}' And  '{endDt}' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 Group By [Name] 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -2907,6 +2983,18 @@ Order By Count Desc"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 From Grp_DelegationInfo di 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 Left Join Sys_SetData sd On di.TeamLevSId = sd.Id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 Where di.Isdel = 0  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+And ( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  SELECT 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    CAST( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      COALESCE(SUM(ItemSumPrice * Rate), 0) AS DECIMAL(12, 2) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    ) AS GroupSales 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  FROM 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    Fin_ForeignReceivables fr 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  WHERE 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    fr.IsDel = 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    AND di.Id = fr.Diid 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    AND AddingWay IN (0, 1, 2) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+) > 0  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  {userSql}  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 And VisitDate Between '{beginDt}' And  '{endDt}' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 Group By [Name] 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -2917,15 +3005,27 @@ Order By Count Desc"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             #region 接单排名 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             string sql4 = string.Format(@$"Select  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	ROW_NUMBER() Over(Order By Count(*) Desc) As RowNumber, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	u.CnName As UserName, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	Count(*) As [Count] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	From Grp_DelegationInfo di 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	Left Join Sys_Users u On di.JietuanOperator = u.Id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	Where di.Isdel = 0  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-     {userSql}  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	And VisitDate Between '{beginDt}' And  '{endDt}' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	Group By CnName"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ROW_NUMBER() Over(Order By Count(*) Desc) As RowNumber, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+u.CnName As UserName, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+Count(*) As [Count] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+From Grp_DelegationInfo di 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+Left Join Sys_Users u On di.JietuanOperator = u.Id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+Where di.Isdel = 0  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+And ( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  SELECT 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    CAST( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      COALESCE(SUM(ItemSumPrice * Rate), 0) AS DECIMAL(12, 2) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    ) AS GroupSales 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  FROM 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    Fin_ForeignReceivables fr 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  WHERE 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    fr.IsDel = 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    AND di.Id = fr.Diid 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    AND AddingWay IN (0, 1, 2) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+) > 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    {userSql}  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+And VisitDate Between '{beginDt}' And  '{endDt}' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+Group By CnName"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             var rankingData = await _sqlSugar.SqlQueryable<MarketingSalesOrderRankingView>(sql4).ToListAsync(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 |