浏览代码

Merge branch 'master' of http://110.188.24.182:10023/Fengwo/hotline

xf 1 年之前
父节点
当前提交
b954ccd8df

+ 9 - 0
src/Hotline.Api/Controllers/IPPbxController.cs

@@ -254,6 +254,15 @@ namespace Hotline.Api.Controllers
         }
 
 
+        #endregion
+
+        #region 关联
+
+
+
+
+
+
         #endregion
 
         #endregion

+ 52 - 13
src/Hotline.Api/Controllers/OrderController.cs

@@ -1442,12 +1442,19 @@ public class OrderController : BaseController
             //    Supervise = superviseDto,
             //    ClientGuid = ""
             //});
-            await _provinceService.SendSuperviseProcessInfo(new PublishSuperviseDto()
+            try
             {
-                Order = orderDto,
-                Supervise = superviseDto,
-                ClientGuid = ""
-            }, HttpContext.RequestAborted);
+                await _provinceService.SendSuperviseProcessInfo(new PublishSuperviseDto()
+                {
+                    Order = orderDto,
+                    Supervise = superviseDto,
+                    ClientGuid = ""
+                }, HttpContext.RequestAborted);
+            }
+            catch (Exception e)
+            {
+                _logger.LogError("_provinceService.SendSuperviseProcessInfo throw exception: {ex}", e.Message);
+            }
         }
     }
 
@@ -1479,12 +1486,19 @@ public class OrderController : BaseController
             //    Supervise = superviseDto,
             //    ClientGuid = ""
             //});
-            await _provinceService.SendSuperviseProcessInfo(new PublishSuperviseDto()
+            try
+            {
+                await _provinceService.SendSuperviseProcessInfo(new PublishSuperviseDto()
+                {
+                    Order = orderDto,
+                    Supervise = superviseDto,
+                    ClientGuid = ""
+                }, HttpContext.RequestAborted);
+            }
+            catch (Exception e)
             {
-                Order = orderDto,
-                Supervise = superviseDto,
-                ClientGuid = ""
-            }, HttpContext.RequestAborted);
+                _logger.LogError("_provinceService.SendSuperviseProcessInfo throw exception: {ex}", e.Message);
+            }
         }
     }
 
@@ -2163,9 +2177,16 @@ public class OrderController : BaseController
             var OrderDto = _mapper.Map<OrderDto>(order);
             //_capPublisher.Publish(EventNames.HotlineOrderSendBackApplyed,
             //    new PublishOrderSendBackDto() { Order = OrderDto, SendBack = sendBackDto, ClientGuid = "" });
-            await _provinceService.GetCaseBackApply(
+            try
+            {
+                await _provinceService.GetCaseBackApply(
                 new PublishOrderSendBackDto { Order = OrderDto, SendBack = sendBackDto, ClientGuid = "" },
                 HttpContext.RequestAborted);
+            }
+            catch (Exception e)
+            {
+                _logger.LogError("_provinceService.GetCaseBackApply throw exception: {ex}", e.Message);
+            }
         }
     }
 
@@ -2232,7 +2253,16 @@ public class OrderController : BaseController
 			}
             var order = await _orderRepository.GetAsync(x => x.Id == model.OrderId);
             if (order != null && ("001170".Equals(order.CurrentHandleOrgCode) || "001180".Equals(order.CurrentHandleOrgCode)))
-                await _provinceService.RevokeOrder(new PublishSpecialDto { Order = _mapper.Map<OrderDto>(order), Special = _mapper.Map<OrderSpecialDto>(model) }, HttpContext.RequestAborted);
+            {
+                try
+                {
+                    await _provinceService.RevokeOrder(new PublishSpecialDto { Order = _mapper.Map<OrderDto>(order), Special = _mapper.Map<OrderSpecialDto>(model) }, HttpContext.RequestAborted);
+                }
+                catch (Exception e)
+                {
+                    _logger.LogError("_provinceService.RevokeOrder throw exception: {ex}", e.Message);
+                }
+            }
 		}
     }
 
@@ -2279,7 +2309,16 @@ public class OrderController : BaseController
             }
             var order = await _orderRepository.GetAsync(x => x.Id == special.OrderId);
             if (order != null && ("001170".Equals(order.CurrentHandleOrgCode) || "001180".Equals(order.CurrentHandleOrgCode)))
