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