qinchaoyue 1 hónapja
szülő
commit
2dc2d78c98

+ 1 - 0
src/Hotline.Application/ExportExcel/ExportApplication.cs

@@ -73,6 +73,7 @@ namespace Hotline.Application.ExportExcel
 
         public FileStreamResult GetExcelFile(Type typeT, Type typeD, object dto, IList<object> items, string fileName, string? totalFiledName)
         {
+            if (totalFiledName.IsNullOrEmpty()) return GetExcelFile(typeT, typeD, dto, items, fileName);
             var fieldsAll = typeT.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
             var fields = fieldsAll.Where(f => IsNumericType(f.FieldType)); // 只选择数值类型字段
             var totalField = fieldsAll.Where(m => m.Name.Contains(totalFiledName)).First();

+ 2 - 0
src/Hotline.Application/Snapshot/BiSnapshotApplication.cs

@@ -761,6 +761,7 @@ public class BiSnapshotApplication : IBiSnapshotApplication, IScopeDependency
         }, true);
     }
 
+    [ExportExcel("随手拍重办统计")]
     public List<Dictionary<string, object>> GetReTransactStatistics(ReTransactStatisticsInDto dto)
     {
         var rawData = _orderSnapshotRepository.Queryable(includeDeleted: true)
@@ -826,6 +827,7 @@ public class BiSnapshotApplication : IBiSnapshotApplication, IScopeDependency
         return pivotResult;
     }
 
+    [ExportExcel("随手拍重办统计")]
     public ISugarQueryable<ReTransactStatisticsDetailsOutDto> GetReTransactStatisticsDetail(ReTransactStatisticsDetailsInDto dto)
     {
         var query = _orderSnapshotRepository.Queryable(includeDeleted: true)

+ 1 - 0
src/Hotline.Share/Attributes/ExportExcelAttribute.cs

@@ -17,6 +17,7 @@ public class ExportExcelAttribute : Attribute
     public ExportExcelAttribute(string fileName)
     {
         FileName = fileName;
+        TotalName = null;
     }
     public ExportExcelAttribute(string fileName, string? totalName)
     {

+ 1 - 1
src/Hotline.Share/Tools/MethodInfoExtensions.cs

@@ -22,7 +22,7 @@ public static class MethodInfoExtensions
     {
         if (value == null) return string.Empty;
         var att = value.GetCustomAttribute<ExportExcelAttribute>();
-        if (att == null) return string.Empty;
+        if (att == null) return null;
         return att.TotalName;
     }
 }