|
|
@@ -26,7 +26,7 @@ namespace CallCenterApi.Interface.Controllers.report
|
|
26
|
26
|
/// <param name="sdate">开始时间</param>
|
|
27
|
27
|
/// <param name="edate">结束时间</param>
|
|
28
|
28
|
/// <returns></returns>
|
|
29
|
|
- public ActionResult GetReport(string TaskID, int quesid,int countryid,string sdate,string edate)
|
|
|
29
|
+ public ActionResult GetReport(string TaskID, int quesid, int countryid, string sdate, string edate)
|
|
30
|
30
|
{
|
|
31
|
31
|
#region 新建输出表
|
|
32
|
32
|
DataTable dtnew = new DataTable();
|
|
|
@@ -143,5 +143,142 @@ namespace CallCenterApi.Interface.Controllers.report
|
|
143
|
143
|
|
|
144
|
144
|
}
|
|
145
|
145
|
#endregion
|
|
|
146
|
+
|
|
|
147
|
+ #region 外呼问题报表数据查询
|
|
|
148
|
+ List<string> arlist = new List<string>();//表头问题分项
|
|
|
149
|
+ List<string> checklist = new List<string>();//查询条件问题分项
|
|
|
150
|
+ DataTable dtNews = new DataTable();
|
|
|
151
|
+ DataTable dtCol = new DataTable();
|
|
|
152
|
+ int columnsnum = 1;//左边留一空列,用于显示查询条件答案
|
|
|
153
|
+ int questioncount = 0;
|
|
|
154
|
+ //获取表头
|
|
|
155
|
+ public ActionResult GetColumnList(int TaskID, int questionid)
|
|
|
156
|
+ {
|
|
|
157
|
+ columnsnum = 1;
|
|
|
158
|
+ arlist.Clear();
|
|
|
159
|
+ checklist.Clear();
|
|
|
160
|
+ #region
|
|
|
161
|
+ dtCol.Columns.Add("wenti", Type.GetType("System.String"));
|
|
|
162
|
+ dtCol.Columns.Add("fenxiangshu", Type.GetType("System.Int32"));
|
|
|
163
|
+ dtCol.Columns.Add("wentiid", Type.GetType("System.String"));
|
|
|
164
|
+ #endregion
|
|
|
165
|
+ #region 根据问题id获取问题的查询条件
|
|
|
166
|
+ string sqlques = "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 + "') ) and F_Type!=1";
|
|
|
167
|
+ if (questionid > 0)
|
|
|
168
|
+ sqlques = "F_QuestionId=" + questionid;
|
|
|
169
|
+ #endregion
|
|
|
170
|
+
|
|
|
171
|
+ var queslist = questionBLL.GetModelList(sqlques);
|
|
|
172
|
+ if (queslist.Count > 0)
|
|
|
173
|
+ {
|
|
|
174
|
+ foreach (var itemquestion in queslist)
|
|
|
175
|
+ {
|
|
|
176
|
+ DataRow dr = dtCol.NewRow();
|
|
|
177
|
+ dr["wenti"] = itemquestion.F_Title;
|
|
|
178
|
+
|
|
|
179
|
+ //根据问题ID查询问题项
|
|
|
180
|
+ var dsi = questionItemBLL.GetModelList(" isnull(F_QuestionId,'') = '" + itemquestion.F_QuestionId + "' ");
|
|
|
181
|
+ if (dsi.Count > 0)
|
|
|
182
|
+ {
|
|
|
183
|
+ foreach (var itemqi in dsi)
|
|
|
184
|
+ {
|
|
|
185
|
+ if (itemquestion.F_QuestionId != questionid)
|
|
|
186
|
+ {
|
|
|
187
|
+ arlist.Add(itemqi.F_ItemName);
|
|
|
188
|
+ columnsnum++;
|
|
|
189
|
+ }
|
|
|
190
|
+ else
|
|
|
191
|
+ {
|
|
|
192
|
+ checklist.Add(itemqi.F_ItemName);
|
|
|
193
|
+ }
|
|
|
194
|
+ }
|
|
|
195
|
+ dr["fenxiangshu"] = dsi.Count;
|
|
|
196
|
+ }
|
|
|
197
|
+ dr["wentiid"] = questionid;
|
|
|
198
|
+ dtCol.Rows.Add(dr);
|
|
|
199
|
+ }
|
|
|
200
|
+ }
|
|
|
201
|
+
|
|
|
202
|
+ return Success("获取外呼问题报表表头成功", dtCol);
|
|
|
203
|
+ }
|
|
|
204
|
+
|
|
|
205
|
+ //获取数据
|
|
|
206
|
+ public ActionResult GetDataList(int TaskID, int questionid, int countryid, string sdate, string edate)
|
|
|
207
|
+ {
|
|
|
208
|
+ int index1 = 0;
|
|
|
209
|
+ int index2 = 0;
|
|
|
210
|
+ GetColumnList(TaskID, questionid);
|
|
|
211
|
+ int rowcount = checklist.Count + 1;//行数
|
|
|
212
|
+
|
|
|
213
|
+ string[,] newdata = new string[rowcount, columnsnum];
|
|
|
214
|
+ #region 回答问题查询条件
|
|
|
215
|
+ string sqlans = " isnull(F_TaskID,'')='" + TaskID + "' ";
|
|
|
216
|
+ if (countryid > 0)
|
|
|
217
|
+ sqlans += " and isnull(F_Expand1,'')='" + countryid + "' ";
|
|
|
218
|
+ if (!string.IsNullOrWhiteSpace(sdate))
|
|
|
219
|
+ sqlans += "DATEDIFF(day,F_OptOn,'" + sdate.Trim() + "')<=0";
|
|
|
220
|
+ if (!string.IsNullOrWhiteSpace(edate))
|
|
|
221
|
+ sqlans += "DATEDIFF(day,F_OptOn,'" + edate.Trim() + "')>=0";
|
|
|
222
|
+ #endregion
|
|
|
223
|
+ #region 第一行添加
|
|
|
224
|
+ newdata[index1, index2] = "";
|
|
|
225
|
+ index2++;
|
|
|
226
|
+ for (int j = 0; j < arlist.Count; j++)
|
|
|
227
|
+ {
|
|
|
228
|
+ newdata[index1, index2] = arlist[j];
|
|
|
229
|
+ index2++;
|
|
|
230
|
+ }
|
|
|
231
|
+
|
|
|
232
|
+ index1++;//第一行添加结束
|
|
|
233
|
+ #endregion
|
|
|
234
|
+ //获取百分比
|
|
|
235
|
+ List<string> rowlist = new List<string>();
|
|
|
236
|
+
|
|
|
237
|
+ foreach (string items in checklist)
|
|
|
238
|
+ {
|
|
|
239
|
+ int colnum = 2;
|
|
|
240
|
+ index2 = 0;
|
|
|
241
|
+ DataRow drr = dtNews.NewRow();
|
|
|
242
|
+ newdata[index1, index2] = items;
|
|
|
243
|
+ int n = 0;
|
|
|
244
|
+ int len = 0;
|
|
|
245
|
+ for (int m = 0; m < dtCol.Rows.Count; m++)
|
|
|
246
|
+ {
|
|
|
247
|
+
|
|
|
248
|
+ //根据问题查询回答该问题的总次数
|
|
|
249
|
+ int totalnum = 0;
|
|
|
250
|
+ int num = 0;
|
|
|
251
|
+ totalnum = ansBLL.GetRecordCount(sqlans + " and isnull(F_QIID,'')='" + dtCol.Rows[m]["wentiid"].ToString() + "'and F_CusTelID IN (select F_CusTelID from T_Call_OutAnswers where F_TaskID='" + TaskID + "' AND F_QID='" + questionid + "' AND F_Answer='" + items + "') ");
|
|
|
252
|
+
|
|
|
253
|
+ int fenxiang = Convert.ToInt32(dtCol.Rows[m]["fenxiangshu"].ToString());
|
|
|
254
|
+ len = len + fenxiang;
|
|
|
255
|
+ while (n < len)
|
|
|
256
|
+ {
|
|
|
257
|
+ index2++;
|
|
|
258
|
+ //同一问题下的分项
|
|
|
259
|
+ num = ansBLL.GetRecordCount(sqlans + " and isnull(F_Answer,'')='" + newdata[0, n + 1] + "'and F_CusTelID IN (select F_CusTelID from T_Call_OutAnswers where F_TaskID='" + TaskID + "' AND F_QID='" + questionid + "' AND F_Answer='" + items + "') ");
|
|
|
260
|
+
|
|
|
261
|
+ if (totalnum > 0)
|
|
|
262
|
+ {
|
|
|
263
|
+ if (num > 0)
|
|
|
264
|
+ {
|
|
|
265
|
+ newdata[index1, index2] = (num / totalnum * 100).ToString() + "%";
|
|
|
266
|
+ }
|
|
|
267
|
+ else
|
|
|
268
|
+ { newdata[index1, index2] = "0"; }
|
|
|
269
|
+ }
|
|
|
270
|
+ else
|
|
|
271
|
+ { newdata[index1, index2] = "0"; }
|
|
|
272
|
+ n++;
|
|
|
273
|
+
|
|
|
274
|
+ }
|
|
|
275
|
+ colnum++;
|
|
|
276
|
+ }
|
|
|
277
|
+ index1++;
|
|
|
278
|
+ }
|
|
|
279
|
+ return Success("获取外呼问题报表数据成功", newdata);
|
|
|
280
|
+
|
|
|
281
|
+ }
|
|
|
282
|
+ #endregion
|
|
146
|
283
|
}
|
|
147
|
284
|
}
|