tangjiang 4 сар өмнө
parent
commit
554df54f1f

+ 9 - 2
src/Hotline.Api/Controllers/Bi/BiOrderController.cs

@@ -81,7 +81,8 @@ namespace Hotline.Api.Controllers.Bi
         private readonly IWorkflowApplication _workflowApplication;
         private readonly ISystemOrganizeRepository _organizeRepository;
         private readonly IRepository<CallNative> _callNativeRepository;
-        private readonly IOptionsSnapshot<AppConfiguration> _appOptions;
+        private readonly IOptionsSnapshot<AppConfiguration> _appOptions; 
+        private readonly IRepository<OrderTsDetails> _orderTsDetailsRepository;
 
         public BiOrderController(
             IOrderRepository orderRepository,
@@ -118,7 +119,8 @@ namespace Hotline.Api.Controllers.Bi
             IExportApplication exportApplication,
             IOrderVisitApplication orderVisitApplication,
             IRepository<CallNative> callNativeRepository,
-            IOptionsSnapshot<AppConfiguration> appOptions)
+            IOptionsSnapshot<AppConfiguration> appOptions,
+            IRepository<OrderTsDetails> orderTsDetailsRepository)
         {
             _orderRepository = orderRepository;
             _hotspotTypeRepository = hotspotTypeRepository;
@@ -155,6 +157,7 @@ namespace Hotline.Api.Controllers.Bi
             _orderVisitApplication = orderVisitApplication;
             _callNativeRepository = callNativeRepository;
             _appOptions = appOptions;
+            _orderTsDetailsRepository = orderTsDetailsRepository;
         }
 
         /// <summary>
@@ -4554,6 +4557,7 @@ namespace Hotline.Api.Controllers.Bi
             var (total, items) = await _orderApplication.HotspotAndAcceptTypeStatisticsDetail(dto).ToPagedListAsync(dto.PageIndex, dto.PageSize, HttpContext.RequestAborted);
             return new PagedDto<OrderDto>(total, _mapper.Map<IReadOnlyList<OrderDto>>(items));
         }
+        
         /// <summary>
         /// 热点受理类型明细导出
         /// </summary>
@@ -4917,6 +4921,7 @@ namespace Hotline.Api.Controllers.Bi
             });
             return items;
         }
+        
         /// <summary>
         /// 中心受理统计导出
         /// </summary>
@@ -4970,6 +4975,7 @@ namespace Hotline.Api.Controllers.Bi
             var (total, items) = await _orderApplication.OrderCenterAcceptUser(dto).ToPagedListAsync(dto.PageIndex, dto.PageSize, HttpContext.RequestAborted);
             return new PagedDto<OrderCenterAcceptUserVo>(total, items);
         }
+        
         /// <summary>
         /// 中心受理值班坐席统计导出
         /// </summary>
@@ -5011,6 +5017,7 @@ namespace Hotline.Api.Controllers.Bi
             var items = await _orderRepository.OrderCenterAcceptHour(dto).ToListAsync(HttpContext.RequestAborted);
             return items;
         }
+        
         /// <summary>
         /// 中心受理时间段统计导出
         /// </summary>

+ 2 - 2
src/Hotline.Api/Controllers/OrderController.cs

@@ -3581,7 +3581,7 @@ public class OrderController : BaseController
             await _callApplication.RelateTianrunCallWithOrderAsync(order.CallId, order.Id, HttpContext.RequestAborted);
 
         //内容分词
-        await _orderApplication.OrderParticiple(dto.Content, order.Id, order.CreationTime, HttpContext.RequestAborted);
+        await _orderApplication.OrderParticiple(dto.Content, order.Id, order.No, order.Title, order.CreationTime, HttpContext.RequestAborted);
         //敏感分词
         await _orderApplication.OrderSensitiveParticiple(dto.Content, order.Id, HttpContext.RequestAborted);
 
@@ -3722,7 +3722,7 @@ public class OrderController : BaseController
         await _orderCopyRepository.AddAsync(copy, HttpContext.RequestAborted);
 
         if (order.Content != dto.Content)
