zhoufan %!s(int64=7) %!d(string=hace) años
padre
commit
47f964dd38

+ 75 - 88
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/IndexController.cs

@@ -191,14 +191,6 @@ namespace CallCenterApi.Interface.Controllers
191 191
                     var monoutlist = bll.GetModelList(uwhere + " and CallType='1' and CONVERT(char(7),BeginTime,20)='" + strMonth + "' and CallState='1' ");
192 192
                     int daynocon = bll.GetList("CallType='0' and CONVERT(varchar(100),BeginTime, 23)='" + strDate + "' and CallState='0' ").Tables[0].Rows.Count;
193 193
 
194
-                    ////2018-05-03 lihai 首页统计问题
195
-                    //var dayinlist = bll.GetModelList(uwhere + " and CallType='0' and CONVERT(varchar(10),BeginTime, 23)='" + strDate + "' ");
196
-                    //var dayoutlist = bll.GetModelList(uwhere + " and CallType='1' and CONVERT(varchar(10),BeginTime, 23)='" + strDate + "' ");
197
-                    //var moninlist = bll.GetModelList(uwhere + " and CallType='0' and CONVERT(char(7),BeginTime,20)='" + strMonth + "' ");
198
-                    //var monoutlist = bll.GetModelList(uwhere + " and CallType='1' and CONVERT(char(7),BeginTime,20)='" + strMonth + "' ");
199
-
200
-                    //int daynocon = bll.GetList("CallType='0' and CONVERT(varchar(10),BeginTime, 23)='" + strDate + "' and CallState='0' ").Tables[0].Rows.Count;
201
-
202 194
                     var obj = new
