瀏覽代碼

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

lihai 7 年之前
父節點
當前提交
acad91cbc2

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

59
         /// <param name="stime"></param>
59
         /// <param name="stime"></param>
60
         /// <param name="endtime"></param>
60
         /// <param name="endtime"></param>
61
         /// <returns></returns>
61
         /// <returns></returns>
62
-        public ActionResult GetDataList(string stime, string endtime)
62
+        public ActionResult GetDataList(string stime, string endtime, string dpt)
63
         {
63
         {
64
             ActionResult res = NoToken("未知错误,请重新登录");
64
             ActionResult res = NoToken("未知错误,请重新登录");
65
             DataTable dtNew = new DataTable();
65
             DataTable dtNew = new DataTable();
85
             }
85
             }
86
             dtGDLY1_name[dtGDLY1rowcount + 1] = "总计";
86
             dtGDLY1_name[dtGDLY1rowcount + 1] = "总计";
87
             dtGDLY1_count[dtGDLY1rowcount + 1] = 1;
87
             dtGDLY1_count[dtGDLY1rowcount + 1] = 1;
88
-            dtNew = getData(stime, endtime);
88
+            dtNew = getData(stime, endtime, dpt);
89
 
89
 
90
             #region 获取第二行标题
90
             #region 获取第二行标题
91
             //DataColumn dc = new DataColumn("姓名");
91
             //DataColumn dc = new DataColumn("姓名");
143
             return res;
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
             DataTable dtNew = new DataTable();
148
             DataTable dtNew = new DataTable();
149
             #region 添加表格标题
149
             #region 添加表格标题
178
             #endregion
178
             #endregion
179
 
179
 
180
             string sqltimeCallRecords = "";
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
             if (stime != null && stime.Trim() != "")
186
             if (stime != null && stime.Trim() != "")