-            await _orderApplication.OrderParticiple(dto.Content, dto.Id, order.CreationTime, HttpContext.RequestAborted);
+            await _orderApplication.OrderParticiple(dto.Content, dto.Id, order.No, order.Title, order.CreationTime, HttpContext.RequestAborted);
         if (dto.RepeatableEventDetails?.Any() ?? false)
         {
             var reAdds = dto.RepeatableEventDetails.Where(x => string.IsNullOrEmpty(x.OrderId) && !x.IsDeleted)

+ 10 - 10
src/Hotline.Application/Orders/IOrderApplication.cs

@@ -57,7 +57,7 @@ namespace Hotline.Application.Orders
         ISugarQueryable<Order> GetAboutToExpireAsync(AboutToExpireListDto dto);
 
         //Task<PagedDto<WorkflowOrderDto>> GetAboutToExpireNodeAsync(AboutToExpireListDto dto, CancellationToken cancellationToken);
-        Task OrderParticiple(string inputStr, string orderId, DateTime time, CancellationToken cancellationToken);
+        Task OrderParticiple(string inputStr, string orderId, string no, string title, DateTime time, CancellationToken cancellationToken);
         Task OrderSensitiveParticiple(string inputStr, string orderId, CancellationToken cancellationToken);
         /// <summary>
         /// 接收外部平台工单
@@ -330,11 +330,11 @@ namespace Hotline.Application.Orders
         ISugarQueryable<OrderVisitDetail> MayScreenList(MayScreenListDto dto);
 
 
-		ISugarQueryable<Order> QueryWaitedForSeat(QueryOrderWaitedDto dto);
+        ISugarQueryable<Order> QueryWaitedForSeat(QueryOrderWaitedDto dto);
 
 
-		ISugarQueryable<Order> QueryWaited(QueryOrderWaitedDto dto);
-        
+        ISugarQueryable<Order> QueryWaited(QueryOrderWaitedDto dto);
+
 
         /// <summary>
         /// 受理类型前10
@@ -356,12 +356,12 @@ namespace Hotline.Application.Orders
         /// <returns></returns>
         ISugarQueryable<OrderVisit> QueryOrderVisitList(QueryOrderVisitDto dto);
 
-		/// <summary>
-		/// 热点类型小类统计明细
-		/// </summary>
-		/// <param name="dto"></param>
-		/// <returns></returns>
-		ISugarQueryable<Order> HotspotStatisticsDetail(HotspotStatisticsRep dto);
+        /// <summary>
+        /// 热点类型小类统计明细
+        /// </summary>
+        /// <param name="dto"></param>
+        /// <returns></returns>
+        ISugarQueryable<Order> HotspotStatisticsDetail(HotspotStatisticsRep dto);
 
         /// <summary>
         /// 坐席总体满意度分析

+ 31 - 3
src/Hotline.Application/Orders/OrderApplication.cs

@@ -93,6 +93,7 @@ public class OrderApplication : IOrderApplication, IScopeDependency
     private readonly IRepository<SchedulingUser> _schedulingUserRepository;
     private readonly IRepository<StatisticsHotspotSatisfied> _statisticsHotspotSatisfiedRepository;
     private readonly IRepository<StatisticsDepartSatisfied> _statisticsDepartSatisfiedRepository;
+    private readonly IRepository<OrderTsDetails> _orderTsDetailsRepository;
 
     public OrderApplication(
         IOrderDomainService orderDomainService,
@@ -134,7 +135,8 @@ public class OrderApplication : IOrderApplication, IScopeDependency
         IRepository<SchedulingUser> schedulingUserRepository,
         IRepository<StatisticsHotspotSatisfied> statisticsHotspotSatisfiedRepository,
         IRepository<StatisticsDepartSatisfied> statisticsDepartSatisfiedRepository,
-        IOrderDelayRepository orderDelayRepository)
+        IOrderDelayRepository orderDelayRepository,
+        IRepository<OrderTsDetails> orderTsDetailsRepository)
     {
         _orderDomainService = orderDomainService;
         _workflowDomainService = workflowDomainService;
@@ -176,7 +178,7 @@ public class OrderApplication : IOrderApplication, IScopeDependency
         _schedulingUserRepository = schedulingUserRepository;
         _statisticsHotspotSatisfiedRepository = statisticsHotspotSatisfiedRepository;
         _statisticsDepartSatisfiedRepository = statisticsDepartSatisfiedRepository;
-
+        _orderTsDetailsRepository = orderTsDetailsRepository;
     }
 
     /// <summary>
