Kaynağa Gözat

点击外呼呼叫结果查询-自定义列列表接口调整

yuqian 8 yıl önce
ebeveyn
işleme
9ecb33acf6

+ 63 - 14
CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/callout/CallPlanController.cs

@@ -734,7 +734,12 @@ namespace CallCenterApi.Interface.Controllers.callout
734 734
             return Content(obj.ToJson());
735 735
         }
736 736
 
737
-        public ActionResult GetPhoneResult(FilterCallPhone filter)
737
+        /// <summary>
738
+        /// 任务结果查询-自定义列表头
739
+        /// </summary>
740
+        /// <param name="filter"></param>
741
+        /// <returns></returns>
742
+        public ActionResult GetPhoneResultHead(FilterCallPhone filter)
738 743
         {
739 744
             var headList1 = new List<string>() { "序号", "外呼计划", "号码Id", "号码", "分配坐席", "呼叫状态", "接通状态", "呼叫结果", "结果反馈", "导入时间", "呼出时间" };
740 745
             //根据任务id查问卷
@@ -751,10 +756,34 @@ namespace CallCenterApi.Interface.Controllers.callout
751 756
             var headList = new List<string>();
752 757
             headList.AddRange(headList1);
753 758
             headList.AddRange(headList2);
759
+            return Success("获取成功", new
760
+            {
761
+                headlist = headList
762
+            });
763
+        }
764
+        /// <summary>
765
+        /// 任务结果查询-自定义列数据
766
+        /// </summary>
767
+        /// <param name="filter"></param>
768
+        /// <returns></returns>
769
+        public ActionResult GetPhoneResult(FilterCallPhone filter)
770
+        {
771
+            var headList1 = new List<string>() { "序号", "外呼计划", "号码Id", "号码", "分配坐席", "呼叫状态", "接通状态", "呼叫结果", "结果反馈", "导入时间", "呼出时间" };
772
+            //根据任务id查问卷
773
+            var task = taskBLL.GetModel(filter.Id);
774
+            if (task == null)
775
+                return Error("该任务不存在");
754 776
 
777
+            var headDt = DbHelperSQL.Query($"select Q.F_TITLE from T_Ask_Question Q  LEFT JOIN T_Ask_PagerItems PIT ON PIT.F_QuestionId = Q.F_QuestionId LEFT JOIN T_Ask_PagerInfo PIN ON PIN.F_PagerId = PIT.F_PagerId LEFT JOIN T_CTI_Task T ON T.y_TkModelId = PIN.F_PagerId where T.TaskID ={task.TaskID} ORDER BY Q.F_SortModel").Tables[0];
778
+            var headList2 = new List<string>();
779
+            foreach (DataRow row in headDt.Rows)
780
+            {
781
+                headList2.Add(row["F_TITLE"]?.ToString() ?? "");
782
+            }
755 783
 
756 784
             //查询数据
757
-            var sql = "";
785
+            //var sql = " 1=1 ";
786
+            var sql = "  ";
758 787
             if (filter.Id > 0)
759 788
             {
760 789
                 var model = taskBLL.GetModel(filter.Id);
@@ -829,28 +858,48 @@ namespace CallCenterApi.Interface.Controllers.callout
829 858
                 var answer = answerList.Where(x => (x.F_CusTelID?.ToString() ?? "") == item.id).GroupBy(x => x.F_QID).ToList();
830 859
                 var itemList = new List<string>();
831 860
                 itemList.AddRange(new string[] { item.id, item.taskname, item.phone, item.agent, item.isallot, item.iscalled, item.isconnected, item.hjjg, item.yhfk, item.createtime, item.lastcalltime });
832
-                foreach (var i in answer)
861
+                if (answer.Count() > 0)
862
+                {
863
+                    foreach (var i in answer)
864
+                    {
865
+                        itemList.Add(string.Join(", ", i.Where(x => !string.IsNullOrWhiteSpace(x.F_Answer)).Select(x => x.F_Answer).Distinct()));
866
+                    }
867
+                }
868
+                else
833 869
                 {
834
-                    itemList.Add(string.Join(", ", i.Where(x => !string.IsNullOrWhiteSpace(x.F_Answer)).Select(x => x.F_Answer).Distinct()));
870
+                    for (int i = 0; i < headList2.Count; i++)
871
+                    {
872
+                        itemList.Add("");
873
+                    }
835 874
                 }
836 875
                 dataList.Add(itemList);
837 876
             }
838 877
 
878
+            List<Dictionary<string, string>> result = new List<Dictionary<string, string>>();
879
+            for (int i = 0; i < dataList.Count(); i++)
880
+            {
881
+                Dictionary<string, string> dic = new Dictionary<string, string>();
882
+                for (int j = 0; j < dataList[i].Count(); j++)
883
+                {
884
+                    dic.Add("items" + j, dataList[i][j]);
885
+                }
886
+                result.Add(dic);
887
+            }
888
+            var obj = new
889
+            {
890
+                statusCode = 200,
891
+                code = 0,
892
+                msg = "",
893
+                rows = result,
894
+                total = recordCount
895
+            };
839 896
 
897
+            return Content(obj.ToJson(), "application/json");
898
+        }
840 899
 
841 900
 
842 901
 
843 902
 
844
-
845
-            return Success("获取成功", new
846
-            {
847
-                headlist = headList,
848
-                datalist = dataList,
849
-                recordcount = recordCount
850
-            });
851
-        }
852
-
853
-
854 903
         /// <summary>
855 904
         /// 坐席自主获取号码(点击外呼分配号码)
856 905
         /// </summary>