Parcourir la Source

业务数据分析 添加部门搜索条件

lihai il y a 7 ans
Parent
commit
acad91cbc2

+ 10 - 5
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/report/GDLXSJController.cs

@@ -59,7 +59,7 @@ namespace CallCenterApi.Interface.Controllers.report
59 59
         /// <param name="stime"></param>
60 60
         /// <param name="endtime"></param>
61 61
         /// <returns></returns>
62
-        public ActionResult GetDataList(string stime, string endtime)
62
+        public ActionResult GetDataList(string stime, string endtime, string dpt)
63 63
         {
64 64
             ActionResult res = NoToken("未知错误,请重新登录");
65 65
             DataTable dtNew = new DataTable();
@@ -85,7 +85,7 @@ namespace CallCenterApi.Interface.Controllers.report
85 85
             }
86 86
             dtGDLY1_name[dtGDLY1rowcount + 1] = "总计";
87 87
             dtGDLY1_count[dtGDLY1rowcount + 1] = 1;
88
-            dtNew = getData(stime, endtime);
88
+            dtNew = getData(stime, endtime, dpt);
89 89
 
90 90
             #region 获取第二行标题
91 91
             //DataColumn dc = new DataColumn("姓名");
@@ -143,7 +143,7 @@ namespace CallCenterApi.Interface.Controllers.report
143 143
             return res;
144 144
         }
145 145
 