@@ -576,8 +578,13 @@ public class OrderApplication : IOrderApplication, IScopeDependency
     /// 工单关键字分词
     /// </summary>
     /// <param name="inputStr"></param>
+    /// <param name="orderId"></param>
+    /// <param name="no"></param>
+    /// <param name="title"></param>
+    /// <param name="time"></param>
+    /// <param name="cancellationToken"></param>
     /// <returns></returns>
-    public async Task OrderParticiple(string inputStr, string orderId, DateTime time, CancellationToken cancellationToken)
+    public async Task OrderParticiple(string inputStr, string orderId, string no, string title, DateTime time, CancellationToken cancellationToken)
     {
         var seg = new Segment();
         ICollection<WordInfo> splitWords = seg.DoSegment(inputStr);
@@ -594,6 +601,27 @@ public class OrderApplication : IOrderApplication, IScopeDependency
             var vector = await _repositoryts.SearchAsync(orderId, cancellationToken);
             if (vector != null && vector.Any()) await _repositoryts.UpdateVectorAsync(orderId, words, cancellationToken);
             else await _repositoryts.AddVectorAsync(orderId, time, words, cancellationToken);
+
+            //是否开启分词
+            var isOpenWordSegmentation = _systemSettingCacheManager.GetSetting(SettingConstants.IsOpenWordSegmentation)?.SettingValue[0];
+            if (!string.IsNullOrEmpty(isOpenWordSegmentation) && isOpenWordSegmentation == "true")
+            {
+                //先删除历史数据,在添加新数据
+                await _orderTsDetailsRepository.RemoveAsync(p => p.OrderId == orderId, false, cancellationToken);
+                List<OrderTsDetails> orderTsDetails = new();
+                foreach (var item in words)
+                {
+                    orderTsDetails.Add(new OrderTsDetails
+                    {
+                        Terms = item,
+                        OrderId = orderId,
+                        Title = title,
+                        No = no
+                    });
+                }
+                if (orderTsDetails != null && orderTsDetails.Count > 0)
+                    await _orderTsDetailsRepository.AddRangeAsync(orderTsDetails, cancellationToken);
+            }
         }
         // 结巴分词
         //var segmenter = new JiebaSegmenter();

+ 27 - 0
src/Hotline/Orders/OrderTsDetails.cs

@@ -0,0 +1,27 @@
+using XF.Domain.Repository;
+
+namespace Hotline.Orders
+{
+    public class OrderTsDetails : CreationEntity
+    {
+        /// <summary>
+        /// 分词词语
+        /// </summary>
+        public string Terms { get; set; }
+
+        /// <summary>
+        /// 工单ID
+        /// </summary>
+        public string OrderId { get; set; }
+
+        /// <summary>
+        /// 工单标题
+        /// </summary>
+        public string Title { get; set; }
+
+        /// <summary>
+        /// 工单编号
+        /// </summary>
+        public string No {  get; set; }
+    }
+}

+ 5 - 0
src/Hotline/Settings/SettingConstants.cs

@@ -682,5 +682,10 @@ namespace Hotline.Settings
         /// 启用随手拍功能
         /// </summary>
         public const string Snapshot = "Snapshot";
+
+        /// <summary>
+        /// 是否开启分词
+        /// </summary>
+        public const string IsOpenWordSegmentation = "IsOpenWordSegmentation";
     }
 }