duhongyu 4 年 前
コミット
023f0dd124

+ 3 - 1
CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/DictionaryController.cs

@@ -440,6 +440,7 @@ namespace CallCenterApi.Interface.Controllers
440 440
             int pid = RequestString.GetInt("pid", 0);
441 441
             string name = RequestString.GetFormString("name");
442 442
             int deptid = RequestString.GetInt("deptid", 0);
443
+            string remark = RequestString.GetFormString("remark");
443 444
             Model.T_Sys_DictionaryValue orderModel = new Model.T_Sys_DictionaryValue();
444 445
             BLL.T_Sys_DictionaryValue orderBll = new BLL.T_Sys_DictionaryValue();
445 446
             
@@ -458,7 +459,7 @@ namespace CallCenterApi.Interface.Controllers
458 459
                     orderModel.F_PrentId = pid;
459 460
                     orderModel.F_State = 0;
460 461
                     orderModel.F_Deptid  = deptid;
461
-                    
462
+                    orderModel.F_Remark  = remark;
462 463
                     int n = orderBll.Add(orderModel);
463 464
                     if (n > 0)
464 465
                     {
@@ -494,6 +495,7 @@ namespace CallCenterApi.Interface.Controllers
494 495
                         orderModel.F_Value = name;
495 496
                         orderModel.F_PrentId = pid;
496 497
                         orderModel.F_Deptid = deptid;
498
+                        orderModel.F_Remark = remark;
497 499
                         if (orderBll.Update(orderModel))
498 500
                         {
499 501
                             if (deptid > 0)

+ 440 - 21
CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/WebChart/InfoNewController.cs

@@ -1,10 +1,13 @@
1 1
 using CallCenter.Utility;
2 2
 using CallCenterApi.DB;
3 3
 using CallCenterApi.Interface.Controllers.Base;
4
+using Newtonsoft.Json;
5
+using Newtonsoft.Json.Linq;
4 6
 using System;
5 7
 using System.Collections.Generic;
6 8
 using System.Data;
7 9
 using System.Linq;
10
+using System.Threading.Tasks;
8 11
 using System.Web;
9 12
 using System.Web.Mvc;
10 13
 
@@ -24,6 +27,15 @@ namespace CallCenterApi.Interface.Controllers.WebChart
24 27
             int source = RequestString.GetInt("source", 0);
25 28
             int hour = RequestString.GetInt("hour", -1);
26 29
             int type = RequestString.GetInt("type", 0);
30
+            int dealtype = RequestString.GetInt("dealtype", -1);
31
+            int timetype = RequestString.GetInt("timetype", 1);
32
+            
33
+            int sourceArea = RequestString.GetInt("sourceArea", 0);
34
+            int keyid = RequestString.GetInt("keyid", 0);
35
+            int deptid = RequestString.GetInt("deptid", 0);
36
+            int bldate = RequestString.GetInt("bldate", 0);
37
+            string latitude = RequestString.GetQueryString("latitude");
38
+            string longitude = RequestString.GetQueryString("longitude");
27 39
             string strpageindex = RequestString.GetQueryString("page");
28 40
             int pageindex = 1;
29 41
             string strpagesize = RequestString.GetQueryString("pagesize");
@@ -32,26 +44,76 @@ namespace CallCenterApi.Interface.Controllers.WebChart
32 44
             {
33 45
                 pageindex = Convert.ToInt32(strpageindex);
34 46
             }
35
-
47
+            if (dealtype > -1)
48
+            {
49
+                if (dealtype == 2)
50
+                {//按时
51
+                    sql += " and F_IsResult=0 and isnull(F_DealTime,'')<>'' and F_LimitTime>=F_DealTime ";
52
+                }
53
+                else if (dealtype == 3)
54
+                {//超期
55
+                    sql += " and isnull(F_DealTime,'')<>'' and F_LimitTime<F_DealTime ";
56
+                }
57
+                else
58
+                    sql += " and isnull(F_IsResult,0) = '" + dealtype + "' ";
59
+            }
36 60
             if (strpagesize.Trim() != "")
37 61
             {
38 62
                 pagesize = Convert.ToInt32(strpagesize);
39 63
             }
64
+            if (bldate>0)
65
+            {
66
+                sql += "and  F_IsResult=0  and datediff(MONTH , F_CreateTime , getdate())= 0  and F_DealDeptId  is not null and F_MainDeptId is not null and F_WorkState in(6, 9) and F_AssignTime is not null and F_DealTime is not null ";
67
+            }
68
+            if (deptid > 0)
69
+            {
70
+                sql += "and F_MainDeptId='" + deptid + "'";
71
+            }
72
+            if (latitude.Trim ()!="")
73
+            {
74
+                sql += "and F_Latitude='" + latitude + "'";
75
+            }
76
+            if (longitude .Trim() != "")
77
+            {
78
+                sql += "and F_Longitude='" + longitude + "'";
79
+            }
80
+           if (sourceArea >0)
81
+            {
82
+                sql += "and F_SourceArea='" + sourceArea + "'";
83
+            }
40 84
             if (type >0)
41 85
             {
42 86
                 sql += "and F_InfoType='" + type + "'";
43 87
             }
44
-            var date = DateTime.Now;
45
-            sql += $" and  F_CreateTime>='{date.ToString("yyyy-MM-dd")} 00:00:00'";
88
+            if (source >0)
89
+            {
90
+                sql += "and F_InfoSource='" + source + "'";
91
+            }
92
+
93
+            if (keyid>0)
94
+            {
95
+                sql += "and F_Key='"+ keyid + "' ";
96
+            }
97
+            if (timetype==1)
98
+            {
99
+                sql += "and datediff(DAY ,F_CreateTime ,getdate())=0 ";
100
+            }
101
+            else if (timetype==2)
102
+            {
103
+                sql += "and datediff(WEEK ,F_CreateTime ,getdate())=0 ";
104
+            }
105
+            else
106
+            {
107
+                sql += "and datediff(MONTH ,F_CreateTime ,getdate())=0 ";
108
+            }
109
+           
110
+
111
+
46 112
             if (hour > -1)
47 113
             {
48
-                int hours = hour + 1;
49
-                if (hour < 23)
50
-                    sql += " and datepart(hh,F_CreateTime)>=" + hour + " AND datepart(hh,F_CreateTime)<" + hours;
51
-                else
52
-                    sql += " and  datepart(hh,F_CreateTime)>=" + hour;
114
+                sql += " and  datepart(hh,F_CreateTime)=" + hour;
53 115
             }
54
-            string cols = "F_WorkOrderId,F_ComTitle,F_WorkState,F_MainDeptId,F_IsResult,F_CreateTime,dbo.GetUserName(F_CreateUser) as UserName,dbo.GetDictionaryName(F_InfoType) as TypeName,dbo.GetDictionaryName(F_InfoSource) as SourceName,dbo.GetDeptNames(F_MainDeptId) as DeptName,F_CloseTime,F_LimitTime as LimitTime,F_ComContent ";
116
+            string cols = "F_WorkOrderId,F_ComTitle,F_WorkState,F_MainDeptId,F_IsResult,F_CreateTime,dbo.GetUserName(F_CreateUser) as UserName,dbo.GetDictionaryName(F_InfoType) as TypeName,dbo.GetDictionaryName(F_InfoSource) as SourceName,dbo.GetDictionaryName(F_Key) KeyName,dbo.GetDeptNames(F_MainDeptId) as DeptName,F_CloseTime,F_LimitTime as LimitTime,F_ComContent ";
55 117
             int recordCount = 0;
56 118
             dt = BLL.PagerBLL.GetListPager(
57 119
                 "T_Bus_WorkOrder a WITH(NOLOCK)",
@@ -72,11 +134,10 @@ namespace CallCenterApi.Interface.Controllers.WebChart
72 134
             };
73 135
             return Content(obj.ToJson());
74 136
         }
75
-        private BLL.T_Sys_SystemConfig configBll = new BLL.T_Sys_SystemConfig();
76
-     
137
+      
77 138
         #region 工单类型
78 139
         /// <summary>
79
-        /// 获取当日24小时受理量
140
+        /// 获取当日24小时类型受理量
80 141
         /// </summary>
81 142
         /// <returns></returns>
82 143
         public ActionResult GetTypeCount24ByNow()
@@ -95,9 +156,6 @@ namespace CallCenterApi.Interface.Controllers.WebChart
95 156
                 colsid= typeList.Select(p => p.F_ValueId ).ToList(),
96 157
                 counts = new List<int[]>(),
97 158
             };
