Explorar o código

新增工单补充

tangjiang hai 2 meses
pai
achega
3b4d7063f7

+ 37 - 1
src/Hotline.Api/Controllers/OrderController.cs

@@ -157,6 +157,7 @@ public class OrderController : BaseController
     private readonly IIndustryRepository _industryRepository;
     private readonly IRepository<SystemDicData> _sysDicDataRepository;
     private readonly IRepository<SystemOrganize> _systemOrganizeRepository;
+    private readonly IRepository<OrderComplement> _orderComplementRepository;
 
     public OrderController(
         IOrderDomainService orderDomainService,
@@ -229,7 +230,8 @@ public class OrderController : BaseController
         IIndustryRepository industryRepository,
         IOrderSnapshotApplication orderSnapshotApplication,
         IRepository<SystemDicData> sysDicDataRepository,
-        IRepository<SystemOrganize> systemOrganizeRepository)
+        IRepository<SystemOrganize> systemOrganizeRepository,
+        IRepository<OrderComplement> orderComplementRepository)
     {
         _orderDomainService = orderDomainService;
         _orderRepository = orderRepository;
@@ -302,6 +304,7 @@ public class OrderController : BaseController
         _orderSnapshotApplication = orderSnapshotApplication;
         _sysDicDataRepository = sysDicDataRepository;
         _systemOrganizeRepository = systemOrganizeRepository;
+        _orderComplementRepository = orderComplementRepository;
     }
 
     #endregion
@@ -8945,4 +8948,37 @@ public class OrderController : BaseController
     }
 
     #endregion
+
+    #region 添加补充
+    /// <summary>
+    /// 添加补充
+    /// </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
+        };
+
+        await _orderComplementRepository.AddAsync(complement, HttpContext.RequestAborted);
+    }
+    #endregion
 }

+ 8 - 7
src/Hotline.Api/Controllers/TestController.cs

@@ -279,14 +279,15 @@ ICallApplication callApplication,
     /// <returns></returns>
     [HttpGet("phonenumber_test")]
     [AllowAnonymous]
-    public async Task<ThirdPhoneOutDto> GetPhoneNumberTest()
+    public async Task GetPhoneNumberTest()
     {
-        var inDto = new ThirdTokenDto
-        {
-            AppId = _systemSettingCacheManager.WxOpenAppId,
-            Secret = _systemSettingCacheManager.WxOpenAppSecret
-        };
-        return await _thirdIdentiyService.GetPhoneNumberAsync(inDto);
+        await _realtimeService.OrderComplementAsync("08db98a6-29f9-4812-8ccc-c81bc1ab2d12","测试推送消息", HttpContext.RequestAborted);
+        //var inDto = new ThirdTokenDto
+        //{
+        //    AppId = _systemSettingCacheManager.WxOpenAppId,
+        //    Secret = _systemSettingCacheManager.WxOpenAppSecret
+        //};
+        //return await _thirdIdentiyService.GetPhoneNumberAsync(inDto);
     }
 
     /// <summary>

+ 11 - 8
src/Hotline.Api/Realtimes/RealtimeMethods.cs

@@ -14,7 +14,7 @@
         /// <summary>
         /// 电话挂断通知
         /// </summary>
-        public static string Bye= "Bye";
+        public static string Bye = "Bye";
         /// <summary>
         /// 小休审核通过通知
         /// </summary>
@@ -41,6 +41,10 @@
         /// </summary>
         public static string CircularRecord = "CircularRecord";
 
+        /// <summary>
+        /// 工单补充消息通知
+        /// </summary>
+        public static string OrderComplementRecord = "OrderComplementRecord";
 
         #endregion
 
@@ -55,13 +59,13 @@
         public static string BsDataShowArea7 = "BsDataShowArea7";
         public static string BsDataShowArea8 = "BsDataShowArea8";
 
-		#endregion
+        #endregion
 
-		#region 大屏-坐席数据
-		public static string BsSeatStateDataShowArea1 = "BsSeatStateDataShowArea1";
-		public static string BsSeatStateDataShowArea2 = "BsSeatStateDataShowArea2";
-		public static string BsSeatStateDataShowArea3 = "BsSeatStateDataShowArea3";
-		public static string BsSeatStateDataShowArea4 = "BsSeatStateDataShowArea4";
+        #region 大屏-坐席数据
+        public static string BsSeatStateDataShowArea1 = "BsSeatStateDataShowArea1";
+        public static string BsSeatStateDataShowArea2 = "BsSeatStateDataShowArea2";
+        public static string BsSeatStateDataShowArea3 = "BsSeatStateDataShowArea3";
+        public static string BsSeatStateDataShowArea4 = "BsSeatStateDataShowArea4";
         #endregion
 
         #region 大屏数据
@@ -86,4 +90,3 @@
         #endregion
     }
 }
-    

+ 10 - 0
src/Hotline.Api/Realtimes/RealtimeService.cs

@@ -122,6 +122,16 @@ public class RealtimeService : IRealtimeService, IScopeDependency
 
     #endregion
 
+    /// <summary>
+    /// 工单补充消息通知
+    /// </summary>
+    /// <param name="userId"></param>
+    /// <param name="msg"></param>
+    /// <param name="cancellationToken"></param>
+    /// <returns></returns>
+    public Task OrderComplementAsync(string userId, string msg, CancellationToken cancellationToken) =>
+        SendToUserAsync(userId, RealtimeMethods.OrderComplementRecord, msg, cancellationToken);
+
     #region 系统信息通知
 
     /// <summary>

+ 9 - 1
src/Hotline.Share/Dtos/Order/AddOrderComplementDto.cs

@@ -45,4 +45,12 @@ public class AddOrderComplementDto
 public class OrderComplementDto : AddOrderComplementDto
 {
     public string Id { get; set; }
-}
+}
+
+public class AddComplementDto
+{
+    public string OrderId { get; set; }
+
+    public string Opinion {  set; get; }
+}
+

+ 12 - 3
src/Hotline/Realtimes/IRealtimeService.cs

@@ -39,11 +39,11 @@ namespace Hotline.Realtimes
         Task BsDataShowChanged7Async(object obj, CancellationToken cancellationToken);
         Task BsDataShowChanged8Async(object obj, CancellationToken cancellationToken);
 
-		#endregion
+        #endregion
 
-		#region 大屏坐席数据
+        #region 大屏坐席数据
 
-		Task BsSeatStateDataShowChangedAsync1(object obj, CancellationToken cancellationToken);
+        Task BsSeatStateDataShowChangedAsync1(object obj, CancellationToken cancellationToken);
         Task BsSeatStateDataShowChangedAsync2(object obj, CancellationToken cancellationToken);
         Task BsSeatStateDataShowChangedAsync3(object obj, CancellationToken cancellationToken);
         Task BsSeatStateDataShowChangedAsync4(object obj, CancellationToken cancellationToken);
@@ -85,5 +85,14 @@ namespace Hotline.Realtimes
         Task CurrentWaitNumAsync(int count, CancellationToken cancellationToken);
 
         #endregion
+
+        /// <summary>
+        /// 工单补充消息通知
+        /// </summary>
+        /// <param name="userId"></param>
+        /// <param name="msg"></param>
+        /// <param name="cancellationToken"></param>
+        /// <returns></returns>
+        Task OrderComplementAsync(string userId, string msg, CancellationToken cancellationToken);
     }
 }