-	            await _provinceService.RevokeOrder(new PublishSpecialDto { Order = _mapper.Map<OrderDto>(order), Special = _mapper.Map<OrderSpecialDto>(special) }, HttpContext.RequestAborted);
+            {
+                try
+                {
+                    await _provinceService.RevokeOrder(new PublishSpecialDto { Order = _mapper.Map<OrderDto>(order), Special = _mapper.Map<OrderSpecialDto>(special) }, HttpContext.RequestAborted);
+                }
+                catch (Exception e)
+                {
+                    _logger.LogError("_provinceService.RevokeOrder throw exception: {ex}", e.Message);
+                }
+            }
 		}
     }
 

+ 2 - 0
src/Hotline.Api/Controllers/QualityController.cs

@@ -103,6 +103,8 @@ namespace Hotline.Api.Controllers
 				.WhereIF(!string.IsNullOrEmpty(dto.Keyword), d => d.Order.Title.Contains(dto.Keyword!) || d.Order.No.Contains(dto.Keyword!))
 				.WhereIF(dto.State.HasValue, d => d.State == dto.State)
 				.WhereIF(dto.Source.HasValue, d => d.Source == dto.Source)
+				.WhereIF(dto.Source.HasValue && dto.Source == EQualitySource.Accepted, x=> !string.IsNullOrEmpty(x.Order.CallId))
+				.WhereIF(dto.Source.HasValue && dto.Source == EQualitySource.Visit, x => !string.IsNullOrEmpty(x.Visit.CallId))
 				.WhereIF(dto.CreationTimeStart.HasValue, d => d.CreationTime >= dto.CreationTimeStart)
 				.WhereIF(dto.CreationTimeEnd.HasValue, d => d.CreationTime <= dto.CreationTimeEnd)
 				.OrderByDescending(x => x.CreationTime)

+ 0 - 2
src/Hotline.Application/Handlers/FlowEngine/WorkflowEndHandler.cs

@@ -129,13 +129,11 @@ public class WorkflowEndHandler : INotificationHandler<EndWorkflowNotify>
                 //}, cancellationToken: cancellationToken);
                 try
                 {
-
                     await _provinceService.OrderFiled(new OrderFlowDto
                     {
                         Order = _mapper.Map<OrderDto>(order),
                         WorkflowTrace = _mapper.Map<WorkflowTraceDto>(notification.Trace)
                     }, cancellationToken: cancellationToken);
-
                 }
                 catch (Exception e)
                 {

+ 36 - 15
src/Hotline.Application/Handlers/FlowEngine/WorkflowNextHandler.cs

@@ -134,13 +134,20 @@ public class WorkflowNextHandler : INotificationHandler<NextStepNotify>
                 //    ExpiredTimeChanged = expiredTimeChanged,
                 //    HandlerOrgLevel = notification.HandlerOrgCode.CalcOrgLevel()
                 //}, cancellationToken: cancellationToken);
-                await _provinceService.SubmitCaseProcess(new OrderFlowDto
+                try
                 {
-                    Order = orderDto,
-                    WorkflowTrace = _mapper.Map<WorkflowTraceDto>(notification.Trace),
-                    ExpiredTimeChanged = expiredTimeChanged,
-                    HandlerOrgLevel = notification.HandlerOrgCode.CalcOrgLevel()
-                }, cancellationToken: cancellationToken);
+                    await _provinceService.SubmitCaseProcess(new OrderFlowDto
+                    {
+                        Order = orderDto,
+                        WorkflowTrace = _mapper.Map<WorkflowTraceDto>(notification.Trace),
+                        ExpiredTimeChanged = expiredTimeChanged,
+                        HandlerOrgLevel = notification.HandlerOrgCode.CalcOrgLevel()
+                    }, cancellationToken: cancellationToken);
+                }
+                catch (Exception e)
+                {
+                    _logger.LogError("_provinceService.SubmitCaseProcess throw exception: {ex}", e.Message);
+                }
 
 
                 break;
@@ -177,12 +184,19 @@ public class WorkflowNextHandler : INotificationHandler<NextStepNotify>
                                         //    Screen = screenDto,
                                         //    ClientGuid = ""
                                         //});
-                                        await _provinceService.ScreenCaseInfoSend(new PublishScreenDto()
+                                        try
+                                        {
+                                            await _provinceService.ScreenCaseInfoSend(new PublishScreenDto()
+                                            {
+                                                Order = screenOrderDto,
+                                                Screen = screenDto,
+                                                ClientGuid = ""
+                                            }, cancellationToken);
+                                        }
+                                        catch (Exception e)
                                         {
-                                            Order = screenOrderDto,
-                                            Screen = screenDto,
-                                            ClientGuid = ""
-                                        }, cancellationToken);
+                                            _logger.LogError("_provinceService.ScreenCaseInfoSend throw exception: {ex}", e.Message);
+                                        }
                                     }
                                 }
 