98
-
99
-
100
-
101 159
             string sqltype = " select datepart(hh, F_CreateTime) hour, count(1) count,F_InfoType type  from dbo.T_Bus_WorkOrder where 1=1 " + where + " group by datepart(hh, F_CreateTime),F_InfoType order by datepart(hh, F_CreateTime)";
102 160
             DataTable dttype = DbHelperSQL.Query(sqltype).Tables[0];
103 161
 
@@ -127,13 +185,95 @@ namespace CallCenterApi.Interface.Controllers.WebChart
127 185
                 int hc = 0;
128 186
                 if (drs.Length > 0)
129 187
                     hc = (from DataRow dr in drs select dr.Field<int>("count")).FirstOrDefault();
130
-
131 188
                 th[i] = hc;
132 189
             }
133 190
             obj.counts.Insert(0, th);
134 191
 
135 192
             return Success("加载成功", obj);
136 193
         }
194
+        /// <summary>
195
+        /// 获取当日受理量
196
+        /// </summary>
197
+        /// <returns></returns>
198
+        public ActionResult GetAcceptanceCountByNow()
199
+        {
200
+            var date = DateTime.Now;
201
+            string where = $" and F_IsDelete=0 and F_CreateTime>='{date.ToString("yyyy-MM-dd")} 00:00:00'";
202
+          
203
+            string sql = $" and   BeginTime>='{date.ToString("yyyy-MM-dd")} 00:00:00' and CallType = 0 ";
204
+            string sqlhw = " select SUM(case  CallType  when 0 then 1 else 0 end) hrcount ,SUM(case  CallType  when 0 then(case CallState when 1then 1 else 0 end ) else 0 end) jtcount, SUM(case  CallType  when 1 then 1 else 0 end) hccount from T_Call_CallRecords where  1=1 "+sql;
205
+            DataTable dthw = DbHelperSQL.Query(sqlhw).Tables[0];
206
+
207
+           
208
+         
209
+            string sqltype = " select COUNT(1) lrcount,SUM(case F_WorkState  when 6 then 1 when 9 then 1 else 0 end  ) blcount ,SUM(case F_WorkState  when 9 then 1 else 0 end) wjcount from dbo.T_Bus_WorkOrder where 1=1"+where ;
210
+            DataTable dttype = DbHelperSQL.Query(sqltype).Tables[0];
211
+            var obj = new
212
+            {
213
+               hw= dthw,
214
+               gd= dttype
215
+            };
216
+            return Success("加载成功", obj);
217
+        }
218
+        /// <summary>
219
+        /// 获取当日24小时受理量
220
+        /// </summary>
221
+        /// <returns></returns>
222
+        public ActionResult GetAcceptanceCount24ByNow()
223
+        {
224
+            var date = DateTime.Now;
225
+            string where = $" and F_IsDelete=0 and F_CreateTime>='{date.ToString("yyyy-MM-dd")} 00:00:00'";
226
+            var hr = date.Hour + 1;
227
+            int[] hours = Enumerable.Range(0, hr).ToArray<int>();
228
+            var obj = new
229
+            {
230
+                hours,
231
+                hrcount = new List<int[]>(),
232
+                jtcount = new List<int[]>(),
233
+                count = new List<int[]>(),
234
+                counts = new List<int[]>(),
235
+            };
236
+            string sql = $" and   BeginTime>='{date.ToString("yyyy-MM-dd")} 00:00:00' and CallType = 0 ";
237
+            string sqlhw = " select datepart(hh, BeginTime ) hour, count(1) count,sum(case  CallState when 1 then 1 else 0 end ) as jtcount from  dbo.T_Call_CallRecords where 1=1  "+ sql + " group by datepart(hh, BeginTime) order by datepart(hh, BeginTime)";
238
+            DataTable dthw = DbHelperSQL.Query(sqlhw).Tables[0];
239
+
240
+            int[] hwc = new int[hours.Length]; int[] jcc = new int[hours.Length];
241
+            for (int i = 0; i < hours.Length; i++)
242
+            {
243
+                var drs = dthw.Select("hour='" + hours[i] + "'");
244
+                int hw = 0; int jc = 0;
245
+                if (drs.Length > 0)
246
+                {
247
+                    hw = (from DataRow dr in drs select dr.Field<int>("count")).FirstOrDefault();
248
+                    jc = (from DataRow dr in drs select dr.Field<int>("jtcount")).FirstOrDefault();
249
+                }
250
+                hwc[i] = hw;
251
+                jcc[i] = jc;
252
+            }
253
+            obj.hrcount.Add(hwc);
254
+            obj.jtcount  .Add(jcc);
255
+            string sqltype = " select datepart(hh, F_CreateTime) hour, count(1) count,sum(F_IsResult) as resultcount from dbo.T_Bus_WorkOrder where 1=1 "+where +" group by datepart(hh, F_CreateTime) order by datepart(hh, F_CreateTime)";
256
+            DataTable dttype = DbHelperSQL.Query(sqltype).Tables[0];
257
+
258
+            int[] ah = new int[hours.Length]; int[] rh = new int[hours.Length];
259
+            for (int i = 0; i < hours.Length; i++)
260
+            {
261
+                var drs = dttype.Select("hour='" + hours[i] + "'");
262
+                int hc = 0;int rc = 0;
263
+                if (drs.Length > 0)
264
+                {
265
+                    hc = (from DataRow dr in drs select dr.Field<int>("count")).FirstOrDefault();
266
+                    rc = (from DataRow dr in drs select dr.Field<int>("resultcount")).FirstOrDefault();
267
+                }
268
+                ah[i] = hc;
269
+                rh[i] = rc;
270
+            }
271
+            obj.count.Add(ah);
272
+            obj.counts.Add(rh);
273
+
274
+
275
+            return Success("加载成功", obj);
276
+        }
137 277
 
