|
|
@@ -12,6 +12,7 @@ namespace CallCenterApi.Interface.Controllers.report
|
|
12
|
12
|
{
|
|
13
|
13
|
public class CallOutReportController : BaseController
|
|
14
|
14
|
{
|
|
|
15
|
+ private readonly BLL.T_Call_OutTask otBLL = new BLL.T_Call_OutTask();
|
|
15
|
16
|
private readonly BLL.T_Call_OutTaskTelNum otnBLL = new BLL.T_Call_OutTaskTelNum();
|
|
16
|
17
|
private readonly BLL.T_Ask_Question questionBLL = new BLL.T_Ask_Question();
|
|
17
|
18
|
private readonly BLL.T_Call_OutAnswers ansBLL = new BLL.T_Call_OutAnswers();
|
|
|
@@ -27,7 +28,7 @@ namespace CallCenterApi.Interface.Controllers.report
|
|
27
|
28
|
/// <param name="sdate">开始时间</param>
|
|
28
|
29
|
/// <param name="edate">结束时间</param>
|
|
29
|
30
|
/// <returns></returns>
|
|
30
|
|
- public ActionResult GetReport(string TaskID, string quesid, string countryid, string sdate, string edate)
|
|
|
31
|
+ public ActionResult GetReport(string TaskID, string quesid, string sdate, string edate)
|
|
31
|
32
|
{
|
|
32
|
33
|
#region 新建输出表
|
|
33
|
34
|
DataTable dtnew = new DataTable();
|
|
|
@@ -44,8 +45,6 @@ namespace CallCenterApi.Interface.Controllers.report
|
|
44
|
45
|
#endregion
|
|
45
|
46
|
#region 回答问题查询条件
|
|
46
|
47
|
string sqlans = " isnull(F_TaskID,'')='" + TaskID + "' ";
|
|
47
|
|
- if (!string.IsNullOrWhiteSpace(countryid))
|
|
48
|
|
- sqlans += " and isnull(F_Expand1,'')='" + countryid + "' ";
|
|
49
|
48
|
if (!string.IsNullOrWhiteSpace(sdate))
|
|
50
|
49
|
sqlans += " and DATEDIFF(day,F_OptOn,'"+ sdate.Trim() + "')<=0";
|
|
51
|
50
|
if (!string.IsNullOrWhiteSpace(edate))
|
|
|
@@ -107,7 +106,7 @@ namespace CallCenterApi.Interface.Controllers.report
|
|
107
|
106
|
}
|
|
108
|
107
|
|
|
109
|
108
|
#region 外呼任务报表导出Excel
|
|
110
|
|
- public ActionResult GetReportExpt(string TaskID, string quesid, string countryid, string sdate, string edate)
|
|
|
109
|
+ public ActionResult GetReportExpt(string TaskID, string quesid, string sdate, string edate)
|
|
111
|
110
|
{
|
|
112
|
111
|
#region 新建输出表
|
|
113
|
112
|
DataTable dtnew = new DataTable();
|
|
|
@@ -124,8 +123,6 @@ namespace CallCenterApi.Interface.Controllers.report
|
|
124
|
123
|
#endregion
|
|
125
|
124
|
#region 回答问题查询条件
|
|
126
|
125
|
string sqlans = " isnull(F_TaskID,'')='" + TaskID + "' ";
|
|
127
|
|
- if (!string.IsNullOrWhiteSpace(countryid))
|
|
128
|
|
- sqlans += " and isnull(F_Expand1,'')='" + countryid + "' ";
|
|
129
|
126
|
if (!string.IsNullOrWhiteSpace(sdate))
|
|
130
|
127
|
sqlans += " and DATEDIFF(day,F_OptOn,'" + sdate.Trim() + "')<=0";
|
|
131
|
128
|
if (!string.IsNullOrWhiteSpace(edate))
|
|
|
@@ -220,8 +217,8 @@ namespace CallCenterApi.Interface.Controllers.report
|
|
220
|
217
|
DataRow dr = dtnew.NewRow();
|
|
221
|
218
|
dr["xiangzhen"] = itemconf.F_Name;
|
|
222
|
219
|
//根据乡镇获取总数
|
|
223
|
|
- int totalnum= otnBLL.GetRecordCount(" DATEDIFF(day,ExpandDatField1,'" + sdate + "')<=0 and DATEDIFF(day,ExpandDatField1,'" + edate + "')>=0 and ExpandIntField1='" + itemconf.F_DictionaryValueId+"' ");
|
|
224
|
|
- //int totalnum = ansBLL.GetRecordCount(" DATEDIFF(day,F_OptOn,'" + sdate + "')<=0 and DATEDIFF(day,F_OptOn,'" + edate + "')>=0 and F_Answer='" + itemconf.F_Name + "' ");
|
|
|
220
|
+ //int totalnum= otnBLL.GetRecordCount(" DATEDIFF(day,ExpandDatField1,'" + sdate + "')<=0 and DATEDIFF(day,ExpandDatField1,'" + edate + "')>=0 and ExpandIntField1='" + itemconf.F_DictionaryValueId+"' ");
|
|
|
221
|
+ int totalnum = ansBLL.GetRecordCount(" DATEDIFF(day,F_OptOn,'" + sdate + "')<=0 and DATEDIFF(day,F_OptOn,'" + edate + "')>=0 and F_Answer='" + itemconf.F_Name + "' ");
|
|
225
|
222
|
|
|
226
|
223
|
leiji += totalnum;
|
|
227
|
224
|
dr["zongshu"] = totalnum;
|
|
|
@@ -266,8 +263,8 @@ namespace CallCenterApi.Interface.Controllers.report
|
|
266
|
263
|
DataRow dr = dtnew.NewRow();
|
|
267
|
264
|
dr["xiangzhen"] = itemconf.F_Name;
|
|
268
|
265
|
//根据乡镇获取总数
|
|
269
|
|
- int totalnum = otnBLL.GetRecordCount(" DATEDIFF(day,ExpandDatField1,'" + sdate + "')<=0 and DATEDIFF(day,ExpandDatField1,'" + edate + "')>=0 and ExpandIntField1='" + itemconf.F_DictionaryValueId + "' ");
|
|
270
|
|
- //int totalnum = ansBLL.GetRecordCount(" DATEDIFF(day,F_OptOn,'" + sdate + "')<=0 and DATEDIFF(day,F_OptOn,'" + edate + "')>=0 and F_Answer='" + itemconf.F_Name + "' ");
|
|
|
266
|
+ //int totalnum = otnBLL.GetRecordCount(" DATEDIFF(day,ExpandDatField1,'" + sdate + "')<=0 and DATEDIFF(day,ExpandDatField1,'" + edate + "')>=0 and ExpandIntField1='" + itemconf.F_DictionaryValueId + "' ");
|
|
|
267
|
+ int totalnum = ansBLL.GetRecordCount(" DATEDIFF(day,F_OptOn,'" + sdate + "')<=0 and DATEDIFF(day,F_OptOn,'" + edate + "')>=0 and F_Answer='" + itemconf.F_Name + "' ");
|
|
271
|
268
|
|
|
272
|
269
|
leiji += totalnum;
|
|
273
|
270
|
dr["zongshu"] = totalnum;
|
|
|
@@ -446,5 +443,156 @@ namespace CallCenterApi.Interface.Controllers.report
|
|
446
|
443
|
|
|
447
|
444
|
}
|
|
448
|
445
|
#endregion
|
|
|
446
|
+
|
|
|
447
|
+ #region 详细报表
|
|
|
448
|
+ #region 数据
|
|
|
449
|
+ /// <summary>
|
|
|
450
|
+ /// 不满意报表
|
|
|
451
|
+ /// </summary>
|
|
|
452
|
+ /// <param name="TaskID">任务id 必选</param>
|
|
|
453
|
+ /// <param name="quesid">问题id 必选</param>
|
|
|
454
|
+ /// <param name="ansid">当前问题答案id 可多选</param>
|
|
|
455
|
+ /// <param name="sdate">开始时间</param>
|
|
|
456
|
+ /// <param name="edate">结束时间</param>
|
|
|
457
|
+ /// <returns></returns>
|
|
|
458
|
+ public ActionResult GetReportDetail(string TaskID, int quesid, string ansids, string sdate, string edate)
|
|
|
459
|
+ {
|
|
|
460
|
+ DataTable dtnew = new DataTable();
|
|
|
461
|
+ dtnew = getdateDetail(TaskID, quesid, ansids, sdate, edate);
|
|
|
462
|
+ return Success("获取详细报表数据成功", dtnew);
|
|
|
463
|
+
|
|
|
464
|
+ }
|
|
|
465
|
+ public DataTable getdateDetail(string TaskID, int quesid, string ansids, string sdate, string edate)
|
|
|
466
|
+ {
|
|
|
467
|
+ DataTable dtnew = new DataTable();
|
|
|
468
|
+ #region 新建输出表
|
|
|
469
|
+ dtnew.Columns.Add("name");
|
|
|
470
|
+ dtnew.Columns.Add("phone");
|
|
|
471
|
+ dtnew.Columns.Add("answer");
|
|
|
472
|
+ #endregion
|
|
|
473
|
+
|
|
|
474
|
+ #region 查询条件
|
|
|
475
|
+ string sqlotn = " and isnull(F_TaskID,'')='" + TaskID + "' ";
|
|
|
476
|
+ #region 选中答案搜索
|
|
|
477
|
+ string sqlans = " and isnull(F_TaskID,'')='" + TaskID + "' " + " and isnull(F_QID,'')='" + quesid + "' ";
|
|
|
478
|
+ if (!string.IsNullOrWhiteSpace(ansids))
|
|
|
479
|
+ {
|
|
|
480
|
+ sqlans += " and F_QIID in (" + ansids.Trim() + ") ";
|
|
|
481
|
+ }
|
|
|
482
|
+ sqlotn += " and F_Id in (select F_CusTelID from T_Call_OutAnswers where 1=1 " + sqlans + ")";
|
|
|
483
|
+ #endregion
|
|
|
484
|
+ if (!string.IsNullOrWhiteSpace(sdate))
|
|
|
485
|
+ sqlotn += " and DATEDIFF(day,ExpandDatField1,'" + sdate.Trim() + "')<=0";
|
|
|
486
|
+ if (!string.IsNullOrWhiteSpace(edate))
|
|
|
487
|
+ sqlotn += " and DATEDIFF(day,ExpandDatField1,'" + edate.Trim() + "')>=0";
|
|
|
488
|
+ #endregion
|
|
|
489
|
+ var otnlist = otnBLL.GetModelList(" 1=1 " + sqlotn);
|
|
|
490
|
+
|
|
|
491
|
+ if (otnlist.Count > 0)
|
|
|
492
|
+ {
|
|
|
493
|
+ foreach (var itemotn in otnlist)
|
|
|
494
|
+ {
|
|
|
495
|
+ DataRow dr = dtnew.NewRow();
|
|
|
496
|
+ dr["name"] = itemotn.F_CusName;
|
|
|
497
|
+ dr["phone"] = itemotn.F_Phone;
|
|
|
498
|
+ string ans = "";
|
|
|
499
|
+ #region 答案
|
|
|
500
|
+ var anslist = ansBLL.GetModelList(" F_CusTelID=" + itemotn.F_Id + sqlans);
|
|
|
501
|
+ if (anslist.Count > 0)
|
|
|
502
|
+ {
|
|
|
503
|
+ string anan = "";
|
|
|
504
|
+ foreach (var ansitem in anslist)
|
|
|
505
|
+ {
|
|
|
506
|
+ anan += ansitem.F_Answer + ";";
|
|
|
507
|
+ }
|
|
|
508
|
+ ans = anan.Trim(';') + "。";
|
|
|
509
|
+ }
|
|
|
510
|
+ #endregion
|
|
|
511
|
+ dr["answer"] = ans;
|
|
|
512
|
+ dtnew.Rows.Add(dr);
|
|
|
513
|
+ }
|
|
|
514
|
+ }
|
|
|
515
|
+ return dtnew;
|
|
|
516
|
+ }
|
|
|
517
|
+ #endregion
|
|
|
518
|
+ #region 表头
|
|
|
519
|
+ public ActionResult GetColoumnDetail(string TaskID, int quesid = 0)
|
|
|
520
|
+ {
|
|
|
521
|
+ string[] col = getcoloumn(TaskID, quesid);
|
|
|
522
|
+
|
|
|
523
|
+ return Success("获取详细报表表头成功", col);
|
|
|
524
|
+
|
|
|
525
|
+ }
|
|
|
526
|
+ public string[] getcoloumn(string TaskID, int quesid = 0)
|
|
|
527
|
+ {
|
|
|
528
|
+ string sqlques = "F_QuestionId=" + quesid;
|
|
|
529
|
+ var quesmodel = questionBLL.GetModel(quesid);
|
|
|
530
|
+ var ques = "";
|
|
|
531
|
+ if (quesmodel != null)
|
|
|
532
|
+ {
|
|
|
533
|
+ ques = quesmodel.F_Title;
|
|
|
534
|
+
|
|
|
535
|
+ }
|
|
|
536
|
+ string[] col = { "姓名", "电话", ques };
|
|
|
537
|
+ return col;
|
|
|
538
|
+ }
|
|
|
539
|
+ #endregion
|
|
|
540
|
+ #region 导出
|
|
|
541
|
+ public ActionResult GetReportDetailExpt(string TaskID, int quesid, string ansids, string sdate, string edate)
|
|
|
542
|
+ {
|
|
|
543
|
+ DataTable dtnew = getdateDetail(TaskID, quesid, ansids, sdate, edate);
|
|
|
544
|
+ NPOIHelper npoi = new NPOIHelper();
|
|
|
545
|
+ string[] col = getcoloumn(TaskID, quesid);
|
|
|
546
|
+ if (npoi.ExportToExcel("详细报表数据", dtnew, col) == "")
|
|
|
547
|
+ {
|
|
|
548
|
+ return Success("导出成功");
|
|
|
549
|
+ }
|
|
|
550
|
+ else
|
|
|
551
|
+ {
|
|
|
552
|
+ return Error("导出失败");
|
|
|
553
|
+ }
|
|
|
554
|
+ }
|
|
|
555
|
+ #endregion
|
|
|
556
|
+ #endregion
|
|
|
557
|
+
|
|
|
558
|
+ #region 下拉框
|
|
|
559
|
+ /// <summary>
|
|
|
560
|
+ /// 任务列表下拉
|
|
|
561
|
+ /// </summary>
|
|
|
562
|
+ /// <returns></returns>
|
|
|
563
|
+ public ActionResult GetTaskDDL()
|
|
|
564
|
+ {
|
|
|
565
|
+ var alllist = otBLL.GetModelList(" F_DeleteFlag=0 order by F_TaskID desc");
|
|
|
566
|
+ return Success("获取任务列表下拉成功", alllist);
|
|
|
567
|
+ }
|
|
|
568
|
+ /// <summary>
|
|
|
569
|
+ /// 问题列表下拉
|
|
|
570
|
+ /// </summary>
|
|
|
571
|
+ /// <returns></returns>
|
|
|
572
|
+ public ActionResult GetQuesDDL(int taskid = 0)
|
|
|
573
|
+ {
|
|
|
574
|
+ string sql = "";
|
|
|
575
|
+ if (taskid > 0)
|
|
|
576
|
+ {
|
|
|
577
|
+ sql += " and F_QuestionId IN (select ta.F_QuestionId from T_Ask_PagerItems ta where ta.F_PagerId=(select F_PagerID from T_Call_OutTask where isnull(F_TaskID,'')='" + taskid + "') )";
|
|
|
578
|
+ }
|
|
|
579
|
+ var list = questionBLL.GetModelList(" F_Type!=1" + sql);
|
|
|
580
|
+ return Success("获取问题列表下拉成功", list);
|
|
|
581
|
+ }
|
|
|
582
|
+ /// <summary>
|
|
|
583
|
+ /// 问题选项列表下拉
|
|
|
584
|
+ /// </summary>
|
|
|
585
|
+ /// <returns></returns>
|
|
|
586
|
+ public ActionResult GetQuesItemDDL(int quesid = 0)
|
|
|
587
|
+ {
|
|
|
588
|
+ string sql = " 1=1 ";
|
|
|
589
|
+ if (quesid > 0)
|
|
|
590
|
+ {
|
|
|
591
|
+ sql += " and F_QuestionId=" + quesid;
|
|
|
592
|
+ }
|
|
|
593
|
+ var list = questionItemBLL.GetModelList(sql);
|
|
|
594
|
+ return Success("获取问题选项列表下拉成功", list);
|
|
|
595
|
+ }
|
|
|
596
|
+ #endregion
|
|
449
|
597
|
}
|
|
450
|
598
|
}
|