Explorar o código

280 市州通用-上传附件功能优化

田爽 hai 2 meses
pai
achega
aacae8e68f

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

@@ -34,6 +34,7 @@ using Hotline.Settings.TimeLimitDomain;
 using Hotline.Settings.TimeLimits;
 using Hotline.Share.Dtos;
 using Hotline.Share.Dtos.CallCenter;
+using Hotline.Share.Dtos.File;
 using Hotline.Share.Dtos.FlowEngine;
 using Hotline.Share.Dtos.FlowEngine.Workflow;
 using Hotline.Share.Dtos.Order;
@@ -3692,6 +3693,33 @@ public class OrderController : BaseController
         return _sessionContext.OrgIsCenter ? dto : dto.DataMask();
     }
 
+
+	/// <summary>
+	/// 上传附件
+	/// </summary>
+	/// <param name="dto"></param>
+	/// <returns></returns>
+	[HttpPost]
+	[LogFilterAlpha("上传附件")]
+	public async Task UploadFiles(OrderUploadFiles dto) { 
+    
+        var fileJson = await _fileRepository.AddFileAsync(dto.Files, dto.Id, "", HttpContext.RequestAborted);
+
+        if (fileJson.Any())
+        {
+			var order = await _orderRepository.GetAsync(dto.Id);
+            if (order.FileJson != null && order.FileJson.Any())
+            {
+                order.FileJson.AddRange(fileJson);
+            }
+            else {
+                order.FileJson = fileJson;
+			}
+            await _orderRepository.Updateable().SetColumns(x => new Order { FileJson = order.FileJson }).Where(x => x.Id == dto.Id).ExecuteCommandAsync();
+		}
+	}
+
+
     /// <summary>
     /// 新增工单
     /// </summary>

+ 14 - 1
src/Hotline.Share/Dtos/Order/OrderDto.cs

@@ -1049,7 +1049,20 @@ namespace Hotline.Share.Dtos.Order
         public bool IsEdit { get; set; }
     }
 
-    public class AddOrderDto : Position
+    public class OrderUploadFiles {
+
+		public string Id { get; set; }
+
+		/// <summary>
+		/// 附件列表
+		/// </summary>
+		public List<FileDto> Files { get; set; } = new();
+
+
+	}
+
+
+	public class AddOrderDto : Position
     {
         #region 来电信息