138 278
         /// <summary>
139 279
         /// 获取当日类型受理量
@@ -156,6 +296,12 @@ namespace CallCenterApi.Interface.Controllers.WebChart
156 296
         #endregion
157 297
 
158 298
         #region 问题分类
299
+        public class KeyCount
300
+        {
301
+            public int ValueCount { set; get; }
302
+            public int ValueId { set; get; }
303
+        }
304
+           
159 305
         /// <summary>
160 306
         /// 获取当日问题分类受理量
161 307
         /// </summary>
@@ -169,31 +315,172 @@ namespace CallCenterApi.Interface.Controllers.WebChart
169 315
             var keyAllList = new BLL.T_Sys_DictionaryValue().GetModelList(" F_State=0 ");
170 316
             var keylist = keyAllList.Where(p => p.F_PrentId == pid).ToList();
171 317
             int total = 0;
318
+            List<KeyCount> jo = new List<KeyCount>();
319
+            if (RedisHelper.StringGet("InfoNewKeyCountValueId" + pid) != null)
320
+            {
321
+                Task.Run(() =>
322
+                {
323
+                    string obsql = $" select (select COUNT(1) from [GetValueId](p .F_ValueId )) as ValueCount ,p.F_ValueId ValueId from T_Sys_DictionaryValue p where F_PrentId = '" + pid + "' and F_State = 0 ";
324
+                    DataTable ob = DbHelperSQL.Query(obsql).Tables[0];
325
+                    RedisHelper.KeyDelete("InfoNewKeyCountValueId" + pid);
326
+                    RedisHelper.StringSet("InfoNewKeyCountValueId" + pid, ob.ToJson(), new TimeSpan(24, 0, 0));
327
+                });
328
+                ;
329
+               
330
+                 jo = JsonConvert.DeserializeObject<List<KeyCount>>(RedisHelper.StringGet("InfoNewKeyCountValueId" + pid).ToString());
331
+              
332
+            }
333
+            else
334
+            {
335
+                string obsql = $" select (select COUNT(1) from [GetValueId](p .F_ValueId )) as ValueCount ,p.F_ValueId ValueId from T_Sys_DictionaryValue p where F_PrentId = '" + pid + "' and F_State = 0 ";
336
+                DataTable ob = DbHelperSQL.Query(obsql).Tables[0];
337
+                RedisHelper.StringSet("InfoNewKeyCountValueId" + pid, ob.ToJson(), new TimeSpan(24, 0, 0));
338
+                jo = JsonConvert.DeserializeObject<List<KeyCount>>(ob.ToJson());
339
+            }
340
+            int TotalClass = 1;
172 341
             var list = keylist.Select(p =>
173 342
             {
174 343
                 var ids = getChildren(keyAllList, p.F_ValueId);
175 344
                 ids.Insert(0, p.F_ValueId);
176 345
                 int sum = dt.Select(" keyid in (" + string.Join(",", ids) + ") ").Sum(x => x.Field<int>("count"));
346
+                int classcount = jo.Where(x => x.ValueId == p.F_ValueId).First().ValueCount;
177 347
                 total += sum;
348
+                TotalClass += classcount;
178 349
                 return new
179 350
                 {
180 351
                     KeyId = p.F_ValueId,
181 352
                     KeyName = p.F_Value,
182
-                    Count = sum
353
+                    Count = sum,
354
+                    ClassCount= classcount
183 355
                 };
184 356
             }).ToList();
