Explorar el Código

调整外呼接口

zhengbingbing %!s(int64=7) %!d(string=hace) años
padre
commit
83c02b3d2d

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

1079
         /// <param name="address">地址</param>
1079
         /// <param name="address">地址</param>
1080
         /// <returns></returns>
1080
         /// <returns></returns>
1081
         public ActionResult Answers(int taskid, int custelid, string[] ans, int hjjgid,
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
             int cc = 0; 
1084
             int cc = 0; 
1085
             if (custelid > 0)
1085
             if (custelid > 0)
1087
                 var otnModel = otnBLL.GetModel(custelid);
1087
                 var otnModel = otnBLL.GetModel(custelid);
1088
                 if (otnModel != null)
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
                     #region 保存答案
1093
                     #region 保存答案
1093
                     var ansModel = new Model.T_Call_OutAnswers();
1094
                     var ansModel = new Model.T_Call_OutAnswers();
1104
                         ansModel.F_OptBy = CurrentUser.UserData.F_UserId;
1105
                         ansModel.F_OptBy = CurrentUser.UserData.F_UserId;
1105
                         ansModel.F_OptByName = CurrentUser.UserData.F_UserName;
1106
                         ansModel.F_OptByName = CurrentUser.UserData.F_UserName;
1106
                         ansModel.F_OptOn = DateTime.Now;
1107
                         ansModel.F_OptOn = DateTime.Now;
1107
-                        ansModel.F_Expand1 = countryid.ToString();
1108
+                        //ansModel.F_Expand1 = countryid.ToString();
1108
                         ansModel.F_Expand3 = DateTime.Now.ToString("yyyyMMddHHmmssfff");
1109
                         ansModel.F_Expand3 = DateTime.Now.ToString("yyyyMMddHHmmssfff");
1109
                         #region 循环保存
1110
                         #region 循环保存
1110
                         foreach (var item in ans)
1111
                         foreach (var item in ans)
1150
                     //var fkconfig = new BLL.T_Sys_DictionaryValue().GetModel(yhfkid);
1151
                     //var fkconfig = new BLL.T_Sys_DictionaryValue().GetModel(yhfkid);
1151
                     //if (fkconfig != null)
1152
                     //if (fkconfig != null)
1152
                     //    otnModel.F_YHFKName = fkconfig.F_Name;
1153
                     //    otnModel.F_YHFKName = fkconfig.F_Name;
1153
-                    otnModel.ExpandVchField2 = phone;
1154
+                    //otnModel.ExpandVchField2 = phone;
1154
                     otnModel.ExpandVchField3 = address;
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
                     otnModel.ExpandDatField1 = DateTime.Now;//调查时间
1160
                     otnModel.ExpandDatField1 = DateTime.Now;//调查时间
1160
                     otnModel.F_AskRes = askqids;
1161
                     otnModel.F_AskRes = askqids;
1161
                     otnModel.F_AskInfo = ansids;
1162
                     otnModel.F_AskInfo = ansids;
1196
         /// <param name="countryid"></param>
1197
         /// <param name="countryid"></param>
1197
         /// <param name="address"></param>
1198
         /// <param name="address"></param>
1198
         /// <returns></returns>
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
             int res = 0;
1202
             int res = 0;
1202
             Model.T_Cus_CustomerBase cusmodel = new Model.T_Cus_CustomerBase();
1203
             Model.T_Cus_CustomerBase cusmodel = new Model.T_Cus_CustomerBase();
1203
             if (!string.IsNullOrWhiteSpace(telphone))
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
                 cusmodel = cusBLL.GetModelByPhone(telphone);
1208
                 cusmodel = cusBLL.GetModelByPhone(telphone);
1208
 
1209
 
1209
                 if (cusmodel != null)
1210
                 if (cusmodel != null)
1210
                 {
1211
                 {
1211
                     cusmodel.F_Address = address;
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
                     cusmodel.F_CustomerName = name;
1216
                     cusmodel.F_CustomerName = name;
1216
-                    cusmodel.F_Telephone = phone;
1217
+                    //cusmodel.F_Telephone = phone;
1217
                     cusBLL.Update(cusmodel);
1218
                     cusBLL.Update(cusmodel);
1218
                     res = cusmodel.F_CustomerId;
1219
                     res = cusmodel.F_CustomerId;
1219
                 }
1220
                 }
1221
                 {
1222
                 {
1222
                     cusmodel = new Model.T_Cus_CustomerBase();
1223
                     cusmodel = new Model.T_Cus_CustomerBase();
1223
                     cusmodel.F_Address = address;
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
                     cusmodel.F_CustomerName = name;
1228
                     cusmodel.F_CustomerName = name;
1228
-                    cusmodel.F_Telephone = phone;
1229
+                    //cusmodel.F_Telephone = phone;
1229
                     cusmodel.F_Mobile = telphone;
1230
                     cusmodel.F_Mobile = telphone;
1230
                     res = cusBLL.Add(cusmodel);
1231
                     res = cusBLL.Add(cusmodel);
1231
 
1232
 

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

12
 {
12
 {
13
     public class CallOutReportController : BaseController
13
     public class CallOutReportController : BaseController
14
     {
14
     {
15
+        private readonly BLL.T_Call_OutTask otBLL = new BLL.T_Call_OutTask();
15
         private readonly BLL.T_Call_OutTaskTelNum otnBLL = new BLL.T_Call_OutTaskTelNum();
16
         private readonly BLL.T_Call_OutTaskTelNum otnBLL = new BLL.T_Call_OutTaskTelNum();
16
         private readonly BLL.T_Ask_Question questionBLL = new BLL.T_Ask_Question();
17
         private readonly BLL.T_Ask_Question questionBLL = new BLL.T_Ask_Question();
17
         private readonly BLL.T_Call_OutAnswers ansBLL = new BLL.T_Call_OutAnswers();
18
         private readonly BLL.T_Call_OutAnswers ansBLL = new BLL.T_Call_OutAnswers();
27
         /// <param name="sdate">开始时间</param>
28
         /// <param name="sdate">开始时间</param>
28
         /// <param name="edate">结束时间</param>
29
         /// <param name="edate">结束时间</param>
29
         /// <returns></returns>
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
             #region 新建输出表
33
             #region 新建输出表
33
             DataTable dtnew = new DataTable();
34
             DataTable dtnew = new DataTable();
44
             #endregion
45
             #endregion
45
             #region 回答问题查询条件
46
             #region 回答问题查询条件
46
             string sqlans = " isnull(F_TaskID,'')='" + TaskID + "' ";
47
             string sqlans = " isnull(F_TaskID,'')='" + TaskID + "' ";
47
-            if (!string.IsNullOrWhiteSpace(countryid))
48
-                sqlans += " and isnull(F_Expand1,'')='" + countryid + "' ";
49
             if (!string.IsNullOrWhiteSpace(sdate))
48
             if (!string.IsNullOrWhiteSpace(sdate))
50
                 sqlans += " and DATEDIFF(day,F_OptOn,'"+ sdate.Trim() + "')<=0";
49
                 sqlans += " and DATEDIFF(day,F_OptOn,'"+ sdate.Trim() + "')<=0";
51
             if (!string.IsNullOrWhiteSpace(edate))
50
             if (!string.IsNullOrWhiteSpace(edate))
107
         }
106
         }
108
 
107
 
109
         #region 外呼任务报表导出Excel
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
             #region 新建输出表
111
             #region 新建输出表
113
             DataTable dtnew = new DataTable();
112
             DataTable dtnew = new DataTable();
124
             #endregion
123
             #endregion
125
             #region 回答问题查询条件
124
             #region 回答问题查询条件
126
             string sqlans = " isnull(F_TaskID,'')='" + TaskID + "' ";
125
             string sqlans = " isnull(F_TaskID,'')='" + TaskID + "' ";
127
-            if (!string.IsNullOrWhiteSpace(countryid))
128
-                sqlans += " and isnull(F_Expand1,'')='" + countryid + "' ";
129
             if (!string.IsNullOrWhiteSpace(sdate))
126
             if (!string.IsNullOrWhiteSpace(sdate))
130
                 sqlans += " and DATEDIFF(day,F_OptOn,'" + sdate.Trim() + "')<=0";
127
                 sqlans += " and DATEDIFF(day,F_OptOn,'" + sdate.Trim() + "')<=0";
131
             if (!string.IsNullOrWhiteSpace(edate))
128
             if (!string.IsNullOrWhiteSpace(edate))
220
                     DataRow dr = dtnew.NewRow();
217
                     DataRow dr = dtnew.NewRow();
221
                     dr["xiangzhen"] = itemconf.F_Name;
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
                     leiji += totalnum;
223
                     leiji += totalnum;
227
                     dr["zongshu"] = totalnum;
224
                     dr["zongshu"] = totalnum;
266
                     DataRow dr = dtnew.NewRow();
263
                     DataRow dr = dtnew.NewRow();
267
                     dr["xiangzhen"] = itemconf.F_Name;
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
                     leiji += totalnum;
269
                     leiji += totalnum;
273
                     dr["zongshu"] = totalnum;
270
                     dr["zongshu"] = totalnum;
446
             
443
             
447
         }
444
         }
448
         #endregion
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
 }