|
|
@@ -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;
|
|
|
@@ -117,12 +117,14 @@ namespace CallCenterApi.Interface.Controllers.report
|
|
117
|
117
|
DataColumn dc1 = new DataColumn("坐席名称", Type.GetType("System.String"));
|
|
118
|
118
|
DataColumn dc2 = new DataColumn("呼入次数", Type.GetType("System.String"));
|
|
119
|
119
|
DataColumn dc3 = new DataColumn("呼入时长", Type.GetType("System.String"));
|
|
120
|
|
- DataColumn dc4 = new DataColumn("呼出次数", Type.GetType("System.String"));
|
|
121
|
|
- DataColumn dc5 = new DataColumn("呼出时长", Type.GetType("System.String"));
|
|
122
|
|
- DataColumn dc6 = new DataColumn("呼出未接通次数", Type.GetType("System.String"));
|
|
123
|
|
- DataColumn dc7 = new DataColumn("振铃时长", Type.GetType("System.String"));
|
|
124
|
|
- DataColumn dc8 = new DataColumn("通话总时长", Type.GetType("System.String"));
|
|
125
|
|
- DataColumn dc9 = new DataColumn("平均通话总时长", Type.GetType("System.String"));
|
|
|
120
|
+ DataColumn dc4 = new DataColumn("呼入未接通次数", Type.GetType("System.String"));
|
|
|
121
|
+ DataColumn dc5 = new DataColumn("呼出次数", Type.GetType("System.String"));
|
|
|
122
|
+ DataColumn dc6 = new DataColumn("呼出时长", Type.GetType("System.String"));
|
|
|
123
|
+ DataColumn dc7 = new DataColumn("呼出未接通次数", Type.GetType("System.String"));
|
|
|
124
|
+ DataColumn dc8 = new DataColumn("振铃时长", Type.GetType("System.String"));
|
|
|
125
|
+ DataColumn dc9 = new DataColumn("接通总次数", Type.GetType("System.String"));
|
|
|
126
|
+ DataColumn dc10 = new DataColumn("通话总时长", Type.GetType("System.String"));
|
|
|
127
|
+ DataColumn dc11 = new DataColumn("平均通话总时长", Type.GetType("System.String"));
|
|
126
|
128
|
|
|
127
|
129
|
dtNew.Columns.Add(dc1);
|
|
128
|
130
|
dtNew.Columns.Add(dc2);
|
|
|
@@ -133,14 +135,18 @@ namespace CallCenterApi.Interface.Controllers.report
|
|
133
|
135
|
dtNew.Columns.Add(dc7);
|
|
134
|
136
|
dtNew.Columns.Add(dc8);
|
|
135
|
137
|
dtNew.Columns.Add(dc9);
|
|
|
138
|
+ dtNew.Columns.Add(dc10);
|
|
|
139
|
+ dtNew.Columns.Add(dc11);
|
|
136
|
140
|
#endregion
|
|
137
|
141
|
|
|
138
|
|
- string[] CallInTime = GetCallRecordIn(stime, endtime, "0").TrimStart('[').TrimEnd(']').Split(',');
|
|
|
142
|
+ string[] CallInTime = GetCallRecordIn(stime, endtime, "0","").TrimStart('[').TrimEnd(']').Split(',');
|
|
139
|
143
|
string[] CallInTimes = GetCallRecordTotalTime(stime, endtime, "0").TrimStart('[').TrimEnd(']').Split(',');
|
|
|
144
|
+ string[] CallInWTime = GetCallRecordIn(stime, endtime, "1", "0").TrimStart('[').TrimEnd(']').Split(',');
|
|
140
|
145
|
string[] CallOutTime = GetCallRecordOut(stime, endtime, "1", "").TrimStart('[').TrimEnd(']').Split(',');
|
|
141
|
146
|
string[] CallOutTimes = GetCallRecordTotalTime(stime, endtime, "1").TrimStart('[').TrimEnd(']').Split(',');
|
|
142
|
147
|
string[] CallOutWTime = GetCallRecordOut(stime, endtime, "1", "0").TrimStart('[').TrimEnd(']').Split(',');
|
|
143
|
148
|
string[] CallOutWTimes = GetCallRecordRingTime(stime, endtime).TrimStart('[').TrimEnd(']').Split(',');
|
|
|
149
|
+ string[] CallTime = GetCallRecord(stime, endtime, "", "1").TrimStart('[').TrimEnd(']').Split(',');
|
|
144
|
150
|
string[] CallTotalTime = GetCallRecordTotalTime(stime, endtime, "").TrimStart('[').TrimEnd(']').Split(',');
|
|
145
|
151
|
string[] AgentArr = GetAgent().TrimStart('[').TrimEnd(']').Split(',');
|
|
146
|
152
|
string[] AverageTime = GetCallAverageTime(stime, endtime).TrimStart('[').TrimEnd(']').Split(',');
|
|
|
@@ -152,10 +158,12 @@ namespace CallCenterApi.Interface.Controllers.report
|
|
152
|
158
|
drNew["坐席名称"] = AgentArr[i].Replace('\'', ' ');
|
|
153
|
159
|
drNew["呼入次数"] = CallInTime[i];
|
|
154
|
160
|
drNew["呼入时长"] = CallInTimes[i];
|
|
|
161
|
+ drNew["呼入未接通次数"] = CallInWTime[i];
|
|
155
|
162
|
drNew["呼出次数"] = CallOutTime[i];
|
|
156
|
163
|
drNew["呼出时长"] = CallOutTimes[i];
|
|
157
|
164
|
drNew["呼出未接通次数"] = CallOutWTime[i];
|
|
158
|
165
|
drNew["振铃时长"] = CallOutWTimes[i];
|
|
|
166
|
+ drNew["接通总次数"] = CallTime[i];
|
|
159
|
167
|
drNew["通话总时长"] = CallTotalTime[i];
|
|
160
|
168
|
drNew["平均通话总时长"] = AverageTime[i];
|
|
161
|
169
|
|
|
|
@@ -200,6 +208,7 @@ namespace CallCenterApi.Interface.Controllers.report
|
|
200
|
208
|
{
|
|
201
|
209
|
sql += " and CallType=" + tag;
|
|
202
|
210
|
}
|
|
|
211
|
+
|
|
203
|
212
|
var userAccountList = new BLL.T_Sys_UserAccount().GetModelList(" F_SeatFlag=1");
|
|
204
|
213
|
DataTable dt = DbHelperSQL.Query("SELECT UserId,UserCode,UserName,COUNT(*) AS calloutCount,SUM(TalkLongTime) AS TalkSummaryTime FROM T_Call_CallRecords where 1=1 " + sql + " GROUP BY UserId,UserCode,UserName").Tables[0];
|
|
205
|
214
|
|
|
|
@@ -241,7 +250,7 @@ namespace CallCenterApi.Interface.Controllers.report
|
|
241
|
250
|
{
|
|
242
|
251
|
string result = "[";
|
|
243
|
252
|
|
|
244
|
|
- string[] CallInTime = GetCallRecordIn(BeginTime, EndTime, "0").TrimStart('[').TrimEnd(']').Split(',');
|
|
|
253
|
+ string[] CallInTime = GetCallRecordIn(BeginTime, EndTime, "0","").TrimStart('[').TrimEnd(']').Split(',');
|
|
245
|
254
|
string[] CallOutTime = GetCallRecordOut(BeginTime, EndTime, "1","").TrimStart('[').TrimEnd(']').Split(',');
|
|
246
|
255
|
|
|
247
|
256
|
string[] CallTotalTime = GetCallRecordTotalTime(BeginTime, EndTime,"").TrimStart('[').TrimEnd(']').Split(',');
|
|
|
@@ -271,9 +280,19 @@ namespace CallCenterApi.Interface.Controllers.report
|
|
271
|
280
|
/// <param name="BeginTime">开始时间</param>
|
|
272
|
281
|
/// <param name="EndTime">结束时间</param>
|
|
273
|
282
|
/// <returns></returns>
|
|
274
|
|
- public string GetCallRecordIn(string BeginTime, string EndTime, string Tag)
|
|
|
283
|
+ public string GetCallRecordIn(string BeginTime, string EndTime, string Tag,string state)
|
|
275
|
284
|
{
|
|
276
|
|
- return GetHighChartData(BeginTime, EndTime, Tag, "");
|
|
|
285
|
+ return GetHighChartData(BeginTime, EndTime, Tag, state);
|
|
|
286
|
+ }
|
|
|
287
|
+ /// <summary>
|
|
|
288
|
+ /// 获取坐席的接通次数
|
|
|
289
|
+ /// </summary>
|
|
|
290
|
+ /// <param name="BeginTime">开始时间</param>
|
|
|
291
|
+ /// <param name="EndTime">结束时间</param>
|
|
|
292
|
+ /// <returns></returns>
|
|
|
293
|
+ public string GetCallRecord(string BeginTime, string EndTime, string Tag, string state)
|
|
|
294
|
+ {
|
|
|
295
|
+ return GetHighChartData(BeginTime, EndTime, Tag, state);
|
|
277
|
296
|
}
|
|
278
|
297
|
/// <summary>
|
|
279
|
298
|
/// 获取呼入呼出数据
|
|
|
@@ -285,25 +304,30 @@ namespace CallCenterApi.Interface.Controllers.report
|
|
285
|
304
|
private string GetHighChartData(string BeginTime, string EndTime, string Tag, string state)
|
|
286
|
305
|
{
|
|
287
|
306
|
string result = "[";
|
|
288
|
|
- string sql = " and CallType=" + Tag; // 呼入
|
|
|
307
|
+ string sql = " 1=1 ";
|
|
289
|
308
|
var userAccountList = new BLL.T_Sys_UserAccount().GetModelList(" F_SeatFlag=1");
|
|
290
|
309
|
|
|
|
310
|
+ if (Tag != "")
|
|
|
311
|
+ {
|
|
|
312
|
+ sql += " and CallType=" + Tag.Trim();
|
|
|
313
|
+ }
|
|
|
314
|
+
|
|
291
|
315
|
if (BeginTime != "")
|
|
292
|
316
|
{
|
|
293
|
|
- sql += " and BeginTime>='" + BeginTime + "'";
|
|
294
|
|
- //sql += " and DATEDIFF(d,BeginTime,'" + BeginTime + "')<=0";
|
|
|
317
|
+ //sql += " and BeginTime>='" + BeginTime + "'";
|
|
|
318
|
+ sql += " and DATEDIFF(d,BeginTime,'" + BeginTime + "')<=0";
|
|
295
|
319
|
}
|
|
296
|
320
|
if (EndTime != "")
|
|
297
|
321
|
{
|
|
298
|
|
- sql += " and BeginTime<='" + EndTime + "'";
|
|
299
|
|
- //sql += " and DATEDIFF(d,BeginTime,'" + EndTime + "')>=0";
|
|
|
322
|
+ //sql += " and BeginTime<='" + EndTime + "'";
|
|
|
323
|
+ sql += " and DATEDIFF(d,BeginTime,'" + EndTime + "')>=0";
|
|
300
|
324
|
}
|
|
301
|
325
|
if (state.Trim() != "")
|
|
302
|
326
|
{
|
|
303
|
327
|
sql += " and CallState=" + state.Trim();
|
|
304
|
328
|
}
|
|
305
|
329
|
|
|
306
|
|
- 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];
|
|
|
330
|
+ DataTable dt = DbHelperSQL.Query("SELECT UserId,UserCode,UserName,COUNT(*) AS calloutCount FROM T_Call_CallRecords where " + sql + " GROUP BY UserId,UserCode,UserName").Tables[0];
|
|
307
|
331
|
Dictionary<string, int> myDictionary = new Dictionary<string, int>();
|
|
308
|
332
|
|
|
309
|
333
|
foreach (Model.T_Sys_UserAccount item in userAccountList)
|
|
|
@@ -340,13 +364,13 @@ namespace CallCenterApi.Interface.Controllers.report
|
|
340
|
364
|
|
|
341
|
365
|
if (BeginTime != "")
|
|
342
|
366
|
{
|
|
343
|
|
- sql += " and BeginTime>='" + BeginTime + "'";
|
|
344
|
|
- //sql += " and DATEDIFF(d,BeginTime,'" + BeginTime + "')<=0";
|
|
|
367
|
+ //sql += " and BeginTime>='" + BeginTime + "'";
|
|
|
368
|
+ sql += " and DATEDIFF(d,BeginTime,'" + BeginTime + "')<=0";
|
|
345
|
369
|
}
|
|
346
|
370
|
if (EndTime != "")
|
|
347
|
371
|
{
|
|
348
|
|
- sql += " and BeginTime<='" + EndTime + "'";
|
|
349
|
|
- //sql += " and DATEDIFF(d,BeginTime,'" + EndTime + "')>=0";
|
|
|
372
|
+ //sql += " and BeginTime<='" + EndTime + "'";
|
|
|
373
|
+ sql += " and DATEDIFF(d,BeginTime,'" + EndTime + "')>=0";
|
|
350
|
374
|
}
|
|
351
|
375
|
sql += " and CallType=1 and CallState=0";
|
|
352
|
376
|
|