Просмотр исходного кода

新增报表,修改外呼回答bug

zhengbingbing лет назад: 7
Родитель
Сommit
65b41c99e6

+ 3 - 1
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/callout/CallOutPlanController.cs

738
             sb.Append(" and F_UserId=" + userid);
738
             sb.Append(" and F_UserId=" + userid);
739
             sb.Append(" and F_DeleteFlag=0 ");
739
             sb.Append(" and F_DeleteFlag=0 ");
740
             //sb.Append(" and isnull(F_HJJGName,'')!='正常接通' and isnull(F_YHFKName,'')!='已同意'");
740
             //sb.Append(" and isnull(F_HJJGName,'')!='正常接通' and isnull(F_YHFKName,'')!='已同意'");
741
-            sb.Append(" and isnull(F_HJJGName,'')=''");
741
+            //sb.Append(" and isnull(F_HJJGName,'')=''");
742
+            sb.Append(" and isnull(F_HJJGName,'')!='正常接通' and isnull(F_HJJGName,'')!='免回访'");
742
             sb.Append(" and F_Taskid in (select F_TaskID from T_Call_OutTask where F_IsStart=1 and F_DeleteFlag=0)");
743
             sb.Append(" and F_Taskid in (select F_TaskID from T_Call_OutTask where F_IsStart=1 and F_DeleteFlag=0)");
743
             if (!string.IsNullOrWhiteSpace(key))
744
             if (!string.IsNullOrWhiteSpace(key))
744
             {
745
             {
1111
                 }
1112
                 }
1112
                 else
1113
                 else
1113
                 {
1114
                 {
1115
+                    cusmodel = new Model.T_Cus_CustomerBase();
1114
                     cusmodel.F_Address = address;
1116
                     cusmodel.F_Address = address;
1115
                     if (fkconfig != null)
1117
                     if (fkconfig != null)
1116
                         cusmodel.F_City = fkconfig.F_Name;
1118
                         cusmodel.F_City = fkconfig.F_Name;

+ 28 - 17
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/report/CallOutReportController.cs

16
         private readonly BLL.T_Call_OutAnswers ansBLL = new BLL.T_Call_OutAnswers();
16
         private readonly BLL.T_Call_OutAnswers ansBLL = new BLL.T_Call_OutAnswers();
17
         private readonly BLL.T_Ask_QuestionItems questionItemBLL = new BLL.T_Ask_QuestionItems();
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
             #region 新建输出表
31
             #region 新建输出表
23
             DataTable dtnew = new DataTable();
32
             DataTable dtnew = new DataTable();
26
             dtnew.Columns.Add("shuliang");
35
             dtnew.Columns.Add("shuliang");
27
             dtnew.Columns.Add("bili");
36
             dtnew.Columns.Add("bili");
28
             #endregion
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
             #region 根据问题id获取问题的查询条件
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
             if (quesid > 0)
41
             if (quesid > 0)
41
                 sqlques = "F_QuestionId="+ quesid;
42
                 sqlques = "F_QuestionId="+ quesid;
42
             #endregion
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
             var queslist = questionBLL.GetModelList(sqlques);
53
             var queslist = questionBLL.GetModelList(sqlques);
44
 
54
 
45
             if (queslist.Count > 0)
55
             if (queslist.Count > 0)
48
                 {
58
                 {
49
                     string content = itemques.F_Content;
59
                     string content = itemques.F_Content;
50
                     string question = itemques.F_Title;
60
                     string question = itemques.F_Title;
51
-                    string[] item = content.Split(';');
61
+
62
+                    sqlans += " and isnull(F_QID,'')='" + itemques.F_QuestionId + "' ";
52
                     //根据问题ID获取当前问题各选项答案总数
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
                     //根据问题ID查询问题项
66
                     //根据问题ID查询问题项
56
                     var dsi = questionItemBLL.GetModelList(" isnull(F_QuestionId,'') = '" + itemques.F_QuestionId + "' ");
67
                     var dsi = questionItemBLL.GetModelList(" isnull(F_QuestionId,'') = '" + itemques.F_QuestionId + "' ");
61
                             DataRow dr = dtnew.NewRow();
72
                             DataRow dr = dtnew.NewRow();
62
                             dr["wenti"] = question;
73
                             dr["wenti"] = question;
63
                             dr["xuanxiang"] = itemqi.F_ItemName;
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
                             dr["shuliang"] = num;
76
                             dr["shuliang"] = num;
66
                             if (totalnum != 0)
77
                             if (totalnum != 0)
67
                             {
78
                             {
83
 
94
 
84
                 }
95
                 }
85
             }
96
             }
86
-            return Success("获取调查报表数据成功", dtnew);
97
+            return Success("获取外呼任务报表数据成功", dtnew);
87
             
98
             
88
         }
99
         }
89
         #endregion
100
         #endregion
90
 
101
 
91
-        #region  数据查询--获取乡镇统计排名
102
+        #region  获取乡镇统计排名
92
         public ActionResult GetRank(string startdate, string enddate)
103
         public ActionResult GetRank(string startdate, string enddate)
93
         {
104
         {
94
             if (string.IsNullOrWhiteSpace(startdate))
105
             if (string.IsNullOrWhiteSpace(startdate))