瀏覽代碼

调整文件路径

tangjiang 1 周之前
父節點
當前提交
fcda9a1308

+ 126 - 2
src/Hotline.Api/Controllers/OrderApi/OrderComplementController.cs

@@ -1,16 +1,39 @@
-using Hotline.Orders;
+using Hotline.Article;
+using Hotline.FlowEngine.Workflows;
+using Hotline.Orders;
+using Hotline.Share.Dtos.Article;
 using Hotline.Share.Dtos.Order;
+using Hotline.Share.Enums.Article;
+using Hotline.Users;
 using Microsoft.AspNetCore.Mvc;
+using XF.Domain.Authentications;
+using XF.Domain.Exceptions;
+using XF.Domain.Repository;
 
 namespace Hotline.Api.Controllers.OrderApi;
 
 public class OrderComplementController : BaseController
 {
     private readonly IOrderDomainService _orderDomainService;
+    private readonly ISessionContext _sessionContext;
+    private readonly IRepository<OrderComplement> _orderComplementRepository;
+    private readonly IRepository<WorkflowStep> _workflowStepRepository;
+    private readonly IRepository<User> _userRepository;
+    private readonly ICircularRecordDomainService _circularRecordDomainService;
 
-    public OrderComplementController(IOrderDomainService orderDomainService)
+    public OrderComplementController(IOrderDomainService orderDomainService,
+       ISessionContext sessionContext,
+       IRepository<OrderComplement> orderComplementRepository,
+       IRepository<WorkflowStep> workflowStepRepository,
+       IRepository<User> userRepository,
+       ICircularRecordDomainService circularRecordDomainService)
     {
         _orderDomainService = orderDomainService;
+        _sessionContext = sessionContext;
+        _orderComplementRepository = orderComplementRepository;
+        _workflowStepRepository = workflowStepRepository;
+        _userRepository = userRepository;
+        _circularRecordDomainService = circularRecordDomainService;
     }
     
     /// <summary>
@@ -23,4 +46,105 @@ public class OrderComplementController : BaseController
     {
         return await _orderDomainService.AddOrderComplementAsync(dto, HttpContext.RequestAborted);
     }
+
+    #region 添加补充
+
+    /// <summary>
+    /// 添加补充 _notificationWaitSendRepository
+    /// </summary>
+    /// <param name="dto"></param>
+    /// <returns></returns>
+    [HttpPost("add_order_complement")]
+    public async Task AddOrderComplement([FromBody] AddComplementDto dto)
+    {
+        if (dto == null)
+            throw UserFriendlyException.SameMessage("数据错误!");
+        if (string.IsNullOrEmpty(dto.Opinion))
+            throw UserFriendlyException.SameMessage("补充内容不能为空!");
+        if (dto.Opinion.Length > 2000)
+            throw UserFriendlyException.SameMessage("补充内容限制2000字!");
+        var data = await _orderDomainService.GetOrderAsync(dto.OrderId, cancellationToken: HttpContext.RequestAborted);
+        if (data == null)
+            throw UserFriendlyException.SameMessage("工单查询失败!");
+
+        OrderComplement complement = new OrderComplement()
+        {
+            OrderId = dto.OrderId,
+            Opinion = dto.Opinion,
+            SupplyName = _sessionContext.UserName,
+            SupplyTime = DateTime.Now,
+            No = data.No,
+            IsProComplement = false
+        };
+
+        var id = await _orderComplementRepository.AddAsync(complement, HttpContext.RequestAborted);
+        if (!string.IsNullOrEmpty(id))
+        {
+            #region 处理推送消息
+
+            //获取当前办理节点数据
+            var work = await _workflowStepRepository.GetAsync(p => p.Id == data.ActualHandleStepId, HttpContext.RequestAborted);
+            if (work != null)
+            {
+                //获取办理指定类型
+                var workflowStepHandler = work.GetWorkflowStepHandler();
+                if (workflowStepHandler != null)
+                {
+                    AddCircularDto circularDto = new AddCircularDto()
+                    {
+                        Title = "工单补充",
+                        Content = "工单" + data.No + "有补充内容,请注意查收!",
+                        CircularTypeId = "6",
+                        CircularTypeName = "工单补充",
+                        IsMustRead = true,
+                        SourceOrgId = _sessionContext.RequiredOrgId,
+                        SourceOrgName = _sessionContext.OrgName,
+                        CircularType = ECircularType.Person
+                    };
+
+                    List<CircularReadGroupDto> users = [];
+                    if (!string.IsNullOrEmpty(workflowStepHandler.UserId)) //指定用户
+                    {
+                        users.Add(new CircularReadGroupDto()
+                        {
+                            UserId = workflowStepHandler.UserId,
+                            UserName = workflowStepHandler.Username
+                        });
+                    }
+                    else if (!string.IsNullOrEmpty(workflowStepHandler.RoleId)) //指定角色
+                    {
+                        //查询指定角色下面所有的用户
+                        var userlist = await _userRepository.Queryable().Where(x =>
+                                x.OrgId == workflowStepHandler.OrgId && x.Roles.Any(d => workflowStepHandler.RoleId.Contains(d.Id)))
+                            .Select(d => new CircularReadGroupDto
+                            {
+                                UserId = d.Id,
+                                UserName = d.Name
+                            }).ToListAsync();
+                        users.AddRange(userlist);
+                    }
+                    else if (!string.IsNullOrEmpty(workflowStepHandler.OrgId)) //指定部门
+                    {
+                        users.Add(new CircularReadGroupDto()
+                        {
+                            OrgId = workflowStepHandler.OrgId,
+                            OrgName = workflowStepHandler.OrgName
+                        });
+                        circularDto.CircularType = ECircularType.Org;
+                    }
+
+                    if (users != null && users.Count > 0)
+                    {
+                        circularDto.CircularReadGroups = users;
+                        //调用推送消息通用接口
+                        await _circularRecordDomainService.AddCircularMessage(circularDto, HttpContext.RequestAborted);
+                    }
+                }
+            }
+
+            #endregion
+        }
+    }
+
+    #endregion
 }

