Bladeren bron

修改bug

zhoufan 7 jaren geleden
bovenliggende
commit
e54464ca27

+ 67 - 0
CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/InfoController.cs

@@ -1505,6 +1505,73 @@ namespace CallCenterApi.Interface.Controllers
1505 1505
         }
1506 1506
 
1507 1507
         /// <summary>
1508
+        /// 获取通话数量
1509
+        /// </summary>
1510
+        /// <param name="start"></param>
1511
+        /// <param name="end"></param>
1512
+        /// <returns></returns>
1513
+        public ActionResult GetTelCountByDateNew(DateTime? start, DateTime? end)
1514
+        {
1515
+            string where = " ";
1516
+
1517
+            if (start == null && end == null)
1518
+            {
1519
+                where += " and datediff(day,BeginTime,getdate())=0";
1520
+            }
1521
+            else
1522
+            {
1523
+                if (start == null) { start = DateTime.Now; }
1524
+                if (end == null) { end = DateTime.Now; }
1525
+                where += $" and datediff(day,BeginTime,'{start.Value.ToString("yyyy-MM-dd")}')<=0 and datediff(day,BeginTime,'{end.Value.ToString("yyyy-MM-dd")}')>=0 ";
1526
+            }
1527
+
1528
+            //话务量
1529
+            DataTable dt = DbHelperSQL.Query(" select count(1) con from T_Call_CallRecords where 1=1 " + where).Tables[0];
1530
+
1531
+            var hwcon = dt.Rows[0]["con"].ToString();//话务量
1532
+
1533
+            //来话量
1534
+            DataTable dt1 = DbHelperSQL.Query(" select count(1) con from T_Call_CallRecords where CallType=0 " + where).Tables[0];
1535
+            var lhcon = dt1.Rows[0]["con"].ToString();//话务量
1536
+
1537
+            //接通量,通话时长
1538
+            DataTable dt2 = DbHelperSQL.Query(" select count(1) con,sum(TalkLongTime) tltimes from T_Call_CallRecords where CallState=1 " + where).Tables[0];
1539
+            var jtcon = dt2.Rows[0]["con"].ToString();//接通量
1540
+            var ths = dt2.Rows[0]["tltimes"];//通话时长
1541
+            var thtimes = "0";
1542
+            if (ths != null && ths.ToString() != "")
1543
+            {
1544
+                thtimes = ths.ToString();
1545
+            }
1546
+            //string jtl = "-";//接通率
1547
+            //if (hwcon != "0")
1548
+            //{
1549
+            //    jtl = (double.Parse(jtcon) / double.Parse(hwcon)).ToString("0.00%");
1550
+            //}
1551
+            double jtl = 0;//接通率
1552
+            if (hwcon != "0")
1553
+            {
1554
+                jtl = Math.Round((double.Parse(jtcon) * 100 / double.Parse(hwcon)), 2);
1555
+            }
1556
+            double pjthtimes = 0.00;//平均通话时长
1557
+            if (jtcon != "0")
1558
+            {
1559
+                pjthtimes = Math.Round(double.Parse(thtimes) / double.Parse(jtcon));
1560
+            }
1561
+
1562
+            var obj = new
1563
+            {
1564
+                hwcon = hwcon,
1565
+                lhcon = lhcon,
1566
+                jtcon = jtcon,
1567
+                pjthtimes = pjthtimes,
1568
+                jtl = jtl
1569
+            };
1570
+
1571
+            return Success("加载成功", obj);
1572
+        }
1573
+
1574
+        /// <summary>
1508 1575
         /// 坐席闲忙比例
1509 1576
         /// </summary>
1510 1577
         /// <param name="start"></param>