Quellcode durchsuchen

工单来源报表添加导出excel接口

machenyang vor 8 Jahren
Ursprung
Commit
49ffa69c3e

+ 26 - 1
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/report/GDLYController.cs

@@ -1,4 +1,5 @@
1
-using CallCenterApi.DB;
1
+using CallCenter.Utility;
2
+using CallCenterApi.DB;
2 3
 using CallCenterApi.Interface.Controllers.Base;
3 4
 using System;
4 5
 using System.Collections.Generic;
@@ -104,5 +105,29 @@ namespace CallCenterApi.Interface.Controllers.report
104 105
             
105 106
             return dtNew;
106 107
         }
108
+
109
+        /// <summary>
110
+        /// 导出excel
111
+        /// </summary>
112
+        /// <returns></returns>
113
+        public ActionResult ExportExcel(string stime, string endtime)
114
+        {
115
+            ActionResult res = NoToken("未知错误,请重新登录");
116
+            if (Request.IsAuthenticated)
117
+            {
118
+                //导出dtnew
119
+                NPOIHelper npoi = new NPOIHelper();
120
+                DataTable dt = getData(stime, endtime);
121
+                if (npoi.ExportToExcel("工单来源数据报表", dt, null) == "")
122
+                {
123
+                    return Success("导出成功");
124
+                }
125
+                else
126
+                {
127
+                    return Error("导出失败");
128
+                }
129
+            }
130
+            return res;
131
+        }
107 132
     }
108 133
 }