Explorar el Código

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

Dun.Jason hace 1 semana
padre
commit
338869defa

+ 4 - 0
src/Hotline.Api/Controllers/OrderController.cs

@@ -1184,6 +1184,10 @@ public class OrderController : BaseController
     {
         var rsp = new
         {
+            Industry = _systemSettingCacheManager.Snapshot ? await _industryRepository
+                    .Queryable()
+                    .Select(d => new { d.Id, d.Name, }).ToListAsync() 
+                : null,
             ChannelOptions = _sysDicDataCacheManager.GetSysDicDataCache(TimeLimitBaseDataConsts.SourceChannel),
             AcceptTypeOptions = _sysDicDataCacheManager.GetSysDicDataCache(SysDicTypeConsts.AcceptType),
             OrderTags = _sysDicDataCacheManager.GetSysDicDataCache(SysDicTypeConsts.OrderTag)

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

@@ -25,6 +25,7 @@ using Hotline.Settings;
 using Hotline.Settings.Hotspots;
 using Hotline.Settings.TimeLimitDomain;
 using Hotline.Share.Dtos;
+using Hotline.Share.Dtos.Article;
 using Hotline.Share.Dtos.DataSharing.PusherHotlineDto;
 using Hotline.Share.Dtos.File;
 using Hotline.Share.Dtos.FlowEngine;
@@ -33,6 +34,7 @@ using Hotline.Share.Dtos.Order;
 using Hotline.Share.Dtos.Order.Publish;
 using Hotline.Share.Dtos.Push;
 using Hotline.Share.Dtos.Settings;
+using Hotline.Share.Enums.Article;
 using Hotline.Share.Enums.FlowEngine;
 using Hotline.Share.Enums.Order;
 using Hotline.Share.Enums.Push;
@@ -41,6 +43,7 @@ using Hotline.Share.Enums.Settings;
 using Hotline.Share.Mq;
 using Hotline.Share.Requests;
 using Hotline.Share.Tools;
+using Hotline.Snapshot;
 using Hotline.Snapshot.IRepository;
 using Hotline.Statistics;
 using Hotline.Tools;
@@ -49,6 +52,7 @@ using Hotline.Validators.FlowEngine;
 using Mapster;
 using MapsterMapper;
 using MediatR;
+using Microsoft.AspNetCore.Http;
 using Microsoft.Extensions.Options;
 using PanGu;
 using SqlSugar;
@@ -800,6 +804,13 @@ public class OrderApplication : IOrderApplication, IScopeDependency
     public ISugarQueryable<Order> GetPublishOrderList(QueryOrderPublishDto dto)
     {
         var query = _orderRepository.Queryable().Includes(d => d.OrderTags);
+        if (_systemSettingCacheManager.Snapshot)
+        {
+            query = query.LeftJoin<OrderSnapshot>((d, snapshot) => d.Id == snapshot.Id)
+                .WhereIF(dto.IndustryId.NotNullOrEmpty(), (d, snapshot) => snapshot.IndustryId == dto.IndustryId)
+                .WhereIF(dto.IsRectifyDepartment.HasValue, (d, snapshot) => snapshot.IsRectifyDepartment == dto.IsRectifyDepartment)
+                .WhereIF(dto.IsDangerDepartment.HasValue, (d, snapshot) => snapshot.IsDangerDepartment == dto.IsDangerDepartment);
+        }
         if (_appOptions.Value.IsLuZhou)
             query = query.Includes(d => d.FwCallRecord);
         //.Includes(d => d.OrderPublish)
@@ -1506,7 +1517,7 @@ public class OrderApplication : IOrderApplication, IScopeDependency
         {
             //if (string.IsNullOrEmpty(visit.EmployeeId)||)
             //    visit.EmployeeId = _sessionContext.UserId;
-            if(dto.IsUpdate==false)
+            if (dto.IsUpdate == false)
                 visit.EmployeeId = _sessionContext.UserId;
         }
         else
@@ -5546,6 +5557,10 @@ public class OrderApplication : IOrderApplication, IScopeDependency
             if (files != null && files.Any())
                 order.FileJson = await _fileRepository.AddFileAsync(files, order.Id, "", cancellationToken);
             await _orderDomainService.AddAsync(order, cancellationToken: cancellationToken);
+
+            //不同来源渠道的待受理工单需给坐席进行待受理提醒
+            if (_appOptions.Value.IsZiGong)
+                await PendingAcceptanceReminder(order.Id, cancellationToken);
         }
         else
         {
@@ -5615,6 +5630,10 @@ public class OrderApplication : IOrderApplication, IScopeDependency
                     _mapper.Map(dto.OrderExtension, orderExtension);
                 await _orderDomainService.UpdateExtensionAsync(orderExtension, cancellationToken);
             }
+
+            //不同来源渠道的待受理工单需给坐席进行待受理提醒
+            if (_appOptions.Value.IsZiGong)
+                await PendingAcceptanceReminder(order.Id, cancellationToken);
         }
         else
         {
@@ -5766,6 +5785,68 @@ public class OrderApplication : IOrderApplication, IScopeDependency
         return _mapper.Map<AddOrderResponse>(order);
     }
 
+    /// <summary>
+    /// 自贡任务 不同来源渠道的待受理工单需给坐席进行待受理提醒
+    /// </summary>
+    /// <param name="orderId"></param>
+    /// <param name="cancellationToken"></param>
+    /// <returns></returns>
+    private async Task PendingAcceptanceReminder(string orderId, CancellationToken cancellationToken)
+    {
+        var order = await _orderRepository.GetAsync(p => p.Id == orderId && p.Status == EOrderStatus.WaitForAccept, cancellationToken);
+        if (order == null)
+            return;
+
+        try
+        {
+            var pendingAcceptanceReminder = _sysDicDataCacheManager.GetSysDicDataCache(SysDicTypeConsts.PendingAcceptanceReminder);
+            if (pendingAcceptanceReminder != null && pendingAcceptanceReminder.Any())
+            {
+                if (pendingAcceptanceReminder.Any(p => p.DicDataValue.Contains(order.SourceChannelCode)))
+                {
+                    //查询坐席角色
+                    var setting = _systemSettingCacheManager.GetSetting(SettingConstants.RoleZuoXi).SettingValue;
+                    var list = await _userRepository.Queryable()
+                            .Includes(u => u.Roles)
+                             .Where(u => u.Roles.Any(x => setting.Contains(x.Name)))
+                             .ToListAsync();
+
+                    //给坐席发送提醒
+                    if (list != null && list.Any())
+                    {
+                        AddCircularDto circularDto = new()
+                        {
+                            Title = "待受理提醒",
+                            Content = "您有新的【" + order.SourceChannel + "】工单待受理",
+                            CircularTypeId = "5",
+                            CircularTypeName = "系统消息",
+                            IsMustRead = true,
+                            SourceOrgId = OrgSeedData.CenterId,
+                            SourceOrgName = OrgSeedData.CenterName,
+                            CircularType = ECircularType.Person
+                        };
+                        List<CircularReadGroupDto> users = [];
+                        foreach (var user in list)
+                        {
+                            users.Add(new CircularReadGroupDto()
+                            {
+                                UserId = user.Id,
+                                UserName = user.Name,
+                            });
+                        }
+                        circularDto.CircularReadGroups = users;
+                        //调用推送消息通用接口
+                        await _circularRecordDomainService.AddCircularMessage(circularDto, cancellationToken);
+                    }
+                }
+            }
+        }
+        catch (Exception)
+        {
+        }
+
+    }
+
     /// <summary>
     /// 派单量统计
     /// </summary>

+ 15 - 0
src/Hotline.Share/Dtos/Order/Publish/QueryOrderPublishDto.cs

@@ -162,4 +162,19 @@ public record QueryOrderPublishDto : PagedKeywordRequest
     /// 省来源分类 1:政民互动直派 2:政民互动  3:省12345
     /// </summary>
     public string? ProvinceChannel { get; set; }
+
+    /// <summary>
+    /// 随手拍行业Id
+    /// </summary>
+    public string? IndustryId { get; set; }
+
+    /// <summary>
+    /// 是否整改;
+    /// </summary>
+    public bool? IsRectifyDepartment { get; set; }
+
+    /// <summary>
+    /// 是否存在安全隐患
+    /// </summary>
+    public bool? IsDangerDepartment { get; set; }
 }

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