357
+            string message = "";
185 358
 
359
+          
186 360
             var listrate = list.Select(p => new
187 361
             {
188 362
                 p.KeyId,
189 363
                 p.KeyName,
190 364
                 p.Count,
191
-                Rate = Math.Round(p.Count * 100.00 / total, 2)
365
+                Rate = string.Format("{0}%", Math.Round(p.Count * 100.00 / total, 2)),
366
+                p .ClassCount
367
+
192 368
             });
369
+            var obj = new
370
+            {
371
+                Date = listrate.OrderByDescending(p => p.Count),
372
+                ClaseeCount = listrate.Count(),
373
+                Total = total,
374
+                ClassTotal= TotalClass
375
+            };
376
+
377
+            return Success("加载成功", obj);
378
+        }
379
+        /// <summary>
380
+        /// 获取区域受理量
381
+        /// </summary>
382
+        /// <param name="date"></param>
383
+        /// <param name="isdc"></param>
384
+        /// <returns></returns>
385
+        public ActionResult GetAreaCount()
386
+        {
387
+            if (RedisHelper.StringGet("InfoNewGetAreaCount") != null)
388
+            {
389
+                Task.Run(() =>
390
+                {
391
+                    Dictionary<string, string> paras = new Dictionary<string, string>();
392
+                    var ob = DbHelperSQL.RunProcedure("P_Areacontrast", paras, "Areacontrast").Tables[0];
393
+                    RedisHelper.KeyDelete("InfoNewGetAreaCount");
394
+                    RedisHelper.StringSet("InfoNewGetAreaCount", ob.ToJson(), new TimeSpan(0, 5, 0));
395
+                });
396
+                return Content(RedisHelper.StringGet("InfoNewGetAreaCount").ToString());
397
+            }
398
+            else
399
+            {
400
+                Dictionary<string, string> paras = new Dictionary<string, string>();
401
+                var obj = DbHelperSQL.RunProcedure("P_Areacontrast", paras, "Areacontrast").Tables[0];
402
+                RedisHelper.StringSet("InfoNewGetAreaCount", obj.ToJson(), new TimeSpan(0, 5, 0));
403
+                return Content(obj.ToJson());
404
+            }
193 405
 
194
-            return Success("加载成功", listrate.OrderByDescending(p => p.Count));
406
+           
407
+          
408
+        }
409
+
410
+
411
+        /// <summary>
412
+        /// 获取平均办理时长
413
+        /// </summary>
414
+        /// <param name="date"></param>
415
+        /// <param name="isdc"></param>
416
+        /// <returns></returns>
417
+        public ActionResult GetDeptDayTime()
418
+        {
419
+            if (RedisHelper.StringGet("InfoNewGetDeptDayTime") != null)
420
+            {
421
+                Task.Run(() =>
422
+                {
423
+                    Dictionary<string, string> paras = new Dictionary<string, string>();
424
+                    var ob = DbHelperSQL.RunProcedure("P_DeptDayTime", paras, "DeptDayTime").Tables[0]; ;
425
+                    RedisHelper.KeyDelete("InfoNewGetDeptDayTime");
426
+                    RedisHelper.StringSet("InfoNewGetDeptDayTime", ob.ToJson(), new TimeSpan(0, 5, 0));
427
+                });
428
+                return Content(RedisHelper.StringGet("InfoNewGetDeptDayTime").ToString());
429
+            }
430
+            else
431
+            {
432
+                Dictionary<string, string> paras = new Dictionary<string, string>();
433
+                var obj = DbHelperSQL.RunProcedure("P_DeptDayTime", paras, "DeptDayTime").Tables[0]; ;
434
+                RedisHelper.StringSet("InfoNewGetDeptDayTime", obj.ToJson(), new TimeSpan(0, 5, 0));
435
+                return Content(obj.ToJson());
436
+            }
437
+           
195 438
         }
