lihai лет назад: 6
Родитель
Сommit
f92ca6875e

+ 70 - 24
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/IndexController.cs

@@ -1,5 +1,6 @@
1 1
 using CallCenter.Utility;
2 2
 using CallCenterApi.Common;
3
+using CallCenterApi.DB;
3 4
 using CallCenterApi.Interface.Controllers.Base;
4 5
 using System;
5 6
 using System.Collections.Generic;
@@ -194,20 +195,41 @@ namespace CallCenterApi.Interface.Controllers
194 195
                     //var monoutlist = bll.GetModelList(uwhere + " and CallType='1' and CONVERT(char(7),BeginTime,20)='" + strMonth + "' ");
195 196
                     //int daynocon = bll.GetList("CallType='0' and CONVERT(varchar(100),BeginTime, 23)='" + strDate + "' ").Tables[0].Rows.Count;
196 197
 
198
+                    //// 今日来电
199
+                    //int dayinlist = bll.GetRecordCount(uwhere + " and CallType='0' and CONVERT(varchar(10),BeginTime, 23)='" + strDate + "' ");
200
+                    //int dayinlist_totaltimesum = bll.GetRecordTalkLongTimeSum(uwhere + " and CallType='0' and CONVERT(varchar(10),BeginTime, 23)='" + strDate + "' ");
201
+                    ////今日去电    
202
+                    //int dayoutlist = bll.GetRecordCount(uwhere + " and CallType='1' and CONVERT(varchar(10),BeginTime, 23)='" + strDate + "' ");
203
+                    //int dayoutlist_totaltimesum = bll.GetRecordTalkLongTimeSum(uwhere + " and CallType='1' and CONVERT(varchar(10),BeginTime, 23)='" + strDate + "' ");
204
+                    ////本月来电    
205
+                    //int moninlist = bll.GetRecordCount(uwhere + " and CallType='0' and CONVERT(char(7),BeginTime,20)='" + strMonth + "' ");
206
+                    //int moninlist_totaltimesum = bll.GetRecordTalkLongTimeSum(uwhere + " and CallType='0' and CONVERT(char(7),BeginTime,20)='" + strMonth + "' ");
207
+                    ////本月去电    
208
+                    //var monoutlist = bll.GetRecordCount(uwhere + " and CallType='1' and CONVERT(char(7),BeginTime,20)='" + strMonth + "' ");
209
+                    //var monoutlist_totaltimesum = bll.GetRecordTalkLongTimeSum(uwhere + " and CallType='1' and CONVERT(char(7),BeginTime,20)='" + strMonth + "' ");
210
+                    ////未接来电    
211
+                    //int daynocon = bll.GetRecordCount("CallType='0' and CONVERT(varchar(100),BeginTime, 23)='" + strDate + "' ");
212
+
213
+                    DataTable dtConnect = DbHelperSQL.Query("select CONVERT(varchar(10),BeginTime, 23) AS yearmonthdays,CONVERT(char(7),BeginTime,20) AS yearmonths,CallType,BeginTime,TalkLongTime FROM T_Call_CallRecords WITH(NOLOCK) where 1 = 1 '" + uwhere + "'").Tables[0];
214
+
197 215
                     // 今日来电
198
-                    int dayinlist = bll.GetRecordCount(uwhere + " and CallType='0' and CONVERT(varchar(10),BeginTime, 23)='" + strDate + "' ");
199
-                    int dayinlist_totaltimesum = bll.GetRecordTalkLongTimeSum(uwhere + " and CallType='0' and CONVERT(varchar(10),BeginTime, 23)='" + strDate + "' ");
216
+                    var dayinlist = dtConnect.Select("CallType='0' and yearmonthdays = '" + strDate + "'").Count();
217
+                    var dayinlist_totaltimesum_0 = dtConnect.Select("CallType='0' and yearmonthdays = '" + strDate + "'");
218
+                    var dayinlist_totaltimesum = (from DataRow dr in dayinlist_totaltimesum_0 select dr.Field<int>("TalkLongTime")).Sum();
200 219
                     //今日去电    
201
-                    int dayoutlist = bll.GetRecordCount(uwhere + " and CallType='1' and CONVERT(varchar(10),BeginTime, 23)='" + strDate + "' ");
202
-                    int dayoutlist_totaltimesum = bll.GetRecordTalkLongTimeSum(uwhere + " and CallType='1' and CONVERT(varchar(10),BeginTime, 23)='" + strDate + "' ");
220
+                    var dayoutlist = dtConnect.Select("CallType='1' and yearmonthdays = '" + strDate + "'").Count();
221
+                    var dayoutlist_totaltimesum_0 = dtConnect.Select("CallType='1' and yearmonthdays = '" + strDate + "'");
222
+                    var dayoutlist_totaltimesum = (from DataRow dr in dayinlist_totaltimesum_0 select dr.Field<int>("TalkLongTime")).Sum();
203 223
                     //本月来电    