+ 3 - 111
src/Hotline.Api/Controllers/OrderController.cs

@@ -14,6 +14,7 @@ using Hotline.Caching.Interfaces;
 using Hotline.CallCenter.Calls;
 using Hotline.Configurations;
 using Hotline.ContingencyManagement.Notifies;
+using Hotline.Early;
 using Hotline.EventBus;
 using Hotline.File;
 using Hotline.FlowEngine.Definitions;
@@ -26,7 +27,6 @@ using Hotline.OrderTranspond;
 using Hotline.Push.FWMessage;
 using Hotline.Push.Notifies;
 using Hotline.Repository.SqlSugar.Extensions;
-using Hotline.Repository.SqlSugar.Orders;
 using Hotline.Repository.SqlSugar.Ts;
 using Hotline.SeedData;
 using Hotline.Settings;
@@ -34,7 +34,6 @@ using Hotline.Settings.Hotspots;
 using Hotline.Settings.TimeLimitDomain;
 using Hotline.Settings.TimeLimits;
 using Hotline.Share.Dtos;
-using Hotline.Share.Dtos.Article;
 using Hotline.Share.Dtos.CallCenter;
 using Hotline.Share.Dtos.File;
 using Hotline.Share.Dtos.FlowEngine;
@@ -43,11 +42,11 @@ using Hotline.Share.Dtos.Order;
 using Hotline.Share.Dtos.Order.Detail;
 using Hotline.Share.Dtos.Order.Handle;
 using Hotline.Share.Dtos.Order.Migration;
+using Hotline.Share.Dtos.Order.OrderDelay;
 using Hotline.Share.Dtos.Order.Publish;
 using Hotline.Share.Dtos.Org;
 using Hotline.Share.Dtos.Settings;
 using Hotline.Share.Dtos.Snapshot;
-using Hotline.Share.Enums.Article;
 using Hotline.Share.Enums.CallCenter;
 using Hotline.Share.Enums.FlowEngine;
 using Hotline.Share.Enums.Order;
@@ -73,19 +72,13 @@ using MiniExcelLibs;
 using SqlSugar;
 using System.Text;
 using System.Text.Json;
-using System.Threading;
 using XF.Domain.Authentications;
 using XF.Domain.Cache;
-using XF.Domain.Entities;
 using XF.Domain.Exceptions;
 using XF.Domain.Repository;
 using XF.Utility.EnumExtensions;
 using OrderDto = Hotline.Share.Dtos.Order.OrderDto;
 using UserInfo = Hotline.Share.Dtos.FlowEngine.UserInfo;
-using Hotline.Caching.Services;
-using Hotline.Early;
-using Hotline.Share.Dtos.Order.OrderDelay;
-using MathNet.Numerics.Distributions;
 
 namespace Hotline.Api.Controllers;
 
@@ -196,7 +189,6 @@ public class OrderController : BaseController
         IRepository<OrderVisitDetail> orderVisitedDetailRepository,
         ICapPublisher capPublisher,
         IOrderDelayRepository orderDelayRepository,
-        //ITimeLimitDomainService timeLimitDomainService,
         ISystemSettingCacheManager systemSettingCacheManager,
         IRepository<OrderRedo> orderRedoRepository,
         IRepository<OrderSupervise> orderSuperviseRepository,
@@ -279,7 +271,6 @@ public class OrderController : BaseController
         _orderVisitedDetailRepository = orderVisitedDetailRepository;
         _capPublisher = capPublisher;
         _orderDelayRepository = orderDelayRepository;
-        //_timeLimitDomainService = timeLimitDomainService;
         _systemSettingCacheManager = systemSettingCacheManager;
         _orderRedoRepository = orderRedoRepository;
         _orderSuperviseRepository = orderSuperviseRepository;
