Просмотр исходного кода

添加呼叫结果统计报表

mengjie лет назад: 7
Родитель
Сommit
c2a32eab64

+ 231 - 1
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/report/CallOutReportController.cs

@@ -18,7 +18,8 @@ namespace CallCenterApi.Interface.Controllers.report
18 18
         private readonly BLL.T_Ask_QuestionItems questionItemBLL = new BLL.T_Ask_QuestionItems();
19 19
         private readonly BLL.T_Sys_DictionaryValue dvItemBLL = new BLL.T_Sys_DictionaryValue();
20 20
         private readonly BLL.T_Call_OutTask otBLL = new BLL.T_Call_OutTask();
21
-
21
+        private BLL.T_Sys_UserAccount sysUserAccountBll = new BLL.T_Sys_UserAccount();
22
+        private readonly BLL.T_Call_OutTaskRecords otrBLL = new BLL.T_Call_OutTaskRecords();
22 23
 
23 24
         #region 获取外呼任务报表查询
24 25
         /// <summary>
@@ -1482,5 +1483,234 @@ namespace CallCenterApi.Interface.Controllers.report
1482 1483
         }
1483 1484
         #endregion
1484 1485
 
1486
+
1487
+        //统计坐席接通未接通等状态
1488
+        //2018-6-28调整报表添加
1489
+        #region 呼叫结果统计报表
1490
+        /// <summary>
1491
+        /// 呼叫结果统计报表
1492
+        /// </summary>
1493
+        /// <param name="agentid">坐席id</param>
1494
+        /// <param name="sdate">开始时间</param>
1495
+        /// <param name="edate">结束时间</param>
1496
+        /// <returns></returns>
1497
+        public ActionResult GetHJJGReport(string agentid, string sdate, string edate)
1498
+        {
1499
+            #region 测试用
1500
+            //TaskID = "";
1501
+            //quesid = "50";
1502
+            ////countryid = "524";
1503
+            //sdate = "2018-02-27";
1504
+            //edate = "2018-07-25";
1505
+            #endregion
1506
+
1507
+            #region 新建输出表
1508
+            DataTable dtnew = new DataTable();
1509
+            dtnew.Columns.Add("坐席");
1510
+
1511
+            var dsi = dvItemBLL.GetModelList(" F_DictionaryFlag='HJJG'");
1512
+            if (dsi.Count > 0)
1513
+            {
1514
+                foreach (var itemconf in dsi)
1515
+                {
1516
+                    dtnew.Columns.Add(itemconf.F_Name);
1517
+
1518
+                }
1519
+            }
1520
+            dtnew.Columns.Add("合计");
1521
+
1522
+            #endregion
1523
+
1524
+            //2018-7-5
1525
+            string strand = "";
1526
+            if (!string.IsNullOrEmpty(agentid))
1527
+            {
1528
+                strand = " and F_UserName='" + agentid + "' ";
1529
+            }
1530
+
1531
+            //2018-7-6
1532
+            DataRow drtotal = dtnew.NewRow();
1533
+            drtotal["坐席"] = "合计";
1534
+            #region 根据单位和QuestionItemID统计数量
1535
+            if (string.IsNullOrEmpty(agentid))//countryid == "")//为空时统计全部坐席信息,否则显示单个坐席数据
1536
+            {
1537
+                string sql = " f_seatflag=1 ";
1538
+                List<Model.T_Sys_UserAccount> userSeartList = sysUserAccountBll.GetModelList(sql + " order by f_userid asc ");
1539
+                if (userSeartList.Count > 0)
1540
+                {
1541
+                    int totalnum = 0;
1542
+                    foreach (var user in userSeartList)
1543
+                    {
1544
+                        DataRow dr = dtnew.NewRow();
1545
+                        agentid = user.F_UserCode;
1546
+                        dr["坐席"] = agentid;
1547
+                        foreach (var itemconf in dsi)
1548
+                        {
1549
+                            var dsk = otrBLL.GetRecordCount(" DATEDIFF(day,ExpandDatField1,'" + sdate + "')<=0 and DATEDIFF(day,ExpandDatField1,'" + edate + "')>=0 and F_UserName='" + agentid + "' and F_HJJGName='" + itemconf.F_Name + "'");
1550
+                            dr[itemconf.F_Name] = dsk;
1551
+                            totalnum += dsk;
1552
+
1553
+                        }
1554
+                        dr["合计"] = totalnum;
1555
+                        dtnew.Rows.Add(dr);
1556
+
1557
+                    }
1558
+
1559
+                }
1560
+            }
1561
+            else
1562
+            {
1563
+                DataRow dr = dtnew.NewRow();
1564
+                
1565
+                dr["坐席"] = agentid;
1566
+                int totalnum = 0;
1567
+                foreach (var itemconf in dsi)
1568
+                {
1569
+                    
1570
+                    var dsk = ansBLL.GetRecordCount(" DATEDIFF(day,ExpandDatField1,'" + sdate + "')<=0 and DATEDIFF(day,ExpandDatField1,'" + edate + "')>=0 and F_UserName='" + agentid + "' and F_HJJGName='" + itemconf.F_Name + "'");
1571
+                    dr[itemconf.F_Name] = dsk;
1572
+                    totalnum += dsk;
1573
+
1574
+                }
1575
+                dr["合计"] = totalnum;
1576
+                dtnew.Rows.Add(dr);
1577
+            }
1578
+                if (dsi.Count > 0)
1579
+                {
1580
+                    foreach (var itemconf in dsi)
1581
+                    {
1582
+
1583
+                        drtotal[itemconf.F_Name] = ColumnSum(dtnew, itemconf.F_Name);
1584
+
1585
+                    }
1586
+                }
1587
+
1588
+                drtotal["合计"] = ColumnSum(dtnew, "合计");
1589
+
1590
+                dtnew.Rows.Add(drtotal);
1591
+                return Success("获取坐席呼叫结果数据成功", dtnew);
1592
+                #endregion
1593
+
1594
+            
1595
+        }
1596
+        #endregion
1597
+
1598
+        #region 导出呼叫结果统计报表
1599
+        /// <summary>
1600
+        /// 呼叫结果统计报表
1601
+        /// </summary>
1602
+        /// <param name="agentid">坐席id</param>
1603
+        /// <param name="sdate">开始时间</param>
1604
+        /// <param name="edate">结束时间</param>
1605
+        /// <returns></returns>
1606
+        public ActionResult GetHJJGReportExpt(string agentid, string sdate, string edate)
1607
+        {
1608
+            #region 测试用
1609
+            //TaskID = "";
1610
+            //quesid = "50";
1611
+            ////countryid = "524";
1612
+            //sdate = "2018-02-27";
1613
+            //edate = "2018-07-25";
1614
+            #endregion
1615
+
1616
+            #region 新建输出表
1617
+            DataTable dtnew = new DataTable();
1618
+            dtnew.Columns.Add("坐席");
1619
+
1620
+            var dsi = dvItemBLL.GetModelList(" F_DictionaryFlag='HJJG'");
1621
+            if (dsi.Count > 0)
1622
+            {
1623
+                foreach (var itemconf in dsi)
1624
+                {
1625
+                    dtnew.Columns.Add(itemconf.F_Name);
1626
+
1627
+                }
1628
+            }
1629
+            dtnew.Columns.Add("合计");
1630
+
1631
+            #endregion
1632
+
1633
+            //2018-7-5
1634
+            string strand = "";
1635
+            if (!string.IsNullOrEmpty(agentid))
1636
+            {
1637
+                strand = " and F_UserName='" + agentid + "' ";
1638
+            }
1639
+
1640
+            //2018-7-6
1641
+            DataRow drtotal = dtnew.NewRow();
1642
+            drtotal["坐席"] = "合计";
1643
+            #region 根据单位和QuestionItemID统计数量
1644
+            if (string.IsNullOrEmpty(agentid))//countryid == "")//为空时统计全部坐席信息,否则显示单个坐席数据
1645
+            {
1646
+                string sql = " f_seatflag=1 ";
1647
+                List<Model.T_Sys_UserAccount> userSeartList = sysUserAccountBll.GetModelList(sql + " order by f_userid asc ");
1648
+                if (userSeartList.Count > 0)
1649
+                {
1650
+                    int totalnum = 0;
1651
+                    foreach (var user in userSeartList)
1652
+                    {
1653
+                        DataRow dr = dtnew.NewRow();
1654
+                        agentid = user.F_UserCode;
1655
+                        dr["坐席"] = agentid;
1656
+                        foreach (var itemconf in dsi)
1657
+                        {
1658
+                            var dsk = otrBLL.GetRecordCount(" DATEDIFF(day,ExpandDatField1,'" + sdate + "')<=0 and DATEDIFF(day,ExpandDatField1,'" + edate + "')>=0 and F_UserName='" + agentid + "' and F_HJJGName='" + itemconf.F_Name + "'");
1659
+                            dr[itemconf.F_Name] = dsk;
1660
+                            totalnum += dsk;
1661
+
1662
+                        }
1663
+                        dr["合计"] = totalnum;
1664
+                        dtnew.Rows.Add(dr);
1665
+
1666
+                    }
1667
+
1668
+                }
1669
+            }
1670
+            else
1671
+            {
1672
+                DataRow dr = dtnew.NewRow();
1673
+
1674
+                dr["坐席"] = agentid;
1675
+                int totalnum = 0;
1676
+                foreach (var itemconf in dsi)
1677
+                {
1678
+
1679
+                    var dsk = ansBLL.GetRecordCount(" DATEDIFF(day,ExpandDatField1,'" + sdate + "')<=0 and DATEDIFF(day,ExpandDatField1,'" + edate + "')>=0 and F_UserName='" + agentid + "' and F_HJJGName='" + itemconf.F_Name + "'");
1680
+                    dr[itemconf.F_Name] = dsk;
1681
+                    totalnum += dsk;
1682
+
1683
+                }
1684
+                dr["合计"] = totalnum;
1685
+                dtnew.Rows.Add(dr);
1686
+            }
1687
+            if (dsi.Count > 0)
1688
+            {
1689
+                foreach (var itemconf in dsi)
1690
+                {
1691
+
1692
+                    drtotal[itemconf.F_Name] = ColumnSum(dtnew, itemconf.F_Name);
1693
+
1694
+                }
1695
+            }
1696
+
1697
+            drtotal["合计"] = ColumnSum(dtnew, "合计");
1698
+
1699
+            dtnew.Rows.Add(drtotal);
1700
+            //return Success("获取坐席呼叫结果数据成功", dtnew);
1701
+            #endregion
1702
+            //导出dtnew
1703
+            NPOIHelper npoi = new NPOIHelper();
1704
+            if (npoi.ExportToExcel("呼叫结果统计数据", dtnew, null) == "")
1705
+            {
1706
+                return Success("导出成功");
1707
+            }
1708
+            else
1709
+            {
1710
+                return Error("导出失败");
1711
+            }
1712
+
1713
+        }
1714
+        #endregion
1485 1715
     }
1486 1716
 }