196 439
         /// <summary>
440
+        /// 平台受理情况概况
441
+        /// </summary>
442
+        /// <returns></returns>
443
+        public ActionResult GetAreaAcceptance()
444
+        {
445
+            if (RedisHelper.StringGet("InfoNewGetAcceptance") != null)
446
+            {
447
+                Task.Run(() =>
448
+                {
449
+                    Dictionary<string, string> paras = new Dictionary<string, string>();
450
+                    var ob = DbHelperSQL.RunProcedure("P_Acceptance", paras, "Acceptance").Tables[0]; ;
451
+                    RedisHelper.KeyDelete("InfoNewGetAcceptance");
452
+                    RedisHelper.StringSet("InfoNewGetAcceptance", ob.ToJson(), new TimeSpan(0, 5, 0));
453
+                });
454
+                return Content(RedisHelper.StringGet("InfoNewGetAcceptance").ToString());
455
+            }
456
+            else
457
+            {
458
+                Dictionary<string, string> paras = new Dictionary<string, string>();
459
+                var obj = DbHelperSQL.RunProcedure("P_Acceptance", paras, "Acceptance").Tables[0]; ;
460
+                RedisHelper.StringSet("InfoNewGetAcceptance", obj.ToJson(), new TimeSpan(0, 5, 0));
461
+                return Content(obj.ToJson());
462
+            }
463
+
464
+
465
+
466
+        }
467
+        /// <summary>
468
+        /// 获取当月区域坐标
469
+        /// </summary>
470
+        /// <returns></returns>
471
+        public ActionResult GetCoordinate(string  areaid)
472
+        {
473
+            string sqlarea = "select F_Latitude,F_Longitude from t_bus_workorder    where datediff(MONTH , F_CreateTime , getdate())= 0 and F_IsDelete = 0 and F_Latitude is not null and F_Longitude is not null and F_SourceArea = '"+ areaid + "' GROUP BY F_Latitude,F_Longitude";
474
+            DataTable dttype = DbHelperSQL.Query(sqlarea).Tables[0];
475
+            var obj = new
476
+            {
477
+                Coordinate= dttype
478
+            };
479
+            return Success("获取成功", obj);
480
+        }
481
+
482
+
483
+        /// <summary>
197 484
         /// 获取父级下的所有子级id
