|
|
@@ -72,6 +72,379 @@ namespace CallCenterApi.Interface.Controllers.report
|
|
72
|
72
|
|
|
73
|
73
|
}
|
|
74
|
74
|
}
|
|
|
75
|
+
|
|
|
76
|
+ public ActionResult AreaComplaint(string stime="", string endtime = "", int isdc=0)
|
|
|
77
|
+ {
|
|
|
78
|
+ List <Complaint> complaintlist = new List<Complaint>();
|
|
|
79
|
+ DateTime strattime,enddatetime ;
|
|
|
80
|
+ string where = "F_IsDelete = 0 and F_Area is not null and (F_Type=2 or (F_Duplicate in(2,0)and F_Type=3))";
|
|
|
81
|
+ if (stime=="")
|
|
|
82
|
+ {
|
|
|
83
|
+ strattime = DateTime.Now.AddDays(-6);
|
|
|
84
|
+ where += " and datediff(day,F_CreateTime,'" + strattime.ToString("yyyy-MM-dd") + "')<=0 ";
|
|
|
85
|
+ }
|
|
|
86
|
+ else
|
|
|
87
|
+ {
|
|
|
88
|
+ strattime = DateTime.Parse(stime);
|
|
|
89
|
+ where += " and datediff(day,F_CreateTime,'" + stime + "')<=0 ";
|
|
|
90
|
+ }
|
|
|
91
|
+ if (endtime=="")
|
|
|
92
|
+ {
|
|
|
93
|
+ enddatetime = DateTime.Now;
|
|
|
94
|
+ where += " and datediff(day,F_CreateTime,'" + DateTime.Now.ToString("yyyy-MM-dd") + "')>=0 ";
|
|
|
95
|
+ }
|
|
|
96
|
+ else
|
|
|
97
|
+ {
|
|
|
98
|
+ enddatetime = DateTime.Parse(endtime);
|
|
|
99
|
+ where += " and datediff(day,F_CreateTime,'" + endtime + "')>=0 ";
|
|
|
100
|
+ }
|
|
|
101
|
+ var workoeder = new BLL.T_Bus_WorkOrder().GetModelList(where);
|
|
|
102
|
+ var Area = new BLL.T_Sys_Department().GetModelList("isnull(F_ParentId, 1) = 1 and F_State = 1 and F_Layer = 1");
|
|
|
103
|
+ float max = 0; float min = 0;
|
|
|
104
|
+ string maxarea = "", minarea="";
|
|
|
105
|
+ Complaint complaints = new Complaint();
|
|
|
106
|
+ complaints.serialnumbe = 20;
|
|
|
107
|
+ complaints.area = "合计";
|
|
|
108
|
+ float Distributionrate = 0;
|
|
|
109
|
+ float documentary = 0;
|
|
|
110
|
+ if (workoeder!=null )
|
|
|
111
|
+ {
|
|
|
112
|
+ for (int i=0;i < Area.Count;i ++ )
|
|
|
113
|
+ {
|
|
|
114
|
+ Complaint complaint = new Complaint();
|
|
|
115
|
+ complaint.serialnumbe = i + 1;//序号
|
|
|
116
|
+ complaint.area = Area[i].F_DeptName;//大区
|
|
|
117
|
+ var group = workoeder.Where(p => p.F_Area == Area[i].F_DeptId.ToString()) ;//投诉总量
|
|
|
118
|
+ complaint.complaintnumber = group.Count();
|
|
|
119
|
+
|
|
|
120
|
+
|
|
|
121
|
+ complaint.assignmentnumber= group.Where(p => p.F_State ==1 || p.F_State == 5).Count ();//待分派
|
|
|
122
|
+ complaints.assignmentnumber += complaint.assignmentnumber;
|
|
|
123
|
+ float a = 0;int c = 0;
|
|
|
124
|
+ for (DateTime dt = strattime; dt <= enddatetime; dt = dt.AddDays (1))
|
|
|
125
|
+ {
|
|
|
126
|
+ c++;
|
|
|
127
|
+
|
|
|
128
|
+ var daycount= group.Where(p => (p.F_TobeallocatedTime< dt.AddDays (1)&&( p .F_AssignmenttIime>= dt || p.F_AssignmenttIime==null) )
|
|
|
129
|
+ ).Count();
|
|
|
130
|
+
|
|
|
131
|
+ var today= group.Where(p => p.F_AssignmenttIime >= dt && p.F_AssignmenttIime < dt.AddDays(1)
|
|
|
132
|
+ ).Count();
|
|
|
133
|
+
|
|
|
134
|
+ if (daycount > 0)
|
|
|
135
|
+ a += today / daycount;//当日分派率
|
|
|
136
|
+ else
|
|
|
137
|
+ a += 1;
|
|
|
138
|
+ }
|
|
|
139
|
+ complaint.assignmentrate = string.Format("{0:f2}%", a / c * 100);
|
|
|
140
|
+ Distributionrate += a / c;
|
|
|
141
|
+ complaint.pendingnumber = group.Where(p => p.F_State == 3).Count();//待处理
|
|
|
142
|
+ complaints.pendingnumber += complaint.pendingnumber;
|
|
|
143
|
+ complaint.processingnumber = group.Where(p => p.F_State == 4).Count();//处理中
|
|
|
144
|
+ if (complaint.complaintnumber > 0)
|
|
|
145
|
+ complaint.processingnumberrate = string.Format("{0:f2}%", complaint.processingnumber /(float ) complaint.complaintnumber * 100);//
|
|
|
146
|
+ else
|
|
|
147
|
+ complaint.processingnumberrate = "100%";
|
|
|
148
|
+
|
|
|
149
|
+ complaints.processingnumber += complaint.processingnumber;
|
|
|
150
|
+ complaint.processednumber = group.Where(p => p.F_State == 10).Count();//已处理
|
|
|
151
|
+
|
|
|
152
|
+ complaints.processednumber += complaint.processednumber;
|
|
|
153
|
+ float d = 0;
|
|
|
154
|
+ if (complaint.complaintnumber > 0)
|
|
|
155
|
+ {
|
|
|
156
|
+ d = complaint.processednumber / (float)complaint.complaintnumber;
|
|
|
157
|
+ complaint.processedrate = string.Format("{0:f2}%", complaint.processednumber / (float)complaint.complaintnumber * 100);//处理率
|
|
|
158
|
+ }
|
|
|
159
|
+ else
|
|
|
160
|
+ {
|
|
|
161
|
+ d = 1;
|
|
|
162
|
+ complaint.processedrate = "100%";
|
|
|
163
|
+ }
|
|
|
164
|
+ if (i == 0)
|
|
|
165
|
+ {
|
|
|
166
|
+ min = d;
|
|
|
167
|
+ max = d;
|
|
|
168
|
+ maxarea = Area[i].F_DeptName;
|
|
|
169
|
+ minarea = Area[i].F_DeptName;
|
|
|
170
|
+ }
|
|
|
171
|
+ else
|
|
|
172
|
+ {
|
|
|
173
|
+ if (d > max)
|
|
|
174
|
+ {
|
|
|
175
|
+ max = d;
|
|
|
176
|
+ maxarea = Area[i].F_DeptName ;
|
|
|
177
|
+ }
|
|
|
178
|
+ if (d < min)
|
|
|
179
|
+ {
|
|
|
180
|
+ min = d;
|
|
|
181
|
+ minarea = Area[i].F_DeptName;
|
|
|
182
|
+ }
|
|
|
183
|
+ }
|
|
|
184
|
+
|
|
|
185
|
+ int reminder= group.Where(p => p.F_DealType == 1 ).Count();//催单数量
|
|
|
186
|
+ documentary += reminder;
|
|
|
187
|
+ int perfect= group.Where(p => p.F_DealState == 1).Count();//完善数量
|
|
|
188
|
+ documentary += perfect;
|
|
|
189
|
+ int total = reminder + perfect;
|
|
|
190
|
+ if (group.Count()>0)
|
|
|
191
|
+ complaint.documentaryrate = string.Format("{0:f2}%", total / (float)group.Count() * 100);//跟单率
|
|
|
192
|
+ else
|
|
|
193
|
+ complaint.documentaryrate = "100%";
|
|
|
194
|
+ complaintlist.Add(complaint);
|
|
|
195
|
+ }
|
|
|
196
|
+ complaints.complaintnumber = workoeder.Count();
|
|
|
197
|
+ if (Area.Count>0)
|
|
|
198
|
+ complaints.assignmentrate = string.Format("{0:f2}%", Distributionrate / Area.Count * 100); //当日分派率
|
|
|
199
|
+ else
|
|
|
200
|
+ complaints.assignmentrate = "100%";
|
|
|
201
|
+ if (complaints.complaintnumber > 0)
|
|
|
202
|
+ complaints.processedrate = string.Format("{0:f2}%", complaints.processednumber/(float )complaints.complaintnumber * 100);//处理率
|
|
|
203
|
+ else
|
|
|
204
|
+ complaints.processedrate = "100%";
|
|
|
205
|
+ if (complaints.complaintnumber > 0)
|
|
|
206
|
+ complaints.documentaryrate = string.Format("{0:f2}%", documentary / complaints.complaintnumber * 100);//跟单率
|
|
|
207
|
+ else
|
|
|
208
|
+ complaints.documentaryrate = "100%";
|
|
|
209
|
+ if (complaints.complaintnumber > 0)
|
|
|
210
|
+ complaints.processingnumberrate = string.Format("{0:f2}%", complaints.processingnumber / (float)complaints.complaintnumber * 100);//
|
|
|
211
|
+ else
|
|
|
212
|
+ complaints.processingnumberrate = "100%";
|
|
|
213
|
+ complaintlist.Add(complaints);
|
|
|
214
|
+
|
|
|
215
|
+ if (isdc>0)
|
|
|
216
|
+ {
|
|
|
217
|
+ NPOIHelper npoi = new NPOIHelper();
|
|
|
218
|
+ if (npoi.Complainthandling(strattime, enddatetime, complaintlist, maxarea,minarea ) == "")
|
|
|
219
|
+ {
|
|
|
220
|
+ return Success("导出成功");
|
|
|
221
|
+ }
|
|
|
222
|
+ else
|
|
|
223
|
+ {
|
|
|
224
|
+ return Error("导出失败");
|
|
|
225
|
+ }
|
|
|
226
|
+ }
|
|
|
227
|
+ else
|
|
|
228
|
+ {
|
|
|
229
|
+ var obj = new
|
|
|
230
|
+ {
|
|
|
231
|
+ complaintlist,
|
|
|
232
|
+ maxarea,
|
|
|
233
|
+ minarea,
|
|
|
234
|
+ };
|
|
|
235
|
+ return Success("获取成功", obj.ToJson ());
|
|
|
236
|
+ }
|
|
|
237
|
+
|
|
|
238
|
+ }
|
|
|
239
|
+ else
|
|
|
240
|
+ {
|
|
|
241
|
+ return Success("暂无数据");
|
|
|
242
|
+ }
|
|
|
243
|
+
|
|
|
244
|
+ }
|
|
|
245
|
+ public ActionResult Afterprogress(string stime = "", string endtime = "", int isdc = 0)
|
|
|
246
|
+ {
|
|
|
247
|
+ List<Aftersale> aftersalelist = new List<Aftersale>();
|
|
|
248
|
+ DateTime strattime, enddatetime;
|
|
|
249
|
+ string where = "F_IsDelete = 0 and F_Area is not null and (F_Type=2 or (F_Duplicate in(2,0)and F_Type=3))";
|
|
|
250
|
+ if (stime == "")
|
|
|
251
|
+ {
|
|
|
252
|
+ strattime =DateTime .Parse ( DateTime.Now.AddMonths (-1).ToString ("yyyy-MM-28"));
|
|
|
253
|
+ where += " and datediff(day,F_CreateTime,'" + strattime.ToString("yyyy-MM-dd") + "')<=0 ";
|
|
|
254
|
+ }
|
|
|
255
|
+ else
|
|
|
256
|
+ {
|
|
|
257
|
+ strattime = DateTime.Parse(stime);
|
|
|
258
|
+ where += " and datediff(day,F_CreateTime,'" + stime + "')<=0 ";
|
|
|
259
|
+ }
|
|
|
260
|
+ if (endtime == "")
|
|
|
261
|
+ {
|
|
|
262
|
+ enddatetime = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-27"));
|
|
|
263
|
+ where += " and datediff(day,F_CreateTime,'" + DateTime.Now.ToString("yyyy-MM-dd") + "')>=0 ";
|
|
|
264
|
+ }
|
|
|
265
|
+ else
|
|
|
266
|
+ {
|
|
|
267
|
+ enddatetime = DateTime.Parse(endtime);
|
|
|
268
|
+ where += " and datediff(day,F_CreateTime,'" + endtime + "')>=0 ";
|
|
|
269
|
+ }
|
|
|
270
|
+ var workoeder = new BLL.T_Bus_WorkOrder().GetModelList(where);
|
|
|
271
|
+ var Area = new BLL.T_Sys_Department().GetModelList("isnull(F_ParentId, 1) = 1 and F_State = 1 and F_Layer = 1");
|
|
|
272
|
+ float max = 0; float min = 0;
|
|
|
273
|
+ string maxarea = "", minarea = "";
|
|
|
274
|
+ Aftersale complaints = new Aftersale();
|
|
|
275
|
+ complaints.serialnumbe = "合计";
|
|
|
276
|
+ complaints.area = "";
|
|
|
277
|
+ if (workoeder != null)
|
|
|
278
|
+ {
|
|
|
279
|
+ for (int i = 0; i < Area.Count; i++)
|
|
|
280
|
+ {
|
|
|
281
|
+ Aftersale aftersale = new Aftersale();
|
|
|
282
|
+ aftersale.serialnumbe = i + 1+"";//序号
|
|
|
283
|
+ aftersale.area = Area[i].F_DeptName;//大区
|
|
|
284
|
+ var group = workoeder.Where(p => p.F_Area == Area[i].F_DeptId.ToString());//投诉总量
|
|
|
285
|
+ aftersale.total = group.Count();
|
|
|
286
|
+
|
|
|
287
|
+ aftersale.assignmentnumber = group.Where(p => p.F_State == 3 || p.F_State == 4 || p.F_State == 10).Count();//分派投诉
|
|
|
288
|
+ if (aftersale.total > 0)
|
|
|
289
|
+ aftersale.assignmentrate = string.Format("{0:f2}%",(float )aftersale.assignmentnumber / aftersale.total * 100);//分派率
|
|
|
290
|
+ else
|
|
|
291
|
+ aftersale.assignmentrate = "100%";
|
|
|
292
|
+
|
|
|
293
|
+ aftersale.receiving = group.Where(p => p.F_State == 4 || p.F_State == 10 ).Count();//接单条数
|
|
|
294
|
+ if (aftersale.total > 0)
|
|
|
295
|
+ aftersale.receivingrate = string.Format("{0:f2}%", (float)aftersale.receiving / aftersale.total * 100);//接单率
|
|
|
296
|
+ else
|
|
|
297
|
+ aftersale.receivingrate = "100%";
|
|
|
298
|
+ aftersale.processingnumber = group.Where( p => p.F_State == 4).Count();//处理中投诉
|
|
|
299
|
+ aftersale.processednumber = group.Where( p => p.F_State == 10).Count();//已处理投诉
|
|
|
300
|
+ float d = 0;
|
|
|
301
|
+ if (aftersale.total > 0)
|
|
|
302
|
+ {
|
|
|
303
|
+ d = (float)aftersale.processednumber / aftersale.total;
|
|
|
304
|
+ aftersale.processed = d;
|
|
|
305
|
+ aftersale.processedrate = string.Format("{0:f2}%", (float)aftersale.processednumber / aftersale.total * 100);//完结率
|
|
|
306
|
+ }
|
|
|
307
|
+
|
|
|
308
|
+ else
|
|
|
309
|
+ {
|
|
|
310
|
+ d = 1;
|
|
|
311
|
+ aftersale.processed = 1;
|
|
|
312
|
+ aftersale.processedrate = "100%";
|
|
|
313
|
+ }
|
|
|
314
|
+ if (i == 0)
|
|
|
315
|
+ {
|
|
|
316
|
+ min = d;
|
|
|
317
|
+ max = d;
|
|
|
318
|
+ maxarea = Area[i].F_DeptName;
|
|
|
319
|
+ minarea = Area[i].F_DeptName;
|
|
|
320
|
+ }
|
|
|
321
|
+ else
|
|
|
322
|
+ {
|
|
|
323
|
+ if (d > max)
|
|
|
324
|
+ {
|
|
|
325
|
+ max = d;
|
|
|
326
|
+ maxarea = Area[i].F_DeptName;
|
|
|
327
|
+ }
|
|
|
328
|
+ if (d < min)
|
|
|
329
|
+ {
|
|
|
330
|
+ min = d;
|
|
|
331
|
+ minarea = Area[i].F_DeptName;
|
|
|
332
|
+ }
|
|
|
333
|
+ }
|
|
|
334
|
+ int reminder = group.Where(p => p.F_DealType == 1).Count();//催单数量
|
|
|
335
|
+ if (aftersale.total > 0)
|
|
|
336
|
+ aftersale.reminderrate = string.Format("{0:f2}%", (float)reminder / aftersale.total * 100);//
|
|
|
337
|
+ else
|
|
|
338
|
+ aftersale.reminderrate = "100%";
|
|
|
339
|
+ aftersale.name = User(Area[i].F_DeptName);
|
|
|
340
|
+ aftersalelist.Add(aftersale);
|
|
|
341
|
+ }
|
|
|
342
|
+ complaints.total = workoeder.Count();
|
|
|
343
|
+ complaints.assignmentnumber = workoeder.Where(p => p.F_State == 3 || p.F_State == 4 || p.F_State == 10).Count();//分派投诉
|
|
|
344
|
+ if (complaints.total > 0)
|
|
|
345
|
+ complaints.assignmentrate = string.Format("{0:f2}%", (float)complaints.assignmentnumber / complaints.total * 100);//分派率
|
|
|
346
|
+ else
|
|
|
347
|
+ complaints.assignmentrate = "100%";
|
|
|
348
|
+
|
|
|
349
|
+ complaints.receiving = workoeder.Where(p => p.F_State == 4 || p.F_State == 10).Count();//接单条数
|
|
|
350
|
+ if (complaints.total > 0)
|
|
|
351
|
+ complaints.receivingrate = string.Format("{0:f2}%", (float)complaints.receiving / complaints.total * 100);//接单率
|
|
|
352
|
+ else
|
|
|
353
|
+ complaints.receivingrate = "100%";
|
|
|
354
|
+ complaints.processingnumber = workoeder.Where(p => p.F_State == 4).Count();//处理中投诉
|
|
|
355
|
+ complaints.processednumber = workoeder.Where(p => p.F_State == 10).Count();//已处理投诉
|
|
|
356
|
+ if (complaints.total > 0)
|
|
|
357
|
+ complaints.processedrate = string.Format("{0:f2}%", (float)complaints.processednumber / complaints.total * 100);//完结率
|
|
|
358
|
+ else
|
|
|
359
|
+ complaints.processedrate = "100%";
|
|
|
360
|
+ int remind= workoeder.Where(p => p.F_DealType == 1).Count();//催单数量
|
|
|
361
|
+ if (complaints.total > 0)
|
|
|
362
|
+ complaints.reminderrate = string.Format("{0:f2}%", (float)remind / complaints.total * 100);//
|
|
|
363
|
+ else
|
|
|
364
|
+ complaints.reminderrate = "100%";
|
|
|
365
|
+ complaints.name = "";
|
|
|
366
|
+ int pendingnumber = workoeder.Where(p => p.F_State == 3).Count();//
|
|
|
367
|
+ aftersalelist = aftersalelist.OrderByDescending(x => x.processed).ToList ();
|
|
|
368
|
+ aftersalelist.Add(complaints);
|
|
|
369
|
+ for (int i=0;i < aftersalelist.Count-1;i++)
|
|
|
370
|
+ {
|
|
|
371
|
+ aftersalelist[i].serialnumbe = i+1+"";
|
|
|
372
|
+ }
|
|
|
373
|
+ if (isdc > 0)
|
|
|
374
|
+ {
|
|
|
375
|
+ NPOIHelper npoi = new NPOIHelper();
|
|
|
376
|
+ if (npoi.AftersaleToExcel(strattime, enddatetime, aftersalelist, maxarea, minarea, pendingnumber) == "")
|
|
|
377
|
+ {
|
|
|
378
|
+ return Success("导出成功");
|
|
|
379
|
+ }
|
|
|
380
|
+ else
|
|
|
381
|
+ {
|
|
|
382
|
+ return Error("导出失败");
|
|
|
383
|
+ }
|
|
|
384
|
+ }
|
|
|
385
|
+ else
|
|
|
386
|
+ {
|
|
|
387
|
+ var obj = new
|
|
|
388
|
+ {
|
|
|
389
|
+ aftersalelist,
|
|
|
390
|
+ maxarea,
|
|
|
391
|
+ minarea,
|
|
|
392
|
+ pendingnumber
|
|
|
393
|
+ };
|
|
|
394
|
+ return Success("获取成功", obj.ToJson ()
|
|
|
395
|
+ );
|
|
|
396
|
+ }
|
|
|
397
|
+
|
|
|
398
|
+ }
|
|
|
399
|
+ else
|
|
|
400
|
+ {
|
|
|
401
|
+ return Success("暂无数据");
|
|
|
402
|
+ }
|
|
|
403
|
+
|
|
|
404
|
+ }
|
|
|
405
|
+
|
|
|
406
|
+ /// <summary>
|
|
|
407
|
+ ///
|
|
|
408
|
+ /// </summary>
|
|
|
409
|
+ /// <returns></returns>
|
|
|
410
|
+ private string User(string DeptName )
|
|
|
411
|
+ {
|
|
|
412
|
+ string user="";
|
|
|
413
|
+ if (DeptName== "京津"|| DeptName == "豫南" || DeptName == "豫北")
|
|
|
414
|
+ {
|
|
|
415
|
+ var usermodel = new BLL.T_Sys_UserAccount().GetModel("8009");
|
|
|
416
|
+ if (usermodel != null)
|
|
|
417
|
+ user = usermodel.F_UserName;
|
|
|
418
|
+
|
|
|
419
|
+ }
|
|
|
420
|
+ else if (DeptName == "山东" || DeptName == "华东" )
|
|
|
421
|
+ {
|
|
|
422
|
+ var usermodel = new BLL.T_Sys_UserAccount().GetModel("8010");
|
|
|
423
|
+ if (usermodel != null)
|
|
|
424
|
+ user = usermodel.F_UserName;
|
|
|
425
|
+ }
|
|
|
426
|
+ else if ( DeptName == "川渝" || DeptName == "湘赣" || DeptName == "西北" || DeptName == "华南")
|
|
|
427
|
+ {
|
|
|
428
|
+ var usermodel = new BLL.T_Sys_UserAccount().GetModel("8011");
|
|
|
429
|
+ if (usermodel != null)
|
|
|
430
|
+ user = usermodel.F_UserName;
|
|
|
431
|
+ }
|
|
|
432
|
+ else if (DeptName == "安徽" || DeptName == "湖北" || DeptName == "晋蒙" || DeptName == "云贵" || DeptName == "陕宁")
|
|
|
433
|
+ {
|
|
|
434
|
+
|
|
|
435
|
+ var usermodel = new BLL.T_Sys_UserAccount().GetModel("8012");
|
|
|
436
|
+ if (usermodel != null)
|
|
|
437
|
+ user = usermodel.F_UserName;
|
|
|
438
|
+ }
|
|
|
439
|
+ else if (DeptName == "吉林" || DeptName == "辽宁" || DeptName == "黑龙江" || DeptName == "河北" || DeptName == "江苏" )
|
|
|
440
|
+ {
|
|
|
441
|
+ var usermodel = new BLL.T_Sys_UserAccount().GetModel("822249");
|
|
|
442
|
+ if (usermodel != null)
|
|
|
443
|
+ user = usermodel.F_UserName;
|
|
|
444
|
+ }
|
|
|
445
|
+ return user;
|
|
|
446
|
+
|
|
|
447
|
+ }
|
|
75
|
448
|
/// <summary>
|
|
76
|
449
|
/// 坐席话务量
|
|
77
|
450
|
/// </summary>
|