|
|
@@ -16,8 +16,17 @@ namespace CallCenterApi.Interface.Controllers.report
|
|
16
|
16
|
private readonly BLL.T_Call_OutAnswers ansBLL = new BLL.T_Call_OutAnswers();
|
|
17
|
17
|
private readonly BLL.T_Ask_QuestionItems questionItemBLL = new BLL.T_Ask_QuestionItems();
|
|
18
|
18
|
|
|
19
|
|
- #region 问卷调查报告数据简单查询
|
|
20
|
|
- public ActionResult GetReport(string TaskName,int quesid,int countryid)
|
|
|
19
|
+ #region 获取外呼任务报表查询
|
|
|
20
|
+ /// <summary>
|
|
|
21
|
+ /// 外呼任务报表
|
|
|
22
|
+ /// </summary>
|
|
|
23
|
+ /// <param name="TaskID">任务id</param>
|
|
|
24
|
+ /// <param name="quesid">问题id</param>
|
|
|
25
|
+ /// <param name="countryid">乡镇id</param>
|
|
|
26
|
+ /// <param name="sdate">开始时间</param>
|
|
|
27
|
+ /// <param name="edate">结束时间</param>
|
|
|
28
|
+ /// <returns></returns>
|
|
|
29
|
+ public ActionResult GetReport(string TaskID, int quesid,int countryid,string sdate,string edate)
|
|
21
|
30
|
{
|
|
22
|
31
|
#region 新建输出表
|
|
23
|
32
|
DataTable dtnew = new DataTable();
|
|
|
@@ -26,20 +35,21 @@ namespace CallCenterApi.Interface.Controllers.report
|
|
26
|
35
|
dtnew.Columns.Add("shuliang");
|
|
27
|
36
|
dtnew.Columns.Add("bili");
|
|
28
|
37
|
#endregion
|
|
29
|
|
- #region 根据任务名获取任务ID
|
|
30
|
|
- //根据任务名获取任务ID
|
|
31
|
|
- string TaskID = "";
|
|
32
|
|
- var objo = DbHelperSQL.GetSingle("select F_TaskID from T_Call_OutTask where F_TaskName='" + TaskName + "'");
|
|
33
|
|
- if (objo != null)
|
|
34
|
|
- {
|
|
35
|
|
- TaskID = objo.ToString();
|
|
36
|
|
- }
|
|
37
|
|
- #endregion
|
|
|
38
|
+
|
|
38
|
39
|
#region 根据问题id获取问题的查询条件
|
|
39
|
|
- string sqlques = "F_QuestionId IN (select ta.F_QuestionId from T_Ask_PagerItems ta where ta.F_PagerId=(select F_PagerID from T_Call_OutTask where F_TaskID='" + TaskID + "') ) and F_Type!=1";
|
|
|
40
|
+ string sqlques = "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 + "') ) and F_Type!=1";
|
|
40
|
41
|
if (quesid > 0)
|
|
41
|
42
|
sqlques = "F_QuestionId="+ quesid;
|
|
42
|
43
|
#endregion
|
|
|
44
|
+ #region 回答问题查询条件
|
|
|
45
|
+ string sqlans = " isnull(F_TaskID,'')='" + TaskID + "' ";
|
|
|
46
|
+ if (countryid > 0)
|
|
|
47
|
+ sqlans += " and isnull(F_Expand1,'')='" + countryid + "' ";
|
|
|
48
|
+ if (!string.IsNullOrWhiteSpace(sdate))
|
|
|
49
|
+ sqlans += "DATEDIFF(day,F_OptOn,'"+ sdate.Trim() + "')<=0";
|
|
|
50
|
+ if (!string.IsNullOrWhiteSpace(edate))
|
|
|
51
|
+ sqlans += "DATEDIFF(day,F_OptOn,'" + edate.Trim() + "')>=0";
|
|
|
52
|
+ #endregion
|
|
43
|
53
|
var queslist = questionBLL.GetModelList(sqlques);
|
|
44
|
54
|
|
|
45
|
55
|
if (queslist.Count > 0)
|
|
|
@@ -48,9 +58,10 @@ namespace CallCenterApi.Interface.Controllers.report
|
|
48
|
58
|
{
|
|
49
|
59
|
string content = itemques.F_Content;
|
|
50
|
60
|
string question = itemques.F_Title;
|
|
51
|
|
- string[] item = content.Split(';');
|
|
|
61
|
+
|
|
|
62
|
+ sqlans += " and isnull(F_QID,'')='" + itemques.F_QuestionId + "' ";
|
|
52
|
63
|
//根据问题ID获取当前问题各选项答案总数
|
|
53
|
|
- int totalnum = ansBLL.GetRecordCount(" isnull(F_TaskID,'')='" + TaskID + "' and isnull(F_QID,'')='" + itemques.F_QuestionId + "' ");
|
|
|
64
|
+ int totalnum = ansBLL.GetRecordCount(sqlans);
|
|
54
|
65
|
|
|
55
|
66
|
//根据问题ID查询问题项
|
|
56
|
67
|
var dsi = questionItemBLL.GetModelList(" isnull(F_QuestionId,'') = '" + itemques.F_QuestionId + "' ");
|
|
|
@@ -61,7 +72,7 @@ namespace CallCenterApi.Interface.Controllers.report
|
|
61
|
72
|
DataRow dr = dtnew.NewRow();
|
|
62
|
73
|
dr["wenti"] = question;
|
|
63
|
74
|
dr["xuanxiang"] = itemqi.F_ItemName;
|
|
64
|
|
- int num = ansBLL.GetRecordCount(" isnull(F_TaskID,'')='" + TaskID + "' and isnull(F_Answer,'')='" + itemqi.F_ItemName + "' and isnull(F_QID,'')='" + itemques.F_QuestionId + "' and isnull(F_Expand1,'')='" + countryid + "'");
|
|
|
75
|
+ int num = ansBLL.GetRecordCount(sqlans + " and isnull(F_QIID,'')='" + itemqi.F_ItemId + "' ");
|
|
65
|
76
|
dr["shuliang"] = num;
|
|
66
|
77
|
if (totalnum != 0)
|
|
67
|
78
|
{
|
|
|
@@ -83,12 +94,12 @@ namespace CallCenterApi.Interface.Controllers.report
|
|
83
|
94
|
|
|
84
|
95
|
}
|
|
85
|
96
|
}
|
|
86
|
|
- return Success("获取调查报表数据成功", dtnew);
|
|
|
97
|
+ return Success("获取外呼任务报表数据成功", dtnew);
|
|
87
|
98
|
|
|
88
|
99
|
}
|
|
89
|
100
|
#endregion
|
|
90
|
101
|
|
|
91
|
|
- #region 数据查询--获取乡镇统计排名
|
|
|
102
|
+ #region 获取乡镇统计排名
|
|
92
|
103
|
public ActionResult GetRank(string startdate, string enddate)
|
|
93
|
104
|
{
|
|
94
|
105
|
if (string.IsNullOrWhiteSpace(startdate))
|