198 485
         /// </summary>
199 486
         /// <param name="list"></param>
@@ -221,7 +508,7 @@ namespace CallCenterApi.Interface.Controllers.WebChart
221 508
         public ActionResult GetSourceCountByNow()
222 509
         {
223 510
             var date = DateTime.Now;
224
-            string sql = $" select F_Value TypeName,(select COUNT(1) from T_Bus_WorkOrder where F_IsDelete=0 and F_InfoSource=F_ValueId and F_CreateTime>='{date.ToString("yyyy-MM-dd")} 00:00:00') Count from dbo.T_Sys_DictionaryValue where F_PrentId=36 and F_State=0 ";
511
+            string sql = $" select F_Value TypeName,F_ValueId ValueId,(select COUNT(1) from T_Bus_WorkOrder where F_IsDelete=0 and F_InfoSource=F_ValueId and F_CreateTime>='{date.ToString("yyyy-MM-dd")} 00:00:00') Count from dbo.T_Sys_DictionaryValue where F_PrentId=36 and F_State=0 ";
225 512
             DataTable dt = DbHelperSQL.Query(sql).Tables[0];
226 513
 
227 514
             //DataRow dr = dt.NewRow();
@@ -450,7 +737,139 @@ namespace CallCenterApi.Interface.Controllers.WebChart
450 737
             {
451 738
                 return Error("参数传输失败");
452 739
             }
453
-        } 
740
+        }
741
+
742
+        //获取通话记录列表
743
+        public ActionResult GetCallList()
744
+        {
745
+            string sql = "";
746
+            DataTable dt = new DataTable();
747
+            string callstate = HttpUtility.UrlDecode(RequestString.GetQueryString("callstate"));
748
+            string calltype = HttpUtility.UrlDecode(RequestString.GetQueryString("calltype"));
749
+            string actiontype = HttpUtility.UrlDecode(RequestString.GetQueryString("actiontype"));
750
+            string starttime = HttpUtility.UrlDecode(RequestString.GetQueryString("starttime"));
751
+            string endtime = HttpUtility.UrlDecode(RequestString.GetQueryString("endtime"));
752
+            string tasktype = HttpUtility.UrlDecode(RequestString.GetQueryString("tasktype"));
753
+            string extnumber = HttpUtility.UrlDecode(RequestString.GetQueryString("extnumber"));
754
+            string PhoneType = HttpUtility.UrlDecode(RequestString.GetQueryString("phoneType"));
755
+            int type = RequestString.GetInt("type", 0);
756
+            int islike = RequestString.GetInt("islike", 1);
757
+            string strpageindex = RequestString.GetQueryString("page");
758
+            int pageindex = 1;
759
+            string strpagesize = RequestString.GetQueryString("pagesize");
760
+            int pagesize = 10;
761
+            int hour = RequestString.GetInt("hour", -1);
762
+            if (hour > -1)
763
+            {
764
+                int hours = hour + 1;
765
+                if (hour < 23)
766
+                    sql += " and datepart(hh,BeginTime)>=" + hour + " AND datepart(hh,BeginTime)<" + hours;
767
+                else
768
+                    sql += " and  datepart(hh,BeginTime)>=" + hour;
769
+            }
770
+
771
+            if (type != 0)
772
+            {
773
+                sql += " and F_CallInType = '" + type + "' ";
774
+            }
775
+          
776
+            if (PhoneType != null && PhoneType.Trim() != "")
777
+            {
778
+                sql += " and PhoneType='" + PhoneType + "'";
779
+            }
780
+
781
+            if (callstate.Trim() != "")
782
+            {
783
+                if (callstate.Trim() == "0")
784
+                {
785
+                    sql += " and CallState=0 and isnull(UserCode,'')!='' ";
786
+                }
787
+                else if (callstate.Trim() == "3")
788
+                {
789
+                    sql += " and CallState=0 and CallType=0 and isnull(UserCode,'')='' ";
790
+                }
791
+                else
792
+                {
793
+                    sql += " and CallState='" + callstate + "'";
794
+                }
795
+            }
796
+            if (calltype.Trim() != "")
797
+            {
798
+                if (calltype == "3")
799
+                {
800
+                    sql += " and CallType='1'";
801
+                    sql += " and CallRecordsId in(select F_CallRecordId from T_Bus_VisitResult WITH(NOLOCK) where F_CallRecordId !='' and F_CallRecordId is not null )";
802
+                }
803
+                else
804
+                    sql += " and CallType='" + calltype + "'";
805
+            }
806
+            if (tasktype.Trim() != "")
807
+            {
808
+                if (tasktype.Trim() == "2")
809
+                {
810
+                    sql += " and TaskType='" + tasktype + "'";
811
+                }
812
+                else if (tasktype.Trim() == "0")
813
+                {
814
+                    sql += " and (TaskType is null or TaskType!='2')";
815
+                }
816
+            }
817
+            if (actiontype.Trim() != "")
818
+            {
819
+                sql += " and ActionType=" + actiontype.Trim();
820
+            }
821
+            if (starttime.Trim() != "")
822
+            {
823
+                sql += " and BeginTime>='" + starttime + "' ";
824
+            }
825
+            else
826
+            {
827
+                DateTime date = DateTime.Now;
828
+                sql += $" and  BeginTime>='{date.ToString("yyyy-MM-dd")} 00:00:00'";
829
+            }
830
+
831
+            if (endtime.Trim() != "")
832
+            {
833
+                sql += " and BeginTime<='" + endtime + "' ";
834
+            }
835
+            if (extnumber.Trim() != "")
836
+            {
837
+                sql += " and isnull(ExtNumber,'')='" + extnumber.Trim() + "'";
838
+            }
839
+
840
+            if (strpageindex.Trim() != "")
841
+            {
842
+                pageindex = Convert.ToInt32(strpageindex);
843
+            }
844
+
845
+            if (strpagesize.Trim() != "")
846
+            {
847
+                pagesize = Convert.ToInt32(strpagesize);
848
+            }
849
+          
850
+           
851
+                int recordCount = 0;
852
+                dt = BLL.PagerBLL.GetListPager(
853
+                    "T_Call_CallRecords WITH(NOLOCK)",
854
+                    "CallRecordsId",
855
+                    "*,dbo.GetUserName(UserCode) as UserName, WorkOrderId,dbo.GetDictionaryName(F_CallInType) as TypeName",
856
+                    sql,
857
+                    "ORDER BY CallRecordsId desc",
858
+                    pagesize,
859
+                    pageindex,
860
+                    true,
861
+                    out recordCount);
862
+                var obj = new
863
+                {
864
+                    state = "success",
865
+                    message = "成功",
866
+                    rows = dt,
867
+                    total = recordCount
868
+                };
869
+
870
+                return Content(obj.ToJson());
871
+            
872
+        }
454 873
         #endregion
