Selaa lähdekoodia

Merge branch 'test' of http://110.188.24.182:10023/Fengwo/hotline into test

田爽 1 kuukausi sitten
vanhempi
commit
75b220f917

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

@@ -4276,11 +4276,7 @@ namespace Hotline.Api.Controllers.Bi
         [HttpGet("highmatter-warning")]
         public async Task<PagedDto<HighMatterWarningDto>> HighMatterWarning([FromQuery] HighMatterWarningRequest dto)
         {
-            List<string> filterTitle = new List<string>();
-            filterTitle.Add("无声");
-            filterTitle.Add("骚扰");
-            filterTitle.Add("错拨");
-            filterTitle.Add("测试");
+            var filterTitle = _systemSettingCacheManager.GetSetting(SettingConstants.HighMatterWarningFilterTitle).SettingValue;
 
             var (total, items) = await _orderRepository.Queryable()
                 .Where(x => x.CreationTime >= dto.StartTime && x.CreationTime <= dto.EndTime)
@@ -4338,11 +4334,7 @@ namespace Hotline.Api.Controllers.Bi
         [HttpGet("highmatter-warning-detail")]
         public async Task<PagedDto<OrderDto>> HighMatterWarningDetail([FromQuery] HighMatterWarningDetailRequest dto)
         {
-            List<string> filterTitle = new List<string>();
-            filterTitle.Add("无声");
-            filterTitle.Add("骚扰");
-            filterTitle.Add("错拨");
-            filterTitle.Add("测试");
+            var filterTitle = _systemSettingCacheManager.GetSetting(SettingConstants.HighMatterWarningFilterTitle).SettingValue;
 
             var (total, items) = await _orderRepository.Queryable()
             .Includes(x => x.OrderScreens)

+ 6 - 8
src/Hotline.Api/Controllers/Bigscreen/DataScreenController.cs

@@ -1,4 +1,5 @@
 using DocumentFormat.OpenXml.Drawing;
+using Hotline.Caching.Interfaces;
 using Hotline.Configurations;
 using Hotline.KnowledgeBase;
 using Hotline.Orders;
@@ -33,12 +34,14 @@ namespace Hotline.Api.Controllers.Bigscreen
         private readonly IRepository<SystemArea> _systemAreaRepository;
         private readonly IOptionsSnapshot<AppConfiguration> _appOptions;
         private readonly IRepository<OrderSecondaryHandling> _orderSecondaryHandlingRepository;
+        private readonly ISystemSettingCacheManager _systemSettingCacheManager;
 
         public DataScreenController(IOrderRepository orderRepository, IRepository<OrderVisit> orderVisitRepository,
             IRepository<OrderDelay> orderDelayRepository, IRepository<Knowledge> knowledgeRepository, IRepository<KnowledgePv> knowledgePvRepository,
             IMapper mapper, IRepository<OrderVisitDetail> orderVisitDetailRepository, IRepository<SystemArea> systemAreaRepository,
             IOptionsSnapshot<AppConfiguration> appOptions,
-            IRepository<OrderSecondaryHandling> orderSecondaryHandlingRepository)
+            IRepository<OrderSecondaryHandling> orderSecondaryHandlingRepository,
+            ISystemSettingCacheManager systemSettingCacheManager)
         {
             _orderRepository = orderRepository;
             _orderVisitRepository = orderVisitRepository;
@@ -50,6 +53,7 @@ namespace Hotline.Api.Controllers.Bigscreen
             _systemAreaRepository = systemAreaRepository;
             _appOptions = appOptions;
             _orderSecondaryHandlingRepository = orderSecondaryHandlingRepository;
+            _systemSettingCacheManager = systemSettingCacheManager;
         }
 
         /// <summary>
@@ -477,13 +481,7 @@ namespace Hotline.Api.Controllers.Bigscreen
             //var endDate = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
             //var startDate = endDate.AddDays(-30).Date;
 
-
-            List<string> filterTitle = new List<string>();
-            filterTitle.Add("无声");
-            filterTitle.Add("骚扰");
-            filterTitle.Add("错拨");
-            filterTitle.Add("测试");
-
+            var filterTitle = _systemSettingCacheManager.GetSetting(SettingConstants.HighMatterWarningFilterTitle).SettingValue;
 
             var list = await _orderRepository.Queryable(false, false, false)
                 .Where(x => x.CreationTime >= StartTime && x.CreationTime <= EndTime)

+ 43 - 22
src/Hotline.Api/Controllers/OrderController.cs

@@ -703,9 +703,11 @@ public class OrderController : BaseController
                 {
                     if (order.Source != ESource.ProvinceStraight && order.FileOrgIsCenter.Value == false)
                     {
+                        var isOpenSendVisitSms = _systemSettingCacheManager.GetSetting(SettingConstants.IsOpenSendVisitSms)?.SettingValue[0];
+
                         var code = "";
                         //受理类型为“投诉、举报”
-                        if ((order.AcceptTypeCode == "30" || order.AcceptTypeCode == "35") && orderVisit.VisitState != EVisitState.Visited)
+                        if ((order.AcceptTypeCode == "30" || order.AcceptTypeCode == "35") && orderVisit.VisitState != EVisitState.Visited && isOpenSendVisitSms == "true")
                         {
                             code = "1017";
                             orderVisit.VisitState = EVisitState.SMSVisiting;
@@ -4393,15 +4395,13 @@ public class OrderController : BaseController
         if (_systemSettingCacheManager.Snapshot)
         {
             await _orderSnapshotRepository.Queryable()
-                .Where(m => m.Id == order.Id)
-                .Select(m => new { m.IndustryId, m.IndustryName, m.IndustryCase })
+                .LeftJoin<IndustryCase>((snapshot, industryCase) => snapshot.IndustryCase == industryCase.Id)
+                .Where((snapshot, industryCase) => snapshot.Id == order.Id)
+                .Select((snapshot, industryCase) => new { snapshot.IndustryId, snapshot.IndustryName, industryCase.Name, })
                 .FirstAsync(HttpContext.RequestAborted)
                 .Then(async snapshot =>
                 {
-                    if (snapshot.IndustryCase.IsNullOrEmpty())
-                        dto.IndustryName = snapshot.IndustryName;
-                    else
-                        dto.IndustryName = snapshot.IndustryName + " " + snapshot.IndustryCase;
+                    dto.IndustryName = snapshot.IndustryName + " " + snapshot.Name;
                     dto.IndustryId = snapshot.IndustryId;
                 });
         }
@@ -4453,6 +4453,15 @@ public class OrderController : BaseController
             }
         }
 
+        if (_systemSettingCacheManager.Snapshot)
+        {
+            await _orderSnapshotRepository.Queryable()
+                .Where(m => m.Id == id)
+                .Select(m => new { m.IndustryId, m.IndustryName })
+                .FirstAsync(HttpContext.RequestAborted)
+                .Then(m => { dto.IndustryName = m.IndustryName; dto.IndustryId = m.IndustryId; });
+        }
+
         return _sessionContext.OrgIsCenter ? dto : dto.DataMask();
     }
 
@@ -4760,6 +4769,14 @@ public class OrderController : BaseController
             if (dto.IsEdit != true && order.Status > EOrderStatus.HandOverToUnAccept)
                 throw UserFriendlyException.SameMessage("工单已发起流程,不可编辑");
         }
