Sfoglia il codice sorgente

获取知识库关键词列表(汉字拼音检索)

lihai 7 anni fa
parent
commit
061cea72b0

+ 1 - 0
CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/CallCenterApi.Interface.csproj

@@ -248,6 +248,7 @@
248 248
     <Compile Include="Models\Dto\AddressBookDto.cs" />
249 249
     <Compile Include="Models\Dto\CallPlan.cs" />
250 250
     <Compile Include="Models\Dto\DeptAssessment.cs" />
251
+    <Compile Include="Models\Dto\KnowledgeKeyDto.cs" />
251 252
     <Compile Include="Models\Dto\WorkOrderReportDto.cs" />
252 253
     <Compile Include="Models\Filter\FilterCallPhone.cs" />
253 254
     <Compile Include="Models\Filter\FilterCallPlan.cs" />

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

@@ -1,4 +1,5 @@
1 1
 using CallCenter.Utility;
2
+using CallCenterApi.Common;
2 3
 using CallCenterApi.DB;
3 4
 using CallCenterApi.Interface.Controllers.Base;
4 5
 using System;
@@ -193,7 +194,8 @@ namespace CallCenterApi.Interface.Controllers
193 194
 
194 195
             Model.T_Sys_DictionaryValue orderModel = new Model.T_Sys_DictionaryValue();
195 196
             BLL.T_Sys_DictionaryValue orderBll = new BLL.T_Sys_DictionaryValue();
196
-
197
+            //清除知识库关键词缓存
198
+            CacheHelper.Remove("KnowledgeKeyWordList");
197 199
             if (id == 0)
198 200
             {
199 201
                 var list = orderBll.GetModelList(" F_Value='" + name + "' and F_ItemId='" + pid + "' ");

+ 46 - 1
CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/knowledge/KnowledgeController.cs

@@ -1,6 +1,8 @@
1 1
 using CallCenter.Utility;
2
+using CallCenterApi.Common;
2 3
 using CallCenterApi.DB;
3 4
 using CallCenterApi.Interface.Controllers.Base;
5
+using CallCenterApi.Interface.Models.Dto;
4 6
 using System;
5 7
 using System.Collections.Generic;
6 8
 using System.Data;
@@ -16,6 +18,7 @@ namespace CallCenterApi.Interface.Controllers.knowledge
16 18
         BLL.T_RepositoryInformation infoBLL = new BLL.T_RepositoryInformation();
17 19
         BLL.T_RepositoryCategory bllcategory = new BLL.T_RepositoryCategory();
18 20
         BLL.T_RepositoryFavorites bllfavorites = new BLL.T_RepositoryFavorites();
21
+        BLL.T_Sys_DictionaryValue blldic = new BLL.T_Sys_DictionaryValue();
19 22
         // 获取知识库列表
20 23
         public ActionResult GetList(string keywords, string pid, int? issub, int? ispass)
21 24
         {
@@ -272,7 +275,7 @@ namespace CallCenterApi.Interface.Controllers.knowledge
272 275
         }
273 276
 
274 277
         /// <summary>
275
-        /// 获取审核列表 修改前修改后对比
278
+        /// 获取修改前修改后对比详情
276 279
         /// </summary>
277 280
         /// <param name="auditid">id</param>
278 281
         /// <returns></returns>
@@ -593,5 +596,47 @@ namespace CallCenterApi.Interface.Controllers.knowledge
593 596
             return logid;
594 597
         }
595 598
 
599
+        #region 知识库关键词
600
+
601
+        /// <summary>
602
+        /// 获取知识库关键词列表
603
+        /// </summary>
604
+        /// <param name="keywords"></param>
605
+        /// <returns></returns>
606
+        public ActionResult GetKnowledgeKeyWordList(string keywords)
607
+        {
608
+            //获取数组
609
+            var lists = new List<KnowledgeKeyDto>();
610
+
611
+            var dtCache = CacheHelper.Get<List<KnowledgeKeyDto>>($"KnowledgeKeyWordList");
612
+            if (dtCache != null)
613
+            {
614
+                lists = dtCache;
615
+            }
616
+            else {
617
+                //知识库关键词(字典)
618
+                string sql = "  F_PrentId = 59 AND F_PrentId != 0 ";
619
+                var list = blldic.DataTableToList(blldic.GetList($" {sql} ").Tables[0]);
620
+                foreach (var item in list)
621
+                {
622
+                    lists.Add(new KnowledgeKeyDto
623
+                    {
624
+                        titleEN = ChineseToPinYin.Convert(item.F_Value).ToLower(),
625
+                        titleCH = item.F_Value
626
+                    });
627
+                }
628
+                //排序
629
+                lists = lists.OrderBy(x => x.titleEN).ToList();
630
+                CacheHelper.Insert($"KnowledgeKeyWordList", lists, 10);
631
+            }
632
+            
633
+            if (!string.IsNullOrEmpty(keywords))
634
+            {
635
+                lists = lists.Where(x => x.titleCH.Contains(keywords) || x.titleEN.Contains(keywords)).ToList();
636
+            }
637
+            return Success("获取知识库关键词成功", lists);
638
+        }
639
+        #endregion
640
+
596 641
     }
597 642
 }

+ 19 - 0
CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Models/Dto/KnowledgeKeyDto.cs

@@ -0,0 +1,19 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.Linq;
4
+using System.Web;
5
+
6
+namespace CallCenterApi.Interface.Models.Dto
7
+{
8
+    public class KnowledgeKeyDto
9
+    {
10
+        /// <summary>
11
+        /// 关键词中文对应的英文
12
+        /// </summary>
13
+        public string titleEN { get; set; }
14
+        /// <summary>
15
+        /// 关键词中文
16
+        /// </summary>
17
+        public string titleCH { get; set; }
18
+    }
19
+}