455 874
     }
456 875
 }

+ 27 - 4
CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/workorder/APPSController.cs

@@ -2680,8 +2680,19 @@ namespace CallCenterApi.Interface.Controllers.workorder
2680 2680
                     newRow["strWrkOrdr_Dtl_StnDsc"] = orderlist[i].F_ComContent.ToString();
2681 2681
                 
2682 2682
                 newRow["strFst_SpInf"] = "";
2683
-                newRow["strWrkOrdr_Splmt_Cntnt"] = orderlist[i].F_Result.ToString();
2684
-                newRow["strCrt_Dt_Tm"] = orderlist[i].F_CreateTime.ToString();
2683
+                if (orderlist[i].F_IsSms == 1)
2684
+                {
2685
+                    newRow["strWrkOrdr_Splmt_Cntnt"] = orderlist[i].F_Result.ToString();
2686
+                }
2687
+                else
2688
+                {
2689
+                    if (orderlist[i].F_WorkState.ToString() == "9")
2690
+                        newRow["strWrkOrdr_Splmt_Cntnt"] = orderlist[i].F_Result.ToString();
2691
+                    else
2692
+                        newRow["strWrkOrdr_Splmt_Cntnt"] = "";
2693
+                }
2694
+              
2695
+                                    newRow["strCrt_Dt_Tm"] = orderlist[i].F_CreateTime.ToString();
2685 2696
                 newRow["strRltv_InsID"] = orderlist[i].F_MainDeptId.ToString();
