Przeglądaj źródła

通话时长统计修改

lihai 7 lat temu
rodzic
commit
402f552466

+ 13 - 5
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/report/TalkTimeController.cs

@@ -20,7 +20,7 @@ namespace CallCenterApi.Interface.Controllers.report
20 20
         {
21 21
             ActionResult res = NoToken("未知错误,请重新登录");
22 22
 
23
-            String[] str = { "坐席名称", "呼入次数", "呼入时长", "呼出次数", "呼出时长", "呼出未接通次数", "振铃时长", "通话总时长", "平均通话时长" };
23
+            String[] str = { "坐席名称", "呼入次数", "呼入时长(秒)", "呼出次数", "呼出时长(秒)", "呼出未接通次数", "振铃时长(秒)", "通话总时长(秒)", "平均通话时长(秒)" };
24 24
             res = Success("获取通话时长统计表头成功", str);
25 25
 
26 26
             return res;
@@ -142,7 +142,7 @@ namespace CallCenterApi.Interface.Controllers.report
142 142
             string[] CallOutWTime = GetCallRecordOut(stime, endtime, "1", "0", dpt).TrimStart('[').TrimEnd(']').Split(',');
143 143
             string[] CallOutWTimes = GetCallRecordRingTime(stime, endtime, dpt).TrimStart('[').TrimEnd(']').Split(',');
144 144
             string[] CallTotalTime = GetCallRecordTotalTime(stime, endtime, "", dpt).TrimStart('[').TrimEnd(']').Split(',');
145
-            string[] AgentArr = GetAgent().TrimStart('[').TrimEnd(']').Split(',');
145
+            string[] AgentArr = GetAgent(dpt).TrimStart('[').TrimEnd(']').Split(',');
146 146
             string[] AverageTime = GetCallAverageTime(stime, endtime, dpt).TrimStart('[').TrimEnd(']').Split(',');
147 147
 
148 148
             for (int i = 0; i < AgentArr.Length; i++)
@@ -227,10 +227,15 @@ namespace CallCenterApi.Interface.Controllers.report
227 227
         /// 获取坐席名称(x轴数据)
228 228
         /// </summary>
229 229
         /// <returns></returns>
230
-        public string GetAgent()
230
+        public string GetAgent(string dpt)
231 231
         {
232
+            string sqluser = "";
233
+            if (dpt != null && dpt.Trim() != "")
234
+            {
235
+                sqluser += $" and F_DeptId = {dpt} ";
236
+            }
232 237
             string result = "[";
233
-            var userAccountList = new BLL.T_Sys_UserAccount().GetModelList(" F_SeatFlag=1");
238
+            var userAccountList = new BLL.T_Sys_UserAccount().GetModelList($" F_SeatFlag=1 {sqluser}");
234 239
             foreach (Model.T_Sys_UserAccount item in userAccountList)
235 240
             {
236 241
                 result += "'" + item.F_UserName + "',";
@@ -293,7 +298,7 @@ namespace CallCenterApi.Interface.Controllers.report
293 298
         {
294 299
             string result = "[";
295 300
             string sql = " and CallType=" + Tag; // 呼入
296
-            var userAccountList = new BLL.T_Sys_UserAccount().GetModelList(" F_SeatFlag=1");
301
+            string sqluser = ""; // 呼入
297 302
 
298 303
             if (!string.IsNullOrEmpty(BeginTime))
299 304
             {
@@ -311,8 +316,11 @@ namespace CallCenterApi.Interface.Controllers.report
311 316
             }
312 317
             if (dpt != null && dpt.Trim() != "")
313 318
             {
319
+                sqluser += $" and F_DeptId = {dpt} ";
314 320
                 sql += $" AND UserCode IN (SELECT F_UserCode FROM dbo.T_Sys_UserAccount WHERE F_DeptId = {dpt} AND f_seatFlag=1 and F_WorkNumber!='') ";
315 321
             }
322
+
323
+            var userAccountList = new BLL.T_Sys_UserAccount().GetModelList($" F_SeatFlag=1  {sqluser}");
316 324
             //DataTable dt = DbHelperSQL.Query("SELECT UserId,UserCode,UserName,COUNT(*) AS calloutCount FROM T_Call_CallRecords where 1=1 " + sql + "  GROUP BY UserId,UserCode,UserName").Tables[0];
317 325
             //var recordstr = " select users.F_UserId,users.F_UserCode,users.F_UserName,COUNT(*) AS calloutCount from T_Sys_UserAccount users right join T_Call_CallRecords records on users.F_UserCode = records.UserCode and 1=1 " + sql + " GROUP BY users.F_UserId,users.F_UserCode,users.F_UserName";
318 326
             //20180509 通话时长统计不对  machenyang