+        if (_systemSettingCacheManager.Snapshot)
+        {
+            await _orderSnapshotRepository.Updateable()
+                .SetColumns(m => m.IndustryId, dto.IndustryId)
+                .SetColumns(m => m.IndustryName, dto.IndustryName)
+                .Where(m => m.Id == dto.Id)
+                .ExecuteCommandAsync();
+        }
 
         // 副本工单
         var copy = new OrderCopy();
@@ -4998,27 +5015,31 @@ public class OrderController : BaseController
     [HttpGet("startflow")]
     public async Task<NextStepsDto> GetFlowStartOptions([FromQuery] string? orderId)
     {
-        var outDto = await _workflowApplication.GetStartStepsAsync(WorkflowModuleConsts.OrderHandle,
+        var dto = await _workflowApplication.GetStartStepsAsync(WorkflowModuleConsts.OrderHandle,
             HttpContext.RequestAborted);
         if (orderId.NotNullOrEmpty())
         {
-            outDto.Opinion = await _typeCache.GetAsync($"tmp_opinion_{orderId}{_sessionContext.UserId}", HttpContext.RequestAborted);
-            outDto.Content = (await _orderRepository.GetAsync(orderId, HttpContext.RequestAborted))?.Content;
+            dto.Opinion = await _typeCache.GetAsync($"tmp_opinion_{orderId}{_sessionContext.UserId}", HttpContext.RequestAborted);
+            dto.Content = (await _orderRepository.GetAsync(orderId, HttpContext.RequestAborted))?.Content;
         }
 
         //随手拍
-        bool.TryParse(_systemSettingCacheManager.GetSetting(SettingConstants.Snapshot)?.SettingValue[0],
-            out bool isSnapshotEnable);
+        var isSnapshotEnable = _systemSettingCacheManager.Snapshot;
+        var isAqyh = false;//行业类型是否为随手拍安全隐患
         if (isSnapshotEnable)
         {
-            var orderSnapshot = await _orderSnapshotRepository.GetAsync(orderId, HttpContext.RequestAborted);
-            if (orderSnapshot != null && string.CompareOrdinal(orderSnapshot.IndustryName, "安全隐患") == 0)
+            var orderSnapShot = await _orderSnapshotRepository.GetAsync(orderId, HttpContext.RequestAborted);
+            if(orderSnapShot != null && string.CompareOrdinal(orderSnapShot.IndustryName, "安全隐患") == 0)
             {
-                outDto.Steps = outDto.Steps.Where(d => d.BusinessType != EBusinessType.Send).ToList();
+                isAqyh = true;
+                dto.Steps.RemoveAll(d => d.BusinessType == EBusinessType.Send);
             }
         }
+        if (!isAqyh)
+            dto.Steps = dto.Steps.Where(d => string.CompareOrdinal(d.Value, "网格员") != 0
+                                             && string.CompareOrdinal(d.Value, "工单标记") != 0).ToList();
 
-        return outDto;
+        return dto;
     }
 
     /// <summary>
@@ -5269,7 +5290,7 @@ public class OrderController : BaseController
                 orderHandleFlowDto.CrossSteps = orderHandleFlowDto.CrossSteps.OrderBy(d => d.Sort).ToList();
                 var stepCount = orderHandleFlowDto.CrossSteps.Count;
                 var unhandleSteps = new List<WorkflowStep> { startStep };
-                for (int i = 0; i < stepCount; i++)
+                for (int i = 0;i < stepCount;i++)
                 {
                     var crossStep = orderHandleFlowDto.CrossSteps[i];
                     var tempSteps = new List<WorkflowStep>();
@@ -5461,15 +5482,15 @@ public class OrderController : BaseController
         if (string.IsNullOrEmpty(order.WorkflowId))
             throw UserFriendlyException.SameMessage("该工单未开启流程");
         var dto = await _workflowApplication.GetNextStepsAsync(order.WorkflowId, HttpContext.RequestAborted);
+        var isAqyh = false;//行业类型是否为随手拍安全隐患
         if (isSnapshotEnable)
         {
             var orderSnapShot = await _orderSnapshotRepository.GetAsync(orderId, HttpContext.RequestAborted);
-            if (orderSnapShot != null && string.CompareOrdinal(orderSnapShot.IndustryName, "安全隐患") != 0)
-            {
-                dto.Steps = dto.Steps.Where(d => string.CompareOrdinal(d.Value, "网格员") != 0
-                && string.CompareOrdinal(d.Value, "工单标记") != 0).ToList();
-            }
+            isAqyh = orderSnapShot != null && string.CompareOrdinal(orderSnapShot.IndustryName, "安全隐患") == 0;
         }
+        if(!isAqyh)
+            dto.Steps = dto.Steps.Where(d => string.CompareOrdinal(d.Value, "网格员") != 0
+                                             && string.CompareOrdinal(d.Value, "工单标记") != 0).ToList();
 
         dto.ExpiredTime = order.ExpiredTime;
         dto.Content = order.Content;

+ 1 - 1
src/Hotline.Api/config/appsettings.Development.json

@@ -78,7 +78,7 @@
     "Host": "110.188.24.182",
     "Port": 50179,
     "Password": "fengwo123!$!$",
-    "Database": 3 //test:3, dev:5
+    "Database": 3 //hotline:3, dev:5, test:2, demo:4
   },
   "Swagger": true,
   "AccLog": false,

+ 1 - 1
src/Hotline.Application/CallCenter/DefaultCallApplication.cs

@@ -203,7 +203,7 @@ public abstract class DefaultCallApplication : ICallApplication
 
         try
         {
-            //工单保存特殊身份验证
+            //签入是否处理是否有小休
             var signInCheckRest = bool.Parse(_systemSettingCacheManager.GetSetting(SettingConstants.SignInCheckRest).SettingValue[0]);
             if (signInCheckRest)
             {

+ 14 - 5
src/Hotline.Application/OrderApp/OrderAnalysisApplication.cs

@@ -1,4 +1,5 @@
-using Hotline.Orders;
+using Hotline.Caching.Interfaces;
+using Hotline.Orders;
 using Hotline.Settings;
 using Hotline.Share.Dtos.Order;
 using Hotline.Share.Enums.Order;
@@ -17,18 +18,21 @@ namespace Hotline.Application.OrderApp
         private readonly IMapper _mapper;
         private readonly IOrderRepository _orderRepository;
         private readonly IRepository<SystemArea> _systemAreaRepository;
+        private readonly ISystemSettingCacheManager _systemSettingCacheManager;
 
         public OrderAnalysisApplication(
             IMapper mapper,
             IOrderRepository orderRepository,
             IRepository<SystemArea> systemAreaRepository,
-            IRepository<OrderAnalysis> orderAnalysisRepository
+            IRepository<OrderAnalysis> orderAnalysisRepository,
+            ISystemSettingCacheManager systemSettingCacheManager
             )
         {
             _mapper = mapper;
             _orderRepository = orderRepository;
             _orderAnalysisRepository = orderAnalysisRepository;
             _systemAreaRepository = systemAreaRepository;
+            _systemSettingCacheManager = systemSettingCacheManager;
         }
 
         /// <summary>
@@ -108,10 +112,13 @@ namespace Hotline.Application.OrderApp
         /// <returns></returns>
         public ISugarQueryable<Order> DetailQuery(OrderAnalysisDetailDto dto, CancellationToken cancellationToken)
         {
+            var filterTitle = _systemSettingCacheManager.GetSetting(SettingConstants.HighMatterWarningFilterTitle).SettingValue;
+
             var query = _orderAnalysisRepository.Queryable()
                 .LeftJoin<Order>((a, o) => a.AcceptTypeCode == o.AcceptTypeCode && a.HotspotId == o.HotspotId && o.AreaCode.StartsWith(a.AreaCode))
                 .Where((a, o) => a.AnalysisId == dto.AnalysisId)
                 .Where((a, o) => o.CreationTime >= a.StartTime && o.CreationTime <= a.EndTime)
+                .Where((a, o) => filterTitle.Any(s => o.Title.Contains(s)) == false)
                 .Select((a, o) => o);
             return query;
         }
@@ -122,16 +129,18 @@ namespace Hotline.Application.OrderApp
         /// <returns></returns>
         public async Task<object> ReportQuery(OrderAnalysisDetailDto dto, CancellationToken cancellationToken)
         {
+            var filterTitle = _systemSettingCacheManager.GetSetting(SettingConstants.HighMatterWarningFilterTitle).SettingValue;
 
             var analysis = await _orderAnalysisRepository.Queryable()
                 .Where(x => x.AnalysisId == dto.AnalysisId)
-                .GroupBy(x => new { x.AnalysisId, x.AnalysisName, x.GeneratedTime, x.Remark })
-                .Select(x => new { x.AnalysisId, x.AnalysisName, x.GeneratedTime, x.Remark }).FirstAsync(cancellationToken);
+                .GroupBy(x => new { x.AnalysisId, x.AnalysisName, x.GeneratedTime, x.Remark, x.StartTime, x.EndTime })
+                .Select(x => new { x.AnalysisId, x.AnalysisName, x.GeneratedTime, x.Remark, x.StartTime, x.EndTime }).FirstAsync(cancellationToken);
 
             var orders = await _orderAnalysisRepository.Queryable()
                 .LeftJoin<Order>((a, o) => a.AcceptTypeCode == o.AcceptTypeCode && a.HotspotId == o.HotspotId && o.AreaCode.StartsWith(a.AreaCode))
                 .Where((a, o) => a.AnalysisId == dto.AnalysisId)
-                .Where((a, o) => o.CreationTime >=)
+                .Where((a, o) => o.CreationTime >= a.StartTime && o.CreationTime <= a.EndTime)
+                 .Where((a, o) => filterTitle.Any(s => o.Title.Contains(s)) == false)
                 .Select((a, o) => o).ToListAsync(cancellationToken);
             var introductionData = orders.GroupBy(x => x.SourceChannel)
                 .Select(x => new { SourceChannel = x.Key, Num = x.Count(), Rate = Math.Round((x.Count() / (double)orders.Count) * 100, 2) })

+ 3 - 1
src/Hotline.Application/OrderApp/OrderApplication.cs

@@ -1572,7 +1572,7 @@ public class OrderApplication : IOrderApplication, IScopeDependency
             await _orderVisitRepository.Updateable()
                 .Where(m => m.Id == item.Id)
                 .SetColumns(m => m.VisitState == EVisitState.SMSVisiting)
-                // .SetColumns(m => m.VisitType == EVisitType.SmsVisit)
+                //.SetColumns(m => m.IsPutThrough == true)
                 .SetColumns(m => m.EmployeeId == _sessionContext.RequiredUserId)
                 .ExecuteCommandAsync(cancellationToken);
 
@@ -3767,6 +3767,8 @@ public class OrderApplication : IOrderApplication, IScopeDependency
             .WhereIF(dto.VisitStateQuery == EVisitStateQuery.SMSVisiting, d => d.VisitState == EVisitState.SMSVisiting)
             .WhereIF(dto.VisitStateQuery == EVisitStateQuery.NoPutThrough,
                 d => d.IsPutThrough == false && d.VisitState != EVisitState.Visited && d.VisitState != EVisitState.None)
+            .WhereIF(_appOptions.Value.IsZiGong && dto.VisitStateQuery == EVisitStateQuery.NoPutThrough,
+                d => d.VisitState != EVisitState.SMSVisiting)//自贡未接通的短信回访了不在未接通中查询
             .WhereIF(dto.VisitStateQuery == EVisitStateQuery.ChipVoiceVisiting, d => d.VisitState == EVisitState.AiVisiting) //任务 162:回访状态快捷查询条件
             .WhereIF(!string.IsNullOrEmpty(dto.Keyword), d => d.Order.Title.Contains(dto.Keyword!))
             .WhereIF(!string.IsNullOrEmpty(dto.No), d => d.No == dto.No)

+ 6 - 4
src/Hotline.Application/Snapshot/SnapshotOrderApplication.cs

@@ -213,11 +213,10 @@ public class SnapshotOrderApplication : IOrderSnapshotApplication, IScopeDepende
     {
         var query = _orderSnapshotRepository.Queryable()
             .LeftJoin<Order>((snapshot, order) => snapshot.Id == order.Id)
-            .LeftJoin<WorkflowStep>((snapshot, order, step) => step.ExternalId == order.Id)
+            .LeftJoin<WorkflowStep>((snapshot, order, step) => step.ExternalId == order.Id && step.Tag == TagDefaults.OrderMark && step.Status != EWorkflowStepStatus.Handled)
             .Where((snapshot, order, step) => snapshot.IndustryName == "安全隐患")
-            //.WhereIF(dto.Status == 0, (snapshot, order, step) => step.Tag == TagDefaults.OrderMark) // 全部
-            .WhereIF(dto.Status == 1, (snapshot, order, step) => step.Tag == TagDefaults.OrderMark && step.Status != EWorkflowStepStatus.Handled &&  _sessionContext.Roles.Contains(step.RoleId)) // 待标记
-            .WhereIF(dto.Status == 2, (snapshot, order, step) => step.Tag == TagDefaults.OrderMark && step.Status == EWorkflowStepStatus.Handled) // 已标记
+            .WhereIF(dto.Status == 1, (snapshot, order, step) => step.Id != null && snapshot.IsSafetyDepartment == null) // 待标记
+            .WhereIF(dto.Status == 2, (snapshot, order, step) => snapshot.IsSafetyDepartment != null) // 已标记
             .WhereIF(dto.No.NotNullOrEmpty(), (snapshot, order, step) => order.No.Contains(dto.No))
             .WhereIF(dto.Title.NotNullOrEmpty(), (snapshot, order, step) => order.Title.Contains(dto.Title))
             .OrderByDescending((snapshot, order, step) => snapshot.CreationTime)
@@ -237,6 +236,9 @@ public class SnapshotOrderApplication : IOrderSnapshotApplication, IScopeDepende
                 LabelTime = snapshot.SignTime,
                 LabelUserName = snapshot.SignUserName
             });
+#if DEBUG
+        var sql = query.ToSqlString();
+#endif
         return query;
     }
 

+ 2 - 1
src/Hotline/Orders/OrderDomainService.cs

@@ -364,9 +364,10 @@ public class OrderDomainService : IOrderDomainService, IScopeDependency
                 {
                     if (order.Source != ESource.ProvinceStraight && order.FileOrgIsCenter.Value == false)
                     {
+                        var isOpenSendVisitSms = _systemSettingCacheManager.GetSetting(SettingConstants.IsOpenSendVisitSms)?.SettingValue[0];
                         var code = "";
                         //受理类型为“投诉、举报”
-                        if ((order.AcceptTypeCode == "30" || order.AcceptTypeCode == "35") && orderVisit.VisitState != EVisitState.Visited)
+                        if ((order.AcceptTypeCode == "30" || order.AcceptTypeCode == "35") && orderVisit.VisitState != EVisitState.Visited && isOpenSendVisitSms == "true")
                         {
                             code = "1017";
                             orderVisit.VisitState = EVisitState.SMSVisiting;

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

@@ -701,6 +701,11 @@ namespace Hotline.Settings
         /// </summary>
         public const string IsOpenSendEndSms = "IsOpenSendEndSms";
 
+        /// <summary>
+        /// 回访是否发送查询短信(投诉、举报查询短信)
+        /// </summary>
+        public const string IsOpenSendVisitSms = "IsOpenSendVisitSms";
+
         /// <summary>
         /// 企业话机
         /// </summary>
@@ -775,5 +780,10 @@ namespace Hotline.Settings
         /// 签入是否处理是否有小休
         /// </summary>
         public const string SignInCheckRest = "SignInCheckRest";
+
+        /// <summary>
+        /// 高频预警许排除的工单标题
+        /// </summary>
+        public const string HighMatterWarningFilterTitle = "HighMatterWarningFilterTitle";
     }
 }

+ 1 - 0
test/Hotline.Tests/Application/SnapshotApplicationTest.cs

@@ -93,6 +93,7 @@ public class SnapshotApplicationTest : TestBase
             IsPublished = true
         }).ToPageListAsync(0, 10);
         items.NotNullOrEmpty().ShouldBeTrue();
+        var signItems =  await _orderSnapshotApplication.GetSignOrderSnapshotItems(new SignOrderSnapshotItemsInDto()).ToListAsync();
     }
 
     [Fact]