@@ -346,4 +346,9 @@ public class SysDicTypeConsts
     /// 随手拍安全员类型
     /// </summary>
     public const string SafetyType = "SafetyType";
+
+    /// <summary>
+    /// 待受理工单提醒来源
+    /// </summary>
+    public const string PendingAcceptanceReminder = "PendingAcceptanceReminder";
 }

+ 17 - 0
test/Hotline.Tests/Application/OrderApplicationTest.cs

@@ -4,8 +4,10 @@ using Hotline.Early;
 using Hotline.Orders;
 using Hotline.Push.FWMessage;
 using Hotline.Push.Notifies;
+using Hotline.Repository.SqlSugar.Extensions;
 using Hotline.Settings;
 using Hotline.Share.Dtos.Order;
+using Hotline.Share.Dtos.Order.Publish;
 using Hotline.Share.Dtos.Settings;
 using Hotline.Share.Enums.Order;
 using Mapster;
@@ -64,4 +66,19 @@ public class OrderApplicationTest
         var b = a.Adapt<SystemDicDataOutDto>();
         b.ShouldNotBeNull();
     }
+
+    [Fact]
+    public async Task GetPublishOrderList_Test()
+    { 
+        var inDto = new QueryOrderPublishDto
+        {
+            StartTime = DateTime.Now.AddDays(-30),
+            EndTime = DateTime.Now,
+            PageSize = 10,
+            PageIndex = 1,
+        };
+
+        var items = await _orderApplication.GetPublishOrderList(inDto).ToPagedListAsync(inDto);
+        items.Total.ShouldNotBe(0);
+    }
 }