Ver código fonte

Merge branch 'release' of http://110.188.24.182:10023/Fengwo/hotline into release

tangjiang 9 meses atrás
pai
commit
a73e2f5934

+ 16 - 4
src/Hotline.Application/Orders/OrderApplication.cs

@@ -1028,7 +1028,7 @@ public class OrderApplication : IOrderApplication, IScopeDependency
                AreaCode = pp.Id,
                AreaName = pp.AreaName,
                Count = SqlFunc.AggregateSum(dd.Count)
-           }).MergeTable().Where(q => q.HotspotName != "").ToPivotListAsync(q => q.AreaCode, q => new { q.HotspotName, q.HotspotId }, q => q.Sum(x => x.Count));
+           }).ToPivotListAsync(q => q.AreaCode, q => new { q.HotspotName, q.HotspotId }, q => q.Sum(x => x.Count));
 
         var areaTitleList = await _systemAreaRepository.Queryable().Where(x => SqlFunc.Length(x.Id) == 6 && x.Id != "510000").OrderBy(x => x.Id).ToListAsync();
         return (areaTitleList, returnList);
@@ -1097,7 +1097,8 @@ public class OrderApplication : IOrderApplication, IScopeDependency
                AreaCode = pp.Id,
                AreaName = pp.AreaName,
                Count = SqlFunc.AggregateSum(dd.Count)
-           }).MergeTable().Where(q => q.HotspotName != "").ToPivotTableAsync(q => q.AreaName, q => new { q.HotspotName }, q => q.Sum(x => x.Count));
+           }).ToPivotTableAsync(q => q.AreaName, q => new { q.HotspotName }, q => q.Sum(x => x.Count));
+        //returnList.Rows.RemoveAt(returnList.Rows.Count-1);
         return returnList;
     }
 
@@ -1170,7 +1171,7 @@ public class OrderApplication : IOrderApplication, IScopeDependency
             }
             else
             {
-                if (dt.Columns.Contains(item))
+                //if (dt.Columns.Contains(item))
                     dt2.Columns.Add(item);
             }
         }
@@ -1178,6 +1179,10 @@ public class OrderApplication : IOrderApplication, IScopeDependency
         //处理数据
         foreach (DataRow sourceRow in dt.Rows)
         {
+            if (sourceRow["一级热点"].ToString() == "")
+            {
+                continue;
+            }
             DataRow targetRow = dt2.NewRow();
             foreach (var item in AddColumnName)
             {
@@ -1238,7 +1243,14 @@ public class OrderApplication : IOrderApplication, IScopeDependency
                 }
                 else
                 {
-                    targetRow[item] = sourceRow[item];
+                    try
+                    {
+                        targetRow[item] = sourceRow[item];
+                    }
+                    catch
+                    {
+                        targetRow[item] = 0;
+                    }
                 }
             }
             dt2.Rows.Add(targetRow);

+ 9 - 3
src/Hotline.Repository.SqlSugar/Orders/OrderRepository.cs

@@ -1021,8 +1021,7 @@ namespace Hotline.Repository.SqlSugar.Orders
             //添加表头
             foreach (var item in AddColumnName)
             {
-                if (dt.Columns.Contains(item))
-                    dt2.Columns.Add(item);
+                dt2.Columns.Add(item);
             }
 
             //处理数据
@@ -1031,7 +1030,14 @@ namespace Hotline.Repository.SqlSugar.Orders
                 DataRow targetRow = dt2.NewRow();
                 foreach (var item in AddColumnName)
                 {
-                    targetRow[item] = sourceRow[item];
+                    try
+                    {
+                        targetRow[item] = sourceRow[item];
+                    }
+                    catch
+                    {
+                        targetRow[item] = 0;
+                    }
                 }
                 dt2.Rows.Add(targetRow);
             }