204
-                    int moninlist = bll.GetRecordCount(uwhere + " and CallType='0' and CONVERT(char(7),BeginTime,20)='" + strMonth + "' ");
205
-                    int moninlist_totaltimesum = bll.GetRecordTalkLongTimeSum(uwhere + " and CallType='0' and CONVERT(char(7),BeginTime,20)='" + strMonth + "' ");
224
+                    var moninlist = dtConnect.Select("CallType='0' and yearmonths = '" + strMonth + "'").Count();
225
+                    var moninlist_totaltimesum_0 = dtConnect.Select("CallType='0' and yearmonths = '" + strMonth + "'");
226
+                    var moninlist_totaltimesum = (from DataRow dr in dayinlist_totaltimesum_0 select dr.Field<int>("TalkLongTime")).Sum();
206 227
                     //本月去电    
207
-                    var monoutlist = bll.GetRecordCount(uwhere + " and CallType='1' and CONVERT(char(7),BeginTime,20)='" + strMonth + "' ");
208
-                    var monoutlist_totaltimesum = bll.GetRecordTalkLongTimeSum(uwhere + " and CallType='1' and CONVERT(char(7),BeginTime,20)='" + strMonth + "' ");
228
+                    var monoutlist = dtConnect.Select("CallType='1' and yearmonths = '" + strMonth + "'").Count();
229
+                    var monoutlist_totaltimesum_0 = dtConnect.Select("CallType='1' and yearmonths = '" + strMonth + "'");
230
+                    var monoutlist_totaltimesum = (from DataRow dr in dayinlist_totaltimesum_0 select dr.Field<int>("TalkLongTime")).Sum();
209 231
                     //未接来电    
210
-                    int daynocon = bll.GetRecordCount("CallType='0' and CONVERT(varchar(100),BeginTime, 23)='" + strDate + "' ");
232
+                    var daynocon = dtConnect.Select("CallType='0' and yearmonthdays = '" + strDate + "'").Count();
211 233
 
212 234
                     var obj = new
213 235
                     {
@@ -276,21 +298,34 @@ namespace CallCenterApi.Interface.Controllers
276 298
                         //var list3 = bll.GetList(uwhere + " and CONVERT(char(7),CreateTime,20)='" + strMonth + "' and State =2 and IsDel=0 ").Tables[0];
277 299
                         //var list4 = bll.GetList(uwhere + " and CONVERT(char(7),CreateTime,20)='" + strMonth + "' and State in (0,1) and IsDel=0 ").Tables[0];
278 300
 
301
+                        ////日已完成
302
+                        //var list1 = bll.GetList(uwhere + " and CONVERT(varchar(10),CreateTime, 23)='" + strDate + "' and State =1 and IsDel=0 ").Tables[0];
303
+                        ////日未完成
304
+                        //var list2 = bll.GetList(uwhere + " and CONVERT(varchar(10),CreateTime, 23)='" + strDate + "' and State=0 and IsDel=0 ").Tables[0];
305
+                        ////月已完成
306
+                        //var list3 = bll.GetList(uwhere + " and CONVERT(char(7),CreateTime,20)='" + strMonth + "' and State =1 and IsDel=0 ").Tables[0];
307
+                        ////月未完成
308
+                        //var list4 = bll.GetList(uwhere + " and CONVERT(char(7),CreateTime,20)='" + strMonth + "' and State=0 and IsDel=0 ").Tables[0];
309
+
279 310
                         //日已完成
280
-                        var list1 = bll.GetList(uwhere + " and CONVERT(varchar(10),CreateTime, 23)='" + strDate + "' and State =1 and IsDel=0 ").Tables[0];
311
+                        int list1_count = bll.GetRecordCount(uwhere + " and CONVERT(varchar(10),CreateTime, 23)='" + strDate + "' and State =1 and IsDel=0 ");
281 312
                         //日未完成
282
-                        var list2 = bll.GetList(uwhere + " and CONVERT(varchar(10),CreateTime, 23)='" + strDate + "' and State=0 and IsDel=0 ").Tables[0];
313
+                        int list2_count = bll.GetRecordCount(uwhere + " and CONVERT(varchar(10),CreateTime, 23)='" + strDate + "' and State=0 and IsDel=0 ");
283 314
                         //月已完成
284
-                        var list3 = bll.GetList(uwhere + " and CONVERT(char(7),CreateTime,20)='" + strMonth + "' and State =1 and IsDel=0 ").Tables[0];
315
+                        var list3_count = bll.GetRecordCount(uwhere + " and CONVERT(char(7),CreateTime,20)='" + strMonth + "' and State =1 and IsDel=0 ");
285 316
                         //月未完成
286
-                        var list4 = bll.GetList(uwhere + " and CONVERT(char(7),CreateTime,20)='" + strMonth + "' and State=0 and IsDel=0 ").Tables[0];
317
+                        var list4_count = bll.GetRecordCount(uwhere + " and CONVERT(char(7),CreateTime,20)='" + strMonth + "' and State=0 and IsDel=0 ");
287 318
 
288 319
                         var obj = new
289 320
                         {
290
-                            daywc = list1.Rows.Count,
291
-                            daywwc = list2.Rows.Count,
292
-                            monwc = list3.Rows.Count,
293
-                            monwwc = list4.Rows.Count
321
+                            //daywc = list1.Rows.Count,
322
+                            //daywwc = list2.Rows.Count,
323
+                            //monwc = list3.Rows.Count,
324
+                            //monwwc = list4.Rows.Count
325
+                            daywc = list1_count,
326
+                            daywwc = list2_count,
327
+                            monwc = list3_count,
328
+                            monwwc = list4_count
294 329
                         };
295 330
                         res = Success("成功", obj);
296 331
                     }