182
             {
187
             {
183
                 sqltimeCallRecords += " and CONVERT(varchar , CreateTime, 120)>=CONVERT(varchar , '" + stime.Trim() + " 00:00:01', 120) ";
188
                 sqltimeCallRecords += " and CONVERT(varchar , CreateTime, 120)>=CONVERT(varchar , '" + stime.Trim() + " 00:00:01', 120) ";
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
             ActionResult res = NoToken("未知错误,请重新登录");
246
             ActionResult res = NoToken("未知错误,请重新登录");
242
             if (Request.IsAuthenticated)
247
             if (Request.IsAuthenticated)
309
 
314
 
310
 
315
 
311
                 NPOIHelper npoi = new NPOIHelper();
316
                 NPOIHelper npoi = new NPOIHelper();
312
-                DataTable dt = getData(stime, endtime);
317
+                DataTable dt = getData(stime, endtime, dpt);
313
                 #region 处理第二行标题
318
                 #region 处理第二行标题
314
                 List<string> colnames = new List<string>();
319
                 List<string> colnames = new List<string>();
315
                 colnames.Add("姓名");
320
                 colnames.Add("姓名");

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

61
         /// <param name="stime"></param>
61
         /// <param name="stime"></param>
62
         /// <param name="endtime"></param>
62
         /// <param name="endtime"></param>
63
         /// <returns></returns>
63
         /// <returns></returns>
64
-        public ActionResult GetDataList(string stime, string endtime)
64
+        public ActionResult GetDataList(string stime, string endtime, string dpt)
65
         {
65
         {
66
             ActionResult res = NoToken("未知错误,请重新登录");
66
             ActionResult res = NoToken("未知错误,请重新登录");
67
             DataTable dtNew = new DataTable();
67
             DataTable dtNew = new DataTable();
87
             }
87
             }
88
             dtGDLY1_name[dtGDLY1rowcount + 1] = "总计";
88
             dtGDLY1_name[dtGDLY1rowcount + 1] = "总计";
89
             dtGDLY1_count[dtGDLY1rowcount + 1] = 1;
89
             dtGDLY1_count[dtGDLY1rowcount + 1] = 1;
90
-            dtNew = getData(stime, endtime);
90
+            dtNew = getData(stime, endtime, dpt);
91
 
91
 
92
             #region 获取第二行标题
92
             #region 获取第二行标题
93
             //DataColumn dc = new DataColumn("姓名");
93
             //DataColumn dc = new DataColumn("姓名");
146
             return res;
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
             DataTable dtNew = new DataTable();
151
             DataTable dtNew = new DataTable();
152
             #region 添加表格标题
152
             #region 添加表格标题
182
             #endregion
182
             #endregion
183
 
183
 
184
             string sqltimeCallRecords = "";
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
             if (stime != null && stime.Trim() != "")
190
             if (stime != null && stime.Trim() != "")
186
             {
191
             {
187
                 sqltimeCallRecords += " and CONVERT(varchar , CreateTime, 120)>=CONVERT(varchar , '" + stime.Trim() + " 00:00:01', 120) ";
192
                 sqltimeCallRecords += " and CONVERT(varchar , CreateTime, 120)>=CONVERT(varchar , '" + stime.Trim() + " 00:00:01', 120) ";
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
             ActionResult res = NoToken("未知错误,请重新登录");
250
             ActionResult res = NoToken("未知错误,请重新登录");
246
             if (Request.IsAuthenticated)
251
             if (Request.IsAuthenticated)
313
 
318
 
314
 
319
 
315
                 NPOIHelper npoi = new NPOIHelper();
320
                 NPOIHelper npoi = new NPOIHelper();
316
-                DataTable dt = getData(stime, endtime);
321
+                DataTable dt = getData(stime, endtime, dpt);
317
                 #region 处理第二行标题
322
                 #region 处理第二行标题
318
                 List<string> colnames = new List<string>();
323
                 List<string> colnames = new List<string>();
319
                 colnames.Add("姓名");
324
                 colnames.Add("姓名");

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

55
         /// <param name="stime"></param>
55
         /// <param name="stime"></param>
56
         /// <param name="endtime"></param>
56
         /// <param name="endtime"></param>
57
         /// <returns></returns>
57
         /// <returns></returns>
58
-        public ActionResult GetDataList(string stime, string endtime)
58
+        public ActionResult GetDataList(string stime, string endtime, string dpt)
59
         {
59
         {
60
             ActionResult res = NoToken("未知错误,请重新登录");
60
             ActionResult res = NoToken("未知错误,请重新登录");
61
             DataTable dtNew = new DataTable();
61
             DataTable dtNew = new DataTable();
62
-            dtNew = getData(stime, endtime);
62
+            dtNew = getData(stime, endtime, dpt);
63
             res = Success("获取工单来源数据成功", dtNew);
63
             res = Success("获取工单来源数据成功", dtNew);
64
 
64
 
65
             return res;
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
             DataTable dtNew = new DataTable();
70
             DataTable dtNew = new DataTable();
71
             #region 添加表格标题
71
             #region 添加表格标题
93
             #endregion
93
             #endregion
94
 
94
 
95
             string sqltimeCallRecords = "";
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
             if (stime != null && stime.Trim() != "")
101
             if (stime != null && stime.Trim() != "")
97
             {
102
             {
98
                 sqltimeCallRecords += " and CONVERT(varchar , CreateTime, 120)>=CONVERT(varchar , '" + stime.Trim() + " 00:00:01', 120) ";
103
                 sqltimeCallRecords += " and CONVERT(varchar , CreateTime, 120)>=CONVERT(varchar , '" + stime.Trim() + " 00:00:01', 120) ";
167
         /// 导出excel
172
         /// 导出excel
168
         /// </summary>
173
         /// </summary>
169
         /// <returns></returns>
174
         /// <returns></returns>
170
-        public ActionResult ExportExcel(string stime, string endtime)
175
+        public ActionResult ExportExcel(string stime, string endtime, string dpt)
171
         {
176
         {
172
             ActionResult res = NoToken("未知错误,请重新登录");
177
             ActionResult res = NoToken("未知错误,请重新登录");
173
             if (Request.IsAuthenticated)
178
             if (Request.IsAuthenticated)
174
             {
179
             {
175
                 //导出dtnew
180
                 //导出dtnew
176
                 NPOIHelper npoi = new NPOIHelper();
181
                 NPOIHelper npoi = new NPOIHelper();
177
-                DataTable dt = getData(stime, endtime);
182
+                DataTable dt = getData(stime, endtime, dpt);
178
                 if (npoi.ExportToExcel("工单来源数据报表", dt, null) == "")
183
                 if (npoi.ExportToExcel("工单来源数据报表", dt, null) == "")
179
                 {
184
                 {
180
                     return Success("导出成功");
185
                     return Success("导出成功");

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

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