@@ -203,11 +217,18 @@ public class WorkflowNextHandler : INotificationHandler<NextStepNotify>
                                 //TODO 发起省延期审批
                                 var orderDelay = await _orderDelayRepository.Queryable().Includes(x => x.Order)
                                     .Where(x => x.Id == workflow.ExternalId).FirstAsync(cancellationToken);
-                                if (orderDelay != null)
+                                try
+                                {
+                                    if (orderDelay != null)
+                                    {
+                                        //推送
+                                        var publishOrderDelay = _mapper.Map<PublishOrderDelayDto>(orderDelay);
+                                        await _provinceService.DelayCaseInfoSend(publishOrderDelay, cancellationToken);
+                                    }
+                                }
+                                catch (Exception e)
                                 {
-                                    //推送
-                                    var publishOrderDelay = _mapper.Map<PublishOrderDelayDto>(orderDelay);
-                                    await _provinceService.DelayCaseInfoSend(publishOrderDelay, cancellationToken);
+                                    _logger.LogError("_provinceService.DelayCaseInfoSend throw exception: {ex}", e.Message);
                                 }
                                 break;
                         }

+ 13 - 2
src/Hotline.Application/Handlers/FlowEngine/WorkflowRecallHandler.cs

@@ -12,6 +12,7 @@ using Hotline.Share.Enums.Order;
 using Hotline.Share.Mq;
 using MapsterMapper;
 using MediatR;
+using Microsoft.Extensions.Logging;
 
 namespace Hotline.Application.Handlers.FlowEngine;
 
@@ -24,6 +25,7 @@ public class WorkflowRecallHandler : INotificationHandler<RecallNotify>
     private readonly IProvinceService _provinceService;
     private readonly ICapPublisher _capPublisher;
     private readonly IMapper _mapper;
+    private readonly ILogger<WorkflowRecallHandler> _logger;
 
     public WorkflowRecallHandler(
         IOrderDomainService orderDomainService,
@@ -32,7 +34,8 @@ public class WorkflowRecallHandler : INotificationHandler<RecallNotify>
         ITimeLimitDomainService timeLimitDomainService,
         IProvinceService provinceService,
         ICapPublisher capPublisher,
-        IMapper mapper)
+        IMapper mapper,
+        ILogger<WorkflowRecallHandler> logger)
     {
         _orderDomainService = orderDomainService;
         _orderRepository = orderRepository;
@@ -41,6 +44,7 @@ public class WorkflowRecallHandler : INotificationHandler<RecallNotify>
         _provinceService = provinceService;
         _capPublisher = capPublisher;
         _mapper = mapper;
+        _logger = logger;
     }
 
     /// <summary>Handles a notification</summary>
@@ -73,7 +77,14 @@ public class WorkflowRecallHandler : INotificationHandler<RecallNotify>
 
                     var dto = _mapper.Map<OrderDto>(order);
                     //await _capPublisher.PublishAsync(EventNames.HotlineOrderExpiredTimeUpdate, dto, cancellationToken: cancellationToken);
-                    await _provinceService.HotlineOrderFlowRecalled(dto, cancellationToken);
+                    try
+                    {
+                        await _provinceService.HotlineOrderFlowRecalled(dto, cancellationToken);
+                    }
+                    catch (Exception e)
+                    {
+                        _logger.LogError("_provinceService.HotlineOrderFlowRecalled throw exception: {ex}", e.Message);
+                    }
                 }
 
                 break;

+ 8 - 1
src/Hotline.Application/Handlers/FlowEngine/WorkflowStartHandler.cs

@@ -75,7 +75,14 @@ namespace Hotline.Application.Handlers.FlowEngine
                     await _orderRepository.UpdateAsync(order, cancellationToken);
                     //await _capPublisher.PublishAsync(EventNames.HotlineOrderFlowStarted, _mapper.Map<OrderDto>(order),
                     //    cancellationToken: cancellationToken);
-                    await _provinceService.OrderFlowStarted(_mapper.Map<OrderDto>(order), cancellationToken);
+                    try
+                    {
+                        await _provinceService.OrderFlowStarted(_mapper.Map<OrderDto>(order), cancellationToken);
+                    }
+                    catch (Exception e)
+                    {
+                        _logger.LogError("_provinceService.OrderFlowStarted throw exception: {ex}", e.Message);
+                    }
 
                     //写入质检
                     await _qualityRepository.AddQualityAsync(EQualitySource.Accepted, order.Id, cancellationToken);

