瀏覽代碼

附件上传

田爽 1 年之前
父節點
當前提交
e867d50de4

+ 15 - 9
src/Hotline.Api/Controllers/OrderController.cs

@@ -553,7 +553,7 @@ public class OrderController : BaseController
 		var model = _mapper.Map<OrderScreen>(dto.Data);
 		model.Status =  EScreenStatus.Apply;
 	    var id = await _orderScreenRepository.AddAsync(model, HttpContext.RequestAborted);
-
+	    if (dto.Data.Files.Any()) await _fileRepository.AddFileAsync(dto.Data.Files, id, HttpContext.RequestAborted);
 		try
 		{
 			var startDto = _mapper.Map<StartWorkflowDto>(dto.Workflow);
@@ -643,7 +643,7 @@ public class OrderController : BaseController
     /// <returns></returns>
     [Permission(EPermission.ApplySupervise)]
     [HttpPost("supervise/apply")]
-    public async Task ApplySupervise([FromBody] ApplyOrderSuperviseDto dto)
+    public async Task<string> ApplySupervise([FromBody] ApplyOrderSuperviseDto dto)
     {
         //验证工单是否可以申请
         var order = await _orderRepository.GetAsync(dto.OrderId, HttpContext.RequestAborted);
@@ -653,8 +653,10 @@ public class OrderController : BaseController
         var model = _mapper.Map<OrderSupervise>(dto);
         model.CreatorOrgName = _sessionContext.OrgName;
         model.State = 0;
-        await _orderSuperviseRepository.AddAsync(model, HttpContext.RequestAborted);
-    }
+        var id = await _orderSuperviseRepository.AddAsync(model, HttpContext.RequestAborted);
+        if (dto.Files.Any()) await _fileRepository.AddFileAsync(dto.Files, id, HttpContext.RequestAborted);
+        return id;
+	}
 
     /// <summary>
     /// 回复督办
@@ -675,7 +677,8 @@ public class OrderController : BaseController
         supervise.ReplyId = _sessionContext.UserId;
         supervise.ReplyTime = DateTime.Now;
         supervise.State = 1;
-        await _orderSuperviseRepository.UpdateAsync(supervise, HttpContext.RequestAborted);
+        if (dto.Files.Any()) await _fileRepository.AddFileAsync(dto.Files, supervise.Id, HttpContext.RequestAborted);
+		await _orderSuperviseRepository.UpdateAsync(supervise, HttpContext.RequestAborted);
     }
 
     /// <summary>
@@ -742,7 +745,7 @@ public class OrderController : BaseController
     /// <returns></returns>
     [Permission(EPermission.ApplyUrge)]
     [HttpPost("urge/apply")]
-    public async Task ApplyUrge([FromBody] ApplyOrderUrgeDto dto)
+    public async Task<string> ApplyUrge([FromBody] ApplyOrderUrgeDto dto)
     {
         //验证工单是否可以申请
         var order = await _orderRepository.GetAsync(dto.OrderId, HttpContext.RequestAborted);
@@ -752,8 +755,10 @@ public class OrderController : BaseController
         var model = _mapper.Map<OrderUrge>(dto);
         model.CreatorOrgName = _sessionContext.OrgName;
         model.State = 0;
-		await _orderUrgeRepository.AddAsync(model, HttpContext.RequestAborted);
-    }
+		var id = await _orderUrgeRepository.AddAsync(model, HttpContext.RequestAborted);
+		if (dto.Files.Any()) await _fileRepository.AddFileAsync(dto.Files, id, HttpContext.RequestAborted);
+		return id;
+	}
 
     /// <summary>
     /// 回复催办
@@ -774,7 +779,8 @@ public class OrderController : BaseController
         urge.ReplyId = _sessionContext.UserId;
         urge.ReplyTime = DateTime.Now;
         urge.State = 1;
-        await _orderUrgeRepository.UpdateAsync(urge, HttpContext.RequestAborted);
+        if (dto.Files.Any()) await _fileRepository.AddFileAsync(dto.Files, urge.Id, HttpContext.RequestAborted);
+		await _orderUrgeRepository.UpdateAsync(urge, HttpContext.RequestAborted);
     }
 
     /// <summary>

+ 7 - 1
src/Hotline.Share/Dtos/Order/OrderScreenDto.cs

@@ -1,4 +1,5 @@
-using Hotline.Share.Enums.Order;
+using Hotline.Share.Dtos.File;
+using Hotline.Share.Enums.Order;
 using System;
 using System.Collections.Generic;
 using System.Linq;
@@ -44,5 +45,10 @@ namespace Hotline.Share.Dtos.Order
 		/// 甄别申请状态
 		/// </summary>
 		public EScreenStatus? Status { get; set; }
+
+		/// <summary>
+		/// 附件列表
+		/// </summary>
+		public List<FileDto> Files { get; set; } = new();
 	}
 }

+ 4 - 3
src/Hotline.Share/Dtos/Order/OrderSuperviseDto.cs

@@ -1,4 +1,5 @@
-using Hotline.Share.Requests;
+using Hotline.Share.Dtos.File;
+using Hotline.Share.Requests;
 using System;
 using System.Collections.Generic;
 using System.Linq;
@@ -10,9 +11,9 @@ namespace Hotline.Share.Dtos.Order
 	public class OrderSuperviseDto
 	{
 		/// <summary>
-		/// 附件
+		/// 附件列表
 		/// </summary>
-		public List<string>? Additions { get; set; } = new();
+		public List<FileDto> Files { get; set; } = new();
 	}
 
 	public class ApplyOrderSuperviseDto : OrderSuperviseDto

+ 4 - 3
src/Hotline.Share/Dtos/Order/OrderUrgeDto.cs

@@ -1,4 +1,5 @@
-using Hotline.Share.Requests;
+using Hotline.Share.Dtos.File;
+using Hotline.Share.Requests;
 using System;
 using System.Collections.Generic;
 using System.Linq;
@@ -10,9 +11,9 @@ namespace Hotline.Share.Dtos.Order
 	public class OrderUrgeDto
 	{
 		/// <summary>
-		/// 附件
+		/// 附件列表
 		/// </summary>
-		public List<string>? Additions { get; set; } = new();
+		public List<FileDto> Files { get; set; } = new();
 	}
 
 	public class ApplyOrderUrgeDto : OrderUrgeDto

+ 0 - 7
src/Hotline/Orders/OrderSupervise.cs

@@ -74,13 +74,6 @@ namespace Hotline.Orders {
 		[SugarColumn(ColumnDescription = "回复人")]
 		public string? ReplyId { get; set; }
 
-		/// <summary>
-		/// 附件
-		/// </summary>
-		[SugarColumn(ColumnDataType = "json", IsJson = true)]
-		public List<string>? Additions { get; set; } = new();
-
-
 		/// <summary>
 		/// 
 		/// </summary>

+ 0 - 7
src/Hotline/Orders/OrderUrge.cs

@@ -68,13 +68,6 @@ namespace Hotline.Orders {
 		[SugarColumn(ColumnDescription = "回复人")]
 		public string? ReplyId { get; set; }
 
-		/// <summary>
-		/// 附件
-		/// </summary>
-		[SugarColumn(ColumnDataType = "json", IsJson = true)]
-		public List<string>? Additions { get; set; } = new();
-
-
 		/// <summary>
 		/// 
 		/// </summary>