2686 2697
                 if (!string.IsNullOrEmpty(orderlist[i].F_MainDeptId.ToString()))
2687 2698
                 {
@@ -2705,9 +2716,21 @@ namespace CallCenterApi.Interface.Controllers.workorder
2705 2716
                     newRow["strSsf_Cst_Ass_CntDsc"] = DbHelperSQL.GetSingle("select top 1 strSsf_Cst_Ass_CntDsc  from  PublicComment where WorkOrderId='" + orderlist[i].F_WorkOrderId.ToString() + "' order by CreateTime desc").ToString();
2706 2717
                     newRow["strWrkOrdr_Cst_Ssf_Dt"] = DbHelperSQL.GetSingle("select top 1 CreateTime  from  PublicComment where WorkOrderId='" + orderlist[i].F_WorkOrderId.ToString() + "' order by CreateTime desc").ToString();
2707 2718
                 }
2708
-                newRow["strWrkOrdr_Pcsg_StnCm"] = orderlist[i].F_Result.ToString();
2719
+                if (orderlist[i].F_IsSms ==1)
2720
+                {
2721
+                    newRow["strWrkOrdr_Pcsg_StnCm"] = orderlist[i].F_Result.ToString();
2722
+                }
2723
+                else
2724
+                {
2725
+                    if (orderlist[i].F_WorkState.ToString() == "9")
2726
+                        newRow["strWrkOrdr_Pcsg_StnCm"] = orderlist[i].F_Result.ToString();
2727
+                    else
2728
+                        newRow["strWrkOrdr_Pcsg_StnCm"] = "";
2729
+
2730
+                }
2731
+               
2732
+
2709 2733
 
2710
-                
2711 2734
                 if (Convert.ToInt32 (DbHelperSQL.GetSingle("select count(1)   from  T_Sys_Collection where F_WorkOrderId='" + orderlist[i].F_WorkOrderId.ToString() + "'and strCrt_EmpID='"+strusercode + "'and strMnplt_TpCd='00'")
2712 2735
                     .ToString ())>0)
2713 2736
                 newRow["strRslt_Rcrd_Num"] = "1";

+ 1 - 8
CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/workorder/WorkOrderController.cs

@@ -572,7 +572,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
572 572
                     if (dr["F_MainDeptId"].ToString() == User.F_DeptId.ToString()) { iszbdw = "1"; }
573 573
                     //   dr["DeptName"] = DbHelperSQL.GetSingle(" select dbo.GetDeptNames('" + dr["F_MainDeptId"].ToString() + "')");
574 574
                     //  string sqljb = "SELECT TOP 1 * FROM T_Bus_AssignedInfo WITH(NOLOCK) WHERE F_WorkOrderId='" + dr["F_WorkOrderId"].ToString() + "' and F_State=1 and F_IsDelete=0 and F_IsSure !=3   ORDER BY F_Id DESC";
575
-                    //   var dtjb = DbHelperSQL.Query(sqljb).Tables[0];
575
+                     // var dtjb = DbHelperSQL.Query(sqljb).Tables[0];
576 576
                     // if (dtjb.Rows.Count > 0)
577 577
                     //   {
578 578
 
@@ -17071,13 +17071,6 @@ namespace CallCenterApi.Interface.Controllers.workorder
17071 17071
 
17072 17072
                                 }
17073 17073
                             }
17074
-
17075
-
17076
-                           
17077
-
17078
-
17079
-
17080
-
17081 17074
                         }
17082 17075
                     }
17083 17076
                     else