146
-        private DataTable getData(string stime, string endtime)
146
+        private DataTable getData(string stime, string endtime, string dpt)
147 147
         {
148 148
             DataTable dtNew = new DataTable();
149 149
             #region 添加表格标题
@@ -178,6 +178,11 @@ namespace CallCenterApi.Interface.Controllers.report
178 178
             #endregion
179 179
 
180 180
             string sqltimeCallRecords = "";
181
+            //部门搜索
182
+            if (dpt != null && dpt.Trim() != "")
183
+            {
184
+                sqltimeCallRecords += $" AND CreateUser IN (SELECT F_UserCode FROM dbo.T_Sys_UserAccount WHERE F_DeptId = {dpt}) ";
185
+            }
181 186
             if (stime != null && stime.Trim() != "")
182 187
             {
183 188
                 sqltimeCallRecords += " and CONVERT(varchar , CreateTime, 120)>=CONVERT(varchar , '" + stime.Trim() + " 00:00:01', 120) ";
@@ -236,7 +241,7 @@ namespace CallCenterApi.Interface.Controllers.report
236 241
         }
237 242
 
238 243
         //导出数据
239
-        public ActionResult ExptList(string stime, string endtime)
244
+        public ActionResult ExptList(string stime, string endtime, string dpt)
240 245
         {
241 246
             ActionResult res = NoToken("未知错误,请重新登录");
242 247
             if (Request.IsAuthenticated)
@@ -309,7 +314,7 @@ namespace CallCenterApi.Interface.Controllers.report
309 314
 
310 315
 
311 316
                 NPOIHelper npoi = new NPOIHelper();
312
-                DataTable dt = getData(stime, endtime);
317
+                DataTable dt = getData(stime, endtime, dpt);
313 318
                 #region 处理第二行标题
314 319
                 List<string> colnames = new List<string>();
315 320
                 colnames.Add("姓名");

+ 10 - 5
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/report/GDLXYQController.cs

@@ -61,7 +61,7 @@ namespace CallCenterApi.Interface.Controllers.report
61 61
         /// <param name="stime"></param>
62 62
         /// <param name="endtime"></param>
63 63
         /// <returns></returns>
64
-        public ActionResult GetDataList(string stime, string endtime)
64
+        public ActionResult GetDataList(string stime, string endtime, string dpt)
65 65
         {
66 66
             ActionResult res = NoToken("未知错误,请重新登录");
67 67
             DataTable dtNew = new DataTable();
@@ -87,7 +87,7 @@ namespace CallCenterApi.Interface.Controllers.report
87 87
             }
88 88
             dtGDLY1_name[dtGDLY1rowcount + 1] = "总计";
89 89
             dtGDLY1_count[dtGDLY1rowcount + 1] = 1;
90
-            dtNew = getData(stime, endtime);
90
+            dtNew = getData(stime, endtime, dpt);
91 91
 
92 92
             #region 获取第二行标题
93 93
             //DataColumn dc = new DataColumn("姓名");
@@ -146,7 +146,7 @@ namespace CallCenterApi.Interface.Controllers.report
146 146
             return res;
147 147
         }
148 148
 
149
-        private DataTable getData(string stime, string endtime)
149
+        private DataTable getData(string stime, string endtime, string dpt)
150 150
         {
151 151
             DataTable dtNew = new DataTable();
152 152
             #region 添加表格标题
@@ -182,6 +182,11 @@ namespace CallCenterApi.Interface.Controllers.report
182 182
             #endregion
183 183
 
184 184
             string sqltimeCallRecords = "";
185
+            //部门搜索
186
+            if (dpt != null && dpt.Trim() != "")
187
+            {
188
+                sqltimeCallRecords += $" AND CreateUser IN (SELECT F_UserCode FROM dbo.T_Sys_UserAccount WHERE F_DeptId = {dpt}) ";
189
+            }
185 190
             if (stime != null && stime.Trim() != "")
186 191
             {
187 192
                 sqltimeCallRecords += " and CONVERT(varchar , CreateTime, 120)>=CONVERT(varchar , '" + stime.Trim() + " 00:00:01', 120) ";
@@ -240,7 +245,7 @@ namespace CallCenterApi.Interface.Controllers.report
240 245
         }
241 246
 
242 247
         //导出数据
243
-        public ActionResult ExptList(string stime, string endtime)
248
+        public ActionResult ExptList(string stime, string endtime, string dpt)
244 249
         {
245 250
             ActionResult res = NoToken("未知错误,请重新登录");
246 251
             if (Request.IsAuthenticated)
@@ -313,7 +318,7 @@ namespace CallCenterApi.Interface.Controllers.report
313 318
 
314 319
 
315 320
                 NPOIHelper npoi = new NPOIHelper();
316
-                DataTable dt = getData(stime, endtime);
321
+                DataTable dt = getData(stime, endtime, dpt);
317 322
                 #region 处理第二行标题
318 323
                 List<string> colnames = new List<string>();
319 324
                 colnames.Add("姓名");

+ 10 - 5
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/report/GDLYController.cs

@@ -55,17 +55,17 @@ namespace CallCenterApi.Interface.Controllers.report
55 55
         /// <param name="stime"></param>
56 56
         /// <param name="endtime"></param>
57 57
         /// <returns></returns>
58
-        public ActionResult GetDataList(string stime, string endtime)
58
+        public ActionResult GetDataList(string stime, string endtime, string dpt)
59 59
         {
60 60
             ActionResult res = NoToken("未知错误,请重新登录");
61 61
             DataTable dtNew = new DataTable();
62
-            dtNew = getData(stime, endtime);
62
+            dtNew = getData(stime, endtime, dpt);
63 63
             res = Success("获取工单来源数据成功", dtNew);
64 64
 
65 65
             return res;
66 66
         }
67 67
 
68
-        private DataTable getData(string stime, string endtime)
68
+        private DataTable getData(string stime, string endtime, string dpt)
69 69
         {
70 70
             DataTable dtNew = new DataTable();
71 71
             #region 添加表格标题
@@ -93,6 +93,11 @@ namespace CallCenterApi.Interface.Controllers.report
93 93
             #endregion
94 94
 
95 95
             string sqltimeCallRecords = "";
96
+            //部门搜索
97
+            if (dpt != null && dpt.Trim() != "")
98
+            {
99
+                sqltimeCallRecords += $" AND CreateUser IN (SELECT F_UserCode FROM dbo.T_Sys_UserAccount WHERE F_DeptId = {dpt}) ";
100
+            }
96 101
             if (stime != null && stime.Trim() != "")
97 102
             {
98 103
                 sqltimeCallRecords += " and CONVERT(varchar , CreateTime, 120)>=CONVERT(varchar , '" + stime.Trim() + " 00:00:01', 120) ";
@@ -167,14 +172,14 @@ namespace CallCenterApi.Interface.Controllers.report
167 172
         /// 导出excel
168 173
         /// </summary>
169 174
         /// <returns></returns>
170
-        public ActionResult ExportExcel(string stime, string endtime)
175
+        public ActionResult ExportExcel(string stime, string endtime, string dpt)
171 176
         {
172 177
             ActionResult res = NoToken("未知错误,请重新登录");
173 178
             if (Request.IsAuthenticated)
174 179
             {
175 180
                 //导出dtnew
176 181
                 NPOIHelper npoi = new NPOIHelper();
177
-                DataTable dt = getData(stime, endtime);
182
+                DataTable dt = getData(stime, endtime, dpt);
178 183
                 if (npoi.ExportToExcel("工单来源数据报表", dt, null) == "")
179 184
                 {
180 185
                     return Success("导出成功");

+ 10 - 5
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/report/GDPosController.cs

@@ -24,11 +24,11 @@ namespace CallCenterApi.Interface.Controllers.report
24 24
         /// <param name="stime"></param>
25 25
         /// <param name="endtime"></param>
26 26
         /// <returns></returns>
27
-        public ActionResult GetDataList(string stime, string endtime)
27
+        public ActionResult GetDataList(string stime, string endtime, string dpt)
28 28
         {
29 29
             ActionResult res = NoToken("未知错误,请重新登录");
30 30
             DataTable dtNew = new DataTable();
31
-            dtNew = getData(stime, endtime);
31
+            dtNew = getData(stime, endtime, dpt);
32 32
             #region 获取表头
33 33
             DataTable dt = new DataTable();
34 34
             string sql = "select b.f_province from [dbo].[T_Wo_WorkOrder] a,T_Cus_CustomerBase b where a.CustomerID = b.F_CustomerId";
@@ -60,7 +60,7 @@ namespace CallCenterApi.Interface.Controllers.report
60 60
             return res;
61 61
         }
62 62
 
63
-        private DataTable getData(string stime, string endtime)
63
+        private DataTable getData(string stime, string endtime, string dpt)
64 64
         {
65 65
             DataTable dtNew = new DataTable();
66 66
             #region 添加表格标题
@@ -90,6 +90,11 @@ namespace CallCenterApi.Interface.Controllers.report
90 90
             #endregion
91 91
 
92 92
             string sqltimeCallRecords = "";
93
+            //部门搜索
94
+            if (dpt != null && dpt.Trim() != "")
95
+            {
96
+                sqltimeCallRecords += $" AND CreateUser IN (SELECT F_UserCode FROM dbo.T_Sys_UserAccount WHERE F_DeptId = {dpt}) ";
97
+            }
93 98
             if (stime != null && stime.Trim() != "")
94 99
             {
95 100
                 sqltimeCallRecords += " and CONVERT(varchar , CreateTime, 120)>=CONVERT(varchar , '" + stime.Trim() + " 00:00:01', 120) ";
@@ -143,14 +148,14 @@ namespace CallCenterApi.Interface.Controllers.report
143 148
         /// 导出excel
144 149
         /// </summary>
145 150
         /// <returns></returns>
146
-        public ActionResult ExportExcel(string stime, string endtime)
151
+        public ActionResult ExportExcel(string stime, string endtime, string dpt)
147 152
         {
148 153
             ActionResult res = NoToken("未知错误,请重新登录");
149 154
             if (Request.IsAuthenticated)
150 155
             {
151 156
                 //导出dtnew
152 157
                 NPOIHelper npoi = new NPOIHelper();
153
-                DataTable dt = getData(stime, endtime);
158
+                DataTable dt = getData(stime, endtime, dpt);
154 159
                 if (npoi.ExportToExcel("工单地区数据报表", dt, null) == "")
155 160
                 {
156 161
                     return Success("导出成功");