@@ -325,14 +360,23 @@ namespace CallCenterApi.Interface.Controllers
325 360
                         uwhere += " and UserCode='" + usercode + "' ";
326 361
                     }
327 362
 
363
+                    DataTable dtConnect = DbHelperSQL.Query("select CONVERT(varchar(13),BeginTime, 120) AS yearmonths,CallState,BeginTime FROM T_Call_CallRecords WITH(NOLOCK) where 1 = 1  and CONVERT(varchar(11),BeginTime, 120) = '" + strDate + "'").Tables[0];
364
+
365
+                    if (!string.IsNullOrEmpty(strDate))
366
+                        uwhere += " and CONVERT(varchar(11),BeginTime, 120) = '" + strDate + "' ";
367
+
328 368
                     BLL.T_Call_CallRecords bll = new BLL.T_Call_CallRecords();
329 369
                     int[] total = new int[24];
330 370
                     int[] count = new int[24];
371
+
372
+
331 373
                     for (int i = 0; i < cols.Length; i++)
332 374
                     {
333
-                        var list = bll.GetModelList(uwhere + " and CONVERT(varchar(13),BeginTime, 120)='" + (strDate + " " + cols[i]) + "' ");
334
-                        var conlist = list.Where(p => p.CallState == 1);
335
-                        total[i] = list.Count;
375
+                        //var list = bll.GetModelList(uwhere + " and CONVERT(varchar(13),BeginTime, 120)='" + (strDate + " " + cols[i]) + "' ");
376
+                        //var conlist = list.Where(p => p.CallState == 1);
377
+                        var list = dtConnect.Select("yearmonths = '" + (strDate + " " + cols[i]) + "'");
378
+                        var conlist = dtConnect.Select("yearmonths = '" + (strDate + " " + cols[i]) + "' and CallState = 1");
379
+                        total[i] = list.Count();
336 380
                         count[i] = conlist.Count();
337 381
                     }
338 382
 
@@ -396,8 +440,10 @@ namespace CallCenterApi.Interface.Controllers
396 440
                             teltotal[i] = tellist.Count;
397 441
                             newcount = newcount + tellist.Count;
398 442
                             //var worklist = workbll.GetList(" F_USERID='" + userId + "' and CONVERT(varchar(10),F_CREATEDATE, 23)='" + (strDate + "-" + cols[i]) + "' ").Tables[0];
399
-                            var worklist = workbll.GetList(uwhere + " and CONVERT(varchar(10),CreateTime, 23)='" + (strDate + "-" + cols[i]) + "' ").Tables[0];
400
-                            worktotal[i] = worklist.Rows.Count;
443
+                            //var worklist = workbll.GetList(uwhere + " and CONVERT(varchar(10),CreateTime, 23)='" + (strDate + "-" + cols[i]) + "' ").Tables[0];
444
+                            int worklist_count = workbll.GetRecordCount(uwhere + " and CONVERT(varchar(10),CreateTime, 23)='" + (strDate + "-" + cols[i]) + "' ");
445
+                            //worktotal[i] = worklist.Rows.Count;
446
+                            worktotal[i] = worklist_count;
401 447
                         }
402 448
 
403 449
                         var olddate = date.AddYears(-1);
@@ -469,10 +515,10 @@ namespace CallCenterApi.Interface.Controllers
469 515
                         {
470 516
                             uwhere += " and CreateUser='" + ua.F_UserCode + "' ";
471 517
                         }
472
-
518
+                        int worklist_count = bll.GetRecordCount(uwhere + " and IsDel=0 and State=0 ");
473 519
                         var obj = new
474 520
                         {
475
-                            dpd = bll.GetList(uwhere+ " and IsDel=0 and State=0 ").Tables[0].Rows.Count,
521
+                            dpd = worklist_count,   //bll.GetList(uwhere+ " and IsDel=0 and State=0 ").Tables[0].Rows.Count,
476 522
                             djd = new BLL.T_Wo_WorkOrderItem().GetModelList(" IsDel=0 and Type=1 and (state='0' and ','+ToUser+',' like '%," + ua.F_UserCode + ",%')  ").Select(p => p.WorkOrderID).Distinct().Count(),
477 523
                             dcl = new BLL.T_Wo_WorkOrderItem().GetModelList(" IsDel=0 and Type=1 and (state='1' and SureUser='" + ua.F_UserCode + "')  ").Select(p => p.WorkOrderID).Distinct().Count()
478 524
                         };