duhongyu 5 年之前
父節點
當前提交
470f9b6e0a

+ 1 - 1
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/Question/QuestionnaireController.cs

@@ -32,7 +32,7 @@ namespace CallCenterApi.Interface.Controllers.Question
32 32
             string sql = "";
33 33
             if (!string.IsNullOrWhiteSpace(filter.Key))
34 34
             {
35
-                sql += $" and (F_Title like '%{ filter.Key.Trim()}%' or F_Remark like '%{ filter.Key.Trim()}%') ";
35
+                sql += $" and F_Title like '%{ filter.Key.Trim()}%'";
36 36
             }
37 37
             var recordCount = 0;
38 38
             var dt = BLL.PagerBLL.GetListPager(

+ 263 - 0
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/callout/PagerAnswerWXController.cs

@@ -0,0 +1,263 @@
1
+using CallCenter.Utility;
2
+using CallCenterApi.Interface.Controllers.Base;
3
+using CallCenterApi.Interface.Models.Dto;
4
+using System;
5
+using System.Collections.Generic;
6
+using System.Linq;
7
+using System.Text;
8
+using System.Web;
9
+using System.Web.Mvc;
10
+
11
+namespace CallCenterApi.Interface.Controllers.callout
12
+{
13
+    public class PagerAnswerWXController : BaseController
14
+    {
15
+        private readonly BLL.T_Call_OutTask otBLL = new BLL.T_Call_OutTask();
16
+        private readonly BLL.T_Call_OutTaskTelNum otnBLL = new BLL.T_Call_OutTaskTelNum();
17
+        private readonly BLL.T_Call_OutAnswers ansBLL = new BLL.T_Call_OutAnswers();
18
+        private readonly BLL.T_Ask_Question questionBLL = new BLL.T_Ask_Question();
19
+        private readonly BLL.T_Ask_PagerInfo pagerInfoBLL = new BLL.T_Ask_PagerInfo();
20
+        private readonly BLL.T_Ask_QuestionItems questionItemBLL = new BLL.T_Ask_QuestionItems();
21
+        #region 获取微信提交的问卷列表
22
+        public ActionResult GetWJList(string key, string sdate, string edate, int pagesize = 10, int pageindex = 1)
23
+        {
24
+            StringBuilder sb = new StringBuilder();
25
+            #region
26
+            sb.Append(" and F_DeleteFlag=0 ");
27
+            if (!string.IsNullOrWhiteSpace(key))
28
+            {
29
+                sb.Append(" and (F_CusName like '%" + key.Trim() + "%' or F_Phone like '%" + key.Trim() + "%' or F_TelPhone like '%" + key.Trim() + "%')");
30
+            }
31
+            if (!string.IsNullOrWhiteSpace(sdate))
32
+                sb.Append(" and DATEDIFF(day,F_CreateTime,'" + sdate.Trim() + "')<=0");
33
+            if (!string.IsNullOrWhiteSpace(edate))
34
+                sb.Append(" and DATEDIFF(day,F_CreateTime,'" + edate.Trim() + "')>=0");
35
+            #endregion
36
+            var recordCount = 0;
37
+            var dt = BLL.PagerBLL.GetListPager(
38
+                    "T_Call_OutTelNumWX",
39
+                    "F_Id",
40
+                    "*",
41
+                    sb.ToString(),
42
+                    "ORDER BY F_Id desc",
43
+                    pagesize,
44
+                    pageindex,
45
+                    true,
46
+                    out recordCount);
47
+
48
+            var obj = new
49
+            {
50
+                rows = dt,
51
+                total = recordCount
52
+            };
53
+            return Content(obj.ToJson());
54
+        }
55
+
56
+        #endregion
57
+
58
+        #region 获取微信提交的问卷详情
59
+      
60
+        #endregion
61
+
62
+        #region 微信端提交问卷
63
+        ///// <summary>
64
+        ///// 微信端提交问卷
65
+        ///// </summary>
66
+        ///// <param name="telphone"></param>
67
+        ///// <param name="openid"></param>
68
+        ///// <param name="ans"></param>
69
+        ///// <param name="name"></param>
70
+        ///// <param name="phone"></param>
71
+        ///// <param name="countryid"></param>
72
+        ///// <param name="address"></param>
73
+        ///// <returns></returns>
74
+        //public bool AnswersWX(string telphone, string openid, string[] ans,
75
+        //    string name, string phone, string countryid, string address, Model.T_Sys_Users users)
76
+        //{
77
+        //    int cc = 0; int telid = 0; string dateflag = DateTime.Now.ToString("yyyyMMddHHmmssfff");
78
+        //    if (!string.IsNullOrWhiteSpace(telphone))
79
+        //    {
80
+        //        var otnModel = new Model.T_Call_OutTelNumWX();
81
+        //        #region 添加问卷提交
82
+        //        otnModel.F_TelPhone = telphone;
83
+        //        otnModel.F_Phone = phone;
84
+        //        otnModel.F_CusName = name;
85
+        //        if (!string.IsNullOrWhiteSpace(countryid.Trim()))
86
+        //        {
87
+        //            otnModel.F_CountryId = int.Parse(countryid.Trim());
88
+        //            var countryconfig = new BLL.T_Sys_DictionaryValue().GetModel(otnModel.F_CountryId.Value);
89
+        //            if (countryconfig != null)
90
+        //                otnModel.F_Country = countryconfig.F_Name;
91
+        //        }
92
+        //        otnModel.F_Address = address;
93
+        //        otnModel.F_Openid = openid;
94
+        //        otnModel.F_PagerId = int.Parse(Configs.GetValue("WXPagerID")); ;
95
+        //        otnModel.F_DeleteFlag = 0;
96
+
97
+        //        otnModel.F_CusID = 0;
98
+        //        otnModel.F_CreateTime = DateTime.Now;
99
+        //        telid = otnwxBLL.Add(otnModel);
100
+        //        #endregion
101
+        //        //微信端提交的问卷不做保存客户档案记录
102
+        //        //int cusid = saveCus(otnModel.F_Phone, name, phone, countryid, address);
103
+
104
+        //        #region 保存答案
105
+        //        var ansModel = new Model.T_Call_OutAnswersWX();
106
+        //        string askqids = "";
107
+        //        string ansids = "";
108
+        //        if (ans != null)
109
+        //        {
110
+        //            ansModel.F_PagerID = otnModel.F_PagerId;
111
+        //            ansModel.F_CusID = 0;
112
+        //            ansModel.F_CusTelID = telid;
113
+        //            if (users != null)
114
+        //            {
115
+        //                ansModel.F_OptBy = users.F_Id;
116
+        //                ansModel.F_OptByOpenid = users.F_OpenId;
117
+        //            }
118
+        //            ansModel.F_OptOn = DateTime.Now;
119
+        //            ansModel.F_Expand1 = countryid.ToString();
120
+        //            ansModel.F_Expand3 = dateflag;
121
+        //            #region 循环保存
122
+        //            foreach (var item in ans)
123
+        //            {
124
+        //                var nn = 0;
125
+        //                var ii = item.Split('_');
126
+        //                ansModel.F_QID = int.Parse(ii[0]);
127
+
128
+        //                askqids += ii[0] + ",";
129
+        //                ansids += ii[1] + ",";
130
+
131
+        //                if (ii[1].IndexOf('|') > 0)
132
+        //                {
133
+        //                    var iii = ii[1].Trim('|').Split('|');
134
+        //                    var iia = ii[2].Trim('|').Split('|');
135
+        //                    for (int i = 0; i < iii.Length; i++)
136
+        //                    {
137
+        //                        ansModel.F_QIID = int.Parse(iii[i]);
138
+        //                        ansModel.F_Answer = iia[i];
139
+        //                        if (answxBLL.Add(ansModel) > 0)
140
+        //                            nn++;
141
+        //                    }
142
+        //                    if (nn == iii.Length)
143
+        //                        cc++;
144
+        //                }
145
+        //                else
146
+        //                {
147
+        //                    ansModel.F_QIID = int.Parse(ii[1]);
148
+        //                    ansModel.F_Answer = ii[2];
149
+        //                    if (answxBLL.Add(ansModel) > 0)
150
+        //                        cc++;
151
+        //                }
152
+        //            }
153
+        //            #endregion
154
+
155
+        //            #endregion
156
+        //            #region  保存日志
157
+
158
+        //            otnModel.F_AskRes = askqids;
159
+        //            otnModel.F_AskInfo = ansids;
160
+        //            otnwxBLL.Update(otnModel);
161
+
162
+        //            planrecord(otnModel);
163
+        //            #endregion
164
+        //        }
165
+        //    }
166
+        //    if (ans != null)
167
+        //    {
168
+        //        if (cc == ans.Length)
169
+        //        {
170
+        //            return true;
171
+        //        }
172
+        //        else
173
+        //        {
174
+        //            answxBLL.DeleteByTelid(telid, dateflag);
175
+        //            //return Error("问卷提交失败!");
176
+        //            return false;
177
+        //        }
178
+        //    }
179
+        //    else
180
+        //    {
181
+        //        return false;
182
+        //        //return Error("没有问卷答案提交");
183
+        //    }
184
+        //}
185
+        #endregion
186
+
187
+        #region 工单关联问卷多选题的内容
188
+        public ActionResult GetSel(int telid)
189
+        {
190
+            if (telid <= 0)
191
+                return Error("参数不正确");
192
+            var model = otnBLL.GetModel(telid);
193
+
194
+            var paperid = 0;
195
+            if (model != null)
196
+            {
197
+                var anslist = ansBLL.GetModelList(" F_TaskID=" + model.F_TaskId.Value + " and F_CusTelID=" + telid + " ");
198
+                var tmodel = otBLL.GetModel(model.F_TaskId.Value);
199
+                if (tmodel != null)
200
+                {
201
+                    paperid = tmodel.F_PagerID.Value;
202
+                    #region 获取多选题目以及答案
203
+                    var qlist = questionBLL.GetModelList(" F_DeleteFlag=0 and F_QuestionId in (select F_QuestionId from T_Ask_PagerItems where F_PagerId=" + paperid + ") order by F_QuestionId ");
204
+
205
+                    var newmodel = new
206
+                    {
207
+                        cusname = model.F_CusName,
208
+                        telphone = model.F_Phone,
209
+                        cusphone = model.ExpandVchField2,
210
+                        countryid = model.ExpandIntField1,
211
+                        country = model.ExpandVchField4,
212
+                        address = model.ExpandVchField3,
213
+                        queslist = qlist.Where(t => t.F_Type == 3).Select(q => {
214
+                            //获取多选题目以及答案
215
+                            var answers = "";
216
+                            var qalist = anslist.Where(al => al.F_QID.Value == q.F_QuestionId).ToList<Model.T_Call_OutAnswers>();
217
+                            if (qalist.Count > 0)
218
+                            {
219
+                                foreach (var item in qalist)
220
+                                {
221
+                                    answers += item.F_Answer + ";";
222
+                                }
223
+                            }
224
+                            return new
225
+                            {
226
+                                questitle = q.F_Title,
227
+                                quesanswers = answers.Trim(';') + "。",
228
+                            };
229
+                        }),
230
+                        textlist = qlist.Where(t => t.F_Type == 1).Select(t => {
231
+                            //获取问答题以及答案
232
+                            var answers = "";
233
+                            var qalist = anslist.Where(al => al.F_QID.Value == t.F_QuestionId).ToList<Model.T_Call_OutAnswers>();
234
+                            if (qalist.Count > 0)
235
+                            {
236
+                                foreach (var item in qalist)
237
+                                {
238
+                                    answers += item.F_Answer + ";";
239
+                                }
240
+                            }
241
+                            return new
242
+                            {
243
+                                questitle = t.F_Title,
244
+                                quesanswers = answers.Trim(';') + "。",
245
+                            };
246
+                        })
247
+                    };
248
+                    #endregion
249
+
250
+                    return Success("获取多选题及答案成功", newmodel);
251
+                }
252
+            }
253
+            return Error("获取多选题及答案失败");
254
+        }
255
+
256
+      
257
+        #endregion
258
+
259
+        #region 记录日志
260
+
261
+        #endregion
262
+    }
263
+}

+ 3 - 3
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/report/BusinessController.cs

@@ -737,7 +737,7 @@ namespace CallCenterApi.Interface.Controllers.report
737 737
             Model.T_Sys_UserAccount userModel = new BLL.T_Sys_UserAccount().GetModel(userId);
738 738
 
739 739
             //原因
740
-            int type = RequestString.GetInt("type", 0);
740
+            string type = RequestString.GetQueryString("type");
741 741
             //产品类别
742 742
             int producttype = RequestString.GetInt("producttype", 0);
743 743
             //大区
@@ -752,9 +752,9 @@ namespace CallCenterApi.Interface.Controllers.report
752 752
             {
753 753
                 where += " and F_GroupCode = '" + userModel.groupcode + "' ";
754 754
             }
755
-            if (type != 0)
755
+            if (type.Trim() != "" && type != "undefined")
756 756
             {
757
-                where += " and F_Type = '" + type + "' ";
757
+                where += " and F_Typeof = '" + type + "' ";
758 758
             }
759 759
             if (producttype != 0)
760 760
             {

+ 4 - 0
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/report/TotalCallController.cs

@@ -241,6 +241,10 @@ namespace CallCenterApi.Interface.Controllers.report
241 241
         //获取图形数据
242 242
         public ActionResult GetChartData(string years, string dpt)
243 243
         {
244
+            int userId = CurrentUser.UserData.F_UserId;
245
+            Model.T_Sys_UserAccount userModel = new BLL.T_Sys_UserAccount().GetModel(userId);
246
+            if (userModel!=null )
247
+            dpt = userModel.groupcode;
244 248
             if (Request.IsAuthenticated)
245 249
             {
246 250
                 string[] arr=new string[12];

+ 13 - 4
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/report/ZuoXiWorkTotalController.cs

@@ -97,7 +97,7 @@ namespace CallCenterApi.Interface.Controllers.report
97 97
             DataColumn dc24 = new DataColumn("平均每天休息时长");
98 98
             DataColumn dc25 = new DataColumn("置忙平均休息分钟数");
99 99
            // DataColumn dc26 = new DataColumn("质检平均成绩");
100
-
100
+        
101 101
             dtNew.Columns.Add(dc2);
102 102
             dtNew.Columns.Add(dc3);
103 103
             dtNew.Columns.Add(dc4);
@@ -197,9 +197,10 @@ namespace CallCenterApi.Interface.Controllers.report
197 197
                         }
198 198
 
199 199
                         DataTable dtTrunk = DbHelperSQL.Query("select COUNT(*) as ct,SUM(DATEDIFF(Second,timewantagent,timeconnected)) as dd from rep_trunk_call_in where AgentID='" + dt.Rows[i]["F_UserCode"].ToString() + "' " + strsql).Tables[0];
200
-                        DataTable dtcall = DbHelperSQL.Query("select COUNT(*) as ct,(select COUNT(*) from T_Call_CallRecords  WITH(NOLOCK) where CallState=1 and CallType=0 and  UserCode='" + dt.Rows[i]["F_UserCode"].ToString() + "' " + strsqlcall + ") as jt from T_Call_CallRecords where CallType=0 and UserCode='" + dt.Rows[i]["F_UserCode"].ToString() + "' " + strsqlcall).Tables[0];
200
+                        DataTable dtcall = DbHelperSQL.Query("select COUNT(*) as ct,(select COUNT(*) from T_Call_CallRecords  WITH(NOLOCK) where CallState=1 and CallType=0 and  UserCode='" + dt.Rows[i]["F_UserCode"].ToString() + "' " + strsqlcall + ") as jt from T_Call_CallRecords where CallType=0 and UserCode='" + dt.Rows[i]["F_UserCode"].ToString() + "' " + strsqlcall ).Tables[0];
201
+                    DataTable dthtk = DbHelperSQL.Query("(select COUNT(*) as ht from T_Call_CallRecords WITH(NOLOCK) where DealType = 5 and  UserCode = '" + dt.Rows[i]["F_UserCode"].ToString() + "' " + strsqlcall + ")  ").Tables[0];
201 202
 
202
-                        if (dtcall != null && dtcall.Rows.Count > 0)
203
+                    if (dtcall != null && dtcall.Rows.Count > 0)
203 204
                         {
204 205
                             if (dtcall.Rows[0]["ct"].ToString() != "")
205 206
                             {
@@ -226,7 +227,15 @@ namespace CallCenterApi.Interface.Controllers.report
226 227
                                 itrunkpjsc = 0;
227 228
                             }
228 229
                         }
229
-                        itrunkhs = itrunkct - itrunkjj;
230
+                    if (dthtk.Rows[0]["ht"].ToString() != "")
231
+                    {
232
+                        itrunkhs = int.Parse(dthtk.Rows[0]["ht"].ToString());
233
+                    }
234
+                    else
235
+                    {
236
+                        itrunkhs = 0;
237
+                    }
238
+                   
230 239
                         if (itrunkct != 0)
231 240
                         {
232 241
                             itrunkjtl = itrunkjj / double.Parse(itrunkct.ToString());

+ 7 - 8
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/tel/CallrecordsController.cs

@@ -39,23 +39,22 @@ namespace CallCenterApi.Interface.Controllers.tel
39 39
             string strpagesize = RequestString.GetQueryString("pagesize");
40 40
             int pagesize = 10;
41 41
 
42
-            
43 42
 
43
+            if (!string.IsNullOrEmpty(userModel.groupcode))
44
+            {
45
+                sql += " and groupcode = '" + userModel.groupcode + "' ";
46
+            }
44 47
             if (usercode != null && usercode.Trim() != "")
45 48
             {
46 49
                 sql += " and UserCode='" + usercode + "'";
47 50
             }
48 51
             else
49 52
             {
50
-                if (ro.F_RoleCode == "XTGLY" )
53
+                if (ro.F_RoleCode != "XTGLY" )
51 54
                 {
52
-                    if (!string.IsNullOrEmpty(userModel.groupcode))
53
-                    {
54
-                        sql += " and groupcode = '" + userModel.groupcode + "' ";
55
-                    }
55
+                    sql += " and UserCode='" + userModel.F_UserCode + "'";
56 56
                 }
57
-                else 
58
-                sql += " and UserCode='" + userModel.F_UserCode  + "'";
57
+                   
59 58
             }
60 59
             if (dept != null && dept.Trim() != "")
61 60
             {