Bladeren bron

调整外呼接口

zhengbingbing 7 jaren geleden
bovenliggende
commit
83c02b3d2d

+ 19 - 18
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/callout/CallOutPlanController.cs

@@ -1079,7 +1079,7 @@ namespace CallCenterApi.Interface.Controllers.callout
1079 1079
         /// <param name="address">地址</param>
1080 1080
         /// <returns></returns>
1081 1081
         public ActionResult Answers(int taskid, int custelid, string[] ans, int hjjgid,
1082
-            string name, string phone, int countryid, string address)
1082
+            string name, string address)
1083 1083
         {
1084 1084
             int cc = 0; 
1085 1085
             if (custelid > 0)
@@ -1087,7 +1087,8 @@ namespace CallCenterApi.Interface.Controllers.callout
1087 1087
                 var otnModel = otnBLL.GetModel(custelid);
1088 1088
                 if (otnModel != null)
1089 1089
                 {
1090
-                    int cusid = saveCus(otnModel.F_Phone, name, phone, countryid, address);
1090
+                    //int cusid = saveCus(otnModel.F_Phone, name, phone, countryid, address);
1091
+                    int cusid = saveCus(otnModel.F_Phone, name, address);
1091 1092
 
1092 1093
                     #region 保存答案
1093 1094
                     var ansModel = new Model.T_Call_OutAnswers();
@@ -1104,7 +1105,7 @@ namespace CallCenterApi.Interface.Controllers.callout
1104 1105
                         ansModel.F_OptBy = CurrentUser.UserData.F_UserId;
1105 1106
                         ansModel.F_OptByName = CurrentUser.UserData.F_UserName;
1106 1107
                         ansModel.F_OptOn = DateTime.Now;
1107
-                        ansModel.F_Expand1 = countryid.ToString();
1108
+                        //ansModel.F_Expand1 = countryid.ToString();
1108 1109
                         ansModel.F_Expand3 = DateTime.Now.ToString("yyyyMMddHHmmssfff");
1109 1110
                         #region 循环保存
1110 1111
                         foreach (var item in ans)
@@ -1150,12 +1151,12 @@ namespace CallCenterApi.Interface.Controllers.callout
1150 1151
                     //var fkconfig = new BLL.T_Sys_DictionaryValue().GetModel(yhfkid);
1151 1152
                     //if (fkconfig != null)
1152 1153
                     //    otnModel.F_YHFKName = fkconfig.F_Name;
1153
-                    otnModel.ExpandVchField2 = phone;
1154
+                    //otnModel.ExpandVchField2 = phone;
1154 1155
                     otnModel.ExpandVchField3 = address;
1155
-                    var fkconfig = new BLL.T_Sys_DictionaryValue().GetModel(countryid);
1156
-                    if (fkconfig != null)
1157
-                        otnModel.ExpandVchField4 = fkconfig.F_Name;
1158
-                    otnModel.ExpandIntField1 = countryid;//乡镇
1156
+                    //var fkconfig = new BLL.T_Sys_DictionaryValue().GetModel(countryid);
1157
+                    //if (fkconfig != null)
1158
+                    //    otnModel.ExpandVchField4 = fkconfig.F_Name;
1159
+                    //otnModel.ExpandIntField1 = countryid;//乡镇
1159 1160
                     otnModel.ExpandDatField1 = DateTime.Now;//调查时间
1160 1161
                     otnModel.F_AskRes = askqids;
1161 1162
                     otnModel.F_AskInfo = ansids;
@@ -1196,24 +1197,24 @@ namespace CallCenterApi.Interface.Controllers.callout
1196 1197
         /// <param name="countryid"></param>
1197 1198
         /// <param name="address"></param>
1198 1199
         /// <returns></returns>
1199
-        private int saveCus(string telphone, string name, string phone,int countryid, string address)
1200
+        private int saveCus(string telphone, string name, string address)
1200 1201
         {
1201 1202
             int res = 0;
1202 1203
             Model.T_Cus_CustomerBase cusmodel = new Model.T_Cus_CustomerBase();
1203 1204
             if (!string.IsNullOrWhiteSpace(telphone))
1204 1205
             {
1205
-                var fkconfig = new BLL.T_Sys_DictionaryValue().GetModel(countryid);
1206
+                //var fkconfig = new BLL.T_Sys_DictionaryValue().GetModel(countryid);
1206 1207
                 
1207 1208
                 cusmodel = cusBLL.GetModelByPhone(telphone);
1208 1209
 
1209 1210
                 if (cusmodel != null)
1210 1211
                 {
1211 1212
                     cusmodel.F_Address = address;
1212
-                    if (fkconfig != null)
1213
-                        cusmodel.F_City = fkconfig.F_Name;
1214
-                    cusmodel.F_CityID = countryid;
1213
+                    //if (fkconfig != null)
1214
+                    //    cusmodel.F_City = fkconfig.F_Name;
1215
+                    //cusmodel.F_CityID = countryid;
1215 1216
                     cusmodel.F_CustomerName = name;
1216
-                    cusmodel.F_Telephone = phone;
1217
+                    //cusmodel.F_Telephone = phone;
1217 1218
                     cusBLL.Update(cusmodel);
1218 1219
                     res = cusmodel.F_CustomerId;
1219 1220
                 }
@@ -1221,11 +1222,11 @@ namespace CallCenterApi.Interface.Controllers.callout
1221 1222
                 {
1222 1223
                     cusmodel = new Model.T_Cus_CustomerBase();
1223 1224
                     cusmodel.F_Address = address;
1224
-                    if (fkconfig != null)
1225
-                        cusmodel.F_City = fkconfig.F_Name;
1226
-                    cusmodel.F_CityID = countryid;
1225
+                    //if (fkconfig != null)
1226
+                    //    cusmodel.F_City = fkconfig.F_Name;
1227
+                    //cusmodel.F_CityID = countryid;
1227 1228
                     cusmodel.F_CustomerName = name;
1228
-                    cusmodel.F_Telephone = phone;
1229
+                    //cusmodel.F_Telephone = phone;
1229 1230
                     cusmodel.F_Mobile = telphone;
1230 1231
                     res = cusBLL.Add(cusmodel);
1231 1232
 

+ 158 - 10
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/report/CallOutReportController.cs

@@ -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
 }