|
|
@@ -19,6 +19,7 @@ namespace CallCenterApi.Interface.Controllers.WebChat
|
|
19
|
19
|
BLL.T_Chat_IM_ReplyList bll_Rep = new BLL.T_Chat_IM_ReplyList();
|
|
20
|
20
|
BLL.T_Chat_IM_OperationRecords bll_Record = new BLL.T_Chat_IM_OperationRecords();
|
|
21
|
21
|
BLL.T_RepositoryInformation bll_Knowledge = new BLL.T_RepositoryInformation();
|
|
|
22
|
+ BLL.T_Bus_WorkOrder bll_Wo = new BLL.T_Bus_WorkOrder();
|
|
22
|
23
|
|
|
23
|
24
|
#region 快速回复
|
|
24
|
25
|
|
|
|
@@ -26,9 +27,10 @@ namespace CallCenterApi.Interface.Controllers.WebChat
|
|
26
|
27
|
/// 快速回复列表
|
|
27
|
28
|
/// </summary>
|
|
28
|
29
|
/// <param name="keyword"></param>
|
|
|
30
|
+ /// <param name="iscollection">收藏(0所有的,1收藏的)</param>
|
|
29
|
31
|
/// <returns></returns>
|
|
30
|
32
|
[Authority]
|
|
31
|
|
- public ActionResult GetReplyList(string keyword)
|
|
|
33
|
+ public ActionResult GetReplyList(string keyword,int iscollection = 0)
|
|
32
|
34
|
{
|
|
33
|
35
|
string usercode = User.UserData["F_UserCode"];
|
|
34
|
36
|
DataTable dt = new DataTable();
|
|
|
@@ -57,7 +59,10 @@ namespace CallCenterApi.Interface.Controllers.WebChat
|
|
57
|
59
|
sql = sb.ToString();
|
|
58
|
60
|
sql += ")";
|
|
59
|
61
|
}
|
|
60
|
|
-
|
|
|
62
|
+
|
|
|
63
|
+ if(iscollection == 1)
|
|
|
64
|
+ sql += $" and ((SELECT COUNT(1) FROM dbo.T_Chat_IM_OperationRecords WHERE 1=1 AND F_TableName = 'T_Chat_IM_ReplyList' AND F_TableField = 'F_CollectionNum' AND F_ReplyId = T_Chat_IM_ReplyList.F_Id AND F_CreateBy = '{usercode}') > 0)";
|
|
|
65
|
+
|
|
61
|
66
|
if (strpageindex.Trim() != "")
|
|
62
|
67
|
pageindex = Convert.ToInt32(strpageindex);
|
|
63
|
68
|
if (strpagesize.Trim() != "")
|
|
|
@@ -83,6 +88,7 @@ namespace CallCenterApi.Interface.Controllers.WebChat
|
|
83
|
88
|
int CollectionNum = list_Record.Where(r => r.F_ReplyId == int.Parse(dr["F_Id"].ToString())).Count();
|
|
84
|
89
|
dr["IsCollection"] = CollectionNum > 0 ? true : false;
|
|
85
|
90
|
}
|
|
|
91
|
+
|
|
86
|
92
|
var obj = new
|
|
87
|
93
|
{
|
|
88
|
94
|
rows = dt,
|
|
|
@@ -221,8 +227,10 @@ namespace CallCenterApi.Interface.Controllers.WebChat
|
|
221
|
227
|
/// 知识库列表
|
|
222
|
228
|
/// </summary>
|
|
223
|
229
|
/// <param name="keyword"></param>
|
|
|
230
|
+ /// <param name="iscollection">收藏(0所有的,1收藏的)</param>
|
|
224
|
231
|
/// <returns></returns>
|
|
225
|
|
- public ActionResult GetKnowledgeList(string keyword)
|
|
|
232
|
+ [Authority]
|
|
|
233
|
+ public ActionResult GetKnowledgeList(string keyword, int iscollection = 0)
|
|
226
|
234
|
{
|
|
227
|
235
|
string usercode = User.UserData["F_UserCode"];
|
|
228
|
236
|
DataTable dt = new DataTable();
|
|
|
@@ -244,6 +252,9 @@ namespace CallCenterApi.Interface.Controllers.WebChat
|
|
244
|
252
|
sql += ")";
|
|
245
|
253
|
}
|
|
246
|
254
|
|
|
|
255
|
+ if (iscollection == 1)
|
|
|
256
|
+ sql += $" and ((SELECT COUNT(1) FROM dbo.T_Chat_IM_OperationRecords WHERE 1=1 AND F_TableName = 'T_RepositoryInformation' AND F_TableField = 'F_CollectionNum' AND F_ReplyId = T_RepositoryInformation.F_RepositoryId AND F_CreateBy = '{usercode}') > 0)";
|
|
|
257
|
+
|
|
247
|
258
|
string strpageindex = RequestString.GetQueryString("page");
|
|
248
|
259
|
int pageindex = 1;
|
|
249
|
260
|
string strpagesize = RequestString.GetQueryString("pagesize");
|
|
|
@@ -269,7 +280,7 @@ namespace CallCenterApi.Interface.Controllers.WebChat
|
|
269
|
280
|
dt = BLL.PagerBLL.GetListPager(
|
|
270
|
281
|
"T_RepositoryInformation",
|
|
271
|
282
|
"F_RepositoryId",
|
|
272
|
|
- "F_CategoryId,(SELECT F_CategoryName FROM dbo.T_RepositoryCategory WHERE F_CategoryId = T_RepositoryInformation.F_CategoryId) AS CategoryName,F_Title,F_Content,F_Description,F_CreateOn",
|
|
|
283
|
+ "F_RepositoryId,F_CategoryId,(SELECT F_CategoryName FROM dbo.T_RepositoryCategory WHERE F_CategoryId = T_RepositoryInformation.F_RepositoryId) AS CategoryName,F_Title,F_Content,F_Description,F_CreateOn",
|
|
273
|
284
|
sql,
|
|
274
|
285
|
"ORDER BY F_RepositoryId desc",
|
|
275
|
286
|
pagesize,
|
|
|
@@ -281,7 +292,7 @@ namespace CallCenterApi.Interface.Controllers.WebChat
|
|
281
|
292
|
dt.Columns.Add("IsCollection", typeof(bool)); //收藏
|
|
282
|
293
|
foreach (DataRow dr in dt.Rows)
|
|
283
|
294
|
{
|
|
284
|
|
- int CollectionNum = list_Record.Where(r => r.F_ReplyId == int.Parse(dr["F_Id"].ToString())).Count();
|
|
|
295
|
+ int CollectionNum = list_Record.Where(r => r.F_ReplyId == int.Parse(dr["F_RepositoryId"].ToString())).Count();
|
|
285
|
296
|
dr["IsCollection"] = CollectionNum > 0 ? true : false;
|
|
286
|
297
|
}
|
|
287
|
298
|
|
|
|
@@ -391,11 +402,180 @@ namespace CallCenterApi.Interface.Controllers.WebChat
|
|
391
|
402
|
#endregion
|
|
392
|
403
|
|
|
393
|
404
|
#region 工单查询
|
|
|
405
|
+ /// <summary>
|
|
|
406
|
+ /// 工单列表
|
|
|
407
|
+ /// </summary>
|
|
|
408
|
+ /// <param name="keyword"></param>
|
|
|
409
|
+ /// <returns></returns>
|
|
|
410
|
+ [Authority]
|
|
|
411
|
+ public ActionResult GetWorkOrderList(string keyword)
|
|
|
412
|
+ {
|
|
|
413
|
+ string usercode = User.UserData["F_UserCode"];
|
|
|
414
|
+ DataTable dt = new DataTable();
|
|
|
415
|
+ // 分词关键字
|
|
|
416
|
+ string keyWords = KeywordSpliterHelper.DoGetKeyword(keyword);
|
|
|
417
|
+ string[] sArrayKey = keyWords.Trim().Split(',');
|
|
|
418
|
+ string sql = "";
|
|
|
419
|
+ foreach (string key in sArrayKey)
|
|
|
420
|
+ {
|
|
|
421
|
+ if (key.Trim() != "")
|
|
|
422
|
+ sql += " or F_WorkOrderId like '%" + key + "%' or F_ComTitle like '%" + key + "%' or F_ComContent like '%" + key + "%'";
|
|
|
423
|
+ }
|
|
|
424
|
+ if (!string.IsNullOrEmpty(sql))
|
|
|
425
|
+ {
|
|
|
426
|
+ // 去掉前面的or,且拼接()
|
|
|
427
|
+ StringBuilder sb = new StringBuilder(sql);
|
|
|
428
|
+ sb.Replace(" or ", " AND (", 0, 4);
|
|
|
429
|
+ sql = sb.ToString();
|
|
|
430
|
+ sql += ")";
|
|
|
431
|
+ }
|
|
|
432
|
+
|
|
|
433
|
+ string strpageindex = RequestString.GetQueryString("page");
|
|
|
434
|
+ int pageindex = 1;
|
|
|
435
|
+ string strpagesize = RequestString.GetQueryString("pagesize");
|
|
|
436
|
+ int pagesize = 10;
|
|
|
437
|
+
|
|
|
438
|
+ sql += " and F_IsDelete=0";
|
|
|
439
|
+ if (strpageindex.Trim() != "")
|
|
|
440
|
+ pageindex = Convert.ToInt32(strpageindex);
|
|
|
441
|
+ if (strpagesize.Trim() != "")
|
|
|
442
|
+ pagesize = Convert.ToInt32(strpagesize);
|
|
|
443
|
+ int recordCount = 0;
|
|
|
444
|
+
|
|
|
445
|
+ // 关键词不为空,且分词后为空时,相当于没有搜索到信息(下面是相反的条件)
|
|
|
446
|
+ if (!(!string.IsNullOrEmpty(keyword) && string.IsNullOrEmpty(keyWords)))
|
|
|
447
|
+ {
|
|
|
448
|
+ dt = BLL.PagerBLL.GetListPager(
|
|
|
449
|
+ "T_Bus_WorkOrder WITH(NOLOCK)",
|
|
|
450
|
+ "F_WorkOrderId",
|
|
|
451
|
+ "F_WorkOrderId,F_ComTitle,F_WorkState,F_MainDeptId,F_OtherDeptIds,F_DealTime,F_LeaveRecordId,F_CallRecordId,F_IsResult,F_IsProtect,F_IsReturn,F_CreateTime,dbo.GetUserName(F_CreateUser) as UserName,dbo.GetDictionaryName(F_InfoType) as TypeName,dbo.GetDictionaryName(F_InfoSource) as SourceName,F_ComContent",
|
|
|
452
|
+ sql,
|
|
|
453
|
+ "ORDER BY F_Id desc",
|
|
|
454
|
+ pagesize,
|
|
|
455
|
+ pageindex,
|
|
|
456
|
+ true,
|
|
|
457
|
+ out recordCount);
|
|
|
458
|
+ }
|
|
|
459
|
+ var obj = new
|
|
|
460
|
+ {
|
|
|
461
|
+ rows = dt,
|
|
|
462
|
+ keys = keyWords,
|
|
|
463
|
+ total = recordCount
|
|
|
464
|
+ };
|
|
|
465
|
+ return Content(obj.ToJson());
|
|
|
466
|
+ }
|
|
|
467
|
+
|
|
|
468
|
+ /// <summary>
|
|
|
469
|
+ /// 发送 工单
|
|
|
470
|
+ /// </summary>
|
|
|
471
|
+ /// <param name="id"></param>
|
|
|
472
|
+ /// <returns></returns>
|
|
|
473
|
+ [HttpPost]
|
|
|
474
|
+ [Authority]
|
|
|
475
|
+ public ActionResult SendWorkOrder(int id = 0)
|
|
|
476
|
+ {
|
|
|
477
|
+ var model_Collection = new Model.T_Chat_IM_OperationRecords();
|
|
|
478
|
+ model_Collection.F_ReplyId = id;
|
|
|
479
|
+ model_Collection.F_TableName = "T_Bus_WorkOrder"; //表名
|
|
|
480
|
+ model_Collection.F_TableField = "F_UseNum"; //对应字段 使用数 F_UseNum
|
|
|
481
|
+ model_Collection.F_CollectionNum = 1;
|
|
|
482
|
+ model_Collection.F_CreateBy = User.UserData["F_UserCode"];
|
|
|
483
|
+ model_Collection.F_CreateTime = DateTime.Now;
|
|
|
484
|
+ int cid = bll_Record.Add(model_Collection);
|
|
|
485
|
+ if (cid > 0)
|
|
|
486
|
+ return Success("发送成功");
|
|
|
487
|
+ else
|
|
|
488
|
+ return Success("发送失败");
|
|
|
489
|
+ }
|
|
394
|
490
|
|
|
395
|
491
|
#endregion
|
|
396
|
492
|
|
|
397
|
493
|
#region 客户档案查询
|
|
|
494
|
+ /// <summary>
|
|
|
495
|
+ /// 客户档案列表
|
|
|
496
|
+ /// </summary>
|
|
|
497
|
+ /// <param name="keyword"></param>
|
|
|
498
|
+ /// <returns></returns>
|
|
|
499
|
+ [Authority]
|
|
|
500
|
+ public ActionResult GetCustomerList(string keyword)
|
|
|
501
|
+ {
|
|
|
502
|
+ string usercode = User.UserData["F_UserCode"];
|
|
|
503
|
+ DataTable dt = new DataTable();
|
|
|
504
|
+ // 分词关键字
|
|
|
505
|
+ string keyWords = KeywordSpliterHelper.DoGetKeyword(keyword);
|
|
|
506
|
+ string[] sArrayKey = keyWords.Trim().Split(',');
|
|
|
507
|
+ string sql = "";
|
|
|
508
|
+ foreach (string key in sArrayKey)
|
|
|
509
|
+ {
|
|
|
510
|
+ if (key.Trim() != "")
|
|
|
511
|
+ sql += " or F_Telephone like '%" + key + "%' or F_Mobile like '%" + key + "%' or F_ChargeTelephone like '%" + key + "%' or F_CustomerName like '%" + key + "%' or F_ChargeDept like '%" + key + "%'";
|
|
|
512
|
+ }
|
|
|
513
|
+ if (!string.IsNullOrEmpty(sql))
|
|
|
514
|
+ {
|
|
|
515
|
+ // 去掉前面的or,且拼接()
|
|
|
516
|
+ StringBuilder sb = new StringBuilder(sql);
|
|
|
517
|
+ sb.Replace(" or ", " AND (", 0, 4);
|
|
|
518
|
+ sql = sb.ToString();
|
|
|
519
|
+ sql += ")";
|
|
|
520
|
+ }
|
|
|
521
|
+
|
|
|
522
|
+ string strpageindex = RequestString.GetQueryString("page");
|
|
|
523
|
+ int pageindex = 1;
|
|
|
524
|
+ string strpagesize = RequestString.GetQueryString("pagesize");
|
|
|
525
|
+ int pagesize = 10;
|
|
|
526
|
+
|
|
|
527
|
+ sql += " and F_DeleteFlag=0";
|
|
|
528
|
+ if (strpageindex.Trim() != "")
|
|
|
529
|
+ pageindex = Convert.ToInt32(strpageindex);
|
|
|
530
|
+ if (strpagesize.Trim() != "")
|
|
|
531
|
+ pagesize = Convert.ToInt32(strpagesize);
|
|
|
532
|
+ int recordCount = 0;
|
|
|
533
|
+
|
|
|
534
|
+ // 关键词不为空,且分词后为空时,相当于没有搜索到信息(下面是相反的条件)
|
|
|
535
|
+ if (!(!string.IsNullOrEmpty(keyword) && string.IsNullOrEmpty(keyWords)))
|
|
|
536
|
+ {
|
|
|
537
|
+ dt = BLL.PagerBLL.GetListPager(
|
|
|
538
|
+ "T_Cus_CustomerBase WITH(NOLOCK)",
|
|
|
539
|
+ "F_CustomerId",
|
|
|
540
|
+ "F_CustomerId,F_CustomerName,F_Mobile,F_Telephone,F_CustomerEName,F_PostCode,F_Email,F_ChargeTelephone,F_ChargeDept,F_CreatedOn",
|
|
|
541
|
+ sql,
|
|
|
542
|
+ "ORDER BY F_CustomerId desc",
|
|
|
543
|
+ pagesize,
|
|
|
544
|
+ pageindex,
|
|
|
545
|
+ true,
|
|
|
546
|
+ out recordCount);
|
|
|
547
|
+ }
|
|
|
548
|
+ var obj = new
|
|
|
549
|
+ {
|
|
|
550
|
+ rows = dt,
|
|
|
551
|
+ keys = keyWords,
|
|
|
552
|
+ total = recordCount
|
|
|
553
|
+ };
|
|
|
554
|
+ return Content(obj.ToJson());
|
|
|
555
|
+ }
|
|
398
|
556
|
|
|
|
557
|
+ /// <summary>
|
|
|
558
|
+ /// 发送 工单
|
|
|
559
|
+ /// </summary>
|
|
|
560
|
+ /// <param name="id"></param>
|
|
|
561
|
+ /// <returns></returns>
|
|
|
562
|
+ [HttpPost]
|
|
|
563
|
+ [Authority]
|
|
|
564
|
+ public ActionResult SendCustomer(int id = 0)
|
|
|
565
|
+ {
|
|
|
566
|
+ var model_Collection = new Model.T_Chat_IM_OperationRecords();
|
|
|
567
|
+ model_Collection.F_ReplyId = id;
|
|
|
568
|
+ model_Collection.F_TableName = "T_Cus_CustomerBase"; //表名
|
|
|
569
|
+ model_Collection.F_TableField = "F_UseNum"; //对应字段 使用数 F_UseNum
|
|
|
570
|
+ model_Collection.F_CollectionNum = 1;
|
|
|
571
|
+ model_Collection.F_CreateBy = User.UserData["F_UserCode"];
|
|
|
572
|
+ model_Collection.F_CreateTime = DateTime.Now;
|
|
|
573
|
+ int cid = bll_Record.Add(model_Collection);
|
|
|
574
|
+ if (cid > 0)
|
|
|
575
|
+ return Success("发送成功");
|
|
|
576
|
+ else
|
|
|
577
|
+ return Success("发送失败");
|
|
|
578
|
+ }
|
|
399
|
579
|
#endregion
|
|
400
|
580
|
}
|
|
401
|
581
|
}
|