@@ -1186,7 +1177,7 @@ public class OrderController : BaseController
         {
             Industry = _systemSettingCacheManager.Snapshot ? await _industryRepository
                     .Queryable()
-                    .Select(d => new { d.Id, d.Name, }).ToListAsync() 
+                    .Select(d => new { d.Id, d.Name, }).ToListAsync()
                 : null,
             ChannelOptions = _sysDicDataCacheManager.GetSysDicDataCache(TimeLimitBaseDataConsts.SourceChannel),
             AcceptTypeOptions = _sysDicDataCacheManager.GetSysDicDataCache(SysDicTypeConsts.AcceptType),
@@ -10456,104 +10447,5 @@ public class OrderController : BaseController
 
     #endregion
 
-    #region 添加补充
-
-    /// <summary>
-    /// 添加补充 _notificationWaitSendRepository
-    /// </summary>
-    /// <param name="dto"></param>
-    /// <returns></returns>
-    [HttpPost("add_order_complement")]
-    public async Task AddOrderComplement([FromBody] AddComplementDto dto)
-    {
-        if (dto == null)
-            throw UserFriendlyException.SameMessage("数据错误!");
-        if (string.IsNullOrEmpty(dto.Opinion))
-            throw UserFriendlyException.SameMessage("补充内容不能为空!");
-        if (dto.Opinion.Length > 2000)
-            throw UserFriendlyException.SameMessage("补充内容限制2000字!");
-        var data = await _orderDomainService.GetOrderAsync(dto.OrderId, cancellationToken: HttpContext.RequestAborted);
-        if (data == null)
-            throw UserFriendlyException.SameMessage("工单查询失败!");
-
-        OrderComplement complement = new OrderComplement()
-        {
-            OrderId = dto.OrderId,
-            Opinion = dto.Opinion,
-            SupplyName = _sessionContext.UserName,
-            SupplyTime = DateTime.Now,
-            No = data.No,
-            IsProComplement = false
-        };
 
-        var id = await _orderComplementRepository.AddAsync(complement, HttpContext.RequestAborted);
-        if (!string.IsNullOrEmpty(id))
-        {
-            #region 处理推送消息
-
-            //获取当前办理节点数据
-            var work = await _workflowStepRepository.GetAsync(p => p.Id == data.ActualHandleStepId, HttpContext.RequestAborted);
-            if (work != null)
-            {
-                //获取办理指定类型
-                var workflowStepHandler = work.GetWorkflowStepHandler();
-                if (workflowStepHandler != null)
-                {
-                    AddCircularDto circularDto = new AddCircularDto()
-                    {
-                        Title = "工单补充",
-                        Content = "工单" + data.No + "有补充内容,请注意查收!",
-                        CircularTypeId = "6",
-                        CircularTypeName = "工单补充",
-                        IsMustRead = true,
-                        SourceOrgId = _sessionContext.RequiredOrgId,
-                        SourceOrgName = _sessionContext.OrgName,
-                        CircularType = ECircularType.Person
-                    };
-
-                    List<CircularReadGroupDto> users = [];
-                    if (!string.IsNullOrEmpty(workflowStepHandler.UserId)) //指定用户
-                    {
-                        users.Add(new CircularReadGroupDto()
-                        {
-                            UserId = workflowStepHandler.UserId,
-                            UserName = workflowStepHandler.Username
-                        });
-                    }
-                    else if (!string.IsNullOrEmpty(workflowStepHandler.RoleId)) //指定角色
-                    {
-                        //查询指定角色下面所有的用户
-                        var userlist = await _userRepository.Queryable().Where(x =>
-                                x.OrgId == workflowStepHandler.OrgId && x.Roles.Any(d => workflowStepHandler.RoleId.Contains(d.Id)))
-                            .Select(d => new CircularReadGroupDto
-                            {
-                                UserId = d.Id,
-                                UserName = d.Name
-                            }).ToListAsync();
-                        users.AddRange(userlist);
-                    }
-                    else if (!string.IsNullOrEmpty(workflowStepHandler.OrgId)) //指定部门
-                    {
-                        users.Add(new CircularReadGroupDto()
-                        {
-                            OrgId = workflowStepHandler.OrgId,
-                            OrgName = workflowStepHandler.OrgName
-                        });
-                        circularDto.CircularType = ECircularType.Org;
-                    }
-
-                    if (users != null && users.Count > 0)
-                    {
-                        circularDto.CircularReadGroups = users;
-                        //调用推送消息通用接口
-                        await _circularRecordDomainService.AddCircularMessage(circularDto, HttpContext.RequestAborted);
-                    }
-                }
-            }
-
-            #endregion
-        }
-    }
-
-    #endregion
 }

+ 12 - 0
src/Hotline.Share/Dtos/Order/ComplementOrderDto.cs

@@ -0,0 +1,12 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Hotline.Share.Dtos.Order
+{
+    public class ComplementOrderDto
+    {
+    }
+}