+ 54 - 6
src/Hotline.Application/Handlers/Order/AddVisitNotifyHandler.cs

@@ -1,5 +1,8 @@
 using Hotline.Orders;
 using Hotline.Orders.Notifications;
+using Hotline.Settings;
+using Hotline.Share.Dtos;
+using Hotline.Share.Enums.Order;
 using MediatR;
 using XF.Domain.Repository;
 
@@ -12,24 +15,69 @@ namespace Hotline.Application.Handlers.Order
 
         private readonly IRepository<OrderVisit> _orderVisitRepository;
         private readonly IRepository<OrderVisitDetail> _orderVisitedDetailRepository;
-        public AddVisitNotifyHandler(IRepository<OrderVisit> orderVisitRepository, IRepository<OrderVisitDetail> orderVisitedDetailRepository)
+        private readonly IRepository<SystemDicData> _systemDicDataRepository;
+        private readonly IOrderRepository _orderRepository;
+
+        public AddVisitNotifyHandler(IRepository<OrderVisit> orderVisitRepository, IRepository<OrderVisitDetail> orderVisitedDetailRepository,IRepository<SystemDicData> systemDicDataRepository,IOrderRepository orderRepository)
         {
             _orderVisitRepository = orderVisitRepository;
             _orderVisitedDetailRepository = orderVisitedDetailRepository;
+            _systemDicDataRepository = systemDicDataRepository;
+            _orderRepository = orderRepository;
         }
 
 
         public async Task Handle(AddVisitNotify notification, CancellationToken cancellationToken)
         {
-            var orderVisit = await _orderVisitRepository.Queryable().Where(x => x.No == notification.OrderVisited.OrderNo && 
+            var orderVisit = await _orderVisitRepository.Queryable()
+                .Includes(x=>x.Order)
+                .Includes(x=>x.OrderVisitDetails)
+                .Where(x => x.No == notification.OrderVisited.OrderNo && 
              x.VisitState != Share.Enums.Order.EVisitState.None).FirstAsync(cancellationToken);
 
             if (orderVisit != null)
             {
-                orderVisit.VisitState = Share.Enums.Order.EVisitState.Visited;
-                orderVisit.VisitTime = notification.OrderVisited.VisitTime;
-                orderVisit.VisitType = notification.OrderVisited.VisitType;
-                orderVisit.IsCanHandle = false;
+                //处理评价结果
+                var processingResult = notification.OrderVisited.OrgProcessingResults;
+                Kv orgProcessingResults = null;
+                if (!string.IsNullOrEmpty(processingResult))
+                {
+                    var dicData = await _systemDicDataRepository.GetAsync(x => x.DicTypeCode == SysDicTypeConsts.VisitSatisfaction && x.DicDataValue == processingResult, cancellationToken);
+                    if (dicData!=null)
+                    {
+                        orgProcessingResults = new Kv();
+                        orgProcessingResults.Key = dicData.DicDataValue;
+                        orgProcessingResults.Value = dicData.DicDataName;
+                    }
+                    if (orgProcessingResults != null)
+                    {
+                        //主表
+                        orderVisit.VisitState = Share.Enums.Order.EVisitState.Visited;
+                        orderVisit.VisitTime = notification.OrderVisited.VisitTime;
+                        orderVisit.VisitType = notification.OrderVisited.VisitType;
+                        orderVisit.IsCanHandle = false;
+                        orderVisit.NowEvaluate = orgProcessingResults;
+                        await _orderVisitRepository.UpdateAsync(orderVisit, cancellationToken);
+                        //子表
+                        for (int i = 0; i < orderVisit.OrderVisitDetails.Count; i++)
+                        {
+                            if (orderVisit.OrderVisitDetails[i].VisitTarget == EVisitTarget.Seat)
+                            {
+                                orderVisit.OrderVisitDetails[i].VoiceEvaluate = (EVoiceEvaluate)int.Parse(orgProcessingResults.Key);
+                                orderVisit.OrderVisitDetails[i].SeatEvaluate = (ESeatEvaluate)int.Parse(orgProcessingResults.Key);
+                            }
+                            else
+                            {
+                                orderVisit.OrderVisitDetails[i].OrgProcessingResults = orgProcessingResults;
+                            }
+                            orderVisit.OrderVisitDetails[i].VisitContent = notification.OrderVisited.VisitContent;
+                        }
+                        await _orderVisitedDetailRepository.UpdateRangeAsync(orderVisit.OrderVisitDetails, cancellationToken);
+                        //工单
+                        orderVisit.Order.Visited(orgProcessingResults.Key, orgProcessingResults.Value);
+                        await _orderRepository.UpdateAsync(orderVisit.Order);
+                    }
+                }
             }
         }
     }