203 195
                     {
204 196
                         dayin = new { count = dayinlist.Count, totaltime =DateTimeConvert.parseTimeSeconds(int.Parse(dayinlist.Select(p => p.TalkLongTime).Sum().ToString()),0) },
@@ -225,8 +217,8 @@ namespace CallCenterApi.Interface.Controllers
225 217
                 int userId = CurrentUser.UserData.F_UserId;
226 218
                 if (userId != 0)
227 219
                 {
228
-                    Model.T_Sys_UserAccount ua = new BLL.T_Sys_UserAccount().GetModel(userId);
229
-                    if (ua != null)
220
+                    Model.T_Sys_UserAccount userModel = new BLL.T_Sys_UserAccount().GetModel(userId);
221
+                    if (userModel != null)
230 222
                     {
231 223
                         var date = DateTime.Now;//DateTime.Parse("2015-04-14"); //
232 224
                         string strDate = date.ToString("yyyy-MM-dd");
@@ -239,25 +231,25 @@ namespace CallCenterApi.Interface.Controllers
239 231
                         //var list4 = bll.GetList(" F_USERID='" + userId + "' and CONVERT(char(7),F_CREATEDATE,20)='" + strMonth + "' and F_WORKORDERSTATEID in (4,5,6,7,9,12,13) ").Tables[0];
240 232
 
241 233
                         string uwhere = " 1=1 ";
242
-                        if (ua.F_RoleId != 17)
234
+                        if (userModel.rolecode != "XTGLY")
243 235
                         {
244
-                            uwhere += " and CreateUser='" + ua.F_UserCode + "' ";
236
+                            uwhere += " and F_CreateUser='" + userModel.F_UserCode + "' ";
245 237
                         }
246 238
 
247
-                        BLL.T_Wo_WorkOrder bll = new BLL.T_Wo_WorkOrder();
239
+                        BLL.T_Bus_WorkOrder bll = new BLL.T_Bus_WorkOrder();
248 240
                         //var list1 = bll.GetList(uwhere + " and CONVERT(varchar(10),CreateTime, 23)='" + strDate + "' and State =2 and IsDel=0 ").Tables[0];
249 241
                         //var list2 = bll.GetList(uwhere + " and CONVERT(varchar(10),CreateTime, 23)='" + strDate + "' and State in (0,1) and IsDel=0 ").Tables[0];
250 242
                         //var list3 = bll.GetList(uwhere + " and CONVERT(char(7),CreateTime,20)='" + strMonth + "' and State =2 and IsDel=0 ").Tables[0];
251 243
                         //var list4 = bll.GetList(uwhere + " and CONVERT(char(7),CreateTime,20)='" + strMonth + "' and State in (0,1) and IsDel=0 ").Tables[0];
252 244
 
253 245
                         //日已完成
254
-                        var list1 = bll.GetList(uwhere + " and CONVERT(varchar(10),CreateTime, 23)='" + strDate + "' and State =1 and IsDel=0 ").Tables[0];
246
+                        var list1 = bll.GetList(uwhere + " and CONVERT(varchar(10),F_CreateTime, 23)='" + strDate + "' and F_State=1 and F_IsDelete=0 ").Tables[0];
255 247
                         //日未完成
256
-                        var list2 = bll.GetList(uwhere + " and CONVERT(varchar(10),CreateTime, 23)='" + strDate + "' and State=0 and IsDel=0 ").Tables[0];
248
+                        var list2 = bll.GetList(uwhere + " and CONVERT(varchar(10),F_CreateTime, 23)='" + strDate + "' and F_State=0 and F_IsDelete=0 ").Tables[0];
257 249
                         //月已完成
258
-                        var list3 = bll.GetList(uwhere + " and CONVERT(char(7),CreateTime,20)='" + strMonth + "' and State =1 and IsDel=0 ").Tables[0];
250
+                        var list3 = bll.GetList(uwhere + " and CONVERT(char(7),F_CreateTime,20)='" + strMonth + "' and F_State=1 and F_IsDelete=0 ").Tables[0];
259 251
                         //月未完成
260
-                        var list4 = bll.GetList(uwhere + " and CONVERT(char(7),CreateTime,20)='" + strMonth + "' and State=0 and IsDel=0 ").Tables[0];
252
+                        var list4 = bll.GetList(uwhere + " and CONVERT(char(7),F_CreateTime,20)='" + strMonth + "' and F_State=0 and F_IsDelete=0 ").Tables[0];
261 253
 
262 254
                         var obj = new
263 255
                         {
@@ -284,8 +276,7 @@ namespace CallCenterApi.Interface.Controllers
284 276
             {
285 277
 
286 278
                 int userId = CurrentUser.UserData.F_UserId;
287
-                string usercode = CurrentUser.UserData.F_UserCode;
288
-                int roleid = CurrentUser.UserData.F_RoleId;
279
+                Model.T_Sys_UserAccount userModel = new BLL.T_Sys_UserAccount().GetModel(userId);
289 280
                 if (userId != 0)
290 281
                 {
291 282
                     var date = DateTime.Now;//DateTime.Parse("2014-05-05"); //
@@ -294,9 +285,9 @@ namespace CallCenterApi.Interface.Controllers
294 285
                     string[] cols = { "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24" };
295 286
 
296 287
                     string uwhere = " 1=1 ";
297
-                    if (roleid != 17)
288
+                    if (userModel.rolecode != "XTGLY")
298 289
                     {
299
-                        uwhere += " and UserCode='" + usercode + "' ";
290
+                        uwhere += " and UserCode='" + userModel.F_UserCode + "' ";
300 291
                     }
301 292
 
302 293
                     BLL.T_Call_CallRecords bll = new BLL.T_Call_CallRecords();
@@ -313,8 +304,8 @@ namespace CallCenterApi.Interface.Controllers
313 304
                     var obj = new
314 305
                     {
315 306
                         col = cols,
316
-                        total = total,
317
-                        count = count
307
+                        total,
308
+                        count
318 309
                     };
319 310
                     return Success("成功", obj);
320 311
                 }
@@ -329,93 +320,89 @@ namespace CallCenterApi.Interface.Controllers
329 320
         /// <returns></returns>
330 321
         public ActionResult GetWorkTelByDay()
331 322
         {
332
-            
323
+
333 324
             if (Request.IsAuthenticated)
334 325
             {
335 326
 
336 327
                 int userId = CurrentUser.UserData.F_UserId;
337
-                if (userId != 0)
328
+                Model.T_Sys_UserAccount userModel = new BLL.T_Sys_UserAccount().GetModel(userId);
329
+                if (userModel != null)
338 330
                 {
339
-                    Model.T_Sys_UserAccount ua = new BLL.T_Sys_UserAccount().GetModel(userId);
340
-                    if (ua != null)
341
-                    {
342
-                        var date = DateTime.Now;//DateTime.Parse("2015-04-05"); //
343
-                        string strDate = date.ToString("yyyy-MM");
331
+                    var date = DateTime.Now;//DateTime.Parse("2015-04-05"); //
332
+                    string strDate = date.ToString("yyyy-MM");
344 333
 
345
-                        int days = DateTime.DaysInMonth(date.Year, date.Month);
334
+                    int days = DateTime.DaysInMonth(date.Year, date.Month);
346 335
 
347
-                        string[] strcols = { "01", "02", "03", "04", "05", "06", "07", "08", "09", "10",
336
+                    string[] strcols = { "01", "02", "03", "04", "05", "06", "07", "08", "09", "10",
348 337
                                   "11", "12", "13", "14", "15", "16", "17", "18", "19", "20",
349 338
                                   "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31" };
350
-                        int newcount = 0;
351
-                        List<string> cols = strcols.Take(days).ToList();
352
-                        BLL.T_Call_CallRecords telbll = new BLL.T_Call_CallRecords();
353
-                        //BLL.T_Wo_WorkOrderBase workbll = new BLL.T_Wo_WorkOrderBase();
354
-                        BLL.T_Wo_WorkOrder workbll = new BLL.T_Wo_WorkOrder();
355
-                        int[] teltotal = new int[days];
356
-                        int[] worktotal = new int[days];
357
-
358
-                        string uwhere = " 1=1 ";
359
-                        string u1where = " 1=1 ";
360
-                        if (ua.F_RoleId != 17)
361
-                        {
362
-                            uwhere += " and CreateUser='" + ua.F_UserCode + "' ";
363
-                            u1where += " and UserCode='" + ua.F_UserCode + "' ";
364
-                        }
339
+                    int newcount = 0;
340
+                    List<string> cols = strcols.Take(days).ToList();
341
+                    BLL.T_Call_CallRecords telbll = new BLL.T_Call_CallRecords();
342
+                    //BLL.T_Wo_WorkOrderBase workbll = new BLL.T_Wo_WorkOrderBase();
343
+                    BLL.T_Bus_WorkOrder workbll = new BLL.T_Bus_WorkOrder();
344
+                    int[] teltotal = new int[days];
345
+                    int[] worktotal = new int[days];
346
+
347
+                    string uwhere = " F_IsDelete=0 ";
348
+                    string u1where = " 1=1 ";
349
+                    if (userModel.rolecode != "XTGLY")
350
+                    {
351
+                        uwhere += " and F_CreateUser='" + userModel.F_UserCode + "' ";
352
+                        u1where += " and UserCode='" + userModel.F_UserCode + "' ";
353
+                    }
365 354
 
366
-                        for (int i = 0; i < cols.Count; i++)
367
-                        {
368
-                            //var tellist = telbll.GetModelList(" UserId='" + userId + "' and CONVERT(varchar(10),BeginTime, 23)='" + (strDate + "-" + cols[i]) + "' ");
369
-                            var tellist = telbll.GetModelList(u1where + " and CONVERT(varchar(10),BeginTime, 23)='" + (strDate + "-" + cols[i]) + "' ");
370
-                            teltotal[i] = tellist.Count;
371
-                            newcount = newcount + tellist.Count;
372
-                            //var worklist = workbll.GetList(" F_USERID='" + userId + "' and CONVERT(varchar(10),F_CREATEDATE, 23)='" + (strDate + "-" + cols[i]) + "' ").Tables[0];
373
-                            var worklist = workbll.GetList(uwhere + " and CONVERT(varchar(10),CreateTime, 23)='" + (strDate + "-" + cols[i]) + "' ").Tables[0];
374
-                            worktotal[i] = worklist.Rows.Count;
375
-                        }
355
+                    for (int i = 0; i < cols.Count; i++)
356
+                    {
357
+                        //var tellist = telbll.GetModelList(" UserId='" + userId + "' and CONVERT(varchar(10),BeginTime, 23)='" + (strDate + "-" + cols[i]) + "' ");
358
+                        var tellist = telbll.GetModelList(u1where + " and CONVERT(varchar(10),BeginTime, 23)='" + (strDate + "-" + cols[i]) + "' ");
359
+                        teltotal[i] = tellist.Count;
360
+                        newcount = newcount + tellist.Count;
361
+                        //var worklist = workbll.GetList(" F_USERID='" + userId + "' and CONVERT(varchar(10),F_CREATEDATE, 23)='" + (strDate + "-" + cols[i]) + "' ").Tables[0];
362
+                        var worklist = workbll.GetList(uwhere + " and CONVERT(varchar(10),F_CreateTime, 23)='" + (strDate + "-" + cols[i]) + "' ").Tables[0];
363
+                        worktotal[i] = worklist.Rows.Count;
364
+                    }
376 365
 
377
-                        var olddate = date.AddYears(-1);
378
-                        string strold1 = olddate.ToString("yyyy-MM") + "-1";
379
-                        string strold2 = olddate.ToString("yyyy-MM-dd");
366
+                    var olddate = date.AddYears(-1);
367
+                    string strold1 = olddate.ToString("yyyy-MM") + "-1";
368
+                    string strold2 = olddate.ToString("yyyy-MM-dd");
380 369
 
381
-                        string bl = string.Empty;
382
-                        var oldcount = telbll.GetModelList(u1where + " and CONVERT(varchar(10),BeginTime, 23)>='" + strold1 + "' and CONVERT(varchar(10),BeginTime, 23)<='" + strold2 + "' ").Count;
370
+                    string bl = string.Empty;
371
+                    var oldcount = telbll.GetModelList(u1where + " and CONVERT(varchar(10),BeginTime, 23)>='" + strold1 + "' and CONVERT(varchar(10),BeginTime, 23)<='" + strold2 + "' ").Count;
383 372
 
384
-                        if (oldcount == newcount)
385
-                        {
386
-                            bl = " 持平";
387
-                        }
388
-                        else
373
+                    if (oldcount == newcount)
374
+                    {
375
+                        bl = " 持平";
376
+                    }
377
+                    else
378
+                    {
379
+                        if (newcount != 0)
389 380
                         {
390
-                            if (newcount != 0)
381
+                            if (oldcount > newcount)
391 382
                             {
392
-                                if (oldcount > newcount)
393
-                                {
394
-                                    bl = " ↓ " + (Convert.ToDouble(oldcount - newcount) / Convert.ToDouble(newcount)).ToString("0.0%");
395
-                                }
396
-                                else if (oldcount < newcount)
397
-                                {
398
-                                    bl = " ↑ " + (Convert.ToDouble(newcount - oldcount) / Convert.ToDouble(newcount)).ToString("0.0%");
399
-                                }
383
+                                bl = " ↓ " + (Convert.ToDouble(oldcount - newcount) / Convert.ToDouble(newcount)).ToString("0.0%");
400 384
                             }
401
-                            else
385
+                            else if (oldcount < newcount)
402 386
                             {
403
-                                bl = " --";
387
+                                bl = " ↑ " + (Convert.ToDouble(newcount - oldcount) / Convert.ToDouble(newcount)).ToString("0.0%");
404 388
                             }
405 389
                         }
406
-
407
-                        var obj = new
390
+                        else
408 391
                         {
409
-                            bl = bl,
410
-                            col = cols.Select(p => p + "日"),
411
-                            worktotal = worktotal,
412
-                            teltotal = teltotal
413
-                        };
414
-
415
-                        return Success("成功", obj);
392
+                            bl = " --";
393
+                        }
416 394
                     }
417
-                }
418 395
 
396
+                    var obj = new
397
+                    {
398
+                        bl,
399
+                        col = cols.Select(p => p + "日"),
400
+                        worktotal,
401
+                        teltotal
402
+                    };
403
+
404
+                    return Success("成功", obj);
405
+                }
419 406
             }
420 407
             return NoToken("未知错误,请重新登录");
421 408
         }