|
|
@@ -26,7 +26,8 @@ namespace CallCenterApi.Interface.Controllers.callout
|
|
26
|
26
|
private BLL.CallResult callResultBLL = new BLL.CallResult();
|
|
27
|
27
|
private BLL.T_CTI_TaskDaily taskDailyBLL = new BLL.T_CTI_TaskDaily();
|
|
28
|
28
|
private BLL.T_CTI_TaskPhonePart taskPhonePartBLL = new BLL.T_CTI_TaskPhonePart();
|
|
29
|
|
-
|
|
|
29
|
+ private BLL.T_Sys_SeatGroup seatGroupBLL = new BLL.T_Sys_SeatGroup();
|
|
|
30
|
+ private BLL.T_Sys_SystemConfig systemConfigBLL = new BLL.T_Sys_SystemConfig();
|
|
30
|
31
|
|
|
31
|
32
|
#region 外呼任务
|
|
32
|
33
|
/// <summary>
|
|
|
@@ -60,28 +61,30 @@ namespace CallCenterApi.Interface.Controllers.callout
|
|
60
|
61
|
var list = new List<CallPlanDto>();
|
|
61
|
62
|
|
|
62
|
63
|
//查询坐席组
|
|
63
|
|
- var agentGroupList = dictValueBLL.DataTableToList(dictValueBLL.GetList(" F_DictionaryFlag='ZXZ'").Tables[0]);
|
|
|
64
|
+ var agentGroupList = seatGroupBLL.DataTableToList(seatGroupBLL.GetList("").Tables[0]);
|
|
64
|
65
|
//查询坐席
|
|
65
|
66
|
var agentList = userAccount.DataTableToList(userAccount.GetList(" F_DeleteFlag=0 ").Tables[0]);
|
|
66
|
67
|
|
|
67
|
68
|
foreach (var model in modelList)
|
|
68
|
69
|
{
|
|
|
70
|
+ //计算数据
|
|
69
|
71
|
string calledRate = "0";
|
|
70
|
72
|
var allcount = model.y_HMCount ?? 0;
|
|
71
|
73
|
float calledcount = model.y_HCCount ?? 0;
|
|
72
|
|
- calledRate = allcount == 0 ? "" : calledcount / allcount * 100 + "%";
|
|
|
74
|
+ calledRate = allcount == 0 ? "" : (calledcount / allcount * 100).ToString("f2") + "%";
|
|
73
|
75
|
|
|
74
|
76
|
string connectedRate = "0";
|
|
75
|
77
|
float connected = model.y_YJCount ?? 0;
|
|
76
|
|
- connectedRate = calledcount == 0 ? "0" : connected / calledcount * 100 + "%";
|
|
|
78
|
+ connectedRate = calledcount == 0 ? "0" : (connected / calledcount * 100).ToString("f2") + "%";
|
|
77
|
79
|
|
|
78
|
|
- var taskTellNumDt = taskTellNumBLL.GetList(" F_HCState=1 and F_YJState=1 and F_UserId>0 ").Tables[0];
|
|
|
80
|
+ var taskTellNumDt = taskTellNumBLL.GetList(" F_HCState=1 and F_YJState=1 and F_UserId>0 and F_TaskId=" + model.TaskID).Tables[0];
|
|
79
|
81
|
float connectedAgentCount = taskTellNumDt?.Rows.Count ?? 0;
|
|
80
|
82
|
var connectedAgentRate = "0";
|
|
81
|
|
- connectedAgentRate = connected == 0 ? "0" : connectedAgentCount / connected * 100 + "%";
|
|
|
83
|
+ connectedAgentRate = connected == 0 ? "0" : (connectedAgentCount / connected * 100).ToString("f2") + "%";
|
|
82
|
84
|
|
|
83
|
|
- var agentGroup = agentGroupList.SingleOrDefault(x => x.F_DictionaryValueId == model.AgentGroupId);
|
|
84
|
|
- var agentCount = agentList.Where(x => x.F_GroupId == (agentGroup?.F_DictionaryValueId ?? 0)).Count();
|
|
|
85
|
+ var agentGroupStr = model.AgentGroupId == -999 ? "不转坐席" : "";
|
|
|
86
|
+ var agentGroup = agentGroupList.SingleOrDefault(x => x.F_ZXZID == model.AgentGroupId);
|
|
|
87
|
+ var agentCount = agentList.Where(x => x.F_SeartGroupID == (agentGroup?.F_ZXZID ?? 0)).Count();
|
|
85
|
88
|
list.Add(new CallPlanDto
|
|
86
|
89
|
{
|
|
87
|
90
|
id = model.TaskID,
|
|
|
@@ -99,7 +102,8 @@ namespace CallCenterApi.Interface.Controllers.callout
|
|
99
|
102
|
endtime1 = model.EndTime1.ToString("HH:mm:ss"),
|
|
100
|
103
|
starttime2 = model.StartTime2.ToString("HH:mm:ss"),
|
|
101
|
104
|
endtime2 = model.EndTime2.ToString("HH:mm:ss"),
|
|
102
|
|
- agentgroup = agentGroup?.F_Name ?? "",//坐席组
|
|
|
105
|
+ agentgroup = agentGroup?.F_ZXZName ?? agentGroupStr,//坐席组
|
|
|
106
|
+ agentgroupid = model.AgentGroupId,
|
|
103
|
107
|
agentcount = agentCount,//坐席组人数
|
|
104
|
108
|
allcount = model.y_HMCount ?? 0, //号码总数
|
|
105
|
109
|
calledcount = model.y_HCCount ?? 0, //已呼个数
|
|
|
@@ -130,30 +134,32 @@ namespace CallCenterApi.Interface.Controllers.callout
|
|
130
|
134
|
//if (!Request.IsAuthenticated)
|
|
131
|
135
|
// return NoToken("未知错误,请重新登录");
|
|
132
|
136
|
var model = taskBLL.GetModel(id);
|
|
133
|
|
-
|
|
|
137
|
+ if (model == null)
|
|
|
138
|
+ return Error("预测外呼任务不存在");
|
|
134
|
139
|
//计算数据
|
|
135
|
140
|
string calledRate = "0";
|
|
136
|
141
|
var allcount = model.y_HMCount ?? 0;
|
|
137
|
142
|
float calledcount = model.y_HCCount ?? 0;
|
|
138
|
|
- calledRate = allcount == 0 ? "" : calledcount / allcount * 100 + "%";
|
|
|
143
|
+ calledRate = allcount == 0 ? "" : (calledcount / allcount * 100).ToString("f2") + "%";
|
|
139
|
144
|
|
|
140
|
145
|
string connectedRate = "0";
|
|
141
|
146
|
float connected = model.y_YJCount ?? 0;
|
|
142
|
|
- connectedRate = calledcount == 0 ? "0" : connected / calledcount * 100 + "%";
|
|
|
147
|
+ connectedRate = calledcount == 0 ? "0" : (connected / calledcount * 100).ToString("f2") + "%";
|
|
143
|
148
|
|
|
144
|
|
- var taskTellNumDt = taskTellNumBLL.GetList(" F_HCState=1 and F_YJState=1 and F_UserId>0 ").Tables[0];
|
|
|
149
|
+ var taskTellNumDt = taskTellNumBLL.GetList(" F_HCState=1 and F_YJState=1 and F_UserId>0 and F_TaskId=" + model.TaskID).Tables[0];
|
|
145
|
150
|
float connectedAgentCount = taskTellNumDt?.Rows.Count ?? 0;
|
|
146
|
151
|
var connectedAgentRate = "0";
|
|
147
|
|
- connectedAgentRate = connected == 0 ? "0" : connectedAgentCount / connected * 100 + "%";
|
|
|
152
|
+ connectedAgentRate = connected == 0 ? "0" : (connectedAgentCount / connected * 100).ToString("f2") + "%";
|
|
148
|
153
|
|
|
149
|
154
|
//查询坐席组
|
|
150
|
|
- var agentGroupList = dictValueBLL.DataTableToList(dictValueBLL.GetList(" F_DictionaryFlag='ZXZ'").Tables[0]);
|
|
|
155
|
+ var agentGroupList = seatGroupBLL.DataTableToList(seatGroupBLL.GetList("").Tables[0]);
|
|
151
|
156
|
//查询坐席
|
|
152
|
157
|
var agentList = userAccount.DataTableToList(userAccount.GetList(" F_DeleteFlag=0 ").Tables[0]);
|
|
153
|
158
|
|
|
154
|
159
|
|
|
155
|
|
- var agentGroup = agentGroupList.SingleOrDefault(x => x.F_DictionaryValueId == model.AgentGroupId);
|
|
156
|
|
- var agentCount = agentList.Where(x => x.F_GroupId == (agentGroup?.F_DictionaryValueId ?? 0)).Count();
|
|
|
160
|
+ var agentGroupStr = model.AgentGroupId == -999 ? "不转坐席" : "";
|
|
|
161
|
+ var agentGroup = agentGroupList.SingleOrDefault(x => x.F_ZXZID == model.AgentGroupId);
|
|
|
162
|
+ var agentCount = agentList.Where(x => x.F_SeartGroupID == (agentGroup?.F_ZXZID ?? 0)).Count();
|
|
157
|
163
|
|
|
158
|
164
|
return Success("获取成功", new CallPlanDto
|
|
159
|
165
|
{
|
|
|
@@ -164,6 +170,8 @@ namespace CallCenterApi.Interface.Controllers.callout
|
|
164
|
170
|
addtime = Convert.ToDateTime(model.AddTime).ToString("yyyy-MM-dd HH:mm:ss"),
|
|
165
|
171
|
talkid = model.y_TkModelId ?? 0,
|
|
166
|
172
|
pre = model.Pre, //线路前缀
|
|
|
173
|
+ recordpathid = model.RecordFileId,
|
|
|
174
|
+ concurrencytypestr = model.ConcurrencyType == 0 ? "并发数" : "并发速率",
|
|
167
|
175
|
concurrencytype = model.ConcurrencyType,
|
|
168
|
176
|
concurrency = model.Concurrency,
|
|
169
|
177
|
planstartdate = model.PlanStartDate.ToString("yyyy-MM-dd"),
|
|
|
@@ -172,8 +180,8 @@ namespace CallCenterApi.Interface.Controllers.callout
|
|
172
|
180
|
endtime1 = model.EndTime1.ToString("HH:mm"),
|
|
173
|
181
|
starttime2 = model.StartTime2.ToString("HH:mm"),
|
|
174
|
182
|
endtime2 = model.EndTime2.ToString("HH:mm"),
|
|
175
|
|
- agentgroupid = agentGroup?.F_DictionaryValueId ?? 0,
|
|
176
|
|
- agentgroup = agentGroup?.F_Name ?? "",//坐席组
|
|
|
183
|
+ agentgroup = agentGroup?.F_ZXZName ?? agentGroupStr,//坐席组
|
|
|
184
|
+ agentgroupid = model.AgentGroupId,
|
|
177
|
185
|
agentcount = agentCount,//坐席组人数
|
|
178
|
186
|
allcount = model.y_HMCount ?? 0, //号码总数
|
|
179
|
187
|
calledcount = model.y_HCCount ?? 0, //已呼个数
|
|
|
@@ -215,6 +223,7 @@ namespace CallCenterApi.Interface.Controllers.callout
|
|
215
|
223
|
return Error("输入的并发数和进号速率必须不小于1");
|
|
216
|
224
|
model.ConcurrencyType = input.ConcurrencyType;
|
|
217
|
225
|
model.Concurrency = input.ConcurrencyType == 0 ? (int)input.Concurrency : input.Concurrency;
|
|
|
226
|
+ model.RecordFileId = input.RecordPathId;
|
|
218
|
227
|
model.y_HMCount = 0;
|
|
219
|
228
|
model.y_HCCount = 0;
|
|
220
|
229
|
model.y_YJCount = 0;
|
|
|
@@ -234,7 +243,7 @@ namespace CallCenterApi.Interface.Controllers.callout
|
|
234
|
243
|
model.y_NoAnswerCount = 0;
|
|
235
|
244
|
model.y_ShutDownCount = 0;
|
|
236
|
245
|
model.PlanStartDate = input.PlanStartDate;
|
|
237
|
|
- model.PlanEndDate = input.PlanEndDate;
|
|
|
246
|
+ model.PlanEndDate = input.PlanEndDate.AddDays(1).AddSeconds(-1);
|
|
238
|
247
|
model.StartTime1 = input.StartTime1;
|
|
239
|
248
|
model.EndTime1 = input.EndTime1;
|
|
240
|
249
|
model.StartTime2 = input.StartTime2;
|
|
|
@@ -292,7 +301,7 @@ namespace CallCenterApi.Interface.Controllers.callout
|
|
292
|
301
|
break;
|
|
293
|
302
|
case 4: //从Excel中导入
|
|
294
|
303
|
NPOIHelper npoi = new NPOIHelper();
|
|
295
|
|
- var dtExcel = npoi.ExcelToTable(input.FilePath, 0);
|
|
|
304
|
+ var dtExcel = npoi.ExcelToTable(input.PhoneStr, 1);
|
|
296
|
305
|
|
|
297
|
306
|
break;
|
|
298
|
307
|
}
|
|
|
@@ -326,7 +335,7 @@ namespace CallCenterApi.Interface.Controllers.callout
|
|
326
|
335
|
model.TaskType = input.Type;
|
|
327
|
336
|
model.AgentGroupId = input.AgentGroupId;
|
|
328
|
337
|
model.y_TkModelId = input.PagerId;
|
|
329
|
|
- model.Pre = input.Pre;
|
|
|
338
|
+ //model.Pre = input.Pre;
|
|
330
|
339
|
if (input.ConcurrencyType == 0)
|
|
331
|
340
|
{
|
|
332
|
341
|
var num = 0;
|
|
|
@@ -339,11 +348,12 @@ namespace CallCenterApi.Interface.Controllers.callout
|
|
339
|
348
|
model.ConcurrencyType = input.ConcurrencyType;
|
|
340
|
349
|
model.Concurrency = input.ConcurrencyType == 0 ? (int)input.Concurrency : input.Concurrency;
|
|
341
|
350
|
model.PlanStartDate = input.PlanStartDate;
|
|
342
|
|
- model.PlanEndDate = input.PlanEndDate;
|
|
|
351
|
+ model.PlanEndDate = input.PlanEndDate.AddDays(1).AddSeconds(-1);
|
|
343
|
352
|
model.StartTime1 = input.StartTime1;
|
|
344
|
353
|
model.EndTime1 = input.EndTime1;
|
|
345
|
354
|
model.StartTime2 = input.StartTime2;
|
|
346
|
355
|
model.EndTime2 = input.EndTime2;
|
|
|
356
|
+ model.RecordFileId = input.RecordPathId;
|
|
347
|
357
|
if (taskBLL.Update(model))
|
|
348
|
358
|
return Success("修改成功");
|
|
349
|
359
|
return Error("修改失败");
|
|
|
@@ -381,17 +391,24 @@ namespace CallCenterApi.Interface.Controllers.callout
|
|
381
|
391
|
/// <param name="id"></param>
|
|
382
|
392
|
/// <param name="concurrency"></param>
|
|
383
|
393
|
/// <returns></returns>
|
|
384
|
|
- public ActionResult UpdateConcurrency(long id, float concurrency)
|
|
|
394
|
+ public ActionResult UpdateConcurrency(long id, float concurrency, int concurrencyType = 0)
|
|
385
|
395
|
{
|
|
386
|
396
|
//if (!Request.IsAuthenticated)
|
|
387
|
397
|
// return NoToken("未知错误,请重新登录");
|
|
388
|
398
|
var model = taskBLL.GetModel(id);
|
|
389
|
399
|
if (model == null)
|
|
390
|
400
|
return Error("该外呼任务不存在");
|
|
391
|
|
- var num = 0;
|
|
392
|
|
- if (!int.TryParse(concurrency.ToString(), out num))
|
|
393
|
|
- return Error("并发数必须为不小于1的整数");
|
|
394
|
|
- model.Concurrency = (int)concurrency;
|
|
|
401
|
+ if (concurrencyType == 0)
|
|
|
402
|
+ {
|
|
|
403
|
+ var num = 0;
|
|
|
404
|
+ if (!int.TryParse(concurrency.ToString(), out num))
|
|
|
405
|
+ return Error("并发数必须为不小于1的整数");
|
|
|
406
|
+ concurrency = num;
|
|
|
407
|
+ }
|
|
|
408
|
+ if (concurrency < 1)
|
|
|
409
|
+ return Error("输入的并发数和进号速率必须不小于1");
|
|
|
410
|
+ model.ConcurrencyType = concurrencyType;
|
|
|
411
|
+ model.Concurrency = concurrency;
|
|
395
|
412
|
if (taskBLL.Update(model))
|
|
396
|
413
|
return Success("修改成功");
|
|
397
|
414
|
return Error("修改失败");
|
|
|
@@ -408,15 +425,80 @@ namespace CallCenterApi.Interface.Controllers.callout
|
|
408
|
425
|
if (num > 0)
|
|
409
|
426
|
{
|
|
410
|
427
|
var task = taskBLL.GetModel(id);
|
|
411
|
|
-
|
|
412
|
|
-
|
|
413
|
428
|
return Success("删除成功");
|
|
414
|
429
|
}
|
|
415
|
430
|
return Error("删除失败");
|
|
416
|
431
|
}
|
|
|
432
|
+ /// <summary>
|
|
|
433
|
+ /// 去除号码前缀
|
|
|
434
|
+ /// </summary>
|
|
|
435
|
+ /// <param name="callId"></param>
|
|
|
436
|
+ /// <param name="tel"></param>
|
|
|
437
|
+ /// <returns></returns>
|
|
|
438
|
+ public ActionResult RemovePre(string callId, string tel)
|
|
|
439
|
+ {
|
|
|
440
|
+ //if (!Request.IsAuthenticated)
|
|
|
441
|
+ // return NoToken("未知错误,请重新登录");
|
|
|
442
|
+ var callResult = callResultBLL.GetModel(callId);
|
|
|
443
|
+ if (callResult == null)
|
|
|
444
|
+ return Error("通话记录未正常添加");
|
|
|
445
|
+ var task = taskBLL.GetModel(callResult.TaskId);
|
|
|
446
|
+ if (task == null)
|
|
|
447
|
+ return Error("任务不存在");
|
|
|
448
|
+ var len = task.Pre.Length;
|
|
|
449
|
+ return Success("去除成功", tel.Substring(len));
|
|
|
450
|
+ }
|
|
|
451
|
+ /// <summary>
|
|
|
452
|
+ /// 更新外呼任务状态
|
|
|
453
|
+ /// </summary>
|
|
|
454
|
+ /// <returns></returns>
|
|
|
455
|
+ public ActionResult UpdateCallPlanState()
|
|
|
456
|
+ {
|
|
|
457
|
+ StringBuilder sb = new StringBuilder();
|
|
|
458
|
+ var log = LogFactory.GetLogger(this.GetType().ToString());
|
|
|
459
|
+ var list = taskBLL.DataTableToList(taskBLL.GetList(" state>=0 ").Tables[0]);
|
|
|
460
|
+ foreach (var task in list)
|
|
|
461
|
+ {
|
|
|
462
|
+ if (task.PlanStartDate <= DateTime.Now && task.PlanEndDate > DateTime.Now)
|
|
|
463
|
+ {
|
|
|
464
|
+ if (task.State == 2)
|
|
|
465
|
+ {
|
|
|
466
|
+ if (task.PlanStartDate < DateTime.Now && DateTime.Now < task.StartTime1)
|
|
|
467
|
+ {
|
|
|
468
|
+ task.State = 0;
|
|
|
469
|
+ if (!taskBLL.Update(task))
|
|
|
470
|
+ return Error($"更新自动外呼任务状态为0=待处理失败,ID={task.TaskID},Name={task.TaskName}");
|
|
|
471
|
+ log.Info($"更新自动外呼任务状态为0=待处理成功,ID={task.TaskID},Name={task.TaskName}");
|
|
|
472
|
+ }
|
|
|
473
|
+ }
|
|
|
474
|
+ if (task.State == 0)
|
|
|
475
|
+ {
|
|
|
476
|
+ if ((DateTime.Now >= task.StartTime1 && DateTime.Now < task.EndTime1) || (DateTime.Now > task.StartTime2 && DateTime.Now < task.EndTime2))
|
|
|
477
|
+ {
|
|
|
478
|
+ task.State = 1;
|
|
|
479
|
+ if (!taskBLL.Update(task))
|
|
|
480
|
+ return Error($"更新自动外呼任务状态为1=处理中失败,ID={task.TaskID},Name={task.TaskName}");
|
|
|
481
|
+ log.Info($"更新自动外呼任务状态为1=处理中成功,ID={task.TaskID},Name={task.TaskName}");
|
|
|
482
|
+
|
|
|
483
|
+ }
|
|
|
484
|
+ }
|
|
|
485
|
+ if (task.State == 1)
|
|
|
486
|
+ {
|
|
|
487
|
+ if (task.PlanEndDate < DateTime.Now)
|
|
|
488
|
+ {
|
|
|
489
|
+ task.State = 0;
|
|
|
490
|
+ if (!taskBLL.Update(task))
|
|
|
491
|
+ return Error($"更新自动外呼任务状态为2=暂停失败,ID={task.TaskID},Name={task.TaskName}");
|
|
|
492
|
+ log.Info($"更新自动外呼任务状态为2=暂停成功,ID={task.TaskID},Name={task.TaskName}");
|
|
|
493
|
+ }
|
|
|
494
|
+ }
|
|
|
495
|
+ }
|
|
|
496
|
+ }
|
|
|
497
|
+ return Success("处理完成");
|
|
|
498
|
+ }
|
|
417
|
499
|
#endregion
|
|
418
|
500
|
|
|
419
|
|
- #region 导入导出数据
|
|
|
501
|
+ #region 导入导出号码
|
|
420
|
502
|
/// <summary>
|
|
421
|
503
|
/// 导入号码信息
|
|
422
|
504
|
/// </summary>
|
|
|
@@ -477,11 +559,11 @@ namespace CallCenterApi.Interface.Controllers.callout
|
|
477
|
559
|
switch (type)
|
|
478
|
560
|
{
|
|
479
|
561
|
case 1:
|
|
480
|
|
- var dt1 = taskTellNumBLL.GetList(" F_TaskId=" + task.TaskID + " and F_HCState=1 and F_YJState=0 ").Tables[0];
|
|
|
562
|
+ var dt1 = taskTellNumBLL.GetPhoneList(" F_TaskId=" + task.TaskID + " and F_HCState=1 and (F_YJState=0 or F_YJState is null) ").Tables[0];
|
|
481
|
563
|
var msg1 = npoi.ExportToExcel(DateTime.Now.ToString("yyyyMMdd") + task.TaskName + "导出未接通号码", dt1);
|
|
482
|
564
|
return !string.IsNullOrWhiteSpace(msg1) ? Error(msg1) : Success("导出成功");
|
|
483
|
565
|
case 2:
|
|
484
|
|
- var dt2 = taskTellNumBLL.GetList(" F_TaskId=" + task.TaskID + " and F_HCState=1 and F_YJState=1 ").Tables[0];
|
|
|
566
|
+ var dt2 = taskTellNumBLL.GetPhoneList(" F_TaskId=" + task.TaskID + " and F_HCState=1 and F_YJState=1 ").Tables[0];
|
|
485
|
567
|
var msg2 = npoi.ExportToExcel(DateTime.Now.ToString("yyyyMMdd") + task.TaskName + "导出已接通号码", dt2);
|
|
486
|
568
|
return !string.IsNullOrWhiteSpace(msg2) ? Error(msg2) : Success("导出成功");
|
|
487
|
569
|
}
|
|
|
@@ -509,18 +591,36 @@ namespace CallCenterApi.Interface.Controllers.callout
|
|
509
|
591
|
/// 获取自动放音文件
|
|
510
|
592
|
/// </summary>
|
|
511
|
593
|
/// <returns></returns>
|
|
512
|
|
- public ActionResult GetRecordList()
|
|
|
594
|
+ public ActionResult GetRecordList(FilterTalkRecord filter)
|
|
513
|
595
|
{
|
|
514
|
596
|
//if (!Request.IsAuthenticated)
|
|
515
|
597
|
// return NoToken("未知错误,请重新登录");
|
|
516
|
|
- var list = taskRecordBLL.DataTableToList(taskRecordBLL.GetList("").Tables[0]).Select(x => new
|
|
|
598
|
+ var recordCount = 0;
|
|
|
599
|
+ var dt = BLL.PagerBLL.GetListPager(
|
|
|
600
|
+ "T_CTI_TaskRecord ",
|
|
|
601
|
+ "id",
|
|
|
602
|
+ "*",
|
|
|
603
|
+ "",
|
|
|
604
|
+ "ORDER BY id desc",
|
|
|
605
|
+ filter.PageSize,
|
|
|
606
|
+ filter.PageIndex,
|
|
|
607
|
+ true,
|
|
|
608
|
+ out recordCount);
|
|
|
609
|
+
|
|
|
610
|
+
|
|
|
611
|
+ var list = taskRecordBLL.DataTableToList(dt).Select(x => new
|
|
517
|
612
|
{
|
|
518
|
613
|
id = x.Id,
|
|
519
|
614
|
name = x.Name,
|
|
520
|
615
|
recordpath = x.RecordPath,
|
|
521
|
616
|
recordtime = x.RecordTime,
|
|
522
|
617
|
});
|
|
523
|
|
- return Success("成功", list.ToList());
|
|
|
618
|
+ var obj = new
|
|
|
619
|
+ {
|
|
|
620
|
+ rows = list,
|
|
|
621
|
+ total = recordCount
|
|
|
622
|
+ };
|
|
|
623
|
+ return Content(obj.ToJson());
|
|
524
|
624
|
}
|
|
525
|
625
|
/// <summary>
|
|
526
|
626
|
/// 获取录音
|
|
|
@@ -553,25 +653,40 @@ namespace CallCenterApi.Interface.Controllers.callout
|
|
553
|
653
|
Model.T_CTI_TaskRecord model = new Model.T_CTI_TaskRecord();
|
|
554
|
654
|
if (input.Id <= 0)
|
|
555
|
655
|
{
|
|
556
|
|
- var file = Request.Files[0];
|
|
|
656
|
+ var dir = Server.MapPath("~/UploadRecord/");
|
|
557
|
657
|
|
|
|
658
|
+ if (!Directory.Exists(dir))
|
|
|
659
|
+ {
|
|
|
660
|
+ Directory.CreateDirectory(dir);
|
|
|
661
|
+ }
|
|
|
662
|
+ var file = Request.Files[0];
|
|
|
663
|
+ if (file.ContentType != "audio/x-wav" && file.ContentType != "audio/wav")
|
|
|
664
|
+ return Error("上传录音格式必须为.wav");
|
|
558
|
665
|
|
|
|
666
|
+ var name = DateTime.Now.ToString("yyyyMMddHHmmss") + Guid.NewGuid().ToString("N").Substring(0, 10) + ".wav";
|
|
|
667
|
+ var path = dir + name;
|
|
|
668
|
+ Request.Files[0].SaveAs(path);
|
|
559
|
669
|
|
|
|
670
|
+ FileInfo fileInfo = new FileInfo(path);
|
|
|
671
|
+ var fileName = FileUp.UploadFile(fileInfo, "/", "120.194.141.197", "Administrator", "hykj@800100");
|
|
560
|
672
|
|
|
|
673
|
+ var sysConfig = systemConfigBLL.GetModel(40);
|
|
|
674
|
+ if (sysConfig == null)
|
|
|
675
|
+ return Error("自动放音录音路径查询失败");
|
|
561
|
676
|
model.Name = input.Name;
|
|
562
|
|
- model.RecordPath = input.RecordPath;
|
|
563
|
|
- model.RecordTime = input.RecordTime;
|
|
|
677
|
+ model.RecordPath = sysConfig.F_ParamValue + fileName;
|
|
|
678
|
+ //model.RecordTime = input.RecordTime;
|
|
564
|
679
|
model.Remark = input.Remark;
|
|
565
|
680
|
|
|
566
|
681
|
if (taskRecordBLL.Add(model) > 0)
|
|
567
|
682
|
return Success("添加成功");
|
|
568
|
683
|
return Error("添加失败");
|
|
569
|
684
|
}
|
|
570
|
|
- return Success("");
|
|
|
685
|
+ return Success("添加失败");
|
|
571
|
686
|
}
|
|
572
|
687
|
#endregion
|
|
573
|
688
|
|
|
574
|
|
- #region 话务统计
|
|
|
689
|
+ #region 话单查询
|
|
575
|
690
|
/// <summary>
|
|
576
|
691
|
/// 话务分析
|
|
577
|
692
|
/// </summary>
|
|
|
@@ -588,16 +703,46 @@ namespace CallCenterApi.Interface.Controllers.callout
|
|
588
|
703
|
|
|
589
|
704
|
//}
|
|
590
|
705
|
|
|
591
|
|
- var fir = taskDailyBLL.DataTableToList(taskDailyBLL.GetList("").Tables[0]);
|
|
592
|
|
- var sec = taskPhonePartBLL.DataTableToList(taskPhonePartBLL.GetList("").Tables[0]);
|
|
|
706
|
+ var fir = taskPhonePartBLL.DataTableToList(taskPhonePartBLL.GetList("").Tables[0]);
|
|
|
707
|
+ var sec = taskDailyBLL.DataTableToList(taskDailyBLL.GetList("").Tables[0]);
|
|
593
|
708
|
var thi = taskDailyBLL.DataTableToList(taskDailyBLL.GetList().Tables[0]);
|
|
594
|
709
|
|
|
595
|
|
-
|
|
596
|
710
|
var obj = new
|
|
597
|
711
|
{
|
|
598
|
|
- fir = fir,
|
|
599
|
|
- sec = sec,
|
|
600
|
|
- thi = thi
|
|
|
712
|
+ fir = fir.Select(x => new
|
|
|
713
|
+ {
|
|
|
714
|
+ date = x.Date.ToString("yyyy-MM-dd"),
|
|
|
715
|
+ phonepart = x.PhonePart,
|
|
|
716
|
+ province = x.Province,
|
|
|
717
|
+ city = x.City,
|
|
|
718
|
+ connectedcount = x.CalledCount == 0 ? "" : (x.ConnectedCount / x.CalledCount * 100).ToString("f2") + "%",
|
|
|
719
|
+ connectedagentcount = x.ConnectedCount == 0 ? "" : (x.ConnectedAgentCount / x.ConnectedCount * 100).ToString("f2") + "%",
|
|
|
720
|
+ }),
|
|
|
721
|
+ sec = sec.Select(x => new
|
|
|
722
|
+ {
|
|
|
723
|
+ date = x.Date.ToString("yyyy-MM-dd"),
|
|
|
724
|
+ allcount = x.AllCount,
|
|
|
725
|
+ calledcount = x.CalledCount,
|
|
|
726
|
+ connectedcount = x.ConnectedCount,
|
|
|
727
|
+ connectedagentcount = x.ConnectedAgentCount,
|
|
|
728
|
+ connectedrate = x.CalledCount == 0 ? "" : (x.ConnectedCount / x.CalledCount * 100).ToString("f2") + "%",
|
|
|
729
|
+ connectedagentrate = x.ConnectedCount == 0 ? "" : (x.ConnectedAgentCount / x.ConnectedCount * 100).ToString("f2") + "%",
|
|
|
730
|
+ taskid = x.TaskId,
|
|
|
731
|
+ taskname = x.TaskName
|
|
|
732
|
+
|
|
|
733
|
+ }),
|
|
|
734
|
+ thi = thi.Select(x => new
|
|
|
735
|
+ {
|
|
|
736
|
+ date = x.Date.ToString("yyyy-MM-dd"),
|
|
|
737
|
+ allcount = x.AllCount,
|
|
|
738
|
+ calledcount = x.CalledCount,
|
|
|
739
|
+ connectedcount = x.ConnectedCount,
|
|
|
740
|
+ connectedagentcount = x.ConnectedAgentCount,
|
|
|
741
|
+ connectedrate = x.CalledCount == 0 ? "" : (x.ConnectedCount / x.CalledCount * 100).ToString("f2") + "%",
|
|
|
742
|
+ connectedagentrate = x.ConnectedCount == 0 ? "" : (x.ConnectedAgentCount / x.ConnectedCount * 100).ToString("f2") + "%",
|
|
|
743
|
+ taskid = x.TaskId,
|
|
|
744
|
+ taskname = x.TaskName
|
|
|
745
|
+ })
|
|
601
|
746
|
};
|
|
602
|
747
|
|
|
603
|
748
|
|
|
|
@@ -611,46 +756,112 @@ namespace CallCenterApi.Interface.Controllers.callout
|
|
611
|
756
|
{
|
|
612
|
757
|
//if (!Request.IsAuthenticated)
|
|
613
|
758
|
// return NoToken("未知错误,请重新登录");
|
|
|
759
|
+ var sort = "ORDER BY startdate desc";
|
|
|
760
|
+ if (!string.IsNullOrWhiteSpace(filter.SortField))
|
|
|
761
|
+ {
|
|
|
762
|
+ var arr = filter.SortField.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
|
|
|
763
|
+ EnumTalkRecordsSortField e;
|
|
|
764
|
+ if (!Enum.TryParse(arr[0], out e))
|
|
|
765
|
+ return Error("排序字段参数错误");
|
|
|
766
|
+ sort = "ORDER BY " + e.ToString() + " " + arr[1];
|
|
|
767
|
+ }
|
|
|
768
|
+
|
|
|
769
|
+ StringBuilder where = new StringBuilder();
|
|
614
|
770
|
|
|
615
|
|
- var sql = "";
|
|
616
|
771
|
|
|
617
|
|
- // 未接通 F_YJState=0
|
|
618
|
|
- // 接通未转入坐席 F_YJState=0
|
|
619
|
|
- // 接通未分配坐席
|
|
620
|
|
- // 接通且分配坐席 F_YJState=1 and agentid>0
|
|
|
772
|
+ if (!string.IsNullOrWhiteSpace(filter.UserCode))
|
|
|
773
|
+ {
|
|
|
774
|
+ where.Append(" and agentid=" + filter.UserCode);
|
|
|
775
|
+ }
|
|
|
776
|
+ if (!string.IsNullOrWhiteSpace(filter.Phone))
|
|
|
777
|
+ {
|
|
|
778
|
+ where.Append(" and callee like '%" + filter.Phone + "%'");
|
|
|
779
|
+ }
|
|
|
780
|
+ if (filter.CallType != 0)
|
|
|
781
|
+ {
|
|
|
782
|
+ where.Append(" and calltype=" + filter.CallType);
|
|
|
783
|
+ }
|
|
|
784
|
+
|
|
|
785
|
+ if (!string.IsNullOrWhiteSpace(filter.TalkTime))
|
|
|
786
|
+ {
|
|
|
787
|
+ var arr = filter.TalkTime.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
|
|
|
788
|
+ if (arr.Length == 2)
|
|
|
789
|
+ {
|
|
|
790
|
+ if (arr[0] == "1")
|
|
|
791
|
+ {
|
|
|
792
|
+ where.Append(" and talktime>" + arr[1]);
|
|
|
793
|
+ }
|
|
|
794
|
+ else if (arr[0] == "2")
|
|
|
795
|
+ {
|
|
|
796
|
+ where.Append(" and talktime=" + arr[1]);
|
|
|
797
|
+ }
|
|
|
798
|
+ else if (arr[0] == "3")
|
|
|
799
|
+ {
|
|
|
800
|
+ where.Append(" and talktime<" + arr[1]);
|
|
|
801
|
+ }
|
|
|
802
|
+ else { }
|
|
|
803
|
+ }
|
|
|
804
|
+ }
|
|
|
805
|
+
|
|
|
806
|
+ if (filter.StartTime == null || filter.EndTime == null)
|
|
|
807
|
+ {
|
|
|
808
|
+ filter.StartTime = DateTime.Now.AddDays(-3);
|
|
|
809
|
+ filter.EndTime = DateTime.Now;
|
|
|
810
|
+ }
|
|
|
811
|
+ where.Append(" and datediff(s,'" + filter.StartTime + "',getdate())>=0 and datediff(s,getdate(),'" + filter.EndTime + "')>=0 ");
|
|
|
812
|
+
|
|
|
813
|
+
|
|
|
814
|
+
|
|
|
815
|
+ // 全部=0
|
|
|
816
|
+ // 未接通=1
|
|
|
817
|
+ // 接通排队=2
|
|
|
818
|
+ // 接通未转入坐席=3
|
|
|
819
|
+ // 接通且分配坐席=4
|
|
621
|
820
|
int recordCount = 0;
|
|
622
|
821
|
Model.PageData<Model.CallResult> pageModel = new Model.PageData<Model.CallResult>();
|
|
623
|
822
|
StringBuilder fields = new StringBuilder();
|
|
624
|
|
- fields.Append(" cr.id,cr.itemid,cr.callee,cr.agentid,ua.f_username as username ,cr.recordpath ");
|
|
625
|
|
- fields.Append(", (case when datediff(y,'1970-01-01 00:00:00.000',cr.StartDate)>0 then cr.StartDate else null end) as startdate ");
|
|
626
|
|
- fields.Append(", (case when datediff(y,'1970-01-01 00:00:00.000',cr.GetInAgentDate)>0 then cr.GetInAgentDate else null end) as getinagentdate ");
|
|
627
|
|
- fields.Append(", (case when datediff(y,'1970-01-01 00:00:00.000',cr.EndDate)>0 then cr.EndDate else null end) as enddate ");
|
|
628
|
|
- fields.Append(", (case when t.F_YJState=0 then '未接通' when (t.F_YJState=1 and cr.AgentId>0) then '接通且转坐席' end ) as state ");
|
|
629
|
|
- fields.Append(", (case when datediff(s,cr.GetInAgentDate,cr.endDate)<0 then 0 else datediff(s,cr.GetInAgentDate,cr.endDate) end) as talktime");
|
|
630
|
823
|
var dt = BLL.PagerBLL.GetListPager(
|
|
631
|
|
- " CallResult cr left join T_Sys_UserAccount ua on cr.agentId=ua.f_usercode left join T_Call_TaskTelNum t ON t.F_Id=cr.Id ",
|
|
632
|
|
- "cr.Id",
|
|
633
|
|
- fields.ToString(),
|
|
634
|
|
- sql,
|
|
635
|
|
- "ORDER BY cr.Id desc",
|
|
636
|
|
- filter.PageSize,
|
|
637
|
|
- filter.PageIndex,
|
|
638
|
|
- true,
|
|
639
|
|
- out recordCount);
|
|
640
|
|
- var list = callResultBLL.DataTableToList(dt).Select(x => new
|
|
|
824
|
+ "V_AutoCallResult",
|
|
|
825
|
+ "V_AutoCallResult.id",
|
|
|
826
|
+ "V_AutoCallResult.id,itemid, callee, agentid, username,startdate,enddate,getinagentdate,calltype,talktime,RecordPath",
|
|
|
827
|
+ where.ToString(),
|
|
|
828
|
+ sort,
|
|
|
829
|
+ filter.PageSize,
|
|
|
830
|
+ filter.PageIndex,
|
|
|
831
|
+ true,
|
|
|
832
|
+ out recordCount);
|
|
|
833
|
+ var config = new BLL.T_Sys_SystemConfig().GetModelList(" F_ParamCode='PlayPath' ").FirstOrDefault();
|
|
|
834
|
+ var callResultList = callResultBLL.DataTableToList(dt);
|
|
|
835
|
+ var list = new List<AutoCallRecordDto>();
|
|
|
836
|
+ callResultList.ForEach(x =>
|
|
641
|
837
|
{
|
|
642
|
|
- id = x.Id,
|
|
643
|
|
- taskid = x.TaskId,
|
|
644
|
|
- callnumber = x.CallNumber,
|
|
645
|
|
- usercode = x.Usercode == "0" ? "" : x.Usercode,
|
|
646
|
|
- startdate = x.StartDate?.ToString("yyyy-MM-dd HH:mm:ss") ?? "",
|
|
647
|
|
- getinagentdate = x.GetInAgentDate?.ToString("yyyy-MM-dd HH:mm:ss") ?? "",
|
|
648
|
|
- enddate = x.EndDate?.ToString("yyyy-MM-dd HH:mm:ss") ?? "",
|
|
649
|
|
- recordpath = x.RecordPath,
|
|
650
|
|
- username = x.Username,
|
|
651
|
|
- state = x.State,
|
|
652
|
|
- talktime = x.TalkTime > 0 ? x.TalkTime.ToString() : ""
|
|
|
838
|
+ var recordPath = "";
|
|
|
839
|
+ if (!string.IsNullOrWhiteSpace(x.RecordPath) && config != null && !string.IsNullOrEmpty(config.F_ParamValue))
|
|
|
840
|
+ {
|
|
|
841
|
+ var ym = config.F_ParamValue;
|
|
|
842
|
+ if (ym.Substring(ym.Length - 1) == "/")
|
|
|
843
|
+ {
|
|
|
844
|
+ ym = ym.Substring(0, ym.Length - 1);
|
|
|
845
|
+ }
|
|
|
846
|
+ recordPath = ym + x.RecordPath.Substring(x.RecordPath.IndexOf(':') + 1).Replace('\\', '/');
|
|
|
847
|
+ }
|
|
|
848
|
+
|
|
|
849
|
+ list.Add(new AutoCallRecordDto
|
|
|
850
|
+ {
|
|
|
851
|
+ id = x.Id,
|
|
|
852
|
+ taskid = x.TaskId,
|
|
|
853
|
+ callnumber = x.CallNumber,
|
|
|
854
|
+ usercode = x.Usercode == "0" ? "" : x.Usercode,
|
|
|
855
|
+ startdate = x.StartDate?.ToString("yyyy-MM-dd HH:mm:ss") ?? "",
|
|
|
856
|
+ getinagentdate = x.GetInAgentDate?.ToString("yyyy-MM-dd HH:mm:ss") ?? "",
|
|
|
857
|
+ enddate = x.EndDate?.ToString("yyyy-MM-dd HH:mm:ss") ?? "",
|
|
|
858
|
+ recordpath = recordPath,
|
|
|
859
|
+ username = x.Username,
|
|
|
860
|
+ state = x.State,
|
|
|
861
|
+ talktime = x.TalkTime > 0 ? x.TalkTime.ToString() : ""
|
|
|
862
|
+ });
|
|
653
|
863
|
});
|
|
|
864
|
+
|
|
654
|
865
|
var obj = new
|
|
655
|
866
|
{
|
|
656
|
867
|
rows = list,
|
|
|
@@ -661,6 +872,8 @@ namespace CallCenterApi.Interface.Controllers.callout
|
|
661
|
872
|
#endregion
|
|
662
|
873
|
|
|
663
|
874
|
#region 过滤号码
|
|
|
875
|
+
|
|
|
876
|
+
|
|
664
|
877
|
#region 过滤号码-数据源
|
|
665
|
878
|
/// <summary>
|
|
666
|
879
|
/// 过滤号码
|
|
|
@@ -684,7 +897,6 @@ namespace CallCenterApi.Interface.Controllers.callout
|
|
684
|
897
|
return dt;
|
|
685
|
898
|
}
|
|
686
|
899
|
#endregion
|
|
687
|
|
-
|
|
688
|
900
|
#region 过滤号码-前三个月
|
|
689
|
901
|
private DataTable PhoneNumFilterMonth(DataTable dt, string phone = "F_Phone")
|
|
690
|
902
|
{
|
|
|
@@ -706,6 +918,5 @@ namespace CallCenterApi.Interface.Controllers.callout
|
|
706
|
918
|
#endregion
|
|
707
|
919
|
#endregion
|
|
708
|
920
|
|
|
709
|
|
-
|
|
710
|
921
|
}
|
|
711
|
922
|
}
|