+ 1 - 1
src/Hotline.Share/Dtos/Order/OrderVisitDto.cs

@@ -457,7 +457,7 @@ namespace Hotline.Share.Dtos.Order
         /// <summary>
         /// 满意度
         /// </summary>
-        public string OrgProcessingResults { get; set; }
+        public string? OrgProcessingResults { get; set; }
 
     }
 }

+ 14 - 15
src/Hotline.Share/Enums/Order/ESeatEvaluate.cs

@@ -10,40 +10,39 @@ namespace Hotline.Share.Enums.Order
     public enum ESeatEvaluate
     {
         /// <summary>
-        /// 非常满意
+        /// 非常满意
         /// </summary>
-        [Description("非常满意")]
-        VerySatisfied = 10,
+        [Description("非常满意")]
+        VeryNoSatisfied = 1,
 
         /// <summary>
-        /// 满意
+        /// 满意
         /// </summary>
-        [Description("满意")]
-        Satisfied = 20,
-
+        [Description("不满意")]
+        NoSatisfied = 2,
 
         /// <summary>
         /// 一般
         /// </summary>
         [Description("一般")]
-        Normal = 40,
+        Normal = 3,
 
         /// <summary>
-        /// 满意
+        /// 满意
         /// </summary>
-        [Description("满意")]
-        NoSatisfied = 50,
+        [Description("满意")]
+        Satisfied = 4,
 
         /// <summary>
-        /// 非常满意
+        /// 非常满意
         /// </summary>
-        [Description("非常满意")]
-        VeryNoSatisfied = 60,
+        [Description("非常满意")]
+        VerySatisfied = 5,
 
         /// <summary>
         /// 未做评价
         /// </summary>
         [Description("未做评价")]
-        NoEvaluate = 100,
+        NoEvaluate = 7,
     }
 }

+ 14 - 14
src/Hotline.Share/Enums/Order/EVoiceEvaluate.cs

@@ -10,39 +10,39 @@ namespace Hotline.Share.Enums.Order
     public enum EVoiceEvaluate
     {
         /// <summary>
-        /// 非常满意
+        /// 非常满意
         /// </summary>
-        [Description("非常满意")]
-        VerySatisfied = 10,
+        [Description("非常满意")]
+        VeryNoSatisfied = 1,
 
         /// <summary>
-        /// 满意
+        /// 满意
         /// </summary>
-        [Description("满意")]
-        Satisfied = 20,
+        [Description("满意")]
+        NoSatisfied = 2,
 
         /// <summary>
         /// 一般
         /// </summary>
         [Description("一般")]
-        Normal = 40,
+        Normal = 3,
 
         /// <summary>
-        /// 满意
+        /// 满意
         /// </summary>
-        [Description("满意")]
-        NoSatisfied = 50,
+        [Description("满意")]
+        Satisfied = 4,
 
         /// <summary>
-        /// 非常满意
+        /// 非常满意
         /// </summary>
-        [Description("非常满意")]
-        VeryNoSatisfied = 60,
+        [Description("非常满意")]
+        VerySatisfied = 5,
 
         /// <summary>
         /// 未做评价
         /// </summary>
         [Description("未做评价")]
-        NoEvaluate = 100,
+        NoEvaluate = 7,
     }
 }

+ 1 - 1
src/Hotline/Caching/Services/SysDicDataCacheManager.cs

@@ -21,7 +21,7 @@ namespace Hotline.Caching.Services
         {
             var sysDicDataList = _cacheSysDicData.GetOrSet(code, k =>
             {
-                return _sysDicDataRepository.Queryable().Where(x => x.DicTypeCode == code).ToTreeAsync(x => x.Children, it => it.ParentId, "").GetAwaiter().GetResult();
+                return _sysDicDataRepository.Queryable().Where(x => x.DicTypeCode == code).OrderBy(x=>x.Sort).ToTreeAsync(x => x.Children, it => it.ParentId, "").GetAwaiter().GetResult();
             });
             return sysDicDataList;
         }