|
|
@@ -1,17 +1,414 @@
|
|
1
|
|
-using System;
|
|
|
1
|
+using CallCenter.Utility;
|
|
|
2
|
+using CallCenterApi.Interface.Controllers.Base;
|
|
|
3
|
+using Newtonsoft.Json.Linq;
|
|
|
4
|
+using System;
|
|
2
|
5
|
using System.Collections.Generic;
|
|
|
6
|
+using System.Data;
|
|
3
|
7
|
using System.Linq;
|
|
4
|
8
|
using System.Web;
|
|
5
|
9
|
using System.Web.Mvc;
|
|
6
|
10
|
|
|
7
|
11
|
namespace CallCenterApi.Interface.Controllers.Quality
|
|
8
|
12
|
{
|
|
9
|
|
- public class QCManageController : Controller
|
|
|
13
|
+ [Authority]
|
|
|
14
|
+ public class QCManageController : BaseController
|
|
10
|
15
|
{
|
|
11
|
16
|
// GET: QCManage
|
|
12
|
|
- public ActionResult Index()
|
|
|
17
|
+
|
|
|
18
|
+ //获取未质检列表
|
|
|
19
|
+ public ActionResult GetNoQCList(string phone, string usercode)
|
|
13
|
20
|
{
|
|
14
|
|
- return View();
|
|
|
21
|
+ string sql = " and CallState=1 and TalkLongTime>0 and F_QCState=0 ";
|
|
|
22
|
+ DataTable dt = new DataTable();
|
|
|
23
|
+
|
|
|
24
|
+ string callstate = HttpUtility.UrlDecode(RequestString.GetQueryString("callstate"));
|
|
|
25
|
+ string calltype = HttpUtility.UrlDecode(RequestString.GetQueryString("calltype"));
|
|
|
26
|
+ string actiontype = HttpUtility.UrlDecode(RequestString.GetQueryString("actiontype"));
|
|
|
27
|
+ string starttime = HttpUtility.UrlDecode(RequestString.GetQueryString("starttime"));
|
|
|
28
|
+ string endtime = HttpUtility.UrlDecode(RequestString.GetQueryString("endtime"));
|
|
|
29
|
+ string tasktype = HttpUtility.UrlDecode(RequestString.GetQueryString("tasktype"));
|
|
|
30
|
+ string extnumber = HttpUtility.UrlDecode(RequestString.GetQueryString("extnumber"));
|
|
|
31
|
+ string PhoneType = HttpUtility.UrlDecode(RequestString.GetQueryString("phoneType"));
|
|
|
32
|
+ int islike = RequestString.GetInt("islike", 1);
|
|
|
33
|
+
|
|
|
34
|
+ string strpageindex = RequestString.GetQueryString("page");
|
|
|
35
|
+ int pageindex = 1;
|
|
|
36
|
+ string strpagesize = RequestString.GetQueryString("pagesize");
|
|
|
37
|
+ int pagesize = 10;
|
|
|
38
|
+
|
|
|
39
|
+ if (usercode != null && usercode.Trim() != "")
|
|
|
40
|
+ {
|
|
|
41
|
+ if (usercode.IndexOf(',') > 0)
|
|
|
42
|
+ {
|
|
|
43
|
+ sql += " and UserCode in(" + usercode + ")";
|
|
|
44
|
+ }
|
|
|
45
|
+ else
|
|
|
46
|
+ {
|
|
|
47
|
+ sql += " and UserCode ='" + usercode + "'";
|
|
|
48
|
+ }
|
|
|
49
|
+ }
|
|
|
50
|
+ if (PhoneType != null && PhoneType.Trim() != "")
|
|
|
51
|
+ {
|
|
|
52
|
+ sql += " and PhoneType='" + PhoneType + "'";
|
|
|
53
|
+ }
|
|
|
54
|
+
|
|
|
55
|
+ if (islike > 0)
|
|
|
56
|
+ {
|
|
|
57
|
+ if (phone != null && phone.Trim() != "")
|
|
|
58
|
+ {
|
|
|
59
|
+ sql += " and CallNumber like '%" + phone + "%'";
|
|
|
60
|
+ }
|
|
|
61
|
+ }
|
|
|
62
|
+ else
|
|
|
63
|
+ {
|
|
|
64
|
+ if (phone != null && phone.Trim() != "")
|
|
|
65
|
+ {
|
|
|
66
|
+ sql += " and CallNumber = '" + phone + "'";
|
|
|
67
|
+ }
|
|
|
68
|
+ }
|
|
|
69
|
+
|
|
|
70
|
+ if (calltype.Trim() != "")
|
|
|
71
|
+ {
|
|
|
72
|
+ if (calltype == "3")
|
|
|
73
|
+ {
|
|
|
74
|
+ sql += " and CallType='1'";
|
|
|
75
|
+ sql += " and CallRecordsId in(select F_CallRecordId from T_Bus_VisitResult WITH(NOLOCK) where F_CallRecordId !='' and F_CallRecordId is not null )";
|
|
|
76
|
+ }
|
|
|
77
|
+ else
|
|
|
78
|
+ sql += " and CallType='" + calltype + "'";
|
|
|
79
|
+ }
|
|
|
80
|
+ if (tasktype.Trim() != "")
|
|
|
81
|
+ {
|
|
|
82
|
+ if (tasktype.Trim() == "2")
|
|
|
83
|
+ {
|
|
|
84
|
+ sql += " and TaskType='" + tasktype + "'";
|
|
|
85
|
+ }
|
|
|
86
|
+ else if (tasktype.Trim() == "0")
|
|
|
87
|
+ {
|
|
|
88
|
+ sql += " and (TaskType is null or TaskType!='2')";
|
|
|
89
|
+ }
|
|
|
90
|
+ }
|
|
|
91
|
+ if (actiontype.Trim() != "")
|
|
|
92
|
+ {
|
|
|
93
|
+ sql += " and ActionType=" + actiontype.Trim();
|
|
|
94
|
+ }
|
|
|
95
|
+ if (starttime.Trim() != "")
|
|
|
96
|
+ {
|
|
|
97
|
+ sql += " and BeginTime>='" + starttime + "' ";
|
|
|
98
|
+ }
|
|
|
99
|
+ if (endtime.Trim() != "")
|
|
|
100
|
+ {
|
|
|
101
|
+ sql += " and BeginTime<='" + endtime + "' ";
|
|
|
102
|
+ }
|
|
|
103
|
+ if (extnumber.Trim() != "")
|
|
|
104
|
+ {
|
|
|
105
|
+ sql += " and isnull(ExtNumber,'')='" + extnumber.Trim() + "'";
|
|
|
106
|
+ }
|
|
|
107
|
+
|
|
|
108
|
+ if (strpageindex.Trim() != "")
|
|
|
109
|
+ {
|
|
|
110
|
+ pageindex = Convert.ToInt32(strpageindex);
|
|
|
111
|
+ }
|
|
|
112
|
+
|
|
|
113
|
+ if (strpagesize.Trim() != "")
|
|
|
114
|
+ {
|
|
|
115
|
+ pagesize = Convert.ToInt32(strpagesize);
|
|
|
116
|
+ }
|
|
|
117
|
+
|
|
|
118
|
+ int recordCount = 0;
|
|
|
119
|
+ dt = BLL.PagerBLL.GetListPager(
|
|
|
120
|
+ "T_Call_CallRecords WITH(NOLOCK)",
|
|
|
121
|
+ "CallRecordsId",
|
|
|
122
|
+ "*,dbo.GetUserName(UserCode) as UserName,dbo.GetDictionaryName(F_CallInType) as TypeName",
|
|
|
123
|
+ sql,
|
|
|
124
|
+ "ORDER BY CallRecordsId desc",
|
|
|
125
|
+ pagesize,
|
|
|
126
|
+ pageindex,
|
|
|
127
|
+ true,
|
|
|
128
|
+ out recordCount);
|
|
|
129
|
+
|
|
|
130
|
+ var config = new BLL.T_Sys_SystemConfig().GetModelList(" F_ParamCode='PlayPath' ").FirstOrDefault();
|
|
|
131
|
+
|
|
|
132
|
+ foreach (DataRow dr in dt.Rows)
|
|
|
133
|
+ {
|
|
|
134
|
+ string path = dr["FilePath"] != null ? dr["FilePath"].ToString() : "";
|
|
|
135
|
+ if (path != "" && config != null && !string.IsNullOrEmpty(config.F_ParamValue))
|
|
|
136
|
+ {
|
|
|
137
|
+ var ym = config.F_ParamValue;
|
|
|
138
|
+ if (ym.Substring(ym.Length - 1) == "/")
|
|
|
139
|
+ {
|
|
|
140
|
+ ym = ym.Substring(0, ym.Length - 1);
|
|
|
141
|
+ }
|
|
|
142
|
+
|
|
|
143
|
+ string lujing = path.Substring(path.IndexOf(':') + 1).Replace('\\', '/');
|
|
|
144
|
+ string wlpath = ym + lujing;
|
|
|
145
|
+
|
|
|
146
|
+ dr["FilePath"] = wlpath;
|
|
|
147
|
+ }
|
|
|
148
|
+ }
|
|
|
149
|
+
|
|
|
150
|
+ var obj = new
|
|
|
151
|
+ {
|
|
|
152
|
+ state = "success",
|
|
|
153
|
+ message = "成功",
|
|
|
154
|
+ rows = dt,
|
|
|
155
|
+ total = recordCount
|
|
|
156
|
+ };
|
|
|
157
|
+
|
|
|
158
|
+ return Content(obj.ToJson());
|
|
|
159
|
+
|
|
|
160
|
+ }
|
|
|
161
|
+
|
|
|
162
|
+ //获取已质检列表
|
|
|
163
|
+ public ActionResult GetQCList(string phone, string usercode)
|
|
|
164
|
+ {
|
|
|
165
|
+ string sql = " and CallState=1 and TalkLongTime>0 and F_QCState=1 ";
|
|
|
166
|
+ DataTable dt = new DataTable();
|
|
|
167
|
+
|
|
|
168
|
+ string callstate = HttpUtility.UrlDecode(RequestString.GetQueryString("callstate"));
|
|
|
169
|
+ string calltype = HttpUtility.UrlDecode(RequestString.GetQueryString("calltype"));
|
|
|
170
|
+ string actiontype = HttpUtility.UrlDecode(RequestString.GetQueryString("actiontype"));
|
|
|
171
|
+ string starttime = HttpUtility.UrlDecode(RequestString.GetQueryString("starttime"));
|
|
|
172
|
+ string endtime = HttpUtility.UrlDecode(RequestString.GetQueryString("endtime"));
|
|
|
173
|
+ string tasktype = HttpUtility.UrlDecode(RequestString.GetQueryString("tasktype"));
|
|
|
174
|
+ string extnumber = HttpUtility.UrlDecode(RequestString.GetQueryString("extnumber"));
|
|
|
175
|
+ string PhoneType = HttpUtility.UrlDecode(RequestString.GetQueryString("phoneType"));
|
|
|
176
|
+ int islike = RequestString.GetInt("islike", 1);
|
|
|
177
|
+
|
|
|
178
|
+ string strpageindex = RequestString.GetQueryString("page");
|
|
|
179
|
+ int pageindex = 1;
|
|
|
180
|
+ string strpagesize = RequestString.GetQueryString("pagesize");
|
|
|
181
|
+ int pagesize = 10;
|
|
|
182
|
+
|
|
|
183
|
+ if (usercode != null && usercode.Trim() != "")
|
|
|
184
|
+ {
|
|
|
185
|
+ if (usercode.IndexOf(',') > 0)
|
|
|
186
|
+ {
|
|
|
187
|
+ sql += " and UserCode in(" + usercode + ")";
|
|
|
188
|
+ }
|
|
|
189
|
+ else
|
|
|
190
|
+ {
|
|
|
191
|
+ sql += " and UserCode ='" + usercode + "'";
|
|
|
192
|
+ }
|
|
|
193
|
+ }
|
|
|
194
|
+ if (PhoneType != null && PhoneType.Trim() != "")
|
|
|
195
|
+ {
|
|
|
196
|
+ sql += " and PhoneType='" + PhoneType + "'";
|
|
|
197
|
+ }
|
|
|
198
|
+
|
|
|
199
|
+ if (islike > 0)
|
|
|
200
|
+ {
|
|
|
201
|
+ if (phone != null && phone.Trim() != "")
|
|
|
202
|
+ {
|
|
|
203
|
+ sql += " and CallNumber like '%" + phone + "%'";
|
|
|
204
|
+ }
|
|
|
205
|
+ }
|
|
|
206
|
+ else
|
|
|
207
|
+ {
|
|
|
208
|
+ if (phone != null && phone.Trim() != "")
|
|
|
209
|
+ {
|
|
|
210
|
+ sql += " and CallNumber = '" + phone + "'";
|
|
|
211
|
+ }
|
|
|
212
|
+ }
|
|
|
213
|
+
|
|
|
214
|
+ if (calltype.Trim() != "")
|
|
|
215
|
+ {
|
|
|
216
|
+ if (calltype == "3")
|
|
|
217
|
+ {
|
|
|
218
|
+ sql += " and CallType='1'";
|
|
|
219
|
+ sql += " and CallRecordsId in(select F_CallRecordId from T_Bus_VisitResult WITH(NOLOCK) where F_CallRecordId !='' and F_CallRecordId is not null )";
|
|
|
220
|
+ }
|
|
|
221
|
+ else
|
|
|
222
|
+ sql += " and CallType='" + calltype + "'";
|
|
|
223
|
+ }
|
|
|
224
|
+ if (tasktype.Trim() != "")
|
|
|
225
|
+ {
|
|
|
226
|
+ if (tasktype.Trim() == "2")
|
|
|
227
|
+ {
|
|
|
228
|
+ sql += " and TaskType='" + tasktype + "'";
|
|
|
229
|
+ }
|
|
|
230
|
+ else if (tasktype.Trim() == "0")
|
|
|
231
|
+ {
|
|
|
232
|
+ sql += " and (TaskType is null or TaskType!='2')";
|
|
|
233
|
+ }
|
|
|
234
|
+ }
|
|
|
235
|
+ if (actiontype.Trim() != "")
|
|
|
236
|
+ {
|
|
|
237
|
+ sql += " and ActionType=" + actiontype.Trim();
|
|
|
238
|
+ }
|
|
|
239
|
+ if (starttime.Trim() != "")
|
|
|
240
|
+ {
|
|
|
241
|
+ sql += " and BeginTime>='" + starttime + "' ";
|
|
|
242
|
+ }
|
|
|
243
|
+ if (endtime.Trim() != "")
|
|
|
244
|
+ {
|
|
|
245
|
+ sql += " and BeginTime<='" + endtime + "' ";
|
|
|
246
|
+ }
|
|
|
247
|
+ if (extnumber.Trim() != "")
|
|
|
248
|
+ {
|
|
|
249
|
+ sql += " and isnull(ExtNumber,'')='" + extnumber.Trim() + "'";
|
|
|
250
|
+ }
|
|
|
251
|
+
|
|
|
252
|
+ if (strpageindex.Trim() != "")
|
|
|
253
|
+ {
|
|
|
254
|
+ pageindex = Convert.ToInt32(strpageindex);
|
|
|
255
|
+ }
|
|
|
256
|
+
|
|
|
257
|
+ if (strpagesize.Trim() != "")
|
|
|
258
|
+ {
|
|
|
259
|
+ pagesize = Convert.ToInt32(strpagesize);
|
|
|
260
|
+ }
|
|
|
261
|
+
|
|
|
262
|
+ int recordCount = 0;
|
|
|
263
|
+ dt = BLL.PagerBLL.GetListPager(
|
|
|
264
|
+ "T_Call_CallRecords WITH(NOLOCK)",
|
|
|
265
|
+ "CallRecordsId",
|
|
|
266
|
+ "*,dbo.GetUserName(UserCode) as UserName,dbo.GetDictionaryName(F_CallInType) as TypeName",
|
|
|
267
|
+ sql,
|
|
|
268
|
+ "ORDER BY CallRecordsId desc",
|
|
|
269
|
+ pagesize,
|
|
|
270
|
+ pageindex,
|
|
|
271
|
+ true,
|
|
|
272
|
+ out recordCount);
|
|
|
273
|
+
|
|
|
274
|
+ var config = new BLL.T_Sys_SystemConfig().GetModelList(" F_ParamCode='PlayPath' ").FirstOrDefault();
|
|
|
275
|
+
|
|
|
276
|
+ foreach (DataRow dr in dt.Rows)
|
|
|
277
|
+ {
|
|
|
278
|
+ string path = dr["FilePath"] != null ? dr["FilePath"].ToString() : "";
|
|
|
279
|
+ if (path != "" && config != null && !string.IsNullOrEmpty(config.F_ParamValue))
|
|
|
280
|
+ {
|
|
|
281
|
+ var ym = config.F_ParamValue;
|
|
|
282
|
+ if (ym.Substring(ym.Length - 1) == "/")
|
|
|
283
|
+ {
|
|
|
284
|
+ ym = ym.Substring(0, ym.Length - 1);
|
|
|
285
|
+ }
|
|
|
286
|
+
|
|
|
287
|
+ string lujing = path.Substring(path.IndexOf(':') + 1).Replace('\\', '/');
|
|
|
288
|
+ string wlpath = ym + lujing;
|
|
|
289
|
+
|
|
|
290
|
+ dr["FilePath"] = wlpath;
|
|
|
291
|
+ }
|
|
|
292
|
+ }
|
|
|
293
|
+
|
|
|
294
|
+ var obj = new
|
|
|
295
|
+ {
|
|
|
296
|
+ state = "success",
|
|
|
297
|
+ message = "成功",
|
|
|
298
|
+ rows = dt,
|
|
|
299
|
+ total = recordCount
|
|
|
300
|
+ };
|
|
|
301
|
+
|
|
|
302
|
+ return Content(obj.ToJson());
|
|
|
303
|
+
|
|
|
304
|
+ }
|
|
|
305
|
+
|
|
|
306
|
+ //获取质检详情
|
|
|
307
|
+ public ActionResult GetIndexList(int id)
|
|
|
308
|
+ {
|
|
|
309
|
+ DataTable dt = new BLL.T_QC_IndexCategory().GetList(" F_DeleteFlag=0 order by F_Sort ,F_CategoryId").Tables[0];
|
|
|
310
|
+ DataTable dtindex = new BLL.T_QC_IndexBase().GetList(" F_DeleteFlag=0 order by F_Sort ,F_CategoryId").Tables[0];
|
|
|
311
|
+ DataTable dtres = new BLL.T_QC_IndexRes().GetList(" CallRecordsId=" + id + " ").Tables[0];
|
|
|
312
|
+
|
|
|
313
|
+ List<object> list = new List<object>();
|
|
|
314
|
+ int allscore = 0;
|
|
|
315
|
+ int allpf = 0;
|
|
|
316
|
+ foreach (DataRow dr in dt.Select("F_ParentId=0"))
|
|
|
317
|
+ {
|
|
|
318
|
+ string categoryid = dr["F_CategoryId"].ToString().Trim();
|
|
|
319
|
+ DataRow[] drcs = dtindex.Select("F_CategoryId=" + categoryid);
|
|
|
320
|
+
|
|
|
321
|
+ var rowspan = drcs.Count();
|
|
|
322
|
+ int csc = int.Parse(dr["F_Score"].ToString().Trim());
|
|
|
323
|
+ allscore += csc;
|
|
|
324
|
+ if (rowspan > 1)
|
|
|
325
|
+ {
|
|
|
326
|
+ var l = new
|
|
|
327
|
+ {
|
|
|
328
|
+ Qcid = categoryid,
|
|
|
329
|
+ Qcname = dr["F_CategoryName"].ToString().Trim(),
|
|
|
330
|
+ Qcscore = csc,
|
|
|
331
|
+ Qcpf = 0,
|
|
|
332
|
+ TypeName="",
|
|
|
333
|
+ Rowspan = rowspan,
|
|
|
334
|
+ Colspan = 1
|
|
|
335
|
+ };
|
|
|
336
|
+ list.Add(l);
|
|
|
337
|
+ }
|
|
|
338
|
+
|
|
|
339
|
+ foreach (DataRow drc in drcs)
|
|
|
340
|
+ {
|
|
|
341
|
+ string childid = drc["F_IndexId"].ToString().Trim();
|
|
|
342
|
+ int sc = int.Parse(drc["F_Score"].ToString().Trim());
|
|
|
343
|
+ var pfdr = dtres.Select("F_IndexId=" + childid);
|
|
|
344
|
+ int pf = pfdr.Count() > 0 ? int.Parse(pfdr[0]["F_QCScore"].ToString()) : 0;
|
|
|
345
|
+ allpf += pf;
|
|
|
346
|
+ var l1 = new
|
|
|
347
|
+ {
|
|
|
348
|
+ Qcid = childid,
|
|
|
349
|
+ Qcname = drc["F_Title"].ToString().Trim(),
|
|
|
350
|
+ Qcscore = sc,
|
|
|
351
|
+ Qcpf = pf,
|
|
|
352
|
+ TypeName = rowspan == 1 ? dr["F_CategoryName"].ToString().Trim() : "",
|
|
|
353
|
+ Rowspan = 1,
|
|
|
354
|
+ Colspan = 1
|
|
|
355
|
+ };
|
|
|
356
|
+ list.Add(l1);
|
|
|
357
|
+ }
|
|
|
358
|
+ }
|
|
|
359
|
+
|
|
|
360
|
+ var lt = new
|
|
|
361
|
+ {
|
|
|
362
|
+ Qcid = "0",
|
|
|
363
|
+ Qcname = "总计",
|
|
|
364
|
+ Qcscore = allscore,
|
|
|
365
|
+ Qcpf = allpf,
|
|
|
366
|
+ TypeName = "",
|
|
|
367
|
+ Rowspan = 1,
|
|
|
368
|
+ Colspan = 2
|
|
|
369
|
+ };
|
|
|
370
|
+ list.Add(lt);
|
|
|
371
|
+
|
|
|
372
|
+ dtres.Clear();
|
|
|
373
|
+ dtres.Dispose();
|
|
|
374
|
+ dtindex.Clear();
|
|
|
375
|
+ dtindex.Dispose();
|
|
|
376
|
+ dt.Clear();
|
|
|
377
|
+ dt.Dispose();
|
|
|
378
|
+
|
|
|
379
|
+ return Success("质检加载成功", list);
|
|
|
380
|
+ }
|
|
|
381
|
+
|
|
|
382
|
+
|
|
|
383
|
+ //保存质检得分
|
|
|
384
|
+ public ActionResult SaveData(int id,string json)
|
|
|
385
|
+ {
|
|
|
386
|
+ if (id > 0)
|
|
|
387
|
+ {
|
|
|
388
|
+ int allscore = 0;
|
|
|
389
|
+ List<string> list = new List<string>();
|
|
|
390
|
+ list.Add("delete from T_QC_IndexRes where CallRecordsId=" + id);
|
|
|
391
|
+ foreach (var scoreinfo in json.ToObject<List<JObject>>())
|
|
|
392
|
+ {
|
|
|
393
|
+ list.Add("insert into T_QC_IndexRes(CallRecordsId,F_IndexId,F_Score,F_QCScore) values(" + id + "," + scoreinfo["Id"].ToString() + "," + scoreinfo["Score"].ToString() + "," + scoreinfo["QCScore"].ToString() + ")");
|
|
|
394
|
+
|
|
|
395
|
+ allscore += int.Parse( scoreinfo["QCScore"].ToString());
|
|
|
396
|
+ }
|
|
|
397
|
+ list.Add("update T_Call_CallRecords set F_QCState=1,F_QCScore=" + allscore+ ",F_QCUserId="+ User.F_UserId+ ",F_QCUserName='"+ User.F_UserName+ "',F_QCTime=getdate() where CallRecordsId="+ id);
|
|
|
398
|
+
|
|
|
399
|
+ if (DB.DbHelperSQL.ExecuteSqlTran(list)>0)
|
|
|
400
|
+ {
|
|
|
401
|
+ return Success("保存成功");
|
|
|
402
|
+ }
|
|
|
403
|
+ else
|
|
|
404
|
+ {
|
|
|
405
|
+ return Error("保存失败");
|
|
|
406
|
+ }
|
|
|
407
|
+ }
|
|
|
408
|
+ else
|
|
|
409
|
+ {
|
|
|
410
|
+ return Error("保存失败");
|
|
|
411
|
+ }
|
|
15
|
412
|
}
|
|
16
|
413
|
}
|
|
17
|
414
|
}
|